aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-06-04 03:54:37 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-05 16:53:34 -0400
commit0983ca2d0f0ff645bc86899aefb936cffb314839 (patch)
tree5eb2fbb53da9b869b809893c0834e8c07addb40e /drivers/base
parentcc7447a5fa92759b0856d6a83ba2539c6a94e67e (diff)
firmware loader: use statically initialized data attribute
There is no reason why we are using a template for binary attribute and copying it into per-firmware data before registering. Using the original works as well. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/firmware_class.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 3f093b0dd217..fb29c64ebecc 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -87,7 +87,6 @@ static DEFINE_MUTEX(fw_lock);
87 87
88struct firmware_priv { 88struct firmware_priv {
89 struct completion completion; 89 struct completion completion;
90 struct bin_attribute attr_data;
91 struct firmware *fw; 90 struct firmware *fw;
92 unsigned long status; 91 unsigned long status;
93 struct page **pages; 92 struct page **pages;
@@ -420,8 +419,8 @@ out:
420 return retval; 419 return retval;
421} 420}
422 421
423static struct bin_attribute firmware_attr_data_tmpl = { 422static struct bin_attribute firmware_attr_data = {
424 .attr = {.name = "data", .mode = 0644}, 423 .attr = { .name = "data", .mode = 0644 },
425 .size = 0, 424 .size = 0,
426 .read = firmware_data_read, 425 .read = firmware_data_read,
427 .write = firmware_data_write, 426 .write = firmware_data_write,
@@ -452,7 +451,6 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
452 451
453 strcpy(fw_priv->fw_id, fw_name); 452 strcpy(fw_priv->fw_id, fw_name);
454 init_completion(&fw_priv->completion); 453 init_completion(&fw_priv->completion);
455 fw_priv->attr_data = firmware_attr_data_tmpl;
456 fw_priv->timeout.function = firmware_class_timeout; 454 fw_priv->timeout.function = firmware_class_timeout;
457 fw_priv->timeout.data = (u_long) fw_priv; 455 fw_priv->timeout.data = (u_long) fw_priv;
458 init_timer(&fw_priv->timeout); 456 init_timer(&fw_priv->timeout);
@@ -498,8 +496,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p,
498 fw_priv->nowait = nowait; 496 fw_priv->nowait = nowait;
499 497
500 fw_priv->fw = fw; 498 fw_priv->fw = fw;
501 sysfs_bin_attr_init(&fw_priv->attr_data); 499 retval = sysfs_create_bin_file(&f_dev->kobj, &firmware_attr_data);
502 retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data);
503 if (retval) { 500 if (retval) {
504 dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__); 501 dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__);
505 goto error_unreg; 502 goto error_unreg;