Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f67f129e authored by Ming Lei's avatar Ming Lei Committed by Greg Kroah-Hartman
Browse files

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: default avatarMing Lei <tom.leiming@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 4995f8ef
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -977,7 +977,7 @@ static int dock_add(acpi_handle handle)
		sizeof(struct dock_station *));

	/* we want the dock device to send uevents */
	dock_device->dev.uevent_suppress = 0;
	dev_set_uevent_suppress(&dock_device->dev, 0);

	if (is_dock(handle))
		dock_station->flags |= DOCK_IS_DOCK;
+0 −2
Original line number Diff line number Diff line
@@ -136,8 +136,6 @@ static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)

	if (ktype == &device_ktype) {
		struct device *dev = to_dev(kobj);
		if (dev->uevent_suppress)
			return 0;
		if (dev->bus)
			return 1;
		if (dev->class)
+2 −2
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ static int fw_register_device(struct device **dev_p, const char *fw_name,
	f_dev->parent = device;
	f_dev->class = &firmware_class;
	dev_set_drvdata(f_dev, fw_priv);
	f_dev->uevent_suppress = 1;
	dev_set_uevent_suppress(f_dev, 1);
	retval = device_register(f_dev);
	if (retval) {
		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,
	}

	if (uevent)
		f_dev->uevent_suppress = 0;
		dev_set_uevent_suppress(f_dev, 0);
	*dev_p = f_dev;
	goto out;

+1 −1
Original line number Diff line number Diff line
@@ -841,7 +841,7 @@ int i2c_attach_client(struct i2c_client *client)

	if (client->driver && !is_newstyle_driver(client->driver)) {
		client->dev.release = i2c_client_release;
		client->dev.uevent_suppress = 1;
		dev_set_uevent_suppress(&client->dev, 1);
	} else
		client->dev.release = i2c_client_dev_release;

+2 −2
Original line number Diff line number Diff line
@@ -84,8 +84,8 @@ static int chsc_subchannel_probe(struct subchannel *sch)
		kfree(private);
	} else {
		sch->private = private;
		if (sch->dev.uevent_suppress) {
			sch->dev.uevent_suppress = 0;
		if (dev_get_uevent_suppress(&sch->dev)) {
			dev_set_uevent_suppress(&sch->dev, 0);
			kobject_uevent(&sch->dev.kobj, KOBJ_ADD);
		}
	}
Loading