public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Dmitry Torokhov <dtor@mail.ru>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 07/28] firmware loader: use statically initialized data attribute
Date: Thu,  5 Aug 2010 15:23:57 -0700	[thread overview]
Message-ID: <1281047058-23716-7-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <20100805213314.GB13744@kroah.com>

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

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>
---
 drivers/base/firmware_class.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 3f093b0..fb29c64 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -87,7 +87,6 @@ static DEFINE_MUTEX(fw_lock);
 
 struct firmware_priv {
 	struct completion completion;
-	struct bin_attribute attr_data;
 	struct firmware *fw;
 	unsigned long status;
 	struct page **pages;
@@ -420,8 +419,8 @@ out:
 	return retval;
 }
 
-static struct bin_attribute firmware_attr_data_tmpl = {
-	.attr = {.name = "data", .mode = 0644},
+static struct bin_attribute firmware_attr_data = {
+	.attr = { .name = "data", .mode = 0644 },
 	.size = 0,
 	.read = firmware_data_read,
 	.write = firmware_data_write,
@@ -452,7 +451,6 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
 
 	strcpy(fw_priv->fw_id, fw_name);
 	init_completion(&fw_priv->completion);
-	fw_priv->attr_data = firmware_attr_data_tmpl;
 	fw_priv->timeout.function = firmware_class_timeout;
 	fw_priv->timeout.data = (u_long) fw_priv;
 	init_timer(&fw_priv->timeout);
@@ -498,8 +496,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p,
 	fw_priv->nowait = nowait;
 
 	fw_priv->fw = fw;
-	sysfs_bin_attr_init(&fw_priv->attr_data);
-	retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data);
+	retval = sysfs_create_bin_file(&f_dev->kobj, &firmware_attr_data);
 	if (retval) {
 		dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__);
 		goto error_unreg;
-- 
1.7.2


  parent reply	other threads:[~2010-08-05 22:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-05 21:33 [GIT PATCH] driver core patches for .36 Greg KH
2010-08-05 22:23 ` [PATCH 01/28] uio: Remove IRQF_DISABLED flag from uio_pdrv_genirq.c Greg Kroah-Hartman
2010-08-05 22:23 ` [PATCH 02/28] uio: Remove IRQF_DISABLED from uio_sercos3.c Greg Kroah-Hartman
2010-08-05 22:23 ` [PATCH 03/28] uio: Remove IRQF_DISABLED flag from uio_cif.c Greg Kroah-Hartman
2010-08-05 22:23 ` [PATCH 04/28] hotplug: Support kernel/hotplug sysctl variable when !CONFIG_NET Greg Kroah-Hartman
2010-08-05 22:23 ` [PATCH 05/28] Driver core: internal struct dma_coherent_mem, change type of a member Greg Kroah-Hartman
2010-08-05 22:23 ` [PATCH 06/28] Driver core: Drop __must_check from bus_for_each_drv() Greg Kroah-Hartman
2010-08-05 22:23 ` Greg Kroah-Hartman [this message]
2010-08-05 22:23 ` [PATCH 08/28] firmware loader: embed device into firmware_priv structure Greg Kroah-Hartman
2010-08-05 22:23 ` [PATCH 09/28] Driver core: use kmemdup in platform_device_add_resources Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 10/28] Driver core: reduce duplicated code for platform_device creation Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 11/28] Driver core: move platform device creation helpers to .init.text (if MODULE=n) Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 12/28] firmware: Update hotplug script Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 13/28] sysfs: sysfs_chmod_file's attr can be const Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 14/28] dmi-id: fix a memory leak in dmi_id_init error path Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 15/28] dcdbas: remove a redundant smi_data_buf_free in dcdbas_exit Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 16/28] sysfs: fix discrepancies between implementation and documentation Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 17/28] sysfs: Fix one more signature discrepancy between sysfs implementation and docs Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 18/28] debugfs: no longer needs to depend on SYSFS Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 19/28] driver core: fix memory leak on one error path in bus_register() Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 20/28] Driver core: Add BUS_NOTIFY_BIND_DRIVER Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 21/28] cgroupfs: create /sys/fs/cgroup to mount cgroupfs on Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 22/28] scsi: Remove owner field from attribute initialization in LPFC driver Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 23/28] scsi: Remove owner field from attribute initialization in ARCMSR driver Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 24/28] leds: Remove owner field from attribute initialization in bd2802 driver Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 25/28] regulator: Remove owner field from attribute initialization in regulator core driver Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 26/28] powerpc/pci: Remove owner field from attribute initialization in PCI bridge init Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 27/28] sysfs: Remove owner field from sysfs struct attribute Greg Kroah-Hartman
2010-08-05 22:24 ` [PATCH 28/28] driver core: device_rename's new_name can be const Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1281047058-23716-7-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dtor@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox