diff options
author | Ming Lei <tom.leiming@gmail.com> | 2009-03-01 08:10:49 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:38:26 -0400 |
commit | f67f129e519fa87f8ebd236b6336fe43f31ee141 (patch) | |
tree | e2832f6d012044f5d05c6130416832235c7d2730 /drivers/base | |
parent | 4995f8ef9d3aac72745e12419d7fbaa8d01b1d81 (diff) |
Driver core: implement uevent suppress in kobject
This patch implements uevent suppress in kobject and removes it
from struct device, based on the following ideas:
1,Uevent sending should be one attribute of kobject, so suppressing it
in kobject layer is more natural than in device layer. By this way,
we can do it for other objects embedded with kobject.
2,It may save several bytes for each instance of struct device.(On my
omap3(32bit ARM) based box, can save 8bytes per device object)
This patch also introduces dev_set|get_uevent_suppress() helpers to
set and query uevent_suppress attribute in case to help kobject
as private part of struct device in future.
[This version is against the latest driver-core patch set of Greg,please
ignore the last version.]
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/core.c | 2 | ||||
-rw-r--r-- | drivers/base/firmware_class.c | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index a90f56f64d6f..95c67ffd71da 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -136,8 +136,6 @@ static int dev_uevent_filter(struct kset *kset, struct kobject *kobj) | |||
136 | 136 | ||
137 | if (ktype == &device_ktype) { | 137 | if (ktype == &device_ktype) { |
138 | struct device *dev = to_dev(kobj); | 138 | struct device *dev = to_dev(kobj); |
139 | if (dev->uevent_suppress) | ||
140 | return 0; | ||
141 | if (dev->bus) | 139 | if (dev->bus) |
142 | return 1; | 140 | return 1; |
143 | if (dev->class) | 141 | if (dev->class) |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 44699d9dd85c..d3a59c688fe4 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -319,7 +319,7 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, | |||
319 | f_dev->parent = device; | 319 | f_dev->parent = device; |
320 | f_dev->class = &firmware_class; | 320 | f_dev->class = &firmware_class; |
321 | dev_set_drvdata(f_dev, fw_priv); | 321 | dev_set_drvdata(f_dev, fw_priv); |
322 | f_dev->uevent_suppress = 1; | 322 | dev_set_uevent_suppress(f_dev, 1); |
323 | retval = device_register(f_dev); | 323 | retval = device_register(f_dev); |
324 | if (retval) { | 324 | if (retval) { |
325 | dev_err(device, "%s: device_register failed\n", __func__); | 325 | dev_err(device, "%s: device_register failed\n", __func__); |
@@ -366,7 +366,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p, | |||
366 | } | 366 | } |
367 | 367 | ||
368 | if (uevent) | 368 | if (uevent) |
369 | f_dev->uevent_suppress = 0; | 369 | dev_set_uevent_suppress(f_dev, 0); |
370 | *dev_p = f_dev; | 370 | *dev_p = f_dev; |
371 | goto out; | 371 | goto out; |
372 | 372 | ||