Skip to contentSkip to conversation

Add bus_type probe, remove, shutdown methods.

PATCH Applied Russell King 13 participants 55 messages Jan 5, 2006 – Jan 12, 2006

Subsystems (26)
Arm (32-bit) Media (V4L/DVB) SCSI USB +22 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/29 Add bus_type probe, remove, shutdown methods.

Add bus_type probe, remove and shutdown methods to replace the corresponding methods in struct device_driver. This matches the way we handle the suspend/resume methods.

Since the bus methods override the device_driver methods, warn if a device driver is registered whose methods will not be called.

The long-term idea is to remove the device_driver methods entirely.

---
 drivers/base/driver.c         |    5 +++++
 drivers/base/dd.c             |   12 ++++++++++--
 drivers/base/power/shutdown.c |    5 ++++-
 include/linux/device.h        |    3 +++
 4 files changed, 22 insertions(+), 3 deletions(-)
drivers/base/dd.c +10 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' -x .git -r linus/drivers/base/dd.c linux/drivers/base/dd.c
@@ -77,7 +77,13 @@ int driver_probe_device(struct device_dr
 	pr_debug("%s: Matched Device %s with Driver %s\n",
 		 drv->bus->name, dev->bus_id, drv->name);
 	dev->driver = drv;
-	if (drv->probe) {
+	if (dev->bus->probe) {
+		ret = dev->bus->probe(dev);
+		if (ret) {
+			dev->driver = NULL;
+			goto ProbeFailed;
+		}
+	} else if (drv->probe) {
 		ret = drv->probe(dev);
 		if (ret) {
 			dev->driver = NULL;
@@ -194,7 +200,9 @@ static void __device_release_driver(stru
 		sysfs_remove_link(&dev->kobj, "driver");
 		klist_remove(&dev->knode_driver);
 
-		if (drv->remove)
+		if (dev->bus->remove)
+			dev->bus->remove(dev);
+		else if (drv->remove)
 			drv->remove(dev);
 		dev->driver = NULL;
 		put_driver(drv);
drivers/base/driver.c +5 -0
@@ -171,6 +171,11 @@ static void klist_devices_put(struct kli
  */
 int driver_register(struct device_driver * drv)
 {
+	if ((drv->bus->probe && drv->probe) ||
+	    (drv->bus->remove && drv->remove) ||
+	    (drv->bus->shutdown && drv->shutdown)) {
+		printk(KERN_WARNING "Driver '%s' needs updating - please use bus_type methods\n", drv->name);
+	}
 	klist_init(&drv->klist_devices, klist_devices_get, klist_devices_put);
 	init_completion(&drv->unloaded);
 	return bus_add_driver(drv);
drivers/base/power/shutdown.c +4 -1
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x '*.orig' -x '*.rej' -x .git -r linus/drivers/base/power/shutdown.c linux/drivers/base/power/shutdown.c
@@ -40,7 +40,10 @@ void device_shutdown(void)
 	down_write(&devices_subsys.rwsem);
 	list_for_each_entry_reverse(dev, &devices_subsys.kset.list,
 				kobj.entry) {
-		if (dev->driver && dev->driver->shutdown) {
+		if (dev->bus && dev->bus->shutdown) {
+			dev_dbg(dev, "shutdown\n");
+			dev->bus->shutdown(dev);
+		} else if (dev->driver && dev->driver->shutdown) {
 			dev_dbg(dev, "shutdown\n");
 			dev->driver->shutdown(dev);
 		}
include/linux/device.h +3 -0
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git -r linus/include/linux/device.h linux/include/linux/device.h
@@ -49,6 +49,9 @@ struct bus_type {
 	int		(*match)(struct device * dev, struct device_driver * drv);
 	int		(*hotplug) (struct device *dev, char **envp, 
 				    int num_envp, char *buffer, int buffer_size);
+	int		(*probe)(struct device * dev);
+	int		(*remove)(struct device * dev);
+	void		(*shutdown)(struct device * dev);
 	int		(*suspend)(struct device * dev, pm_message_t state);
 	int		(*resume)(struct device * dev);
 };
#1 lore raw

PATCH 2/29 Add pci_bus_type probe and remove methods

Move the PCI bus device probe/remove methods to the bus_type structure. We leave the shutdown method alone since there are compatibility issues with that.

Greg: can we move the shutdown method, or are there still drivers which need the special handling?

---
 drivers/pci/pci-driver.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pci-driver.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/pci/pci-driver.c linux/drivers/pci/pci-driver.c
@@ -380,8 +380,6 @@ int __pci_register_driver(struct pci_dri
 	/* initialize common driver fields */
 	drv->driver.name = drv->name;
 	drv->driver.bus = &pci_bus_type;
-	drv->driver.probe = pci_device_probe;
-	drv->driver.remove = pci_device_remove;
 	/* FIXME, once all of the existing PCI drivers have been fixed to set
 	 * the pci shutdown function, this test can go away. */
 	if (!drv->driver.shutdown)
@@ -513,6 +511,8 @@ struct bus_type pci_bus_type = {
 	.name		= "pci",
 	.match		= pci_bus_match,
 	.hotplug	= pci_hotplug,
+	.probe		= pci_device_probe,
+	.remove		= pci_device_remove,
 	.suspend	= pci_device_suspend,
 	.resume		= pci_device_resume,
 	.dev_attrs	= pci_dev_attrs,
#2 lore raw

PATCH 3/29 Add ecard_bus_type probe/remove/shutdown methods

In reply to Russell King
---
 arch/arm/kernel/ecard.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
arch/arm/kernel/ecard.c +8 -6
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/arm/kernel/ecard.c linux/arch/arm/kernel/ecard.c
@@ -1146,9 +1146,11 @@ static void ecard_drv_shutdown(struct de
 	struct ecard_driver *drv = ECARD_DRV(dev->driver);
 	struct ecard_request req;
 
-	if (drv->shutdown)
-		drv->shutdown(ec);
-	ecard_release(ec);
+	if (dev->driver) {
+		if (drv->shutdown)
+			drv->shutdown(ec);
+		ecard_release(ec);
+	}
 
 	/*
 	 * If this card has a loader, call the reset handler.
@@ -1163,9 +1165,6 @@ static void ecard_drv_shutdown(struct de
 int ecard_register_driver(struct ecard_driver *drv)
 {
 	drv->drv.bus = &ecard_bus_type;
-	drv->drv.probe = ecard_drv_probe;
-	drv->drv.remove = ecard_drv_remove;
-	drv->drv.shutdown = ecard_drv_shutdown;
 
 	return driver_register(&drv->drv);
 }
@@ -1194,6 +1193,9 @@ struct bus_type ecard_bus_type = {
 	.name		= "ecard",
 	.dev_attrs	= ecard_dev_attrs,
 	.match		= ecard_match,
+	.probe		= ecard_drv_probe,
+	.remove		= ecard_drv_remove,
+	.shutdown	= ecard_drv_shutdown,
 };
 
 static int ecard_bus_init(void)
#3 lore raw

PATCH 4/29 Add ecard_bus_type probe/remove/shutdown methods

In reply to Russell King
---
 arch/arm26/kernel/ecard.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
arch/arm26/kernel/ecard.c +10 -8
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/arm26/kernel/ecard.c linux/arch/arm26/kernel/ecard.c
@@ -793,9 +793,11 @@ static void ecard_drv_shutdown(struct de
 	struct ecard_driver *drv = ECARD_DRV(dev->driver);
 	struct ecard_request req;
 
-	if (drv->shutdown)
-		drv->shutdown(ec);
-	ecard_release(ec);
+	if (dev->driver) {
+		if (drv->shutdown)
+			drv->shutdown(ec);
+		ecard_release(ec);
+	}
 	req.req = req_reset;
 	req.ec = ec;
 	ecard_call(&req);
@@ -804,9 +806,6 @@ static void ecard_drv_shutdown(struct de
 int ecard_register_driver(struct ecard_driver *drv)
 {
 	drv->drv.bus = &ecard_bus_type;
-	drv->drv.probe = ecard_drv_probe;
-	drv->drv.remove = ecard_drv_remove;
-	drv->drv.shutdown = ecard_drv_shutdown;
 
 	return driver_register(&drv->drv);
 }
@@ -832,8 +831,11 @@ static int ecard_match(struct device *_d
 }
 
 struct bus_type ecard_bus_type = {
-	.name	= "ecard",
-	.match	= ecard_match,
+	.name		= "ecard",
+	.match		= ecard_match,
+	.probe		= ecard_drv_probe,
+	.remove		= ecard_drv_remove,
+	.shutdown	= ecard_drv_shutdown,
 };
 
 static int ecard_bus_init(void)
#4 lore raw

PATCH 5/29 Add AMBA bus_type probe/remove/shutdown methods

In reply to Russell King
---
 arch/arm/common/amba.c |   71 ++++++++++++++++++++++++++-----------------------
 1 files changed, 38 insertions(+), 33 deletions(-)
arch/arm/common/amba.c +38 -33
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/arm/common/amba.c linux/arch/arm/common/amba.c
@@ -61,6 +61,41 @@ static int amba_hotplug(struct device *d
 #define amba_hotplug NULL
 #endif
 
+/*
+ * These are the device model conversion veneers; they convert the
+ * device model structures to our more specific structures.
+ */
+static int amba_probe(struct device *dev)
+{
+	struct amba_device *pcdev = to_amba_device(dev);
+	struct amba_driver *pcdrv = to_amba_driver(dev->driver);
+	struct amba_id *id;
+	int ret = -ENODEV;
+
+	if (pcdrv->probe) {
+		id = amba_lookup(pcdrv->id_table, pcdev);
+		ret = pcdrv->probe(pcdev, id);
+	}
+	return ret;
+}
+
+static int amba_remove(struct device *dev)
+{
+	struct amba_driver *drv = to_amba_driver(dev->driver);
+	int ret = 0;
+
+	if (drv->remove)
+		ret = drv->remove(to_amba_device(dev));
+	return ret;
+}
+
+static void amba_shutdown(struct device *dev)
+{
+	struct amba_driver *drv = to_amba_driver(dev->driver);
+	if (dev->driver && drv->shutdown)
+		drv->shutdown(to_amba_device(dev));
+}
+
 static int amba_suspend(struct device *dev, pm_message_t state)
 {
 	struct amba_driver *drv = to_amba_driver(dev->driver);
@@ -89,6 +124,9 @@ static struct bus_type amba_bustype = {
 	.name		= "amba",
 	.match		= amba_match,
 	.hotplug	= amba_hotplug,
+	.probe		= amba_probe,
+	.remove		= amba_remove,
+	.shutdown	= amba_shutdown,
 	.suspend	= amba_suspend,
 	.resume		= amba_resume,
 };
@@ -100,33 +138,6 @@ static int __init amba_init(void)
 
 postcore_initcall(amba_init);
 
-/*
- * These are the device model conversion veneers; they convert the
- * device model structures to our more specific structures.
- */
-static int amba_probe(struct device *dev)
-{
-	struct amba_device *pcdev = to_amba_device(dev);
-	struct amba_driver *pcdrv = to_amba_driver(dev->driver);
-	struct amba_id *id;
-
-	id = amba_lookup(pcdrv->id_table, pcdev);
-
-	return pcdrv->probe(pcdev, id);
-}
-
-static int amba_remove(struct device *dev)
-{
-	struct amba_driver *drv = to_amba_driver(dev->driver);
-	return drv->remove(to_amba_device(dev));
-}
-
-static void amba_shutdown(struct device *dev)
-{
-	struct amba_driver *drv = to_amba_driver(dev->driver);
-	drv->shutdown(to_amba_device(dev));
-}
-
 /**
  *	amba_driver_register - register an AMBA device driver
  *	@drv: amba device driver structure
@@ -138,12 +149,6 @@ static void amba_shutdown(struct device 
 int amba_driver_register(struct amba_driver *drv)
 {
 	drv->drv.bus = &amba_bustype;
-
-#define SETFN(fn)	if (drv->fn) drv->drv.fn = amba_##fn
-	SETFN(probe);
-	SETFN(remove);
-	SETFN(shutdown);
-
 	return driver_register(&drv->drv);
 }
 
#5 lore raw

PATCH 6/29 Add SA1111 bus_type probe/remove methods

In reply to Russell King
---
 arch/arm/common/sa1111.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/common/sa1111.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/arm/common/sa1111.c linux/arch/arm/common/sa1111.c
@@ -1247,14 +1247,14 @@ static int sa1111_bus_remove(struct devi
 struct bus_type sa1111_bus_type = {
 	.name		= "sa1111-rab",
 	.match		= sa1111_match,
+	.probe		= sa1111_bus_probe,
+	.remove		= sa1111_bus_remove,
 	.suspend	= sa1111_bus_suspend,
 	.resume		= sa1111_bus_resume,
 };
 
 int sa1111_driver_register(struct sa1111_driver *driver)
 {
-	driver->drv.probe = sa1111_bus_probe;
-	driver->drv.remove = sa1111_bus_remove;
 	driver->drv.bus = &sa1111_bus_type;
 	return driver_register(&driver->drv);
 }
#6 lore raw

PATCH 7/29 Add locomo bus_type probe/remove methods

In reply to Russell King
---
 arch/arm/common/locomo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/common/locomo.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/arm/common/locomo.c linux/arch/arm/common/locomo.c
@@ -1103,14 +1103,14 @@ static int locomo_bus_remove(struct devi
 struct bus_type locomo_bus_type = {
 	.name		= "locomo-bus",
 	.match		= locomo_match,
+	.probe		= locomo_bus_probe,
+	.remove		= locomo_bus_remove,
 	.suspend	= locomo_bus_suspend,
 	.resume		= locomo_bus_resume,
 };
 
 int locomo_driver_register(struct locomo_driver *driver)
 {
-	driver->drv.probe = locomo_bus_probe;
-	driver->drv.remove = locomo_bus_remove;
 	driver->drv.bus = &locomo_bus_type;
 	return driver_register(&driver->drv);
 }
#7 lore raw

Re: [CFT 7/29] Add locomo bus_type probe/remove methods

but no changelog entry?

Quoted 29 lines · Russell King
---
 arch/arm/common/locomo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej

(quoted diff) +0 -1
-x .git linus/arch/arm/common/locomo.c linux/arch/arm/common/locomo.c
arch/arm/common/locomo.c Sun Nov 13 15:56:31 2005 renamed from arch/arm/common/locomo.c Fri Nov 11 21:20:00 2005 +2 -2
@@ -1103,14 +1103,14 @@ static int locomo_bus_remove(struct devi
 struct bus_type locomo_bus_type = {
        .name           = "locomo-bus",
        .match          = locomo_match,
+       .probe          = locomo_bus_probe,
+       .remove         = locomo_bus_remove,
        .suspend        = locomo_bus_suspend,
        .resume         = locomo_bus_resume,
 };
 
 int locomo_driver_register(struct locomo_driver *driver)
 {
-       driver->drv.probe = locomo_bus_probe;
-       driver->drv.remove = locomo_bus_remove;
        driver->drv.bus = &locomo_bus_type;
        return driver_register(&driver->drv);
 }
#8 lore raw

PATCH 8/29 Add logic module bus_type probe/remove methods

In reply to Russell King
---
 arch/arm/mach-integrator/lm.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)
arch/arm/mach-integrator/lm.c +18 -18
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/arm/mach-integrator/lm.c linux/arch/arm/mach-integrator/lm.c
@@ -22,20 +22,6 @@ static int lm_match(struct device *dev, 
 	return 1;
 }
 
-static struct bus_type lm_bustype = {
-	.name		= "logicmodule",
-	.match		= lm_match,
-//	.suspend	= lm_suspend,
-//	.resume		= lm_resume,
-};
-
-static int __init lm_init(void)
-{
-	return bus_register(&lm_bustype);
-}
-
-postcore_initcall(lm_init);
-
 static int lm_bus_probe(struct device *dev)
 {
 	struct lm_device *lmdev = to_lm_device(dev);
@@ -49,16 +35,30 @@ static int lm_bus_remove(struct device *
 	struct lm_device *lmdev = to_lm_device(dev);
 	struct lm_driver *lmdrv = to_lm_driver(dev->driver);
 
-	lmdrv->remove(lmdev);
+	if (lmdrv->remove)
+		lmdrv->remove(lmdev);
 	return 0;
 }
 
+static struct bus_type lm_bustype = {
+	.name		= "logicmodule",
+	.match		= lm_match,
+	.probe		= lm_bus_probe,
+	.remove		= lm_bus_remove,
+//	.suspend	= lm_bus_suspend,
+//	.resume		= lm_bus_resume,
+};
+
+static int __init lm_init(void)
+{
+	return bus_register(&lm_bustype);
+}
+
+postcore_initcall(lm_init);
+
 int lm_driver_register(struct lm_driver *drv)
 {
 	drv->drv.bus = &lm_bustype;
-	drv->drv.probe = lm_bus_probe;
-	drv->drv.remove = lm_bus_remove;
-
 	return driver_register(&drv->drv);
 }
 
#9 lore raw

PATCH 9/29 Add tiocx bus_type probe/remove methods

In reply to Russell King
---
 arch/ia64/sn/kernel/tiocx.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
arch/ia64/sn/kernel/tiocx.c +8 -8
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/ia64/sn/kernel/tiocx.c linux/arch/ia64/sn/kernel/tiocx.c
@@ -76,12 +76,6 @@ static void tiocx_bus_release(struct dev
 	kfree(to_cx_dev(dev));
 }
 
-struct bus_type tiocx_bus_type = {
-	.name = "tiocx",
-	.match = tiocx_match,
-	.hotplug = tiocx_hotplug,
-};
-
 /**
  * cx_device_match - Find cx_device in the id table.
  * @ids: id table from driver
@@ -148,6 +142,14 @@ static int cx_driver_remove(struct devic
 	return 0;
 }
 
+struct bus_type tiocx_bus_type = {
+	.name = "tiocx",
+	.match = tiocx_match,
+	.hotplug = tiocx_hotplug,
+	.probe = cx_device_probe,
+	.remove = cx_device_remove,
+};
+
 /**
  * cx_driver_register - Register the driver.
  * @cx_driver: driver table (cx_drv struct) from driver
@@ -161,8 +163,6 @@ int cx_driver_register(struct cx_drv *cx
 {
 	cx_driver->driver.name = cx_driver->name;
 	cx_driver->driver.bus = &tiocx_bus_type;
-	cx_driver->driver.probe = cx_device_probe;
-	cx_driver->driver.remove = cx_driver_remove;
 
 	return driver_register(&cx_driver->driver);
 }
#10 lore raw

Re: [CFT 9/29] Add tiocx bus_type probe/remove methods

This patch looks broken. I see the lines:

+ .remove = cx_device_remove,
- cx_driver->driver.remove = cx_driver_remove;

The routine (not in this patch) is still known as "cx_driver_remove" but now it is linked to from the .remove line as "cx_device_remove"

A defconfig ia64 build of *-mm3 with this patch fails:

arch/ia64/sn/kernel/tiocx.c:151: error: cx_device_remove' undeclared here (not in a function) arch/ia64/sn/kernel/tiocx.c:151: error: initializer element is not constant arch/ia64/sn/kernel/tiocx.c:151: error: (near initialization for tiocx_bus_type.remove') arch/ia64/sn/kernel/tiocx.c:137: warning: `cx_driver_remove' defined but not used

When I s/cx_device_remove/cx_driver_remove/, then ia64 *-mm3 defconfig builds fine.

Signature · 3 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401
#11 lore raw

Re: [CFT 9/29] Add tiocx bus_type probe/remove methods

Review

Quoted 4 lines · pj

This patch looks broken. I see the lines:

(quoted diff) +1 -1
+	.remove = cx_device_remove,
-	cx_driver->driver.remove = cx_driver_remove;

It looks like Adrian already posted a patch for this - thanks.

Signature · 3 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401
#12 lore raw

PATCH 10/29 Add parisc_bus_type probe and remove methods

In reply to Russell King
---
 arch/parisc/kernel/drivers.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/parisc/kernel/drivers.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/parisc/kernel/drivers.c linux/arch/parisc/kernel/drivers.c
@@ -173,8 +173,6 @@ int register_parisc_driver(struct parisc
 	WARN_ON(driver->drv.probe != NULL);
 	WARN_ON(driver->drv.remove != NULL);
 
-	driver->drv.probe = parisc_driver_probe;
-	driver->drv.remove = parisc_driver_remove;
 	driver->drv.name = driver->name;
 
 	return driver_register(&driver->drv);
@@ -570,6 +568,8 @@ struct bus_type parisc_bus_type = {
 	.name = "parisc",
 	.match = parisc_generic_match,
 	.dev_attrs = parisc_device_attrs,
+	.probe = parisc_driver_probe,
+	.remove = parisc_driver_remove,
 };
 
 /**

_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

#13 lore raw

PATCH 10/29 Add parisc_bus_type probe and remove methods

In reply to Russell King
---
 arch/parisc/kernel/drivers.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/parisc/kernel/drivers.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/parisc/kernel/drivers.c linux/arch/parisc/kernel/drivers.c
@@ -173,8 +173,6 @@ int register_parisc_driver(struct parisc
 	WARN_ON(driver->drv.probe != NULL);
 	WARN_ON(driver->drv.remove != NULL);
 
-	driver->drv.probe = parisc_driver_probe;
-	driver->drv.remove = parisc_driver_remove;
 	driver->drv.name = driver->name;
 
 	return driver_register(&driver->drv);
@@ -570,6 +568,8 @@ struct bus_type parisc_bus_type = {
 	.name = "parisc",
 	.match = parisc_generic_match,
 	.dev_attrs = parisc_device_attrs,
+	.probe = parisc_driver_probe,
+	.remove = parisc_driver_remove,
 };
 
 /**
#14 lore raw

Re: [parisc-linux] [CFT 10/29] Add parisc_bus_type probe and remove methods

Quoted 1 line · Russell King

Works fine, Acked-by: Matthew Wilcox <[email protected]>

arch/parisc/kernel/drivers.c int register_parisc_driver(struct parisc · line 174

Quoted 6 lines

diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/parisc/kernel/drivers.c linux/arch/parisc/kernel/drivers.c

arch/parisc/kernel/drivers.c +0 -0
@@ -173,8 +173,6 @@ int register_parisc_driver(struct parisc
 	WARN_ON(driver->drv.probe != NULL);
 	WARN_ON(driver->drv.remove != NULL);

I wonder if you want to delete the two WARN_ONs here too.
_______________________________________________
parisc-linux mailing list [email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

#15 lore raw

Re: [parisc-linux] [CFT 10/29] Add parisc_bus_type probe and remove methods

In reply to Russell King
Quoted 1 line · Russell King

Works fine, Acked-by: Matthew Wilcox <[email protected]>

arch/parisc/kernel/drivers.c int register_parisc_driver(struct parisc · line 174

Quoted 6 lines

diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/parisc/kernel/drivers.c linux/arch/parisc/kernel/drivers.c

arch/parisc/kernel/drivers.c +0 -0
@@ -173,8 +173,6 @@ int register_parisc_driver(struct parisc
 	WARN_ON(driver->drv.probe != NULL);
 	WARN_ON(driver->drv.remove != NULL);

I wonder if you want to delete the two WARN_ONs here too.

#16 lore raw

[parisc-linux] patch add-parisc_bus_type-probe-and-remove-methods.patch added to gregkh-2.6 tree

In reply to Russell King

This is a note to let you know that I've just added the patch titled

Subject: [CFT 10/29] Add parisc_bus_type probe and remove methods

to my gregkh-2.6 tree. Its filename is

add-parisc_bus_type-probe-and-remove-methods.patch

This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Quoted 1 line
Quoted 1 line

From [email protected] Thu Jan 5 06:37:17 2006

From: Russell King <[email protected]>
CC: Greg K-H <[email protected]>, parisc <[email protected]>
Subject: [CFT 10/29] Add parisc_bus_type probe and remove methods
Date: Thu, 05 Jan 2006 14:34:38 +0000
Message-ID: <[email protected]>

---
 arch/parisc/kernel/drivers.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/kernel/drivers.c +2 -2
@@ -173,8 +173,6 @@ int register_parisc_driver(struct parisc
 	WARN_ON(driver->drv.probe != NULL);
 	WARN_ON(driver->drv.remove != NULL);
 
-	driver->drv.probe = parisc_driver_probe;
-	driver->drv.remove = parisc_driver_remove;
 	driver->drv.name = driver->name;
 
 	return driver_register(&driver->drv);
@@ -570,6 +568,8 @@ struct bus_type parisc_bus_type = {
 	.name = "parisc",
 	.match = parisc_generic_match,
 	.dev_attrs = parisc_device_attrs,
+	.probe = parisc_driver_probe,
+	.remove = parisc_driver_remove,
 };
 
 /**

Patches currently in gregkh-2.6 which might be from [email protected] are

driver/add-bttv-sub-bus_type-probe-and-remove-methods.patch driver/add-bus_type-probe-remove-shutdown-methods..patch driver/add-ccwgroup_bus_type-probe-and-remove-methods.patch driver/add-dio_bus_type-probe-and-remove-methods.patch driver/add-ecard_bus_type-probe-remove-shutdown-methods.patch driver/add-gameport-bus_type-probe-and-remove-methods.patch driver/add-i2c_bus_type-probe-and-remove-methods.patch driver/add-ide_bus_type-probe-and-remove-methods.patch driver/add-locomo-bus_type-probe-remove-methods.patch driver/add-logic-module-bus_type-probe-remove-methods.patch driver/add-macio_bus_type-probe-and-remove-methods.patch driver/add-mcp-bus_type-probe-and-remove-methods.patch driver/add-mmc_bus_type-probe-and-remove-methods.patch driver/add-ocp_bus_type-probe-and-remove-methods.patch driver/add-of_platform_bus_type-probe-and-remove-methods.patch driver/add-parisc_bus_type-probe-and-remove-methods.patch driver/add-pci_bus_type-probe-and-remove-methods.patch driver/add-pcmcia_bus_type-probe-and-remove-methods.patch driver/add-pnp_bus_type-probe-and-remove-methods.patch driver/add-pseudo-lld-bus_type-probe-and-remove-methods.patch driver/add-rio_bus_type-probe-and-remove-methods.patch driver/add-sa1111-bus_type-probe-remove-methods.patch driver/add-serio-bus_type-probe-and-remove-methods.patch driver/add-sh_bus_type-probe-and-remove-methods.patch driver/add-superhyway_bus_type-probe-and-remove-methods.patch driver/add-tiocx-bus_type-probe-remove-methods.patch driver/add-usb_serial_bus_type-probe-and-remove-methods.patch driver/add-vio_bus_type-probe-and-remove-methods.patch driver/add-zorro_bus_type-probe-and-remove-methods.patch driver/remove-usb-gadget-generic-driver-methods.patch
_______________________________________________
parisc-linux mailing list [email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

#17 lore raw

PATCH 11/29 Add ocp_bus_type probe and remove methods

In reply to Russell King
---
 arch/ppc/syslib/ocp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/ppc/syslib/ocp.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/ppc/syslib/ocp.c linux/arch/ppc/syslib/ocp.c
@@ -189,6 +189,8 @@ ocp_device_resume(struct device *dev)
 struct bus_type ocp_bus_type = {
 	.name = "ocp",
 	.match = ocp_device_match,
+	.probe = ocp_driver_probe,
+	.remove = ocp_driver_remove,
 	.suspend = ocp_device_suspend,
 	.resume = ocp_device_resume,
 };
@@ -210,8 +212,6 @@ ocp_register_driver(struct ocp_driver *d
 	/* initialize common driver fields */
 	drv->driver.name = drv->name;
 	drv->driver.bus = &ocp_bus_type;
-	drv->driver.probe = ocp_device_probe;
-	drv->driver.remove = ocp_device_remove;
 
 	/* register with core */
 	return driver_register(&drv->driver);
#18 lore raw

PATCH 12/29 Add sh_bus_type probe and remove methods

In reply to Russell King
---
 arch/sh/kernel/cpu/bus.c |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)
arch/sh/kernel/cpu/bus.c +17 -17
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/sh/kernel/cpu/bus.c linux/arch/sh/kernel/cpu/bus.c
@@ -53,21 +53,6 @@ static int sh_bus_resume(struct device *
 	return 0;
 }
 
-static struct device sh_bus_devices[SH_NR_BUSES] = {
-	{
-		.bus_id		= SH_BUS_NAME_VIRT,
-	},
-};
-
-struct bus_type sh_bus_types[SH_NR_BUSES] = {
-	{
-		.name		= SH_BUS_NAME_VIRT,
-		.match		= sh_bus_match,
-		.suspend	= sh_bus_suspend,
-		.resume		= sh_bus_resume,
-	},
-};
-
 static int sh_device_probe(struct device *dev)
 {
 	struct sh_dev *shdev = to_sh_dev(dev);
@@ -90,6 +75,23 @@ static int sh_device_remove(struct devic
 	return 0;
 }
 
+static struct device sh_bus_devices[SH_NR_BUSES] = {
+	{
+		.bus_id		= SH_BUS_NAME_VIRT,
+	},
+};
+
+struct bus_type sh_bus_types[SH_NR_BUSES] = {
+	{
+		.name		= SH_BUS_NAME_VIRT,
+		.match		= sh_bus_match,
+		.probe		= sh_bus_probe,
+		.remove		= sh_bus_remove,
+		.suspend	= sh_bus_suspend,
+		.resume		= sh_bus_resume,
+	},
+};
+
 int sh_device_register(struct sh_dev *dev)
 {
 	if (!dev)
@@ -133,8 +135,6 @@ int sh_driver_register(struct sh_driver 
 		return -EINVAL;
 	}
 
-	drv->drv.probe  = sh_device_probe;
-	drv->drv.remove = sh_device_remove;
 	drv->drv.bus    = &sh_bus_types[drv->bus_id];
 
 	return driver_register(&drv->drv);
#19 lore raw

PATCH 13/29 Add of_platform_bus_type probe and remove methods

In reply to Russell King
---
 arch/powerpc/kernel/of_device.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/of_device.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/powerpc/kernel/of_device.c linux/arch/powerpc/kernel/of_device.c
@@ -132,6 +132,8 @@ static int of_device_resume(struct devic
 struct bus_type of_platform_bus_type = {
        .name	= "of_platform",
        .match	= of_platform_bus_match,
+       .probe	= of_device_probe,
+       .remove	= of_device_remove,
        .suspend	= of_device_suspend,
        .resume	= of_device_resume,
 };
@@ -150,8 +152,6 @@ int of_register_driver(struct of_platfor
 	/* initialize common driver fields */
 	drv->driver.name = drv->name;
 	drv->driver.bus = &of_platform_bus_type;
-	drv->driver.probe = of_device_probe;
-	drv->driver.remove = of_device_remove;
 
 	/* register with core */
 	count = driver_register(&drv->driver);
#20 lore raw

patch add-of_platform_bus_type-probe-and-remove-methods.patch added to gregkh-2.6 tree

This is a note to let you know that I've just added the patch titled

Subject: [CFT 13/29] Add of_platform_bus_type probe and remove methods

to my gregkh-2.6 tree. Its filename is

add-of_platform_bus_type-probe-and-remove-methods.patch

This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Quoted 1 line

From [email protected] Thu Jan 5 06:37:22 2006

From: Russell King <[email protected]>
CC: Greg K-H <[email protected]>, PowerPC <[email protected]>
Subject: [CFT 13/29] Add of_platform_bus_type probe and remove methods
Date: Thu, 05 Jan 2006 14:36:16 +0000
Message-ID: <[email protected]>

---
 arch/powerpc/kernel/of_device.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/of_device.c +2 -2
@@ -132,6 +132,8 @@ static int of_device_resume(struct devic
 struct bus_type of_platform_bus_type = {
        .name	= "of_platform",
        .match	= of_platform_bus_match,
+       .probe	= of_device_probe,
+       .remove	= of_device_remove,
        .suspend	= of_device_suspend,
        .resume	= of_device_resume,
 };
@@ -150,8 +152,6 @@ int of_register_driver(struct of_platfor
 	/* initialize common driver fields */
 	drv->driver.name = drv->name;
 	drv->driver.bus = &of_platform_bus_type;
-	drv->driver.probe = of_device_probe;
-	drv->driver.remove = of_device_remove;
 
 	/* register with core */
 	count = driver_register(&drv->driver);

Patches currently in gregkh-2.6 which might be from [email protected] are

driver/add-bttv-sub-bus_type-probe-and-remove-methods.patch driver/add-bus_type-probe-remove-shutdown-methods..patch driver/add-ccwgroup_bus_type-probe-and-remove-methods.patch driver/add-dio_bus_type-probe-and-remove-methods.patch driver/add-ecard_bus_type-probe-remove-shutdown-methods.patch driver/add-gameport-bus_type-probe-and-remove-methods.patch driver/add-i2c_bus_type-probe-and-remove-methods.patch driver/add-ide_bus_type-probe-and-remove-methods.patch driver/add-locomo-bus_type-probe-remove-methods.patch driver/add-logic-module-bus_type-probe-remove-methods.patch driver/add-macio_bus_type-probe-and-remove-methods.patch driver/add-mcp-bus_type-probe-and-remove-methods.patch driver/add-mmc_bus_type-probe-and-remove-methods.patch driver/add-ocp_bus_type-probe-and-remove-methods.patch driver/add-of_platform_bus_type-probe-and-remove-methods.patch driver/add-parisc_bus_type-probe-and-remove-methods.patch driver/add-pci_bus_type-probe-and-remove-methods.patch driver/add-pcmcia_bus_type-probe-and-remove-methods.patch driver/add-pnp_bus_type-probe-and-remove-methods.patch driver/add-pseudo-lld-bus_type-probe-and-remove-methods.patch driver/add-rio_bus_type-probe-and-remove-methods.patch driver/add-sa1111-bus_type-probe-remove-methods.patch driver/add-serio-bus_type-probe-and-remove-methods.patch driver/add-sh_bus_type-probe-and-remove-methods.patch driver/add-superhyway_bus_type-probe-and-remove-methods.patch driver/add-tiocx-bus_type-probe-remove-methods.patch driver/add-usb_serial_bus_type-probe-and-remove-methods.patch driver/add-vio_bus_type-probe-and-remove-methods.patch driver/add-zorro_bus_type-probe-and-remove-methods.patch driver/remove-usb-gadget-generic-driver-methods.patch

#21 lore raw

PATCH 14/29 Add vio_bus_type probe and remove methods

In reply to Russell King
---
 arch/powerpc/kernel/vio.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/kernel/vio.c +4 -4
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/arch/powerpc/kernel/vio.c linux/arch/powerpc/kernel/vio.c
@@ -76,7 +76,7 @@ static void vio_bus_shutdown(struct devi
 	struct vio_dev *viodev = to_vio_dev(dev);
 	struct vio_driver *viodrv = to_vio_driver(dev->driver);
 
-	if (viodrv->shutdown)
+	if (dev->driver && viodrv->shutdown)
 		viodrv->shutdown(viodev);
 }
 
@@ -91,9 +91,6 @@ int vio_register_driver(struct vio_drive
 
 	/* fill in 'struct driver' fields */
 	viodrv->driver.bus = &vio_bus_type;
-	viodrv->driver.probe = vio_bus_probe;
-	viodrv->driver.remove = vio_bus_remove;
-	viodrv->driver.shutdown = vio_bus_shutdown;
 
 	return driver_register(&viodrv->driver);
 }
@@ -295,4 +292,7 @@ struct bus_type vio_bus_type = {
 	.name = "vio",
 	.hotplug = vio_hotplug,
 	.match = vio_bus_match,
+	.probe = vio_bus_probe,
+	.remove = vio_bus_remove,
+	.shutdown = vio_bus_shutdown,
 };
#22 lore raw

patch add-vio_bus_type-probe-and-remove-methods.patch added to gregkh-2.6 tree

This is a note to let you know that I've just added the patch titled

Subject: [CFT 14/29] Add vio_bus_type probe and remove methods

to my gregkh-2.6 tree. Its filename is

add-vio_bus_type-probe-and-remove-methods.patch

This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Quoted 1 line

From [email protected] Thu Jan 5 06:37:30 2006

From: Russell King <[email protected]>
CC: Greg K-H <[email protected]>, PPC <[email protected]>
Subject: [CFT 14/29] Add vio_bus_type probe and remove methods
Date: Thu, 05 Jan 2006 14:36:47 +0000
Message-ID: <[email protected]>

---
 arch/powerpc/kernel/vio.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/kernel/vio.c +4 -4
@@ -76,7 +76,7 @@ static void vio_bus_shutdown(struct devi
 	struct vio_dev *viodev = to_vio_dev(dev);
 	struct vio_driver *viodrv = to_vio_driver(dev->driver);
 
-	if (viodrv->shutdown)
+	if (dev->driver && viodrv->shutdown)
 		viodrv->shutdown(viodev);
 }
 
@@ -91,9 +91,6 @@ int vio_register_driver(struct vio_drive
 
 	/* fill in 'struct driver' fields */
 	viodrv->driver.bus = &vio_bus_type;
-	viodrv->driver.probe = vio_bus_probe;
-	viodrv->driver.remove = vio_bus_remove;
-	viodrv->driver.shutdown = vio_bus_shutdown;
 
 	return driver_register(&viodrv->driver);
 }
@@ -295,4 +292,7 @@ struct bus_type vio_bus_type = {
 	.name = "vio",
 	.uevent = vio_hotplug,
 	.match = vio_bus_match,
+	.probe = vio_bus_probe,
+	.remove = vio_bus_remove,
+	.shutdown = vio_bus_shutdown,
 };

Patches currently in gregkh-2.6 which might be from [email protected] are

driver/add-bttv-sub-bus_type-probe-and-remove-methods.patch driver/add-bus_type-probe-remove-shutdown-methods..patch driver/add-ccwgroup_bus_type-probe-and-remove-methods.patch driver/add-dio_bus_type-probe-and-remove-methods.patch driver/add-ecard_bus_type-probe-remove-shutdown-methods.patch driver/add-gameport-bus_type-probe-and-remove-methods.patch driver/add-i2c_bus_type-probe-and-remove-methods.patch driver/add-ide_bus_type-probe-and-remove-methods.patch driver/add-locomo-bus_type-probe-remove-methods.patch driver/add-logic-module-bus_type-probe-remove-methods.patch driver/add-macio_bus_type-probe-and-remove-methods.patch driver/add-mcp-bus_type-probe-and-remove-methods.patch driver/add-mmc_bus_type-probe-and-remove-methods.patch driver/add-ocp_bus_type-probe-and-remove-methods.patch driver/add-of_platform_bus_type-probe-and-remove-methods.patch driver/add-parisc_bus_type-probe-and-remove-methods.patch driver/add-pci_bus_type-probe-and-remove-methods.patch driver/add-pcmcia_bus_type-probe-and-remove-methods.patch driver/add-pnp_bus_type-probe-and-remove-methods.patch driver/add-pseudo-lld-bus_type-probe-and-remove-methods.patch driver/add-rio_bus_type-probe-and-remove-methods.patch driver/add-sa1111-bus_type-probe-remove-methods.patch driver/add-serio-bus_type-probe-and-remove-methods.patch driver/add-sh_bus_type-probe-and-remove-methods.patch driver/add-superhyway_bus_type-probe-and-remove-methods.patch driver/add-tiocx-bus_type-probe-remove-methods.patch driver/add-usb_serial_bus_type-probe-and-remove-methods.patch driver/add-vio_bus_type-probe-and-remove-methods.patch driver/add-zorro_bus_type-probe-and-remove-methods.patch driver/remove-usb-gadget-generic-driver-methods.patch

#23 lore raw

PATCH 15/29 Add dio_bus_type probe and remove methods

In reply to Russell King
---
 drivers/dio/dio-driver.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/dio/dio-driver.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/dio/dio-driver.c linux/drivers/dio/dio-driver.c
@@ -83,7 +83,6 @@ int dio_register_driver(struct dio_drive
 	/* initialize common driver fields */
 	drv->driver.name = drv->name;
 	drv->driver.bus = &dio_bus_type;
-	drv->driver.probe = dio_device_probe;
 
 	/* register with core */
 	count = driver_register(&drv->driver);
@@ -145,7 +144,8 @@ static int dio_bus_match(struct device *
 
 struct bus_type dio_bus_type = {
 	.name	= "dio",
-	.match	= dio_bus_match
+	.match	= dio_bus_match,
+	.probe	= dio_device_probe,
 };
 
 
#24 lore raw

PATCH 16/29 Add i2c_bus_type probe and remove methods

In reply to Russell King
Signed-off-by Russell King <rmk+kernel at arm.linux.org.uk>
---
 drivers/i2c/i2c-core.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
drivers/i2c/i2c-core.c +9 -11
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/i2c/i2c-core.c linux/drivers/i2c/i2c-core.c
@@ -63,13 +63,6 @@ static int i2c_bus_resume(struct device 
 	return rc;
 }
 
-struct bus_type i2c_bus_type = {
-	.name =		"i2c",
-	.match =	i2c_device_match,
-	.suspend =      i2c_bus_suspend,
-	.resume =       i2c_bus_resume,
-};
-
 static int i2c_device_probe(struct device *dev)
 {
 	return -ENODEV;
@@ -80,6 +73,15 @@ static int i2c_device_remove(struct devi
 	return 0;
 }
 
+struct bus_type i2c_bus_type = {
+	.name =		"i2c",
+	.match =	i2c_device_match,
+	.probe =	i2c_device_probe,
+	.remove =	i2c_device_remove,
+	.suspend =      i2c_bus_suspend,
+	.resume =       i2c_bus_resume,
+};
+
 void i2c_adapter_dev_release(struct device *dev)
 {
 	struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
@@ -90,8 +92,6 @@ struct device_driver i2c_adapter_driver 
 	.owner = THIS_MODULE,
 	.name =	"i2c_adapter",
 	.bus = &i2c_bus_type,
-	.probe = i2c_device_probe,
-	.remove = i2c_device_remove,
 };
 
 static void i2c_adapter_class_dev_release(struct class_device *dev)
@@ -298,8 +298,6 @@ int i2c_add_driver(struct i2c_driver *dr
 	driver->driver.owner = driver->owner;
 	driver->driver.name = driver->name;
 	driver->driver.bus = &i2c_bus_type;
-	driver->driver.probe = i2c_device_probe;
-	driver->driver.remove = i2c_device_remove;
 
 	res = driver_register(&driver->driver);
 	if (res)
#25 lore raw

PATCH 17/29 Add gameport bus_type probe and remove methods

In reply to Russell King
---
 drivers/input/gameport/gameport.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
drivers/input/gameport/gameport.c +7 -5
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/input/gameport/gameport.c linux/drivers/input/gameport/gameport.c
@@ -50,9 +50,7 @@ static DECLARE_MUTEX(gameport_sem);
 
 static LIST_HEAD(gameport_list);
 
-static struct bus_type gameport_bus = {
-	.name =	"gameport",
-};
+static struct bus_type gameport_bus;
 
 static void gameport_add_port(struct gameport *gameport);
 static void gameport_destroy_port(struct gameport *gameport);
@@ -703,11 +701,15 @@ static int gameport_driver_remove(struct
 	return 0;
 }
 
+static struct bus_type gameport_bus = {
+	.name =	"gameport",
+	.probe = gameport_driver_probe,
+	.remove = gameport_driver_remove,
+};
+
 void __gameport_register_driver(struct gameport_driver *drv, struct module *owner)
 {
 	drv->driver.bus = &gameport_bus;
-	drv->driver.probe = gameport_driver_probe;
-	drv->driver.remove = gameport_driver_remove;
 	gameport_queue_event(drv, owner, GAMEPORT_REGISTER_DRIVER);
 }
 
#26 lore raw

PATCH 18/29 Add serio bus_type probe and remove methods

In reply to Russell King
---
 drivers/input/serio/serio.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
drivers/input/serio/serio.c +7 -5
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/input/serio/serio.c linux/drivers/input/serio/serio.c
@@ -59,9 +59,7 @@ static DECLARE_MUTEX(serio_sem);
 
 static LIST_HEAD(serio_list);
 
-static struct bus_type serio_bus = {
-	.name =	"serio",
-};
+static struct bus_type serio_bus;
 
 static void serio_add_port(struct serio *serio);
 static void serio_destroy_port(struct serio *serio);
@@ -750,11 +748,15 @@ static int serio_driver_remove(struct de
 	return 0;
 }
 
+static struct bus_type serio_bus = {
+	.name =	"serio",
+	.probe = serio_driver_probe,
+	.remove = serio_driver_remove,
+};
+
 void __serio_register_driver(struct serio_driver *drv, struct module *owner)
 {
 	drv->driver.bus = &serio_bus;
-	drv->driver.probe = serio_driver_probe;
-	drv->driver.remove = serio_driver_remove;
 
 	serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER);
 }
#27 lore raw

PATCH 19/29 Add macio_bus_type probe and remove methods

In reply to Russell King
---
 drivers/macintosh/macio_asic.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/macintosh/macio_asic.c +3 -3
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/macintosh/macio_asic.c linux/drivers/macintosh/macio_asic.c
@@ -204,6 +204,9 @@ struct bus_type macio_bus_type = {
        .name	= "macio",
        .match	= macio_bus_match,
        .hotplug = macio_hotplug,
+       .probe	= macio_device_probe,
+       .remove	= macio_device_remove,
+       .shutdown = macio_device_shutdown,
        .suspend	= macio_device_suspend,
        .resume	= macio_device_resume,
        .dev_attrs = macio_dev_attrs,
@@ -487,9 +490,6 @@ int macio_register_driver(struct macio_d
 	/* initialize common driver fields */
 	drv->driver.name = drv->name;
 	drv->driver.bus = &macio_bus_type;
-	drv->driver.probe = macio_device_probe;
-	drv->driver.remove = macio_device_remove;
-	drv->driver.shutdown = macio_device_shutdown;
 
 	/* register with core */
 	count = driver_register(&drv->driver);
#28 lore raw

patch add-macio_bus_type-probe-and-remove-methods.patch added to gregkh-2.6 tree

This is a note to let you know that I've just added the patch titled

Subject: [CFT 19/29] Add macio_bus_type probe and remove methods

to my gregkh-2.6 tree. Its filename is

add-macio_bus_type-probe-and-remove-methods.patch

This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Quoted 1 line

From [email protected] Thu Jan 5 06:42:59 2006

From: Russell King <[email protected]>
CC: Greg K-H <[email protected]>, MAC <[email protected]>
Subject: [CFT 19/29] Add macio_bus_type probe and remove methods
Date: Thu, 05 Jan 2006 14:39:24 +0000
Message-ID: <[email protected]>

---
 drivers/macintosh/macio_asic.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/macintosh/macio_asic.c +3 -3
@@ -204,6 +204,9 @@ struct bus_type macio_bus_type = {
        .name	= "macio",
        .match	= macio_bus_match,
        .uevent = macio_uevent,
+       .probe	= macio_device_probe,
+       .remove	= macio_device_remove,
+       .shutdown = macio_device_shutdown,
        .suspend	= macio_device_suspend,
        .resume	= macio_device_resume,
        .dev_attrs = macio_dev_attrs,
@@ -487,9 +490,6 @@ int macio_register_driver(struct macio_d
 	/* initialize common driver fields */
 	drv->driver.name = drv->name;
 	drv->driver.bus = &macio_bus_type;
-	drv->driver.probe = macio_device_probe;
-	drv->driver.remove = macio_device_remove;
-	drv->driver.shutdown = macio_device_shutdown;
 
 	/* register with core */
 	count = driver_register(&drv->driver);

Patches currently in gregkh-2.6 which might be from [email protected] are

driver/add-bttv-sub-bus_type-probe-and-remove-methods.patch driver/add-bus_type-probe-remove-shutdown-methods..patch driver/add-ccwgroup_bus_type-probe-and-remove-methods.patch driver/add-dio_bus_type-probe-and-remove-methods.patch driver/add-ecard_bus_type-probe-remove-shutdown-methods.patch driver/add-gameport-bus_type-probe-and-remove-methods.patch driver/add-i2c_bus_type-probe-and-remove-methods.patch driver/add-ide_bus_type-probe-and-remove-methods.patch driver/add-locomo-bus_type-probe-remove-methods.patch driver/add-logic-module-bus_type-probe-remove-methods.patch driver/add-macio_bus_type-probe-and-remove-methods.patch driver/add-mcp-bus_type-probe-and-remove-methods.patch driver/add-mmc_bus_type-probe-and-remove-methods.patch driver/add-ocp_bus_type-probe-and-remove-methods.patch driver/add-of_platform_bus_type-probe-and-remove-methods.patch driver/add-parisc_bus_type-probe-and-remove-methods.patch driver/add-pci_bus_type-probe-and-remove-methods.patch driver/add-pcmcia_bus_type-probe-and-remove-methods.patch driver/add-pnp_bus_type-probe-and-remove-methods.patch driver/add-pseudo-lld-bus_type-probe-and-remove-methods.patch driver/add-rio_bus_type-probe-and-remove-methods.patch driver/add-sa1111-bus_type-probe-remove-methods.patch driver/add-serio-bus_type-probe-and-remove-methods.patch driver/add-sh_bus_type-probe-and-remove-methods.patch driver/add-superhyway_bus_type-probe-and-remove-methods.patch driver/add-tiocx-bus_type-probe-remove-methods.patch driver/add-usb_serial_bus_type-probe-and-remove-methods.patch driver/add-vio_bus_type-probe-and-remove-methods.patch driver/add-zorro_bus_type-probe-and-remove-methods.patch driver/remove-usb-gadget-generic-driver-methods.patch

#29 lore raw

Re: patch add-macio_bus_type-probe-and-remove-methods.patch added to gregkh-2.6 tree

Quoted 6 lines · On Mon, 2006-01-09 at 22:00 -0800, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

Subject: [CFT 19/29] Add macio_bus_type probe and remove methods

to my gregkh-2.6 tree. Its filename is

Quoted 8 lines

add-macio_bus_type-probe-and-remove-methods.patch

This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Quoted 64 lines
---
 drivers/macintosh/macio_asic.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/macintosh/macio_asic.c +3 -3
@@ -204,6 +204,9 @@ struct bus_type macio_bus_type = {
        .name	= "macio",
        .match	= macio_bus_match,
        .uevent = macio_uevent,
+       .probe	= macio_device_probe,
+       .remove	= macio_device_remove,
+       .shutdown = macio_device_shutdown,
        .suspend	= macio_device_suspend,
        .resume	= macio_device_resume,
        .dev_attrs = macio_dev_attrs,
@@ -487,9 +490,6 @@ int macio_register_driver(struct macio_d
 	/* initialize common driver fields */
 	drv->driver.name = drv->name;
 	drv->driver.bus = &macio_bus_type;
-	drv->driver.probe = macio_device_probe;
-	drv->driver.remove = macio_device_remove;
-	drv->driver.shutdown = macio_device_shutdown;
 
 	/* register with core */
 	count = driver_register(&drv->driver);

Patches currently in gregkh-2.6 which might be from [email protected] are

driver/add-bttv-sub-bus_type-probe-and-remove-methods.patch driver/add-bus_type-probe-remove-shutdown-methods..patch driver/add-ccwgroup_bus_type-probe-and-remove-methods.patch driver/add-dio_bus_type-probe-and-remove-methods.patch driver/add-ecard_bus_type-probe-remove-shutdown-methods.patch driver/add-gameport-bus_type-probe-and-remove-methods.patch driver/add-i2c_bus_type-probe-and-remove-methods.patch driver/add-ide_bus_type-probe-and-remove-methods.patch driver/add-locomo-bus_type-probe-remove-methods.patch driver/add-logic-module-bus_type-probe-remove-methods.patch driver/add-macio_bus_type-probe-and-remove-methods.patch driver/add-mcp-bus_type-probe-and-remove-methods.patch driver/add-mmc_bus_type-probe-and-remove-methods.patch driver/add-ocp_bus_type-probe-and-remove-methods.patch driver/add-of_platform_bus_type-probe-and-remove-methods.patch driver/add-parisc_bus_type-probe-and-remove-methods.patch driver/add-pci_bus_type-probe-and-remove-methods.patch driver/add-pcmcia_bus_type-probe-and-remove-methods.patch driver/add-pnp_bus_type-probe-and-remove-methods.patch driver/add-pseudo-lld-bus_type-probe-and-remove-methods.patch driver/add-rio_bus_type-probe-and-remove-methods.patch driver/add-sa1111-bus_type-probe-remove-methods.patch driver/add-serio-bus_type-probe-and-remove-methods.patch driver/add-sh_bus_type-probe-and-remove-methods.patch driver/add-superhyway_bus_type-probe-and-remove-methods.patch driver/add-tiocx-bus_type-probe-remove-methods.patch driver/add-usb_serial_bus_type-probe-and-remove-methods.patch driver/add-vio_bus_type-probe-and-remove-methods.patch driver/add-zorro_bus_type-probe-and-remove-methods.patch driver/remove-usb-gadget-generic-driver-methods.patch
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#30 lore raw

PATCH 20/29 Add MCP bus_type probe and remove methods

In reply to Russell King
---
 drivers/mfd/mcp-core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/mcp-core.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/mfd/mcp-core.c linux/drivers/mfd/mcp-core.c
@@ -77,6 +77,8 @@ static int mcp_bus_resume(struct device 
 static struct bus_type mcp_bus_type = {
 	.name		= "mcp",
 	.match		= mcp_bus_match,
+	.probe		= mcp_bus_probe,
+	.remove		= mcp_bus_remove,
 	.suspend	= mcp_bus_suspend,
 	.resume		= mcp_bus_resume,
 };
@@ -227,8 +229,6 @@ EXPORT_SYMBOL(mcp_host_unregister);
 int mcp_driver_register(struct mcp_driver *mcpdrv)
 {
 	mcpdrv->drv.bus = &mcp_bus_type;
-	mcpdrv->drv.probe = mcp_bus_probe;
-	mcpdrv->drv.remove = mcp_bus_remove;
 	return driver_register(&mcpdrv->drv);
 }
 EXPORT_SYMBOL(mcp_driver_register);
#31 lore raw

PATCH 21/29 Add mmc_bus_type probe and remove methods

In reply to Russell King
---
 drivers/mmc/mmc_sysfs.c |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)
drivers/mmc/mmc_sysfs.c +12 -14
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/mmc/mmc_sysfs.c linux/drivers/mmc/mmc_sysfs.c
@@ -136,17 +136,7 @@ static int mmc_bus_resume(struct device 
 	return ret;
 }
 
-static struct bus_type mmc_bus_type = {
-	.name		= "mmc",
-	.dev_attrs	= mmc_dev_attrs,
-	.match		= mmc_bus_match,
-	.hotplug	= mmc_bus_hotplug,
-	.suspend	= mmc_bus_suspend,
-	.resume		= mmc_bus_resume,
-};
-
-
-static int mmc_drv_probe(struct device *dev)
+static int mmc_bus_probe(struct device *dev)
 {
 	struct mmc_driver *drv = to_mmc_driver(dev->driver);
 	struct mmc_card *card = dev_to_mmc_card(dev);
@@ -154,7 +144,7 @@ static int mmc_drv_probe(struct device *
 	return drv->probe(card);
 }
 
-static int mmc_drv_remove(struct device *dev)
+static int mmc_bus_remove(struct device *dev)
 {
 	struct mmc_driver *drv = to_mmc_driver(dev->driver);
 	struct mmc_card *card = dev_to_mmc_card(dev);
@@ -164,6 +154,16 @@ static int mmc_drv_remove(struct device 
 	return 0;
 }
 
+static struct bus_type mmc_bus_type = {
+	.name		= "mmc",
+	.dev_attrs	= mmc_dev_attrs,
+	.match		= mmc_bus_match,
+	.hotplug	= mmc_bus_hotplug,
+	.probe		= mmc_bus_probe,
+	.remove		= mmc_bus_remove,
+	.suspend	= mmc_bus_suspend,
+	.resume		= mmc_bus_resume,
+};
 
 /**
  *	mmc_register_driver - register a media driver
@@ -172,8 +172,6 @@ static int mmc_drv_remove(struct device 
 int mmc_register_driver(struct mmc_driver *drv)
 {
 	drv->drv.bus = &mmc_bus_type;
-	drv->drv.probe = mmc_drv_probe;
-	drv->drv.remove = mmc_drv_remove;
 	return driver_register(&drv->drv);
 }
 
#32 lore raw

PATCH 22/29 Add pcmcia_bus_type probe and remove methods

In reply to Russell King
---
 drivers/pcmcia/ds.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/pcmcia/ds.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/pcmcia/ds.c linux/drivers/pcmcia/ds.c
@@ -315,8 +315,6 @@ int pcmcia_register_driver(struct pcmcia
 	/* initialize common fields */
 	driver->drv.bus = &pcmcia_bus_type;
 	driver->drv.owner = driver->owner;
-	driver->drv.probe = pcmcia_device_probe;
-	driver->drv.remove = pcmcia_device_remove;
 
 	return driver_register(&driver->drv);
 }
@@ -1226,6 +1224,8 @@ struct bus_type pcmcia_bus_type = {
 	.hotplug = pcmcia_bus_hotplug,
 	.match = pcmcia_bus_match,
 	.dev_attrs = pcmcia_dev_attrs,
+	.probe = pcmcia_device_probe,
+	.remove = pcmcia_device_remove,
 };
 
 
#33 lore raw

PATCH 23/29 Add pnp_bus_type probe and remove methods

In reply to Russell King
---
 drivers/pnp/driver.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/pnp/driver.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/pnp/driver.c linux/drivers/pnp/driver.c
@@ -150,6 +150,8 @@ static int pnp_bus_match(struct device *
 struct bus_type pnp_bus_type = {
 	.name	= "pnp",
 	.match	= pnp_bus_match,
+	.probe	= pnp_device_probe,
+	.remove	= pnp_device_remove,
 };
 
 
@@ -168,8 +170,6 @@ int pnp_register_driver(struct pnp_drive
 
 	drv->driver.name = drv->name;
 	drv->driver.bus = &pnp_bus_type;
-	drv->driver.probe = pnp_device_probe;
-	drv->driver.remove = pnp_device_remove;
 
 	count = driver_register(&drv->driver);
 
#34 lore raw

PATCH 24/29 Add ccwgroup_bus_type probe and remove methods

In reply to Russell King
---
 drivers/s390/cio/ccwgroup.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
drivers/s390/cio/ccwgroup.c +9 -7
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/s390/cio/ccwgroup.c linux/drivers/s390/cio/ccwgroup.c
@@ -52,11 +52,7 @@ ccwgroup_hotplug (struct device *dev, ch
 	return 0;
 }
 
-static struct bus_type ccwgroup_bus_type = {
-	.name    = "ccwgroup",
-	.match   = ccwgroup_bus_match,
-	.hotplug = ccwgroup_hotplug,
-};
+static struct bus_type ccwgroup_bus_type;
 
 static inline void
 __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev)
@@ -389,6 +385,14 @@ ccwgroup_remove (struct device *dev)
 	return 0;
 }
 
+static struct bus_type ccwgroup_bus_type = {
+	.name    = "ccwgroup",
+	.match   = ccwgroup_bus_match,
+	.hotplug = ccwgroup_hotplug,
+	.probe   = ccwgroup_probe,
+	.remove  = ccwgroup_remove,
+};
+
 int
 ccwgroup_driver_register (struct ccwgroup_driver *cdriver)
 {
@@ -396,8 +400,6 @@ ccwgroup_driver_register (struct ccwgrou
 	cdriver->driver = (struct device_driver) {
 		.bus = &ccwgroup_bus_type,
 		.name = cdriver->name,
-		.probe = ccwgroup_probe,
-		.remove = ccwgroup_remove,
 	};
 
 	return driver_register(&cdriver->driver);
#35 lore raw

PATCH 25/29 Add superhyway_bus_type probe and remove methods

In reply to Russell King
---
 drivers/sh/superhyway/superhyway.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/sh/superhyway/superhyway.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/sh/superhyway/superhyway.c linux/drivers/sh/superhyway/superhyway.c
@@ -175,8 +175,6 @@ int superhyway_register_driver(struct su
 {
 	drv->drv.name	= drv->name;
 	drv->drv.bus	= &superhyway_bus_type;
-	drv->drv.probe	= superhyway_device_probe;
-	drv->drv.remove	= superhyway_device_remove;
 
 	return driver_register(&drv->drv);
 }
@@ -213,6 +211,8 @@ struct bus_type superhyway_bus_type = {
 #ifdef CONFIG_SYSFS
 	.dev_attrs	= superhyway_dev_attrs,
 #endif
+	.probe		= superhyway_device_probe,
+	.remove		= superhyway_device_remove,
 };
 
 static int __init superhyway_bus_init(void)
#36 lore raw

PATCH 26/29 Add usb_serial_bus_type probe and remove methods

In reply to Russell King
---
 drivers/usb/serial/bus.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
drivers/usb/serial/bus.c +7 -8
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/usb/serial/bus.c linux/drivers/usb/serial/bus.c
@@ -37,11 +37,6 @@ static int usb_serial_device_match (stru
 	return 0;
 }
 
-struct bus_type usb_serial_bus_type = {
-	.name =		"usb-serial",
-	.match =	usb_serial_device_match,
-};
-
 static int usb_serial_device_probe (struct device *dev)
 {
 	struct usb_serial_driver *driver;
@@ -109,14 +104,18 @@ exit:
 	return retval;
 }
 
+struct bus_type usb_serial_bus_type = {
+	.name =		"usb-serial",
+	.match =	usb_serial_device_match,
+	.probe =	usb_serial_device_probe,
+	.remove =	usb_serial_device_remove,
+};
+
 int usb_serial_bus_register(struct usb_serial_driver *driver)
 {
 	int retval;
 
 	driver->driver.bus = &usb_serial_bus_type;
-	driver->driver.probe = usb_serial_device_probe;
-	driver->driver.remove = usb_serial_device_remove;
-
 	retval = driver_register(&driver->driver);
 
 	return retval;
#37 lore raw

PATCH 27/29 Add zorro_bus_type probe and remove methods

In reply to Russell King
---
 drivers/zorro/zorro-driver.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/zorro/zorro-driver.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/zorro/zorro-driver.c linux/drivers/zorro/zorro-driver.c
@@ -77,7 +77,6 @@ int zorro_register_driver(struct zorro_d
 	/* initialize common driver fields */
 	drv->driver.name = drv->name;
 	drv->driver.bus = &zorro_bus_type;
-	drv->driver.probe = zorro_device_probe;
 
 	/* register with core */
 	count = driver_register(&drv->driver);
@@ -132,7 +131,8 @@ static int zorro_bus_match(struct device
 
 struct bus_type zorro_bus_type = {
 	.name	= "zorro",
-	.match	= zorro_bus_match
+	.match	= zorro_bus_match,
+	.probe	= zorro_device_probe,
 };
 
 
#38 lore raw

PATCH 28/29 Add rio_bus_type probe and remove methods

In reply to Russell King
---
 drivers/rapidio/rio-driver.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/rapidio/rio-driver.c +3 -3
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/rapidio/rio-driver.c linux/drivers/rapidio/rio-driver.c
@@ -147,8 +147,6 @@ int rio_register_driver(struct rio_drive
 	/* initialize common driver fields */
 	rdrv->driver.name = rdrv->name;
 	rdrv->driver.bus = &rio_bus_type;
-	rdrv->driver.probe = rio_device_probe;
-	rdrv->driver.remove = rio_device_remove;
 
 	/* register with core */
 	return driver_register(&rdrv->driver);
@@ -204,7 +202,9 @@ static struct device rio_bus = {
 struct bus_type rio_bus_type = {
 	.name = "rapidio",
 	.match = rio_match_bus,
-	.dev_attrs = rio_dev_attrs
+	.dev_attrs = rio_dev_attrs,
+	.probe = rio_device_probe,
+	.remove = rio_device_remove,
 };
 
 /**
#39 lore raw

PATCH 29/29 Add Pseudo LLD bus_type probe and remove methods

In reply to Russell King
---
 drivers/scsi/scsi_debug.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/scsi_debug.c +2 -2
diff -up -x BitKeeper -x ChangeSet -x SCCS -x _xlk -x *.orig -x *.rej -x .git linus/drivers/scsi/scsi_debug.c linux/drivers/scsi/scsi_debug.c
@@ -221,8 +221,6 @@ static struct bus_type pseudo_lld_bus;
 static struct device_driver sdebug_driverfs_driver = {
 	.name 		= sdebug_proc_name,
 	.bus		= &pseudo_lld_bus,
-	.probe          = sdebug_driver_probe,
-	.remove         = sdebug_driver_remove,
 };
 
 static const int check_condition_result =
@@ -1796,6 +1794,8 @@ static int pseudo_lld_bus_match(struct d
 static struct bus_type pseudo_lld_bus = {
         .name = "pseudo",
         .match = pseudo_lld_bus_match,
+	.probe = sdebug_driver_probe,
+	.remove = sdebug_driver_remove,
 };
 
 static void sdebug_release_adapter(struct device * dev)
#40 lore raw

patch add-pseudo-lld-bus_type-probe-and-remove-methods.patch added to gregkh-2.6 tree

This is a note to let you know that I've just added the patch titled

Subject: [CFT 29/29] Add Pseudo LLD bus_type probe and remove methods

to my gregkh-2.6 tree. Its filename is

add-pseudo-lld-bus_type-probe-and-remove-methods.patch

This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Quoted 1 line

From [email protected] Thu Jan 5 06:49:11 2006

From: Russell King <[email protected]>
CC: Greg K-H <[email protected]>, SCSI <[email protected]>
Subject: [CFT 29/29] Add Pseudo LLD bus_type probe and remove methods
Date: Thu, 05 Jan 2006 14:44:46 +0000
Message-ID: <[email protected]>

---
 drivers/scsi/scsi_debug.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/scsi_debug.c +2 -2
@@ -221,8 +221,6 @@ static struct bus_type pseudo_lld_bus;
 static struct device_driver sdebug_driverfs_driver = {
 	.name 		= sdebug_proc_name,
 	.bus		= &pseudo_lld_bus,
-	.probe          = sdebug_driver_probe,
-	.remove         = sdebug_driver_remove,
 };
 
 static const int check_condition_result =
@@ -1796,6 +1794,8 @@ static int pseudo_lld_bus_match(struct d
 static struct bus_type pseudo_lld_bus = {
         .name = "pseudo",
         .match = pseudo_lld_bus_match,
+	.probe = sdebug_driver_probe,
+	.remove = sdebug_driver_remove,
 };
 
 static void sdebug_release_adapter(struct device * dev)

Patches currently in gregkh-2.6 which might be from [email protected] are

driver/add-bttv-sub-bus_type-probe-and-remove-methods.patch driver/add-bus_type-probe-remove-shutdown-methods..patch driver/add-ccwgroup_bus_type-probe-and-remove-methods.patch driver/add-dio_bus_type-probe-and-remove-methods.patch driver/add-ecard_bus_type-probe-remove-shutdown-methods.patch driver/add-gameport-bus_type-probe-and-remove-methods.patch driver/add-i2c_bus_type-probe-and-remove-methods.patch driver/add-ide_bus_type-probe-and-remove-methods.patch driver/add-locomo-bus_type-probe-remove-methods.patch driver/add-logic-module-bus_type-probe-remove-methods.patch driver/add-macio_bus_type-probe-and-remove-methods.patch driver/add-mcp-bus_type-probe-and-remove-methods.patch driver/add-mmc_bus_type-probe-and-remove-methods.patch driver/add-ocp_bus_type-probe-and-remove-methods.patch driver/add-of_platform_bus_type-probe-and-remove-methods.patch driver/add-parisc_bus_type-probe-and-remove-methods.patch driver/add-pci_bus_type-probe-and-remove-methods.patch driver/add-pcmcia_bus_type-probe-and-remove-methods.patch driver/add-pnp_bus_type-probe-and-remove-methods.patch driver/add-pseudo-lld-bus_type-probe-and-remove-methods.patch driver/add-rio_bus_type-probe-and-remove-methods.patch driver/add-sa1111-bus_type-probe-remove-methods.patch driver/add-serio-bus_type-probe-and-remove-methods.patch driver/add-sh_bus_type-probe-and-remove-methods.patch driver/add-superhyway_bus_type-probe-and-remove-methods.patch driver/add-tiocx-bus_type-probe-remove-methods.patch driver/add-usb_serial_bus_type-probe-and-remove-methods.patch driver/add-vio_bus_type-probe-and-remove-methods.patch driver/add-zorro_bus_type-probe-and-remove-methods.patch driver/remove-usb-gadget-generic-driver-methods.patch

#41 lore raw
In reply to Russell King
Quoted 11 lines · Russell King

Add bus_type probe, remove and shutdown methods to replace the corresponding methods in struct device_driver. This matches the way we handle the suspend/resume methods.

Since the bus methods override the device_driver methods, warn if a device driver is registered whose methods will not be called.

The long-term idea is to remove the device_driver methods entirely.

All of this looks good to me, want me to add them to my tree and forward it on to Linus?

thanks for doing this work, I really appreciate it.

greg k-h

#42 lore raw
Quoted 9 lines · Greg KH
Quoted 8 lines · Russell King

Add bus_type probe, remove and shutdown methods to replace the corresponding methods in struct device_driver. This matches the way we handle the suspend/resume methods.

Since the bus methods override the device_driver methods, warn if a device driver is registered whose methods will not be called.

Quoted 6 lines
Quoted 3 lines

The long-term idea is to remove the device_driver methods entirely.

All of this looks good to me, want me to add them to my tree and forward it on to Linus?

As far as forwarding to Linus, not sure about that yet - I suspect these patches may cause akpm some reject grief since they're fairly wide-spread over the kernel. If akpm prefers the small patches instead of one large one, it may make sense for it to go via akpm.

I don't have a preference myself - it's whatever's easiest for others.

Quoted 1 line

thanks for doing this work, I really appreciate it.

Obviously, there's still more to come when I get a round tuit, but this should provide sufficient infrastructure to allow folk to move over the remaining areas if I don't get there first. ISTR SCSI requires a bit of work.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#43 lore raw
Quoted 14 lines · Russell King
Quoted 13 lines · Greg KH
Quoted 11 lines · Russell King

Add bus_type probe, remove and shutdown methods to replace the corresponding methods in struct device_driver. This matches the way we handle the suspend/resume methods.

Since the bus methods override the device_driver methods, warn if a device driver is registered whose methods will not be called.

The long-term idea is to remove the device_driver methods entirely.

Quoted 7 lines
Quoted 2 lines

All of this looks good to me, want me to add them to my tree and forward it on to Linus?

As far as forwarding to Linus, not sure about that yet - I suspect these patches may cause akpm some reject grief since they're fairly wide-spread over the kernel. If akpm prefers the small patches instead of one large one, it may make sense for it to go via akpm.

Bah, rejects are something that akpm eats for lunch, we have good tools to handle this now :)

Quoted 1 line

I don't have a preference myself - it's whatever's easiest for others.

I'll add this to my tree, which will end up in -mm and forward to Linus in a bit, after some sanity build tests.

Quoted 6 lines
Quoted 1 line

thanks for doing this work, I really appreciate it.

Obviously, there's still more to come when I get a round tuit, but this should provide sufficient infrastructure to allow folk to move over the remaining areas if I don't get there first. ISTR SCSI requires a bit of work.

I'll poke at the remainders when I get a chance, the kernel log messages should cause others to perk up and notice and possibly help out too :)

thanks,

greg k-h

#44 lore raw

PATCH 1/3 Add ide_bus_type probe and remove methods

In reply to Russell King

(This is an additional patch - on lkml, see
"[CFT 1/29] Add bus_type probe, remove, shutdown methods.")

---
 drivers/ide/ide-cd.c     |   14 +++++---------
 drivers/ide/ide-disk.c   |   22 ++++++++--------------
 drivers/ide/ide-floppy.c |   14 +++++---------
 drivers/ide/ide-tape.c   |   18 +++++++-----------
 drivers/ide/ide.c        |   31 +++++++++++++++++++++++++++++++
 include/linux/ide.h      |    5 +++++
 6 files changed, 61 insertions(+), 43 deletions(-)
drivers/ide/ide-cd.c +5 -9
@@ -3264,9 +3264,8 @@ sector_t ide_cdrom_capacity (ide_drive_t
 }
 #endif
 
-static int ide_cd_remove(struct device *dev)
+static void ide_cd_remove(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	struct cdrom_info *info = drive->driver_data;
 
 	ide_unregister_subdriver(drive, info->driver);
@@ -3274,8 +3273,6 @@ static int ide_cd_remove(struct device *
 	del_gendisk(info->disk);
 
 	ide_cd_put(info);
-
-	return 0;
 }
 
 static void ide_cd_release(struct kref *kref)
@@ -3299,7 +3296,7 @@ static void ide_cd_release(struct kref *
 	kfree(info);
 }
 
-static int ide_cd_probe(struct device *);
+static int ide_cd_probe(ide_drive_t *);
 
 #ifdef CONFIG_PROC_FS
 static int proc_idecd_read_capacity
@@ -3325,9 +3322,9 @@ static ide_driver_t ide_cdrom_driver = {
 		.owner		= THIS_MODULE,
 		.name		= "ide-cdrom",
 		.bus		= &ide_bus_type,
-		.probe		= ide_cd_probe,
-		.remove		= ide_cd_remove,
 	},
+	.probe			= ide_cd_probe,
+	.remove			= ide_cd_remove,
 	.version		= IDECD_VERSION,
 	.media			= ide_cdrom,
 	.supports_dsc_overlap	= 1,
@@ -3421,9 +3418,8 @@ static char *ignore = NULL;
 module_param(ignore, charp, 0400);
 MODULE_DESCRIPTION("ATAPI CD-ROM Driver");
 
-static int ide_cd_probe(struct device *dev)
+static int ide_cd_probe(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	struct cdrom_info *info;
 	struct gendisk *g;
 	struct request_sense sense;
drivers/ide/ide-disk.c +8 -14
@@ -1028,9 +1028,8 @@ static void ide_cacheflush_p(ide_drive_t
 		printk(KERN_INFO "%s: wcache flush failed!\n", drive->name);
 }
 
-static int ide_disk_remove(struct device *dev)
+static void ide_disk_remove(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	struct ide_disk_obj *idkp = drive->driver_data;
 	struct gendisk *g = idkp->disk;
 
@@ -1041,8 +1040,6 @@ static int ide_disk_remove(struct device
 	ide_cacheflush_p(drive);
 
 	ide_disk_put(idkp);
-
-	return 0;
 }
 
 static void ide_disk_release(struct kref *kref)
@@ -1058,12 +1055,10 @@ static void ide_disk_release(struct kref
 	kfree(idkp);
 }
 
-static int ide_disk_probe(struct device *dev);
+static int ide_disk_probe(ide_drive_t *drive);
 
-static void ide_device_shutdown(struct device *dev)
+static void ide_device_shutdown(ide_drive_t *drive)
 {
-	ide_drive_t *drive = container_of(dev, ide_drive_t, gendev);
-
 #ifdef	CONFIG_ALPHA
 	/* On Alpha, halt(8) doesn't actually turn the machine off,
 	   it puts you into the sort of firmware monitor. Typically,
@@ -1085,7 +1080,7 @@ static void ide_device_shutdown(struct d
 	}
 
 	printk("Shutdown: %s\n", drive->name);
-	dev->bus->suspend(dev, PMSG_SUSPEND);
+	drive->gendev.bus->suspend(&drive->gendev, PMSG_SUSPEND);
 }
 
 static ide_driver_t idedisk_driver = {
@@ -1093,10 +1088,10 @@ static ide_driver_t idedisk_driver = {
 		.owner		= THIS_MODULE,
 		.name		= "ide-disk",
 		.bus		= &ide_bus_type,
-		.probe		= ide_disk_probe,
-		.remove		= ide_disk_remove,
-		.shutdown	= ide_device_shutdown,
 	},
+	.probe			= ide_disk_probe,
+	.remove			= ide_disk_remove,
+	.shutdown		= ide_device_shutdown,
 	.version		= IDEDISK_VERSION,
 	.media			= ide_disk,
 	.supports_dsc_overlap	= 0,
@@ -1201,9 +1196,8 @@ static struct block_device_operations id
 
 MODULE_DESCRIPTION("ATA DISK Driver");
 
-static int ide_disk_probe(struct device *dev)
+static int ide_disk_probe(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	struct ide_disk_obj *idkp;
 	struct gendisk *g;
 
drivers/ide/ide-floppy.c +5 -9
@@ -1871,9 +1871,8 @@ static void idefloppy_setup (ide_drive_t
 	idefloppy_add_settings(drive);
 }
 
-static int ide_floppy_remove(struct device *dev)
+static void ide_floppy_remove(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	idefloppy_floppy_t *floppy = drive->driver_data;
 	struct gendisk *g = floppy->disk;
 
@@ -1882,8 +1881,6 @@ static int ide_floppy_remove(struct devi
 	del_gendisk(g);
 
 	ide_floppy_put(floppy);
-
-	return 0;
 }
 
 static void ide_floppy_release(struct kref *kref)
@@ -1922,16 +1919,16 @@ static ide_proc_entry_t idefloppy_proc[]
 
 #endif	/* CONFIG_PROC_FS */
 
-static int ide_floppy_probe(struct device *);
+static int ide_floppy_probe(ide_drive_t *);
 
 static ide_driver_t idefloppy_driver = {
 	.gen_driver = {
 		.owner		= THIS_MODULE,
 		.name		= "ide-floppy",
 		.bus		= &ide_bus_type,
-		.probe		= ide_floppy_probe,
-		.remove		= ide_floppy_remove,
 	},
+	.probe			= ide_floppy_probe,
+	.remove			= ide_floppy_remove,
 	.version		= IDEFLOPPY_VERSION,
 	.media			= ide_floppy,
 	.supports_dsc_overlap	= 0,
@@ -2124,9 +2121,8 @@ static struct block_device_operations id
 	.revalidate_disk= idefloppy_revalidate_disk
 };
 
-static int ide_floppy_probe(struct device *dev)
+static int ide_floppy_probe(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	idefloppy_floppy_t *floppy;
 	struct gendisk *g;
 
drivers/ide/ide-tape.c +7 -11
@@ -4682,9 +4682,8 @@ static void idetape_setup (ide_drive_t *
 	idetape_add_settings(drive);
 }
 
-static int ide_tape_remove(struct device *dev)
+static void ide_tape_remove(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	idetape_tape_t *tape = drive->driver_data;
 
 	ide_unregister_subdriver(drive, tape->driver);
@@ -4692,8 +4691,6 @@ static int ide_tape_remove(struct device
 	ide_unregister_region(tape->disk);
 
 	ide_tape_put(tape);
-
-	return 0;
 }
 
 static void ide_tape_release(struct kref *kref)
@@ -4745,16 +4742,16 @@ static ide_proc_entry_t idetape_proc[] =
 
 #endif
 
-static int ide_tape_probe(struct device *);
+static int ide_tape_probe(ide_drive_t *);
 
 static ide_driver_t idetape_driver = {
 	.gen_driver = {
 		.owner		= THIS_MODULE,
 		.name		= "ide-tape",
 		.bus		= &ide_bus_type,
-		.probe		= ide_tape_probe,
-		.remove		= ide_tape_remove,
 	},
+	.probe			= ide_tape_probe,
+	.remove			= ide_tape_remove,
 	.version		= IDETAPE_VERSION,
 	.media			= ide_tape,
 	.supports_dsc_overlap 	= 1,
@@ -4825,9 +4822,8 @@ static struct block_device_operations id
 	.ioctl		= idetape_ioctl,
 };
 
-static int ide_tape_probe(struct device *dev)
+static int ide_tape_probe(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	idetape_tape_t *tape;
 	struct gendisk *g;
 	int minor;
@@ -4883,9 +4879,9 @@ static int ide_tape_probe(struct device 
 	idetape_setup(drive, tape, minor);
 
 	class_device_create(idetape_sysfs_class, NULL,
-			MKDEV(IDETAPE_MAJOR, minor), dev, "%s", tape->name);
+			MKDEV(IDETAPE_MAJOR, minor), &drive->gendev, "%s", tape->name);
 	class_device_create(idetape_sysfs_class, NULL,
-			MKDEV(IDETAPE_MAJOR, minor + 128), dev, "n%s", tape->name);
+			MKDEV(IDETAPE_MAJOR, minor + 128), &drive->gendev, "n%s", tape->name);
 
 	devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor),
 			S_IFCHR | S_IRUGO | S_IWUGO,
drivers/ide/ide.c +31 -0
@@ -1904,9 +1904,40 @@ static int ide_bus_match(struct device *
 	return 1;
 }
 
+static int generic_ide_probe(struct device *dev)
+{
+	ide_drive_t *drive = to_ide_device(dev);
+	ide_driver_t *drv = to_ide_driver(dev->driver);
+
+	return drv->probe ? drv->probe(drive) : -ENODEV;
+}
+
+static int generic_ide_remove(struct device *dev)
+{
+	ide_drive_t *drive = to_ide_device(dev);
+	ide_driver_t *drv = to_ide_driver(dev->driver);
+
+	if (drv->remove)
+		drv->remove(drive);
+
+	return 0;
+}
+
+static void generic_ide_shutdown(struct device *dev)
+{
+	ide_drive_t *drive = to_ide_device(dev);
+	ide_driver_t *drv = to_ide_driver(dev->driver);
+
+	if (dev->driver && drv->shutdown)
+		drv->shutdown(drive);
+}
+
 struct bus_type ide_bus_type = {
 	.name		= "ide",
 	.match		= ide_bus_match,
+	.probe		= generic_ide_probe,
+	.remove		= generic_ide_remove,
+	.shutdown	= generic_ide_shutdown,
 	.suspend	= generic_ide_suspend,
 	.resume		= generic_ide_resume,
 };
include/linux/ide.h +5 -0
@@ -982,8 +982,13 @@ typedef struct ide_driver_s {
 	ide_startstop_t	(*abort)(ide_drive_t *, struct request *rq);
 	ide_proc_entry_t	*proc;
 	struct device_driver	gen_driver;
+	int		(*probe)(ide_drive_t *);
+	void		(*remove)(ide_drive_t *);
+	void		(*shutdown)(ide_drive_t *);
 } ide_driver_t;
 
+#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
+
 int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long);
 
 /*
#45 lore raw

patch add-ide_bus_type-probe-and-remove-methods.patch added to gregkh-2.6 tree

This is a note to let you know that I've just added the patch titled

Subject: [CFT 1/3] Add ide_bus_type probe and remove methods

to my gregkh-2.6 tree. Its filename is

add-ide_bus_type-probe-and-remove-methods.patch

This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/

Quoted 1 line

From [email protected] Fri Jan 6 03:42:40 2006

From: Russell King <[email protected]>
CC: Greg K-H <[email protected]>, IDE <[email protected]>
Subject: [CFT 1/3] Add ide_bus_type probe and remove methods
Date: Fri, 06 Jan 2006 11:41:00 +0000
Message-ID: <[email protected]>

---
 drivers/ide/ide-cd.c     |   14 +++++---------
 drivers/ide/ide-disk.c   |   22 ++++++++--------------
 drivers/ide/ide-floppy.c |   14 +++++---------
 drivers/ide/ide-tape.c   |   18 +++++++-----------
 drivers/ide/ide.c        |   31 +++++++++++++++++++++++++++++++
 include/linux/ide.h      |    5 +++++
 6 files changed, 61 insertions(+), 43 deletions(-)
drivers/ide/ide-cd.c +5 -9
@@ -3264,9 +3264,8 @@ sector_t ide_cdrom_capacity (ide_drive_t
 }
 #endif
 
-static int ide_cd_remove(struct device *dev)
+static void ide_cd_remove(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	struct cdrom_info *info = drive->driver_data;
 
 	ide_unregister_subdriver(drive, info->driver);
@@ -3274,8 +3273,6 @@ static int ide_cd_remove(struct device *
 	del_gendisk(info->disk);
 
 	ide_cd_put(info);
-
-	return 0;
 }
 
 static void ide_cd_release(struct kref *kref)
@@ -3299,7 +3296,7 @@ static void ide_cd_release(struct kref *
 	kfree(info);
 }
 
-static int ide_cd_probe(struct device *);
+static int ide_cd_probe(ide_drive_t *);
 
 #ifdef CONFIG_PROC_FS
 static int proc_idecd_read_capacity
@@ -3325,9 +3322,9 @@ static ide_driver_t ide_cdrom_driver = {
 		.owner		= THIS_MODULE,
 		.name		= "ide-cdrom",
 		.bus		= &ide_bus_type,
-		.probe		= ide_cd_probe,
-		.remove		= ide_cd_remove,
 	},
+	.probe			= ide_cd_probe,
+	.remove			= ide_cd_remove,
 	.version		= IDECD_VERSION,
 	.media			= ide_cdrom,
 	.supports_dsc_overlap	= 1,
@@ -3421,9 +3418,8 @@ static char *ignore = NULL;
 module_param(ignore, charp, 0400);
 MODULE_DESCRIPTION("ATAPI CD-ROM Driver");
 
-static int ide_cd_probe(struct device *dev)
+static int ide_cd_probe(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	struct cdrom_info *info;
 	struct gendisk *g;
 	struct request_sense sense;
drivers/ide/ide-disk.c +8 -14
@@ -997,9 +997,8 @@ static void ide_cacheflush_p(ide_drive_t
 		printk(KERN_INFO "%s: wcache flush failed!\n", drive->name);
 }
 
-static int ide_disk_remove(struct device *dev)
+static void ide_disk_remove(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	struct ide_disk_obj *idkp = drive->driver_data;
 	struct gendisk *g = idkp->disk;
 
@@ -1010,8 +1009,6 @@ static int ide_disk_remove(struct device
 	ide_cacheflush_p(drive);
 
 	ide_disk_put(idkp);
-
-	return 0;
 }
 
 static void ide_disk_release(struct kref *kref)
@@ -1027,12 +1024,10 @@ static void ide_disk_release(struct kref
 	kfree(idkp);
 }
 
-static int ide_disk_probe(struct device *dev);
+static int ide_disk_probe(ide_drive_t *drive);
 
-static void ide_device_shutdown(struct device *dev)
+static void ide_device_shutdown(ide_drive_t *drive)
 {
-	ide_drive_t *drive = container_of(dev, ide_drive_t, gendev);
-
 #ifdef	CONFIG_ALPHA
 	/* On Alpha, halt(8) doesn't actually turn the machine off,
 	   it puts you into the sort of firmware monitor. Typically,
@@ -1054,7 +1049,7 @@ static void ide_device_shutdown(struct d
 	}
 
 	printk("Shutdown: %s\n", drive->name);
-	dev->bus->suspend(dev, PMSG_SUSPEND);
+	drive->gendev.bus->suspend(&drive->gendev, PMSG_SUSPEND);
 }
 
 static ide_driver_t idedisk_driver = {
@@ -1062,10 +1057,10 @@ static ide_driver_t idedisk_driver = {
 		.owner		= THIS_MODULE,
 		.name		= "ide-disk",
 		.bus		= &ide_bus_type,
-		.probe		= ide_disk_probe,
-		.remove		= ide_disk_remove,
-		.shutdown	= ide_device_shutdown,
 	},
+	.probe			= ide_disk_probe,
+	.remove			= ide_disk_remove,
+	.shutdown		= ide_device_shutdown,
 	.version		= IDEDISK_VERSION,
 	.media			= ide_disk,
 	.supports_dsc_overlap	= 0,
@@ -1182,9 +1177,8 @@ static struct block_device_operations id
 
 MODULE_DESCRIPTION("ATA DISK Driver");
 
-static int ide_disk_probe(struct device *dev)
+static int ide_disk_probe(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	struct ide_disk_obj *idkp;
 	struct gendisk *g;
 
drivers/ide/ide-floppy.c +5 -9
@@ -1871,9 +1871,8 @@ static void idefloppy_setup (ide_drive_t
 	idefloppy_add_settings(drive);
 }
 
-static int ide_floppy_remove(struct device *dev)
+static void ide_floppy_remove(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	idefloppy_floppy_t *floppy = drive->driver_data;
 	struct gendisk *g = floppy->disk;
 
@@ -1882,8 +1881,6 @@ static int ide_floppy_remove(struct devi
 	del_gendisk(g);
 
 	ide_floppy_put(floppy);
-
-	return 0;
 }
 
 static void ide_floppy_release(struct kref *kref)
@@ -1922,16 +1919,16 @@ static ide_proc_entry_t idefloppy_proc[]
 
 #endif	/* CONFIG_PROC_FS */
 
-static int ide_floppy_probe(struct device *);
+static int ide_floppy_probe(ide_drive_t *);
 
 static ide_driver_t idefloppy_driver = {
 	.gen_driver = {
 		.owner		= THIS_MODULE,
 		.name		= "ide-floppy",
 		.bus		= &ide_bus_type,
-		.probe		= ide_floppy_probe,
-		.remove		= ide_floppy_remove,
 	},
+	.probe			= ide_floppy_probe,
+	.remove			= ide_floppy_remove,
 	.version		= IDEFLOPPY_VERSION,
 	.media			= ide_floppy,
 	.supports_dsc_overlap	= 0,
@@ -2136,9 +2133,8 @@ static struct block_device_operations id
 	.revalidate_disk= idefloppy_revalidate_disk
 };
 
-static int ide_floppy_probe(struct device *dev)
+static int ide_floppy_probe(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	idefloppy_floppy_t *floppy;
 	struct gendisk *g;
 
drivers/ide/ide-tape.c +7 -11
@@ -4682,9 +4682,8 @@ static void idetape_setup (ide_drive_t *
 	idetape_add_settings(drive);
 }
 
-static int ide_tape_remove(struct device *dev)
+static void ide_tape_remove(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	idetape_tape_t *tape = drive->driver_data;
 
 	ide_unregister_subdriver(drive, tape->driver);
@@ -4692,8 +4691,6 @@ static int ide_tape_remove(struct device
 	ide_unregister_region(tape->disk);
 
 	ide_tape_put(tape);
-
-	return 0;
 }
 
 static void ide_tape_release(struct kref *kref)
@@ -4745,16 +4742,16 @@ static ide_proc_entry_t idetape_proc[] =
 
 #endif
 
-static int ide_tape_probe(struct device *);
+static int ide_tape_probe(ide_drive_t *);
 
 static ide_driver_t idetape_driver = {
 	.gen_driver = {
 		.owner		= THIS_MODULE,
 		.name		= "ide-tape",
 		.bus		= &ide_bus_type,
-		.probe		= ide_tape_probe,
-		.remove		= ide_tape_remove,
 	},
+	.probe			= ide_tape_probe,
+	.remove			= ide_tape_remove,
 	.version		= IDETAPE_VERSION,
 	.media			= ide_tape,
 	.supports_dsc_overlap 	= 1,
@@ -4825,9 +4822,8 @@ static struct block_device_operations id
 	.ioctl		= idetape_ioctl,
 };
 
-static int ide_tape_probe(struct device *dev)
+static int ide_tape_probe(ide_drive_t *drive)
 {
-	ide_drive_t *drive = to_ide_device(dev);
 	idetape_tape_t *tape;
 	struct gendisk *g;
 	int minor;
@@ -4883,9 +4879,9 @@ static int ide_tape_probe(struct device 
 	idetape_setup(drive, tape, minor);
 
 	class_device_create(idetape_sysfs_class, NULL,
-			MKDEV(IDETAPE_MAJOR, minor), dev, "%s", tape->name);
+			MKDEV(IDETAPE_MAJOR, minor), &drive->gendev, "%s", tape->name);
 	class_device_create(idetape_sysfs_class, NULL,
-			MKDEV(IDETAPE_MAJOR, minor + 128), dev, "n%s", tape->name);
+			MKDEV(IDETAPE_MAJOR, minor + 128), &drive->gendev, "n%s", tape->name);
 
 	devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor),
 			S_IFCHR | S_IRUGO | S_IWUGO,
drivers/ide/ide.c +31 -0
@@ -1949,10 +1949,41 @@ static int ide_uevent(struct device *dev
 	return 0;
 }
 
+static int generic_ide_probe(struct device *dev)
+{
+	ide_drive_t *drive = to_ide_device(dev);
+	ide_driver_t *drv = to_ide_driver(dev->driver);
+
+	return drv->probe ? drv->probe(drive) : -ENODEV;
+}
+
+static int generic_ide_remove(struct device *dev)
+{
+	ide_drive_t *drive = to_ide_device(dev);
+	ide_driver_t *drv = to_ide_driver(dev->driver);
+
+	if (drv->remove)
+		drv->remove(drive);
+
+	return 0;
+}
+
+static void generic_ide_shutdown(struct device *dev)
+{
+	ide_drive_t *drive = to_ide_device(dev);
+	ide_driver_t *drv = to_ide_driver(dev->driver);
+
+	if (dev->driver && drv->shutdown)
+		drv->shutdown(drive);
+}
+
 struct bus_type ide_bus_type = {
 	.name		= "ide",
 	.match		= ide_bus_match,
 	.uevent		= ide_uevent,
+	.probe		= generic_ide_probe,
+	.remove		= generic_ide_remove,
+	.shutdown	= generic_ide_shutdown,
 	.dev_attrs	= ide_dev_attrs,
 	.suspend	= generic_ide_suspend,
 	.resume		= generic_ide_resume,
include/linux/ide.h +5 -0
@@ -982,8 +982,13 @@ typedef struct ide_driver_s {
 	ide_startstop_t	(*abort)(ide_drive_t *, struct request *rq);
 	ide_proc_entry_t	*proc;
 	struct device_driver	gen_driver;
+	int		(*probe)(ide_drive_t *);
+	void		(*remove)(ide_drive_t *);
+	void		(*shutdown)(ide_drive_t *);
 } ide_driver_t;
 
+#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver)
+
 int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long);
 
 /*

Patches currently in gregkh-2.6 which might be from [email protected] are

driver/add-bttv-sub-bus_type-probe-and-remove-methods.patch driver/add-bus_type-probe-remove-shutdown-methods..patch driver/add-ccwgroup_bus_type-probe-and-remove-methods.patch driver/add-dio_bus_type-probe-and-remove-methods.patch driver/add-ecard_bus_type-probe-remove-shutdown-methods.patch driver/add-gameport-bus_type-probe-and-remove-methods.patch driver/add-i2c_bus_type-probe-and-remove-methods.patch driver/add-ide_bus_type-probe-and-remove-methods.patch driver/add-locomo-bus_type-probe-remove-methods.patch driver/add-logic-module-bus_type-probe-remove-methods.patch driver/add-macio_bus_type-probe-and-remove-methods.patch driver/add-mcp-bus_type-probe-and-remove-methods.patch driver/add-mmc_bus_type-probe-and-remove-methods.patch driver/add-ocp_bus_type-probe-and-remove-methods.patch driver/add-of_platform_bus_type-probe-and-remove-methods.patch driver/add-parisc_bus_type-probe-and-remove-methods.patch driver/add-pci_bus_type-probe-and-remove-methods.patch driver/add-pcmcia_bus_type-probe-and-remove-methods.patch driver/add-pnp_bus_type-probe-and-remove-methods.patch driver/add-pseudo-lld-bus_type-probe-and-remove-methods.patch driver/add-rio_bus_type-probe-and-remove-methods.patch driver/add-sa1111-bus_type-probe-remove-methods.patch driver/add-serio-bus_type-probe-and-remove-methods.patch driver/add-sh_bus_type-probe-and-remove-methods.patch driver/add-superhyway_bus_type-probe-and-remove-methods.patch driver/add-tiocx-bus_type-probe-remove-methods.patch driver/add-usb_serial_bus_type-probe-and-remove-methods.patch driver/add-vio_bus_type-probe-and-remove-methods.patch driver/add-zorro_bus_type-probe-and-remove-methods.patch driver/remove-usb-gadget-generic-driver-methods.patch

Acked-by on v1 1/3
#46 lore raw

Re: [CFT 1/3] Add ide_bus_type probe and remove methods

In reply to Russell King
Quoted 4 lines · Russell King

(This is an additional patch - on lkml, see
"[CFT 1/29] Add bus_type probe, remove, shutdown methods.")

Looks fine but shouldn't it also update drivers/scsi/ide-scsi.c?

With ide-scsi.c updated it is is fine with me:

Quoted 8 lines
---
 drivers/ide/ide-cd.c     |   14 +++++---------
 drivers/ide/ide-disk.c   |   22 ++++++++--------------
 drivers/ide/ide-floppy.c |   14 +++++---------
 drivers/ide/ide-tape.c   |   18 +++++++-----------
 drivers/ide/ide.c        |   31 +++++++++++++++++++++++++++++++
 include/linux/ide.h      |    5 +++++
 6 files changed, 61 insertions(+), 43 deletions(-)
#47 lore raw

PATCH 2/3 Remove usb gadget generic driver methods

In reply to Russell King

USB gadget drivers make no use of these, remove the pointless comments.

(This is an additional patch - on lkml, see
"[CFT 1/29] Add bus_type probe, remove, shutdown methods.")

---
 drivers/usb/gadget/ether.c  |    3 ---
 drivers/usb/gadget/inode.c  |    3 ---
 drivers/usb/gadget/serial.c |    3 ---
 drivers/usb/gadget/zero.c   |    3 ---
 4 files changed, 12 deletions(-)
drivers/usb/gadget/ether.c +0 -3
@@ -2534,9 +2534,6 @@ static struct usb_gadget_driver eth_driv
 	.driver 	= {
 		.name		= (char *) shortname,
 		.owner		= THIS_MODULE,
-		// .shutdown = ...
-		// .suspend = ...
-		// .resume = ...
 	},
 };
 
drivers/usb/gadget/inode.c +0 -3
@@ -1738,9 +1738,6 @@ static struct usb_gadget_driver gadgetfs
 
 	.driver 	= {
 		.name		= (char *) shortname,
-		// .shutdown = ...
-		// .suspend = ...
-		// .resume = ...
 	},
 };
 
drivers/usb/gadget/serial.c +0 -3
@@ -374,9 +374,6 @@ static struct usb_gadget_driver gs_gadge
 	.disconnect =		gs_disconnect,
 	.driver = {
 		.name =		GS_SHORT_NAME,
-		/* .shutdown = ... */
-		/* .suspend = ...  */
-		/* .resume = ...   */
 	},
 };
 
drivers/usb/gadget/zero.c +0 -3
@@ -1303,9 +1303,6 @@ static struct usb_gadget_driver zero_dri
 	.driver 	= {
 		.name		= (char *) shortname,
 		.owner		= THIS_MODULE,
-		// .shutdown = ...
-		// .suspend = ...
-		// .resume = ...
 	},
 };
 
#48 lore raw

PATCH 3/3 Add bttv sub bus_type probe and remove methods

In reply to Russell King

(This is an additional patch - on lkml, see
"[CFT 1/29] Add bus_type probe, remove, shutdown methods.")

---
 drivers/media/dvb/bt8xx/dvb-bt8xx.c |   23 +++++++++++------------
 drivers/media/video/bttv-gpio.c     |   24 ++++++++++++++++++++++--
 drivers/media/video/bttv.h          |    2 ++
 drivers/media/video/ir-kbd-gpio.c   |   17 ++++++++---------
 4 files changed, 43 insertions(+), 23 deletions(-)
drivers/media/dvb/bt8xx/dvb-bt8xx.c +11 -12
@@ -787,9 +787,8 @@ static int __init dvb_bt8xx_load_card(st
 	return 0;
 }
 
-static int dvb_bt8xx_probe(struct device *dev)
+static int dvb_bt8xx_probe(struct bttv_sub_device *sub)
 {
-	struct bttv_sub_device *sub = to_bttv_sub_dev(dev);
 	struct dvb_bt8xx_card *card;
 	struct pci_dev* bttv_pci_dev;
 	int ret;
@@ -907,13 +906,13 @@ static int dvb_bt8xx_probe(struct device
 		return ret;
 	}
 
-	dev_set_drvdata(dev, card);
+	dev_set_drvdata(&sub->dev, card);
 	return 0;
 }
 
-static int dvb_bt8xx_remove(struct device *dev)
+static int dvb_bt8xx_remove(struct bttv_sub_device *sub)
 {
-	struct dvb_bt8xx_card *card = dev_get_drvdata(dev);
+	struct dvb_bt8xx_card *card = dev_get_drvdata(&sub->dev);
 
 	dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr);
 
@@ -936,14 +935,14 @@ static int dvb_bt8xx_remove(struct devic
 static struct bttv_sub_driver driver = {
 	.drv = {
 		.name		= "dvb-bt8xx",
-		.probe		= dvb_bt8xx_probe,
-		.remove		= dvb_bt8xx_remove,
-		/* FIXME:
-		 * .shutdown	= dvb_bt8xx_shutdown,
-		 * .suspend	= dvb_bt8xx_suspend,
-		 * .resume	= dvb_bt8xx_resume,
-		 */
 	},
+	.probe		= dvb_bt8xx_probe,
+	.remove		= dvb_bt8xx_remove,
+	/* FIXME:
+	 * .shutdown	= dvb_bt8xx_shutdown,
+	 * .suspend	= dvb_bt8xx_suspend,
+	 * .resume	= dvb_bt8xx_resume,
+	 */
 };
 
 static int __init dvb_bt8xx_init(void)
drivers/media/video/bttv-gpio.c +22 -2
@@ -47,9 +47,29 @@ static int bttv_sub_bus_match(struct dev
 	return 0;
 }
 
+static int bttv_sub_probe(struct device *dev)
+{
+	struct bttv_sub_device *sdev = to_bttv_sub_dev(dev);
+	struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver);
+
+	return sub->probe ? sub->probe(sdev) : -ENODEV;
+}
+
+static int bttv_sub_remove(struct device *dev)
+{
+	struct bttv_sub_device *sdev = to_bttv_sub_dev(dev);
+	struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver);
+
+	if (sub->remove)
+		sub->remove(sdev);
+	return 0;
+}
+
 struct bus_type bttv_sub_bus_type = {
-	.name  = "bttv-sub",
-	.match = &bttv_sub_bus_match,
+	.name   = "bttv-sub",
+	.match  = &bttv_sub_bus_match,
+	.probe  = bttv_sub_probe,
+	.remove = bttv_sub_remove,
 };
 EXPORT_SYMBOL(bttv_sub_bus_type);
 
drivers/media/video/bttv.h +2 -0
@@ -334,6 +334,8 @@ struct bttv_sub_device {
 struct bttv_sub_driver {
 	struct device_driver   drv;
 	char                   wanted[BUS_ID_SIZE];
+	int                    (*probe)(struct bttv_sub_device *sub);
+	void                   (*remove)(struct bttv_sub_device *sub);
 	void                   (*gpio_irq)(struct bttv_sub_device *sub);
 	int                    (*any_irq)(struct bttv_sub_device *sub);
 };
drivers/media/video/ir-kbd-gpio.c +8 -9
@@ -319,15 +319,15 @@ module_param(repeat_period, int, 0644);
 	printk(KERN_DEBUG DEVNAME ": " fmt , ## arg)
 
 static void ir_irq(struct bttv_sub_device *sub);
-static int ir_probe(struct device *dev);
-static int ir_remove(struct device *dev);
+static int ir_probe(struct bttv_sub_device *sub);
+static int ir_remove(struct bttv_sub_device *sub);
 
 static struct bttv_sub_driver driver = {
 	.drv = {
 		.name	= DEVNAME,
-		.probe	= ir_probe,
-		.remove	= ir_remove,
 	},
+	.probe		= ir_probe,
+	.remove		= ir_remove,
 	.gpio_irq 	= ir_irq,
 };
 
@@ -570,9 +570,8 @@ static void ir_rc5_timer_keyup(unsigned 
 
 /* ---------------------------------------------------------------------- */
 
-static int ir_probe(struct device *dev)
+static int ir_probe(struct bttv_sub_device *sub)
 {
-	struct bttv_sub_device *sub = to_bttv_sub_dev(dev);
 	struct IR *ir;
 	struct input_dev *input_dev;
 	IR_KEYTAB_TYPE *ir_codes = NULL;
@@ -707,7 +706,7 @@ static int ir_probe(struct device *dev)
 	}
 
 	/* all done */
-	dev_set_drvdata(dev, ir);
+	dev_set_drvdata(&sub->dev, ir);
 	input_register_device(ir->input);
 
 	/* the remote isn't as bouncy as a keyboard */
@@ -717,9 +716,9 @@ static int ir_probe(struct device *dev)
 	return 0;
 }
 
-static int ir_remove(struct device *dev)
+static int ir_remove(struct bttv_sub_device *sub)
 {
-	struct IR *ir = dev_get_drvdata(dev);
+	struct IR *ir = dev_get_drvdata(&sub->dev);
 
 	if (ir->polling) {
 		del_timer(&ir->timer);
#49 lore raw

Re: [CFT 3/3] Add bttv sub bus_type probe and remove methods

Quoted 169 lines · Russell King

(This is an additional patch - on lkml, see
"[CFT 1/29] Add bus_type probe, remove, shutdown methods.")

---
 drivers/media/dvb/bt8xx/dvb-bt8xx.c |   23 +++++++++++------------
 drivers/media/video/bttv-gpio.c     |   24 ++++++++++++++++++++++--
 drivers/media/video/bttv.h          |    2 ++
 drivers/media/video/ir-kbd-gpio.c   |   17 ++++++++---------
 4 files changed, 43 insertions(+), 23 deletions(-)
drivers/media/dvb/bt8xx/dvb-bt8xx.c +11 -12
@@ -787,9 +787,8 @@ static int __init dvb_bt8xx_load_card(st
        return 0;
 }
 
-static int dvb_bt8xx_probe(struct device *dev)
+static int dvb_bt8xx_probe(struct bttv_sub_device *sub)
 {
-       struct bttv_sub_device *sub = to_bttv_sub_dev(dev);
        struct dvb_bt8xx_card *card;
        struct pci_dev* bttv_pci_dev;
        int ret;
@@ -907,13 +906,13 @@ static int dvb_bt8xx_probe(struct device
                return ret;
        }
 
-       dev_set_drvdata(dev, card);
+       dev_set_drvdata(&sub->dev, card);
        return 0;
 }
 
-static int dvb_bt8xx_remove(struct device *dev)
+static int dvb_bt8xx_remove(struct bttv_sub_device *sub)
 {
-       struct dvb_bt8xx_card *card = dev_get_drvdata(dev);
+       struct dvb_bt8xx_card *card = dev_get_drvdata(&sub->dev);
 
        dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr);
 
@@ -936,14 +935,14 @@ static int dvb_bt8xx_remove(struct devic
 static struct bttv_sub_driver driver = {
        .drv = {
                .name           = "dvb-bt8xx",
-               .probe          = dvb_bt8xx_probe,
-               .remove         = dvb_bt8xx_remove,
-               /* FIXME:
-                * .shutdown    = dvb_bt8xx_shutdown,
-                * .suspend     = dvb_bt8xx_suspend,
-                * .resume      = dvb_bt8xx_resume,
-                */
        },
+       .probe          = dvb_bt8xx_probe,
+       .remove         = dvb_bt8xx_remove,
+       /* FIXME:
+        * .shutdown    = dvb_bt8xx_shutdown,
+        * .suspend     = dvb_bt8xx_suspend,
+        * .resume      = dvb_bt8xx_resume,
+        */
 };
 
 static int __init dvb_bt8xx_init(void)
drivers/media/video/bttv-gpio.c +22 -2
@@ -47,9 +47,29 @@ static int bttv_sub_bus_match(struct dev
        return 0;
 }
 
+static int bttv_sub_probe(struct device *dev)
+{
+       struct bttv_sub_device *sdev = to_bttv_sub_dev(dev);
+       struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver);
+
+       return sub->probe ? sub->probe(sdev) : -ENODEV;
+}
+
+static int bttv_sub_remove(struct device *dev)
+{
+       struct bttv_sub_device *sdev = to_bttv_sub_dev(dev);
+       struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver);
+
+       if (sub->remove)
+               sub->remove(sdev);
+       return 0;
+}
+
 struct bus_type bttv_sub_bus_type = {
-       .name  = "bttv-sub",
-       .match = &bttv_sub_bus_match,
+       .name   = "bttv-sub",
+       .match  = &bttv_sub_bus_match,
+       .probe  = bttv_sub_probe,
+       .remove = bttv_sub_remove,
 };
 EXPORT_SYMBOL(bttv_sub_bus_type);
 
drivers/media/video/bttv.h +2 -0
@@ -334,6 +334,8 @@ struct bttv_sub_device {
 struct bttv_sub_driver {
        struct device_driver   drv;
        char                   wanted[BUS_ID_SIZE];
+       int                    (*probe)(struct bttv_sub_device *sub);
+       void                   (*remove)(struct bttv_sub_device *sub);
        void                   (*gpio_irq)(struct bttv_sub_device *sub);
        int                    (*any_irq)(struct bttv_sub_device *sub);
 };
drivers/media/video/ir-kbd-gpio.c +8 -10
@@ -319,15 +319,15 @@ module_param(repeat_period, int, 0644);
        printk(KERN_DEBUG DEVNAME ": " fmt , ## arg)
 
 static void ir_irq(struct bttv_sub_device *sub);
-static int ir_probe(struct device *dev);
-static int ir_remove(struct device *dev);
+static int ir_probe(struct bttv_sub_device *sub);
+static int ir_remove(struct bttv_sub_device *sub);
 
 static struct bttv_sub_driver driver = {
        .drv = {
                .name   = DEVNAME,
-               .probe  = ir_probe,
-               .remove = ir_remove,
        },
+       .probe          = ir_probe,
+       .remove         = ir_remove,
        .gpio_irq       = ir_irq,
 };
 
@@ -570,9 +570,8 @@ static void ir_rc5_timer_keyup(unsigned
 
 /* ---------------------------------------------------------------------- */
 
-static int ir_probe(struct device *dev)
+static int ir_probe(struct bttv_sub_device *sub)
 {
-       struct bttv_sub_device *sub = to_bttv_sub_dev(dev);
        struct IR *ir;
        struct input_dev *input_dev;
        IR_KEYTAB_TYPE *ir_codes = NULL;
@@ -707,7 +706,7 @@ static int ir_probe(struct device *dev)
        }
 
        /* all done */
-       dev_set_drvdata(dev, ir);
+       dev_set_drvdata(&sub->dev, ir);
        input_register_device(ir->input);
 
        /* the remote isn't as bouncy as a keyboard */
@@ -717,9 +716,9 @@ static int ir_probe(struct device *dev)
        return 0;
 }
 
-static int ir_remove(struct device *dev)
+static int ir_remove(struct bttv_sub_device *sub)
 {
-       struct IR *ir = dev_get_drvdata(dev);
+       struct IR *ir = dev_get_drvdata(&sub->dev);
 
        if (ir->polling) {
                del_timer(&ir->timer);
 
--
Quoted 4 lines

video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

Russell-

I apologize for not emailing you earlier... I didnt see this patch originally, but I saw it this morning in GregKH's quilt tree...

We've gotten rid of ir-kbd-gpio.c , in favor of bttv-input.c ...

This change hit Linus' tree yesterday.

http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4abdfed5676e5ef7f2461bb76f5929068a9cc9cf

Please regenerate your patch.

Thanks,

Michael Krufky

#50 lore raw
In reply to Russell King
Quoted 1 line · Russell King

The long-term idea is to remove the device_driver methods entirely.

With the three additional patches I've just posted, this leaves:

ccw_driver
css_driver
pcie_port_service_driver
scsi_driver

using the generic device_driver probe/remove/shutdown/suspend/resume methods.

I'm not sure what's going on with the PCIE code - my attempts to contact the PCIE folk about their suspend/resume implementation has been met by silence.

The scsi_driver business looks like being a pig to solve - so can SCSI folk please look at what's required to unuse these fields.

Could the s390 folk also look at what's required for ccw_driver and css_driver please?

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#51 lore raw

2006/1/6, Russell King <[email protected]>:

Quoted 2 lines

Could the s390 folk also look at what's required for ccw_driver and css_driver please?

ccw_driver should be easy: Just don't set ->probe and ->remove in ccw_driver_register() and move ccw_device_remove() and ccw_device_probe() to the bus type.

css_driver needs some wrapper functions added, since io_subchannel_{probe,remove,shutdown} are really specific to I/O subchannels.

I'll see what I can put together when I'm back at work next week.

Cornelia

#52 lore raw

PATCH 1/1 Add {css,ccw}_bus_type probe, remove, shutdown methods.

Quoted 1 line · On Fri, 6 Jan 2006 14:38:27 +0100 Cornelia Huck <[email protected]> wrote:

I'll see what I can put together when I'm back at work next week.

The following patch converts css_bus_type and ccw_bus_type to use the new bus_type methods.

CC Martin Schwidefsky <[email protected]>
 css.c    |   36 ++++++++++++++++++++++++++++++++++--
 css.h    |    4 ++++
 device.c |   50 ++++++++++++++++++++++++--------------------------
 3 files changed, 62 insertions(+), 28 deletions(-)
drivers/s390/cio/css.c +34 -2
index e565193..2d319fb 100644
@@ -542,9 +542,41 @@ css_bus_match (struct device *dev, struc
 	return 0;
 }
 
+static int
+css_probe (struct device *dev)
+{
+	struct subchannel *sch;
+
+	sch = to_subchannel(dev);
+	sch->driver = container_of (dev->driver, struct css_driver, drv);
+	return (sch->driver->probe ? sch->driver->probe(sch) : 0);
+}
+
+static int
+css_remove (struct device *dev)
+{
+	struct subchannel *sch;
+
+	sch = to_subchannel(dev);
+	return (sch->driver->remove ? sch->driver->remove(sch) : 0);
+}
+
+static void
+css_shutdown (struct device *dev)
+{
+	struct subchannel *sch;
+
+	sch = to_subchannel(dev);
+	if (sch->driver->shutdown)
+		sch->driver->shutdown(sch);
+}
+
 struct bus_type css_bus_type = {
-	.name  = "css",
-	.match = &css_bus_match,
+	.name     = "css",
+	.match    = css_bus_match,
+	.probe    = css_probe,
+	.remove   = css_remove,
+	.shutdown = css_shutdown,
 };
 
 subsys_initcall(init_channel_subsystem);
drivers/s390/cio/css.h +4 -0
index 251ebd7..aa5ab5d 100644
@@ -115,6 +115,7 @@ struct ccw_device_private {
  * Currently, we only care about I/O subchannels (type 0), these
  * have a ccw_device connected to them.
  */
+struct subchannel;
 struct css_driver {
 	unsigned int subchannel_type;
 	struct device_driver drv;
@@ -122,6 +123,9 @@ struct css_driver {
 	int (*notify)(struct device *, int);
 	void (*verify)(struct device *);
 	void (*termination)(struct device *);
+	int (*probe)(struct subchannel *);
+	int (*remove)(struct subchannel *);
+	void (*shutdown)(struct subchannel *);
 };
 
 /*
drivers/s390/cio/device.c +24 -26

130 lines not on this page · raw message

#53 lore raw
In reply to Russell King
Quoted 2 lines · Russell King

The scsi_driver business looks like being a pig to solve - so can SCSI folk please look at what's required to unuse these fields.

Well, not necessarily pig. Perhaps piglet. We definitely need the separate probe, shutdown and remove methods for each of our ULDs. However, if they moved into the bus, since scsi_driver is always of type scsi_bus, we could add separate probe, shutdown and remove fields to struct scsi_driver and have the new fields in scsi_bus call those. I have to ask, though; isn't that primarily what most other bus types are going to be doing anyway? So doesn't it make sense to leave the fields in the generic driver? Then the rule becomes that if the bus has the field, we call it, and the bus routine *may* call the corresponding generic driver field if it feels like it. Otherwise if the bus has no callbacks, just use the generic driver ones?

James

#54 lore raw
Quoted 4 lines · James Bottomley
Quoted 2 lines · Russell King

The scsi_driver business looks like being a pig to solve - so can SCSI folk please look at what's required to unuse these fields.

Quoted 11 lines

Well, not necessarily pig. Perhaps piglet. We definitely need the separate probe, shutdown and remove methods for each of our ULDs. However, if they moved into the bus, since scsi_driver is always of type scsi_bus, we could add separate probe, shutdown and remove fields to struct scsi_driver and have the new fields in scsi_bus call those. I have to ask, though; isn't that primarily what most other bus types are going to be doing anyway? So doesn't it make sense to leave the fields in the generic driver? Then the rule becomes that if the bus has the field, we call it, and the bus routine *may* call the corresponding generic driver field if it feels like it. Otherwise if the bus has no callbacks, just use the generic driver ones?

Firstly, having both causes confusion. As a prime example of this, see the PCIE crap - they implement both the bus_type suspend/resume methods _and_ the device_driver suspend/resume methods, despite these device_driver suspend/resume methods never ever being called.

Secondly, keeping both negates the _whole_ point of this series and the previous platform device driver series - needless bloat:

- the extra bloat in struct device_driver for all bus types, many of which do not have things like shutdown or suspend/resume callbacks.

- the extra code bloat in many drivers to convert the struct device to something more bus specific.

Also, don't you think it's wrong to keep these fields _just_ to support single case that SCSI wants to remain using the Old Way, when everything else can be (and almost has been) converted to the New Way?

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core