All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] firmware loader: use statically initialized data attribute
Date: Sat, 13 Mar 2010 23:49:07 -0800	[thread overview]
Message-ID: <20100314074907.27035.41960.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100314074330.27035.38765.stgit@localhost.localdomain>

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 and gets rid of the following lockdep
compaint:

 platform microcode: firmware: requesting intel-ucode/06-0f-0b
 BUG: key ffff88011371be70 not in .data!
 ------------[ cut here ]------------
 WARNING: at kernel/lockdep.c:2706 lockdep_init_map+0x125/0x140()
 Hardware name: Latitude D630
 Modules linked in: ...
 Pid: 738, comm: modprobe Tainted: P           2.6.34-rc1 #237
 Call Trace:
  [<ffffffff81048fb6>] warn_slowpath_common+0x76/0xb0
  [<ffffffff81048fff>] warn_slowpath_null+0xf/0x20
  [<ffffffff8107c915>] lockdep_init_map+0x125/0x140
  [<ffffffff8118485a>] sysfs_add_file_mode+0x6a/0xc0
  [<ffffffff811848bc>] sysfs_add_file+0xc/0x10
  [<ffffffff811870e1>] sysfs_create_bin_file+0x21/0x30
  [<ffffffff8130dff1>] fw_setup_device+0x81/0x120
  [<ffffffff8130e14f>] _request_firmware+0xbf/0x270
  [<ffffffff8130e38e>] request_firmware+0xe/0x10
  [<ffffffffa0064be1>] request_microcode_fw+0x61/0xa0 [microcode]
  [<ffffffffa00643b8>] microcode_init_cpu+0xb8/0xd0 [microcode]
  [<ffffffffa0064426>] mc_sysdev_add+0x56/0x70 [microcode]
  [<ffffffff813032ae>] sysdev_driver_register+0x9e/0x130
  [<ffffffffa006a000>] ? microcode_init+0x0/0x12a [microcode]
  [<ffffffffa006a0bd>] microcode_init+0xbd/0x12a [microcode]
  [<ffffffff810001d7>] do_one_initcall+0x37/0x190
  [<ffffffff8108d178>] sys_init_module+0xd8/0x250
  [<ffffffff81002fab>] system_call_fastpath+0x16/0x1b
 ---[ end trace 93c9f72439beee7f ]---


Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/base/firmware_class.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index d0dc26a..3f50b2e 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -41,7 +41,6 @@ static DEFINE_MUTEX(fw_lock);
 struct firmware_priv {
 	char *fw_id;
 	struct completion completion;
-	struct bin_attribute attr_data;
 	struct firmware *fw;
 	unsigned long status;
 	struct page **pages;
@@ -344,8 +343,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,
@@ -390,7 +389,6 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
 	}
 
 	init_completion(&fw_priv->completion);
-	fw_priv->attr_data = firmware_attr_data_tmpl;
 	fw_priv->fw_id = kstrdup(fw_name, GFP_KERNEL);
 	if (!fw_priv->fw_id) {
 		dev_err(device, "%s: Firmware name allocation failed\n",
@@ -442,7 +440,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p,
 	fw_priv = dev_get_drvdata(f_dev);
 
 	fw_priv->fw = fw;
-	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;


  reply	other threads:[~2010-03-14  7:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-14  7:49 [PATCH 0/5] Assorted patches for firmware loader Dmitry Torokhov
2010-03-14  7:49 ` Dmitry Torokhov [this message]
2010-04-22 23:51   ` [PATCH 1/5] firmware loader: use statically initialized data attribute Greg KH
2010-03-14  7:49 ` [PATCH 2/5] firmware loader: rely on driver core to create class attribute Dmitry Torokhov
2010-03-14  7:49 ` [PATCH 3/5] firmware loader: split out builtin firmware handling Dmitry Torokhov
2010-03-14  7:49 ` [PATCH 4/5] firmware loader: do not allocate firmare id separately Dmitry Torokhov
2010-03-14  7:49 ` [PATCH 5/5] firmware loader: embed device into firmware_priv structure Dmitry Torokhov
2010-04-23  0:01   ` Greg KH
2010-04-23  0:19     ` Dmitry Torokhov
2010-04-23  3:16       ` Greg KH

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=20100314074907.27035.41960.stgit@localhost.localdomain \
    --to=dmitry.torokhov@gmail.com \
    --cc=gregkh@suse.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.