* [GIT PATCH] driver core fixes for 2.6.34-git
@ 2010-03-19 15:13 Greg KH
2010-03-19 15:18 ` [PATCH 01/12] sysfs: use sysfs_bin_attr_init in firmware class driver Greg Kroah-Hartman
` (11 more replies)
0 siblings, 12 replies; 14+ messages in thread
From: Greg KH @ 2010-03-19 15:13 UTC (permalink / raw)
To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel
Here are a number of bugfixes for the driver core for your 2.6.34-git
tree.
This series should resolve all of the sysfs lockdep warnings that have
been reported numerous times. It also includes a number of
documentation updates and other small fixes.
Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git/
All of these patches have been in the linux-next and mm trees.
The patches will be sent as a follow-on to this message to lkml for
people to see.
thanks,
greg k-h
------------
Documentation/kobject.txt | 60 +++++++++++++++++++++++-----------
drivers/base/class.c | 2 +
drivers/base/core.c | 6 +++
drivers/base/cpu.c | 16 +++++-----
drivers/base/firmware_class.c | 2 +
drivers/base/node.c | 7 +++-
drivers/base/platform.c | 33 +++++++++++++++----
drivers/char/ipmi/ipmi_msghandler.c | 10 ++++++
drivers/infiniband/core/sysfs.c | 1 +
drivers/net/mlx4/main.c | 1 +
drivers/pci/pci-sysfs.c | 2 +-
11 files changed, 102 insertions(+), 38 deletions(-)
---------------
David Rientjes (1):
driver core: numa: fix BUILD_BUG_ON for node_read_distance
Greg Kroah-Hartman (3):
sysfs: fix sysfs lockdep warning in ipmi code
sysfs: fix sysfs lockdep warning in infiniband code
sysfs: fix sysfs lockdep warning in mlx4 code
Jani Nikula (1):
driver-core: document ERR_PTR() return values
Jiri Kosina (1):
sysfs: use sysfs_bin_attr_init in firmware class driver
Magnus Damm (1):
Driver core: Early platform kernel-doc update
Mel Gorman (1):
sysfs: Initialised pci bus legacy_mem field before use
Randy Dunlap (1):
driver-core: fix missing kernel-doc in firmware_class
Robert P. J. Day (2):
kobject: documentation: Fix erroneous example in kobject doc.
kobject: documentation: Update to refer to kset-example.c.
Stephen Rothwell (1):
sysdev: the cpu probe/release attributes should be sysdev_class_attributes
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/12] sysfs: use sysfs_bin_attr_init in firmware class driver
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 02/12] sysfs: Initialised pci bus legacy_mem field before use Greg Kroah-Hartman
` (10 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Jiri Kosina, Eric W. Biederman, Greg Kroah-Hartman
From: Jiri Kosina <jkosina@suse.cz>
Annotate dynamic sysfs attribute in fw_setup_device(). This gets
rid of the following lockdep warning:
bnx2 0000:08:00.0: firmware: requesting bnx2/bnx2-mips-06-5.0.0.j6.fw
BUG: key ffff880008293470 not in .data!
------------[ cut here ]------------
WARNING: at kernel/lockdep.c:2706 lockdep_init_map+0x562/0x620()
Modules linked in: bnx2(+) sg tpm_bios floppy rtc_lib usb_storage i2c_piix4 joydev button container shpchp i2c_core sr_mod cdrom pci_hotplug usbhid hid ohci_hcd ehci_hcd sd_mod usbcore edd ext3 mbcache jbd fan ata_generic sata_svw pata_serverworks libata scsi_mod thermal processor
Pid: 1915, comm: work_for_cpu Not tainted 2.6.34-rc1-default #81
Call Trace:
[<ffffffff8107c1d2>] ? lockdep_init_map+0x562/0x620
[<ffffffff81049fd8>] warn_slowpath_common+0x78/0xd0
[<ffffffff8104a03f>] warn_slowpath_null+0xf/0x20
[<ffffffff8107c1d2>] lockdep_init_map+0x562/0x620
[<ffffffff8117a236>] ? sysfs_new_dirent+0x76/0x120
[<ffffffff8126edb2>] ? put_device+0x12/0x20
[<ffffffff811797cc>] sysfs_add_file_mode+0x6c/0xd0
[<ffffffff8117983c>] sysfs_add_file+0xc/0x10
[<ffffffff8117bf61>] sysfs_create_bin_file+0x21/0x30
[<ffffffff81279c61>] _request_firmware+0x2f1/0x650
[<ffffffff8127a04e>] request_firmware+0xe/0x10
[<ffffffffa01ec19e>] bnx2_init_one+0x8f5/0x177e [bnx2]
[<ffffffff81389eab>] ? _raw_spin_unlock_irq+0x2b/0x40
[<ffffffff81040ed9>] ? finish_task_switch+0x69/0x100
[<ffffffff81040e70>] ? finish_task_switch+0x0/0x100
[<ffffffff81064b40>] ? do_work_for_cpu+0x0/0x30
[<ffffffff811e6302>] local_pci_probe+0x12/0x20
[<ffffffff81064b53>] do_work_for_cpu+0x13/0x30
[<ffffffff81064b40>] ? do_work_for_cpu+0x0/0x30
[<ffffffff81068c56>] kthread+0x96/0xa0
[<ffffffff81003e64>] kernel_thread_helper+0x4/0x10
[<ffffffff8138a350>] ? restore_args+0x0/0x30
[<ffffffff81068bc0>] ? kthread+0x0/0xa0
[<ffffffff81003e60>] ? kernel_thread_helper+0x0/0x10
---[ end trace a2ecee9c9602d195 ]---
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/firmware_class.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index d0dc26a..fc7565c 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -442,6 +442,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p,
fw_priv = dev_get_drvdata(f_dev);
fw_priv->fw = fw;
+ sysfs_bin_attr_init(&fw_priv->attr_data);
retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data);
if (retval) {
dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__);
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/12] sysfs: Initialised pci bus legacy_mem field before use
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
2010-03-19 15:18 ` [PATCH 01/12] sysfs: use sysfs_bin_attr_init in firmware class driver Greg Kroah-Hartman
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 03/12] sysfs: fix sysfs lockdep warning in ipmi code Greg Kroah-Hartman
` (9 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Mel Gorman, Greg Kroah-Hartman
From: Mel Gorman <mel@csn.ul.ie>
PPC64 is failing to boot the latest mmotm due to an uninitialised pointer in
pci_create_legacy_files(). The surprise is that machines boot at all and it
would appear to affect current mainline as well. This patch fixes the problem.
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/pci/pci-sysfs.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index de29645..9976685 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -655,8 +655,8 @@ void pci_create_legacy_files(struct pci_bus *b)
goto legacy_io_err;
/* Allocated above after the legacy_io struct */
- sysfs_bin_attr_init(b->legacy_mem);
b->legacy_mem = b->legacy_io + 1;
+ sysfs_bin_attr_init(b->legacy_mem);
b->legacy_mem->attr.name = "legacy_mem";
b->legacy_mem->size = 1024*1024;
b->legacy_mem->attr.mode = S_IRUSR | S_IWUSR;
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/12] sysfs: fix sysfs lockdep warning in ipmi code
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
2010-03-19 15:18 ` [PATCH 01/12] sysfs: use sysfs_bin_attr_init in firmware class driver Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 02/12] sysfs: Initialised pci bus legacy_mem field before use Greg Kroah-Hartman
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 04/12] sysfs: fix sysfs lockdep warning in infiniband code Greg Kroah-Hartman
` (8 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg Kroah-Hartman, Yinghai Lu, Eric Biederman
This fixes a sysfs lockdep warning in the ipmi code.
Thanks to Eric Biederman and Yinghai Lu for the original versions of the
patch, unfortunatly they did not submit them in a form they could be
applied in.
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/char/ipmi/ipmi_msghandler.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index ec5e3f8..c6ad423 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -2272,42 +2272,52 @@ static int create_files(struct bmc_device *bmc)
bmc->device_id_attr.attr.name = "device_id";
bmc->device_id_attr.attr.mode = S_IRUGO;
bmc->device_id_attr.show = device_id_show;
+ sysfs_attr_init(&bmc->device_id_attr.attr);
bmc->provides_dev_sdrs_attr.attr.name = "provides_device_sdrs";
bmc->provides_dev_sdrs_attr.attr.mode = S_IRUGO;
bmc->provides_dev_sdrs_attr.show = provides_dev_sdrs_show;
+ sysfs_attr_init(&bmc->provides_dev_sdrs_attr.attr);
bmc->revision_attr.attr.name = "revision";
bmc->revision_attr.attr.mode = S_IRUGO;
bmc->revision_attr.show = revision_show;
+ sysfs_attr_init(&bmc->revision_attr.attr);
bmc->firmware_rev_attr.attr.name = "firmware_revision";
bmc->firmware_rev_attr.attr.mode = S_IRUGO;
bmc->firmware_rev_attr.show = firmware_rev_show;
+ sysfs_attr_init(&bmc->firmware_rev_attr.attr);
bmc->version_attr.attr.name = "ipmi_version";
bmc->version_attr.attr.mode = S_IRUGO;
bmc->version_attr.show = ipmi_version_show;
+ sysfs_attr_init(&bmc->version_attr.attr);
bmc->add_dev_support_attr.attr.name = "additional_device_support";
bmc->add_dev_support_attr.attr.mode = S_IRUGO;
bmc->add_dev_support_attr.show = add_dev_support_show;
+ sysfs_attr_init(&bmc->add_dev_support_attr.attr);
bmc->manufacturer_id_attr.attr.name = "manufacturer_id";
bmc->manufacturer_id_attr.attr.mode = S_IRUGO;
bmc->manufacturer_id_attr.show = manufacturer_id_show;
+ sysfs_attr_init(&bmc->manufacturer_id_attr.attr);
bmc->product_id_attr.attr.name = "product_id";
bmc->product_id_attr.attr.mode = S_IRUGO;
bmc->product_id_attr.show = product_id_show;
+ sysfs_attr_init(&bmc->product_id_attr.attr);
bmc->guid_attr.attr.name = "guid";
bmc->guid_attr.attr.mode = S_IRUGO;
bmc->guid_attr.show = guid_show;
+ sysfs_attr_init(&bmc->guid_attr.attr);
bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision";
bmc->aux_firmware_rev_attr.attr.mode = S_IRUGO;
bmc->aux_firmware_rev_attr.show = aux_firmware_rev_show;
+ sysfs_attr_init(&bmc->aux_firmware_rev_attr.attr);
err = device_create_file(&bmc->dev->dev,
&bmc->device_id_attr);
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 04/12] sysfs: fix sysfs lockdep warning in infiniband code
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
` (2 preceding siblings ...)
2010-03-19 15:18 ` [PATCH 03/12] sysfs: fix sysfs lockdep warning in ipmi code Greg Kroah-Hartman
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 05/12] sysfs: fix sysfs lockdep warning in mlx4 code Greg Kroah-Hartman
` (7 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg Kroah-Hartman, Yinghai Lu, Eric Biederman
This fixes a sysfs lockdep warning in the infiniband code.
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/infiniband/core/sysfs.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 1558bb7..f901957 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -461,6 +461,7 @@ alloc_group_attrs(ssize_t (*show)(struct ib_port *,
element->attr.attr.mode = S_IRUGO;
element->attr.show = show;
element->index = i;
+ sysfs_attr_init(&element->attr.attr);
tab_attr[i] = &element->attr.attr;
}
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/12] sysfs: fix sysfs lockdep warning in mlx4 code
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
` (3 preceding siblings ...)
2010-03-19 15:18 ` [PATCH 04/12] sysfs: fix sysfs lockdep warning in infiniband code Greg Kroah-Hartman
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 06/12] Driver core: Early platform kernel-doc update Greg Kroah-Hartman
` (6 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Greg Kroah-Hartman, Yinghai Lu, Eric Biederman
This fixes a sysfs lockdep warning in the mlx4 code.
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/net/mlx4/main.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 8f6e816..b402a95 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -1023,6 +1023,7 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
info->port_attr.attr.mode = S_IRUGO | S_IWUSR;
info->port_attr.show = show_port_type;
info->port_attr.store = set_port_type;
+ sysfs_attr_init(&info->port_attr.attr);
err = device_create_file(&dev->pdev->dev, &info->port_attr);
if (err) {
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/12] Driver core: Early platform kernel-doc update
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
` (4 preceding siblings ...)
2010-03-19 15:18 ` [PATCH 05/12] sysfs: fix sysfs lockdep warning in mlx4 code Greg Kroah-Hartman
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 07/12] driver-core: fix missing kernel-doc in firmware_class Greg Kroah-Hartman
` (5 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Magnus Damm, Greg Kroah-Hartman
From: Magnus Damm <damm@opensource.se>
This patch updates the kernel-doc notation for early
platform functions.
Signed-off-by: Magnus Damm <damm@opensource.se>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/platform.c | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 1ba9d61..f6bcf22 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1052,9 +1052,11 @@ static __initdata LIST_HEAD(early_platform_driver_list);
static __initdata LIST_HEAD(early_platform_device_list);
/**
- * early_platform_driver_register
+ * early_platform_driver_register - register early platform driver
* @epdrv: early_platform driver structure
* @buf: string passed from early_param()
+ *
+ * Helper function for early_platform_init() / early_platform_init_buffer()
*/
int __init early_platform_driver_register(struct early_platform_driver *epdrv,
char *buf)
@@ -1106,9 +1108,12 @@ int __init early_platform_driver_register(struct early_platform_driver *epdrv,
}
/**
- * early_platform_add_devices - add a numbers of early platform devices
+ * early_platform_add_devices - adds a number of early platform devices
* @devs: array of early platform devices to add
* @num: number of early platform devices in array
+ *
+ * Used by early architecture code to register early platform devices and
+ * their platform data.
*/
void __init early_platform_add_devices(struct platform_device **devs, int num)
{
@@ -1128,8 +1133,12 @@ void __init early_platform_add_devices(struct platform_device **devs, int num)
}
/**
- * early_platform_driver_register_all
+ * early_platform_driver_register_all - register early platform drivers
* @class_str: string to identify early platform driver class
+ *
+ * Used by architecture code to register all early platform drivers
+ * for a certain class. If omitted then only early platform drivers
+ * with matching kernel command line class parameters will be registered.
*/
void __init early_platform_driver_register_all(char *class_str)
{
@@ -1151,7 +1160,7 @@ void __init early_platform_driver_register_all(char *class_str)
}
/**
- * early_platform_match
+ * early_platform_match - find early platform device matching driver
* @epdrv: early platform driver structure
* @id: id to match against
*/
@@ -1169,7 +1178,7 @@ early_platform_match(struct early_platform_driver *epdrv, int id)
}
/**
- * early_platform_left
+ * early_platform_left - check if early platform driver has matching devices
* @epdrv: early platform driver structure
* @id: return true if id or above exists
*/
@@ -1187,7 +1196,7 @@ static __init int early_platform_left(struct early_platform_driver *epdrv,
}
/**
- * early_platform_driver_probe_id
+ * early_platform_driver_probe_id - probe drivers matching class_str and id
* @class_str: string to identify early platform driver class
* @id: id to match against
* @nr_probe: number of platform devices to successfully probe before exiting
@@ -1257,10 +1266,14 @@ static int __init early_platform_driver_probe_id(char *class_str,
}
/**
- * early_platform_driver_probe
+ * early_platform_driver_probe - probe a class of registered drivers
* @class_str: string to identify early platform driver class
* @nr_probe: number of platform devices to successfully probe before exiting
* @user_only: only probe user specified early platform devices
+ *
+ * Used by architecture code to probe registered early platform drivers
+ * within a certain class. For probe to happen a registered early platform
+ * device matching a registered early platform driver is needed.
*/
int __init early_platform_driver_probe(char *class_str,
int nr_probe,
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 07/12] driver-core: fix missing kernel-doc in firmware_class
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
` (5 preceding siblings ...)
2010-03-19 15:18 ` [PATCH 06/12] Driver core: Early platform kernel-doc update Greg Kroah-Hartman
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 08/12] kobject: documentation: Fix erroneous example in kobject doc Greg Kroah-Hartman
` (4 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Randy Dunlap, Greg Kroah-Hartman
From: Randy Dunlap <randy.dunlap@oracle.com>
Fix kernel-doc warning in firmware_class.c:
Warning(drivers/base/firmware_class.c:94): No description found for parameter 'attr'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/firmware_class.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index fc7565c..18518ba 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -78,6 +78,7 @@ firmware_timeout_show(struct class *class,
/**
* firmware_timeout_store - set number of seconds to wait for firmware
* @class: device class pointer
+ * @attr: device attribute pointer
* @buf: buffer to scan for timeout value
* @count: number of bytes in @buf
*
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 08/12] kobject: documentation: Fix erroneous example in kobject doc.
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
` (6 preceding siblings ...)
2010-03-19 15:18 ` [PATCH 07/12] driver-core: fix missing kernel-doc in firmware_class Greg Kroah-Hartman
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 09/12] sysdev: the cpu probe/release attributes should be sysdev_class_attributes Greg Kroah-Hartman
` (3 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Robert P. J. Day, Greg Kroah-Hartman
From: Robert P. J. Day <rpjday@crashcourse.ca>
Replace uio_mem example for kobjects with uio_map, since the uio_mem
struct no longer contains a kobject.
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
Documentation/kobject.txt | 57 ++++++++++++++++++++++++++++++---------------
1 files changed, 38 insertions(+), 19 deletions(-)
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt
index bdb1381..668cb83 100644
--- a/Documentation/kobject.txt
+++ b/Documentation/kobject.txt
@@ -59,37 +59,56 @@ nice to have in other objects. The C language does not allow for the
direct expression of inheritance, so other techniques - such as structure
embedding - must be used.
-So, for example, the UIO code has a structure that defines the memory
-region associated with a uio device:
+(As an aside, for those familiar with the kernel linked list implementation,
+this is analogous as to how "list_head" structs are rarely useful on
+their own, but are invariably found embedded in the larger objects of
+interest.)
-struct uio_mem {
+So, for example, the UIO code in drivers/uio/uio.c has a structure that
+defines the memory region associated with a uio device:
+
+ struct uio_map {
struct kobject kobj;
- unsigned long addr;
- unsigned long size;
- int memtype;
- void __iomem *internal_addr;
-};
+ struct uio_mem *mem;
+ };
-If you have a struct uio_mem structure, finding its embedded kobject is
+If you have a struct uio_map structure, finding its embedded kobject is
just a matter of using the kobj member. Code that works with kobjects will
often have the opposite problem, however: given a struct kobject pointer,
what is the pointer to the containing structure? You must avoid tricks
(such as assuming that the kobject is at the beginning of the structure)
and, instead, use the container_of() macro, found in <linux/kernel.h>:
- container_of(pointer, type, member)
+ container_of(pointer, type, member)
+
+where:
+
+ * "pointer" is the pointer to the embedded kobject,
+ * "type" is the type of the containing structure, and
+ * "member" is the name of the structure field to which "pointer" points.
+
+The return value from container_of() is a pointer to the corresponding
+container type. So, for example, a pointer "kp" to a struct kobject
+embedded *within* a struct uio_map could be converted to a pointer to the
+*containing* uio_map structure with:
+
+ struct uio_map *u_map = container_of(kp, struct uio_map, kobj);
+
+For convenience, programmers often define a simple macro for "back-casting"
+kobject pointers to the containing type. Exactly this happens in the
+earlier drivers/uio/uio.c, as you can see here:
+
+ struct uio_map {
+ struct kobject kobj;
+ struct uio_mem *mem;
+ };
-where pointer is the pointer to the embedded kobject, type is the type of
-the containing structure, and member is the name of the structure field to
-which pointer points. The return value from container_of() is a pointer to
-the given type. So, for example, a pointer "kp" to a struct kobject
-embedded within a struct uio_mem could be converted to a pointer to the
-containing uio_mem structure with:
+ #define to_map(map) container_of(map, struct uio_map, kobj)
- struct uio_mem *u_mem = container_of(kp, struct uio_mem, kobj);
+where the macro argument "map" is a pointer to the struct kobject in
+question. That macro is subsequently invoked with:
-Programmers often define a simple macro for "back-casting" kobject pointers
-to the containing type.
+ struct uio_map *map = to_map(kobj);
Initialization of kobjects
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/12] sysdev: the cpu probe/release attributes should be sysdev_class_attributes
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
` (7 preceding siblings ...)
2010-03-19 15:18 ` [PATCH 08/12] kobject: documentation: Fix erroneous example in kobject doc Greg Kroah-Hartman
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 10/12] kobject: documentation: Update to refer to kset-example.c Greg Kroah-Hartman
` (2 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Stephen Rothwell, Andi Kleen, Greg Kroah-Hartman
From: Stephen Rothwell <sfr@canb.auug.org.au>
This fixes these warnings:
drivers/base/cpu.c:264: warning: initialization from incompatible pointer type
drivers/base/cpu.c:265: warning: initialization from incompatible pointer type
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/cpu.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 7036e8e..b5242e1 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -79,24 +79,24 @@ void unregister_cpu(struct cpu *cpu)
}
#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
-static ssize_t cpu_probe_store(struct sys_device *dev,
- struct sysdev_attribute *attr,
- const char *buf,
+static ssize_t cpu_probe_store(struct sysdev_class *class,
+ struct sysdev_class_attribute *attr,
+ const char *buf,
size_t count)
{
return arch_cpu_probe(buf, count);
}
-static ssize_t cpu_release_store(struct sys_device *dev,
- struct sysdev_attribute *attr,
- const char *buf,
+static ssize_t cpu_release_store(struct sysdev_class *class,
+ struct sysdev_class_attribute *attr,
+ const char *buf,
size_t count)
{
return arch_cpu_release(buf, count);
}
-static SYSDEV_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
-static SYSDEV_ATTR(release, S_IWUSR, NULL, cpu_release_store);
+static SYSDEV_CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
+static SYSDEV_CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store);
#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
#else /* ... !CONFIG_HOTPLUG_CPU */
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 10/12] kobject: documentation: Update to refer to kset-example.c.
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
` (8 preceding siblings ...)
2010-03-19 15:18 ` [PATCH 09/12] sysdev: the cpu probe/release attributes should be sysdev_class_attributes Greg Kroah-Hartman
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 11/12] driver-core: document ERR_PTR() return values Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 12/12] driver core: numa: fix BUILD_BUG_ON for node_read_distance Greg Kroah-Hartman
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Robert P. J. Day, Greg Kroah-Hartman
From: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
Documentation/kobject.txt | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt
index 668cb83..3ab2472 100644
--- a/Documentation/kobject.txt
+++ b/Documentation/kobject.txt
@@ -406,4 +406,5 @@ called, and the objects in the former circle release each other.
Example code to copy from
For a more complete example of using ksets and kobjects properly, see the
-sample/kobject/kset-example.c code.
+example programs samples/kobject/{kobject-example.c,kset-example.c},
+which will be built as loadable modules if you select CONFIG_SAMPLE_KOBJECT.
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 11/12] driver-core: document ERR_PTR() return values
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
` (9 preceding siblings ...)
2010-03-19 15:18 ` [PATCH 10/12] kobject: documentation: Update to refer to kset-example.c Greg Kroah-Hartman
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 12/12] driver core: numa: fix BUILD_BUG_ON for node_read_distance Greg Kroah-Hartman
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: Jani Nikula, Greg Kroah-Hartman
From: Jani Nikula <ext-jani.1.nikula@nokia.com>
A number of functions in the driver core return ERR_PTR() values on
error. Document this in the kernel-doc of the functions.
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/class.c | 2 ++
drivers/base/core.c | 6 ++++++
drivers/base/platform.c | 6 ++++++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 0147f47..9c6a0d6 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -219,6 +219,8 @@ static void class_create_release(struct class *cls)
* This is used to create a struct class pointer that can then be used
* in calls to device_create().
*
+ * Returns &struct class pointer on success, or ERR_PTR() on error.
+ *
* Note, the pointer created here is to be destroyed when finished by
* making a call to class_destroy().
*/
diff --git a/drivers/base/core.c b/drivers/base/core.c
index ef55df3..b56a0ba 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1345,6 +1345,8 @@ static void root_device_release(struct device *dev)
* 'module' symlink which points to the @owner directory
* in sysfs.
*
+ * Returns &struct device pointer on success, or ERR_PTR() on error.
+ *
* Note: You probably want to use root_device_register().
*/
struct device *__root_device_register(const char *name, struct module *owner)
@@ -1432,6 +1434,8 @@ static void device_create_release(struct device *dev)
* Any further sysfs files that might be required can be created using this
* pointer.
*
+ * Returns &struct device pointer on success, or ERR_PTR() on error.
+ *
* Note: the struct class passed to this function must have previously
* been created with a call to class_create().
*/
@@ -1492,6 +1496,8 @@ EXPORT_SYMBOL_GPL(device_create_vargs);
* Any further sysfs files that might be required can be created using this
* pointer.
*
+ * Returns &struct device pointer on success, or ERR_PTR() on error.
+ *
* Note: the struct class passed to this function must have previously
* been created with a call to class_create().
*/
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index f6bcf22..4b4b565 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -362,6 +362,8 @@ EXPORT_SYMBOL_GPL(platform_device_unregister);
* enumeration tasks, they don't fully conform to the Linux driver model.
* In particular, when such drivers are built as modules, they can't be
* "hotplugged".
+ *
+ * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
*/
struct platform_device *platform_device_register_simple(const char *name,
int id,
@@ -408,6 +410,8 @@ EXPORT_SYMBOL_GPL(platform_device_register_simple);
* allocated for the device allows drivers using such devices to be
* unloaded without waiting for the last reference to the device to be
* dropped.
+ *
+ * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
*/
struct platform_device *platform_device_register_data(
struct device *parent,
@@ -559,6 +563,8 @@ EXPORT_SYMBOL_GPL(platform_driver_probe);
*
* Use this in legacy-style modules that probe hardware directly and
* register a single platform device and corresponding platform driver.
+ *
+ * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
*/
struct platform_device * __init_or_module platform_create_bundle(
struct platform_driver *driver,
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 12/12] driver core: numa: fix BUILD_BUG_ON for node_read_distance
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
` (10 preceding siblings ...)
2010-03-19 15:18 ` [PATCH 11/12] driver-core: document ERR_PTR() return values Greg Kroah-Hartman
@ 2010-03-19 15:18 ` Greg Kroah-Hartman
11 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2010-03-19 15:18 UTC (permalink / raw)
To: linux-kernel; +Cc: David Rientjes, Ingo Molnar, Greg Kroah-Hartman
From: David Rientjes <rientjes@google.com>
node_read_distance() has a BUILD_BUG_ON() to prevent buffer overruns when
the number of nodes printed will exceed the buffer length.
Each node only needs four chars: three for distance (maximum distance is
255) and one for a seperating space or a trailing newline.
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/node.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/base/node.c b/drivers/base/node.c
index ad43185..93b3ac6 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -165,8 +165,11 @@ static ssize_t node_read_distance(struct sys_device * dev,
int len = 0;
int i;
- /* buf currently PAGE_SIZE, need ~4 chars per node */
- BUILD_BUG_ON(MAX_NUMNODES*4 > PAGE_SIZE/2);
+ /*
+ * buf is currently PAGE_SIZE in length and each node needs 4 chars
+ * at the most (distance + space or newline).
+ */
+ BUILD_BUG_ON(MAX_NUMNODES * 4 > PAGE_SIZE);
for_each_online_node(i)
len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i));
--
1.7.0.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [GIT PATCH] driver core fixes for 2.6.34-git
@ 2010-04-22 22:29 Greg KH
0 siblings, 0 replies; 14+ messages in thread
From: Greg KH @ 2010-04-22 22:29 UTC (permalink / raw)
To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel
Here are 3 patches for your 2.6.34-git tree.
Two documentation updates, and one fix for the sysfs attribute warning
that people have reported.
Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git/
All of these patches have been in the linux-next and mm trees.
The patches will be sent as a follow-on to this message to lkml for
people to see.
thanks,
greg k-h
------------
Documentation/HOWTO | 2 +-
Documentation/stable_kernel_rules.txt | 9 ++++-----
drivers/hwmon/asus_atk0110.c | 4 ++++
3 files changed, 9 insertions(+), 6 deletions(-)
---------------
Jiri Kosina (1):
sysfs: use sysfs_attr_init in ASUS atk0110 driver
Randy Dunlap (1):
Documentation/HOWTO: update git home URL
Stefan Richter (1):
Documentation: -stable rules: upstream commit ID requirement reworded
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2010-04-22 22:30 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-19 15:13 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
2010-03-19 15:18 ` [PATCH 01/12] sysfs: use sysfs_bin_attr_init in firmware class driver Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 02/12] sysfs: Initialised pci bus legacy_mem field before use Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 03/12] sysfs: fix sysfs lockdep warning in ipmi code Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 04/12] sysfs: fix sysfs lockdep warning in infiniband code Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 05/12] sysfs: fix sysfs lockdep warning in mlx4 code Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 06/12] Driver core: Early platform kernel-doc update Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 07/12] driver-core: fix missing kernel-doc in firmware_class Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 08/12] kobject: documentation: Fix erroneous example in kobject doc Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 09/12] sysdev: the cpu probe/release attributes should be sysdev_class_attributes Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 10/12] kobject: documentation: Update to refer to kset-example.c Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 11/12] driver-core: document ERR_PTR() return values Greg Kroah-Hartman
2010-03-19 15:18 ` [PATCH 12/12] driver core: numa: fix BUILD_BUG_ON for node_read_distance Greg Kroah-Hartman
-- strict thread matches above, loose matches on Subject: below --
2010-04-22 22:29 [GIT PATCH] driver core fixes for 2.6.34-git Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox