Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 621061 Details for
Bug 827538
DVB USB device firmware requested in module_init()
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Improved version of previous patch
patch.diff (text/plain), 2.75 KB, created by
Linus Torvalds
on 2012-10-03 18:12:07 UTC
(
hide
)
Description:
Improved version of previous patch
Filename:
MIME Type:
Creator:
Linus Torvalds
Created:
2012-10-03 18:12:07 UTC
Size:
2.75 KB
patch
obsolete
> drivers/base/firmware_class.c | 73 ++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 72 insertions(+), 1 deletion(-) > >diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c >index 6e210802c37b..38feac4af991 100644 >--- a/drivers/base/firmware_class.c >+++ b/drivers/base/firmware_class.c >@@ -21,6 +21,7 @@ > #include <linux/firmware.h> > #include <linux/slab.h> > #include <linux/sched.h> >+#include <linux/file.h> > #include <linux/list.h> > #include <linux/async.h> > #include <linux/pm.h> >@@ -33,6 +34,67 @@ MODULE_AUTHOR("Manuel Estrada Sainz"); > MODULE_DESCRIPTION("Multi purpose firmware loading support"); > MODULE_LICENSE("GPL"); > >+/* Don't inline this: 'struct kstat' is biggish */ >+static noinline long fw_file_size(struct file *file) >+{ >+ struct kstat st; >+ if (vfs_getattr(file->f_path.mnt, file->f_path.dentry, &st)) >+ return -1; >+ if (!S_ISREG(st.mode)) >+ return -1; >+ if (st.size != (long)st.size) >+ return -1; >+ return st.size; >+} >+ >+static bool fw_read_file_contents(struct file *file, struct firmware *fw) >+{ >+ loff_t pos; >+ long size; >+ char *buf; >+ >+ size = fw_file_size(file); >+ if (size < 0) >+ return false; >+ buf = vmalloc(size); >+ if (!buf) >+ return false; >+ pos = 0; >+ if (vfs_read(file, buf, size, &pos) != size) { >+ vfree(buf); >+ return false; >+ } >+ fw->data = buf; >+ fw->size = size; >+ return true; >+} >+ >+static bool fw_get_filesystem_firmware(struct firmware *fw, const char *name) >+{ >+ int i; >+ bool success = false; >+ const char *fw_path[] = { "/lib/firmware/update", "/firmware", "/lib/firmware" }; >+ char *path = __getname(); >+ >+printk("Trying to load fw '%s' ", name); >+ for (i = 0; i < ARRAY_SIZE(fw_path); i++) { >+ struct file *file; >+ snprintf(path, PATH_MAX, "%s/%s", fw_path[i], name); >+ >+ file = filp_open(path, O_RDONLY, 0); >+ if (IS_ERR(file)) >+ continue; >+printk("from file '%s' ", path); >+ success = fw_read_file_contents(file, fw); >+ fput(file); >+ if (success) >+ break; >+ } >+printk(" %s.\n", success ? "Ok" : "failed"); >+ __putname(path); >+ return success; >+} >+ > /* Builtin firmware support */ > > #ifdef CONFIG_FW_LOADER >@@ -346,7 +408,11 @@ static ssize_t firmware_loading_show(struct device *dev, > /* firmware holds the ownership of pages */ > static void firmware_free_data(const struct firmware *fw) > { >- WARN_ON(!fw->priv); >+ /* Loaded directly? */ >+ if (!fw->priv) { >+ vfree(fw->data); >+ return; >+ } > fw_free_buf(fw->priv); > } > >@@ -709,6 +775,11 @@ _request_firmware_prepare(const struct firmware **firmware_p, const char *name, > return NULL; > } > >+ if (fw_get_filesystem_firmware(firmware, name)) { >+ dev_dbg(device, "firmware: direct-loading firmware %s\n", name); >+ return NULL; >+ } >+ > ret = fw_lookup_and_allocate_buf(name, &fw_cache, &buf); > if (!ret) > fw_priv = fw_create_instance(firmware, name, device,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 827538
:
588547
|
621017
| 621061