- driver-core-dont-ignore-bus_attach_device-retval.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Driver core: Don't ignore bus_attach_device() retval
has been removed from the -mm tree.  Its filename was
     driver-core-dont-ignore-bus_attach_device-retval.patch

This patch was dropped because for the second time Greg has ignored this patch and merged other stuff which trashed it

------------------------------------------------------
Subject: Driver core: Don't ignore bus_attach_device() retval
From: Cornelia Huck <cornelia.huck@xxxxxxxxxx>

Check for return value of bus_attach_device() in device_add().  Add a
function bus_delete_device() that undos the effects of bus_add_device(). 
bus_remove_device() now undos the effects of bus_attach_device(). 
device_del() now calls bus_remove_device(), kobject_uevent(),
bus_delete_device() which makes it symmetric to the call sequence in
device_add().

Signed-off-by: Cornelia Huck <cornelia.huck@xxxxxxxxxx>
Cc: Greg KH <greg@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/base/base.h |    1 +
 drivers/base/bus.c  |   36 ++++++++++++++++++++++++------------
 drivers/base/core.c |    3 ++-
 3 files changed, 27 insertions(+), 13 deletions(-)

diff -puN drivers/base/base.h~driver-core-dont-ignore-bus_attach_device-retval drivers/base/base.h
--- a/drivers/base/base.h~driver-core-dont-ignore-bus_attach_device-retval
+++ a/drivers/base/base.h
@@ -17,6 +17,7 @@ extern int attribute_container_init(void
 
 extern int bus_add_device(struct device * dev);
 extern int bus_attach_device(struct device * dev);
+extern void bus_delete_device(struct device * dev);
 extern void bus_remove_device(struct device * dev);
 extern struct bus_type *get_bus(struct bus_type * bus);
 extern void put_bus(struct bus_type * bus);
diff -puN drivers/base/bus.c~driver-core-dont-ignore-bus_attach_device-retval drivers/base/bus.c
--- a/drivers/base/bus.c~driver-core-dont-ignore-bus_attach_device-retval
+++ a/drivers/base/bus.c
@@ -360,7 +360,7 @@ static void device_remove_attrs(struct b
  *	bus_add_device - add device to bus
  *	@dev:	device being added
  *
- *	- Add the device to its bus's list of devices.
+ *	- Add attributes.
  *	- Create link to device's bus.
  */
 int bus_add_device(struct device * dev)
@@ -424,31 +424,43 @@ int bus_attach_device(struct device * de
 }
 
 /**
- *	bus_remove_device - remove device from bus
- *	@dev:	device to be removed
+ *	bus_delete_device - bus_add_device
+ *	@dev:	device being deleted
  *
  *	- Remove symlink from bus's directory.
- *	- Delete device from bus's list.
- *	- Detach from its driver.
+ *	- Remove attributes.
  *	- Drop reference taken in bus_add_device().
  */
-void bus_remove_device(struct device * dev)
+void bus_delete_device(struct device * dev)
 {
 	if (dev->bus) {
 		sysfs_remove_link(&dev->kobj, "subsystem");
 		sysfs_remove_link(&dev->kobj, "bus");
 		sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
 		device_remove_attrs(dev->bus, dev);
-		if (dev->is_registered) {
-			dev->is_registered = 0;
-			klist_del(&dev->knode_bus);
-		}
-		pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id);
-		device_release_driver(dev);
 		put_bus(dev->bus);
 	}
 }
 
+/**
+ *	bus_remove_device - remove device from bus
+ *	@dev:	device to be removed
+ *
+ *	- Delete device from bus's list.
+ *	- Detach from its driver.
+ */
+void bus_remove_device(struct device * dev)
+{
+	if (dev->bus) {
+		device_remove_attrs(dev->bus, dev);
+		dev->is_registered = 0;
+		klist_del(&dev->knode_bus);
+		pr_debug("bus %s: remove device %s\n", dev->bus->name,
+			 dev->bus_id);
+		device_release_driver(dev);
+	}
+}
+
 static int driver_add_attrs(struct bus_type * bus, struct device_driver * drv)
 {
 	int error = 0;
diff -puN drivers/base/core.c~driver-core-dont-ignore-bus_attach_device-retval drivers/base/core.c
--- a/drivers/base/core.c~driver-core-dont-ignore-bus_attach_device-retval
+++ a/drivers/base/core.c
@@ -550,7 +550,7 @@ int device_add(struct device *dev)
 	put_device(dev);
 	return error;
  AttachError:
-	bus_remove_device(dev);
+	bus_delete_device(dev);
  BusError:
 	device_pm_remove(dev);
  PMError:
@@ -678,6 +678,7 @@ void device_del(struct device * dev)
 	bus_remove_device(dev);
 	device_pm_remove(dev);
 	kobject_uevent(&dev->kobj, KOBJ_REMOVE);
+	bus_delete_device(dev);
 	kobject_del(&dev->kobj);
 	if (parent)
 		put_device(parent);
_

Patches currently in -mm which might be from cornelia.huck@xxxxxxxxxx are

driver-core-dont-ignore-bus_attach_device-retval.patch
cpu-topology-consider-sysfs_create_group-return-value.patch
git-s390.patch
tty-switch-to-ktermios-sclp-fix.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux