Commit 0983ca2d authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Greg Kroah-Hartman

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: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cc7447a5
...@@ -87,7 +87,6 @@ static DEFINE_MUTEX(fw_lock); ...@@ -87,7 +87,6 @@ static DEFINE_MUTEX(fw_lock);
struct firmware_priv { struct firmware_priv {
struct completion completion; struct completion completion;
struct bin_attribute attr_data;
struct firmware *fw; struct firmware *fw;
unsigned long status; unsigned long status;
struct page **pages; struct page **pages;
...@@ -420,8 +419,8 @@ firmware_data_write(struct file* filp, struct kobject *kobj, ...@@ -420,8 +419,8 @@ firmware_data_write(struct file* filp, struct kobject *kobj,
return retval; return retval;
} }
static struct bin_attribute firmware_attr_data_tmpl = { static struct bin_attribute firmware_attr_data = {
.attr = {.name = "data", .mode = 0644}, .attr = { .name = "data", .mode = 0644 },
.size = 0, .size = 0,
.read = firmware_data_read, .read = firmware_data_read,
.write = firmware_data_write, .write = firmware_data_write,
...@@ -452,7 +451,6 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, ...@@ -452,7 +451,6 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
strcpy(fw_priv->fw_id, fw_name); strcpy(fw_priv->fw_id, fw_name);
init_completion(&fw_priv->completion); init_completion(&fw_priv->completion);
fw_priv->attr_data = firmware_attr_data_tmpl;
fw_priv->timeout.function = firmware_class_timeout; fw_priv->timeout.function = firmware_class_timeout;
fw_priv->timeout.data = (u_long) fw_priv; fw_priv->timeout.data = (u_long) fw_priv;
init_timer(&fw_priv->timeout); init_timer(&fw_priv->timeout);
...@@ -498,8 +496,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p, ...@@ -498,8 +496,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p,
fw_priv->nowait = nowait; fw_priv->nowait = nowait;
fw_priv->fw = fw; fw_priv->fw = fw;
sysfs_bin_attr_init(&fw_priv->attr_data); retval = sysfs_create_bin_file(&f_dev->kobj, &firmware_attr_data);
retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data);
if (retval) { if (retval) {
dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__); dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__);
goto error_unreg; goto error_unreg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment