2006-01-05 14:29:59

by Russell King

[permalink] [raw]
Subject: [CFT 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.

Signed-off-by: Russell King <[email protected]>

---
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(-)

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
--- linus/drivers/base/dd.c Fri Sep 23 07:03:13 2005
+++ linux/drivers/base/dd.c Sun Nov 13 14:02:19 2005
@@ -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);
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -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);
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
--- linus/drivers/base/power/shutdown.c Sun Nov 6 22:15:23 2005
+++ linux/drivers/base/power/shutdown.c Sun Nov 13 14:03:05 2005
@@ -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);
}
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
--- linus/include/linux/device.h Sun Nov 6 22:20:07 2005
+++ linux/include/linux/device.h Sun Nov 13 13:58:17 2005
@@ -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);
};


2006-01-05 14:30:34

by Russell King

[permalink] [raw]
Subject: [CFT 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.

Signed-off-by: Russell King <[email protected]>

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(-)

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
--- linus/drivers/pci/pci-driver.c Fri Nov 11 07:04:15 2005
+++ linux/drivers/pci/pci-driver.c Sun Nov 13 15:44:26 2005
@@ -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,

2006-01-05 14:31:46

by Russell King

[permalink] [raw]
Subject: [CFT 4/29] Add ecard_bus_type probe/remove/shutdown methods

Signed-off-by: Russell King <[email protected]>

---
arch/arm26/kernel/ecard.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)

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
--- linus/arch/arm26/kernel/ecard.c Sun Nov 6 22:14:20 2005
+++ linux/arch/arm26/kernel/ecard.c Sun Nov 13 15:52:04 2005
@@ -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)

2006-01-05 14:32:19

by Russell King

[permalink] [raw]
Subject: [CFT 5/29] Add AMBA bus_type probe/remove/shutdown methods

Signed-off-by: Russell King <[email protected]>

---
arch/arm/common/amba.c | 71 ++++++++++++++++++++++++++-----------------------
1 files changed, 38 insertions(+), 33 deletions(-)

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
--- linus/arch/arm/common/amba.c Sun Nov 6 22:14:11 2005
+++ linux/arch/arm/common/amba.c Sun Nov 13 15:49:25 2005
@@ -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);
}

2006-01-05 14:31:16

by Russell King

[permalink] [raw]
Subject: [CFT 3/29] Add ecard_bus_type probe/remove/shutdown methods

Signed-off-by: Russell King <[email protected]>

---
arch/arm/kernel/ecard.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)

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
--- linus/arch/arm/kernel/ecard.c Sun Nov 6 22:14:13 2005
+++ linux/arch/arm/kernel/ecard.c Sun Nov 13 15:52:20 2005
@@ -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)

2006-01-05 14:33:59

by Russell King

[permalink] [raw]
Subject: [CFT 8/29] Add logic module bus_type probe/remove methods

Signed-off-by: Russell King <[email protected]>

---
arch/arm/mach-integrator/lm.c | 36 ++++++++++++++++++------------------
1 files changed, 18 insertions(+), 18 deletions(-)

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
--- linus/arch/arm/mach-integrator/lm.c Sun Nov 6 22:14:16 2005
+++ linux/arch/arm/mach-integrator/lm.c Sun Nov 13 15:57:58 2005
@@ -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);
}

2006-01-05 14:32:42

by Russell King

[permalink] [raw]
Subject: [CFT 6/29] Add SA1111 bus_type probe/remove methods

Signed-off-by: Russell King <[email protected]>

---
arch/arm/common/sa1111.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

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
--- linus/arch/arm/common/sa1111.c Fri Nov 11 21:20:00 2005
+++ linux/arch/arm/common/sa1111.c Sun Nov 13 15:55:17 2005
@@ -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);
}

2006-01-05 14:33:13

by Russell King

[permalink] [raw]
Subject: [CFT 7/29] Add locomo bus_type probe/remove methods

Signed-off-by: Russell King <[email protected]>

---
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 -x .git linus/arch/arm/common/locomo.c linux/arch/arm/common/locomo.c
--- linus/arch/arm/common/locomo.c Fri Nov 11 21:20:00 2005
+++ linux/arch/arm/common/locomo.c Sun Nov 13 15:56:31 2005
@@ -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);
}

2006-01-05 14:34:15

by Russell King

[permalink] [raw]
Subject: [CFT 9/29] Add tiocx bus_type probe/remove methods

Signed-off-by: Russell King <[email protected]>

---
arch/ia64/sn/kernel/tiocx.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)

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
--- linus/arch/ia64/sn/kernel/tiocx.c Sun Nov 6 22:14:30 2005
+++ linux/arch/ia64/sn/kernel/tiocx.c Sun Nov 13 16:07:12 2005
@@ -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);
}

2006-01-05 14:36:24

by Russell King

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

Signed-off-by: Russell King <[email protected]>

---
arch/powerpc/kernel/of_device.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

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
--- linus/arch/powerpc/kernel/of_device.c Mon Oct 31 07:31:59 2005
+++ linux/arch/powerpc/kernel/of_device.c Sun Nov 13 16:12:38 2005
@@ -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);

2006-01-05 14:34:55

by Russell King

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

Signed-off-by: Russell King <[email protected]>

---
arch/parisc/kernel/drivers.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

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
--- linus/arch/parisc/kernel/drivers.c Sun Nov 6 22:14:46 2005
+++ linux/arch/parisc/kernel/drivers.c Sun Nov 13 16:08:49 2005
@@ -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,
};

/**

2006-01-05 14:35:27

by Russell King

[permalink] [raw]
Subject: [CFT 11/29] Add ocp_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
arch/ppc/syslib/ocp.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

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
--- linus/arch/ppc/syslib/ocp.c Sun Nov 6 22:14:53 2005
+++ linux/arch/ppc/syslib/ocp.c Sun Nov 13 16:09:45 2005
@@ -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);

2006-01-05 14:36:09

by Russell King

[permalink] [raw]
Subject: [CFT 12/29] Add sh_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
arch/sh/kernel/cpu/bus.c | 34 +++++++++++++++++-----------------
1 files changed, 17 insertions(+), 17 deletions(-)

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
--- linus/arch/sh/kernel/cpu/bus.c Sun Nov 6 22:14:58 2005
+++ linux/arch/sh/kernel/cpu/bus.c Sun Nov 13 16:11:45 2005
@@ -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);

2006-01-05 14:36:55

by Russell King

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

Signed-off-by: Russell King <[email protected]>

---
arch/powerpc/kernel/vio.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

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
--- linus/arch/powerpc/kernel/vio.c Wed Nov 9 19:20:14 2005
+++ linux/arch/powerpc/kernel/vio.c Sun Nov 13 16:14:10 2005
@@ -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,
};

2006-01-05 14:37:59

by Russell King

[permalink] [raw]
Subject: [CFT 16/29] Add i2c_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/i2c/i2c-core.c | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)

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
--- linus/drivers/i2c/i2c-core.c Sun Nov 6 22:15:59 2005
+++ linux/drivers/i2c/i2c-core.c Sun Nov 13 16:21:32 2005
@@ -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)

2006-01-05 14:39:01

by Russell King

[permalink] [raw]
Subject: [CFT 18/29] Add serio bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/input/serio/serio.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)

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
--- linus/drivers/input/serio/serio.c Sun Nov 6 22:16:18 2005
+++ linux/drivers/input/serio/serio.c Sun Nov 13 16:27:06 2005
@@ -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);
}

2006-01-05 14:37:30

by Russell King

[permalink] [raw]
Subject: [CFT 15/29] Add dio_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/dio/dio-driver.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

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
--- linus/drivers/dio/dio-driver.c Sun Nov 6 22:15:57 2005
+++ linux/drivers/dio/dio-driver.c Sun Nov 13 16:18:45 2005
@@ -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,
};


2006-01-05 14:38:40

by Russell King

[permalink] [raw]
Subject: [CFT 17/29] Add gameport bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/input/gameport/gameport.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)

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
--- linus/drivers/input/gameport/gameport.c Sun Nov 6 22:16:11 2005
+++ linux/drivers/input/gameport/gameport.c Sun Nov 13 16:25:51 2005
@@ -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);
}

2006-01-05 14:39:32

by Russell King

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

Signed-off-by: Russell King <[email protected]>

---
drivers/macintosh/macio_asic.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

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
--- linus/drivers/macintosh/macio_asic.c Sun Nov 6 22:16:28 2005
+++ linux/drivers/macintosh/macio_asic.c Sun Nov 13 16:28:39 2005
@@ -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);

2006-01-05 14:40:06

by Russell King

[permalink] [raw]
Subject: [CFT 20/29] Add MCP bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/mfd/mcp-core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

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
--- linus/drivers/mfd/mcp-core.c Mon Nov 7 19:57:44 2005
+++ linux/drivers/mfd/mcp-core.c Sun Nov 13 16:31:11 2005
@@ -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);

2006-01-05 14:41:46

by Russell King

[permalink] [raw]
Subject: [CFT 22/29] Add pcmcia_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/pcmcia/ds.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

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
--- linus/drivers/pcmcia/ds.c Sun Nov 6 22:17:11 2005
+++ linux/drivers/pcmcia/ds.c Sun Nov 13 16:33:41 2005
@@ -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,
};


2006-01-05 14:41:47

by Russell King

[permalink] [raw]
Subject: [CFT 23/29] Add pnp_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/pnp/driver.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

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
--- linus/drivers/pnp/driver.c Mon Nov 7 19:57:55 2005
+++ linux/drivers/pnp/driver.c Sun Nov 13 16:34:22 2005
@@ -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);

2006-01-05 14:41:05

by Russell King

[permalink] [raw]
Subject: [CFT 21/29] Add mmc_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/mmc/mmc_sysfs.c | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)

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
--- linus/drivers/mmc/mmc_sysfs.c Sun Nov 6 22:16:40 2005
+++ linux/drivers/mmc/mmc_sysfs.c Sun Nov 13 16:32:05 2005
@@ -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);
}

2006-01-05 14:42:24

by Russell King

[permalink] [raw]
Subject: [CFT 24/29] Add ccwgroup_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/s390/cio/ccwgroup.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)

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
--- linus/drivers/s390/cio/ccwgroup.c Mon Nov 7 19:57:56 2005
+++ linux/drivers/s390/cio/ccwgroup.c Sun Nov 13 16:35:57 2005
@@ -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);

2006-01-05 14:43:04

by Russell King

[permalink] [raw]
Subject: [CFT 25/29] Add superhyway_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/sh/superhyway/superhyway.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

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
--- linus/drivers/sh/superhyway/superhyway.c Mon Nov 7 19:58:05 2005
+++ linux/drivers/sh/superhyway/superhyway.c Sun Nov 13 16:38:04 2005
@@ -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)

2006-01-05 14:43:51

by Russell King

[permalink] [raw]
Subject: [CFT 27/29] Add zorro_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/zorro/zorro-driver.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

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
--- linus/drivers/zorro/zorro-driver.c Sun Nov 6 22:18:11 2005
+++ linux/drivers/zorro/zorro-driver.c Sun Nov 13 16:41:51 2005
@@ -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,
};


2006-01-05 14:44:22

by Russell King

[permalink] [raw]
Subject: [CFT 28/29] Add rio_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/rapidio/rio-driver.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

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
--- linus/drivers/rapidio/rio-driver.c Mon Nov 7 19:57:55 2005
+++ linux/drivers/rapidio/rio-driver.c Sun Nov 13 16:42:34 2005
@@ -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,
};

/**

2006-01-05 14:44:53

by Russell King

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

Signed-off-by: Russell King <[email protected]>

---
drivers/scsi/scsi_debug.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

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
--- linus/drivers/scsi/scsi_debug.c Sat Nov 12 07:32:38 2005
+++ linux/drivers/scsi/scsi_debug.c Sun Nov 13 16:45:02 2005
@@ -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)

2006-01-05 14:43:20

by Russell King

[permalink] [raw]
Subject: [CFT 26/29] Add usb_serial_bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

---
drivers/usb/serial/bus.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)

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
--- linus/drivers/usb/serial/bus.c Sun Nov 6 22:17:51 2005
+++ linux/drivers/usb/serial/bus.c Sun Nov 13 16:40:36 2005
@@ -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;

2006-01-05 15:35:39

by Richard Purdie

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

Signed-off-by: Richard Purdie <[email protected]>

but no changelog entry?

On Thu, 2006-01-05 at 14:33 +0000, Russell King wrote:
> Signed-off-by: Russell King <[email protected]>
>
> ---
> 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
> -x .git linus/arch/arm/common/locomo.c linux/arch/arm/common/locomo.c
> --- linus/arch/arm/common/locomo.c Fri Nov 11 21:20:00 2005
> +++ linux/arch/arm/common/locomo.c Sun Nov 13 15:56:31 2005
> @@ -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);
> }
>
>

2006-01-05 18:46:46

by Matthew Wilcox

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

On Thu, Jan 05, 2006 at 02:34:38PM +0000, Russell King wrote:
> Signed-off-by: Russell King <[email protected]>

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

> 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
> --- linus/arch/parisc/kernel/drivers.c Sun Nov 6 22:14:46 2005
> +++ linux/arch/parisc/kernel/drivers.c Sun Nov 13 16:08:49 2005
> @@ -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.

2006-01-05 23:09:31

by Greg KH

[permalink] [raw]
Subject: Re: [CFT 1/29] Add bus_type probe, remove, shutdown methods.

On Thu, Jan 05, 2006 at 02:29:51PM +0000, Russell King wrote:
> 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.
>
> Signed-off-by: Russell King <[email protected]>

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

2006-01-05 23:24:17

by Russell King

[permalink] [raw]
Subject: Re: [CFT 1/29] Add bus_type probe, remove, shutdown methods.

On Thu, Jan 05, 2006 at 03:07:39PM -0800, Greg KH wrote:
> On Thu, Jan 05, 2006 at 02:29:51PM +0000, Russell King wrote:
> > 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.
> >
> > Signed-off-by: Russell King <[email protected]>
>
> 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.

> 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.

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

2006-01-06 02:50:23

by Greg KH

[permalink] [raw]
Subject: Re: [CFT 1/29] Add bus_type probe, remove, shutdown methods.

On Thu, Jan 05, 2006 at 11:24:10PM +0000, Russell King wrote:
> On Thu, Jan 05, 2006 at 03:07:39PM -0800, Greg KH wrote:
> > On Thu, Jan 05, 2006 at 02:29:51PM +0000, Russell King wrote:
> > > 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.
> > >
> > > Signed-off-by: Russell King <[email protected]>
> >
> > 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 :)

> 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.

> > 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

2006-01-06 11:41:40

by Russell King

[permalink] [raw]
Subject: [CFT 2/3] Remove usb gadget generic driver methods

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

Signed-off-by: Russell King <[email protected]>

(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(-)

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2534,9 +2534,6 @@ static struct usb_gadget_driver eth_driv
.driver = {
.name = (char *) shortname,
.owner = THIS_MODULE,
- // .shutdown = ...
- // .suspend = ...
- // .resume = ...
},
};

diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1738,9 +1738,6 @@ static struct usb_gadget_driver gadgetfs

.driver = {
.name = (char *) shortname,
- // .shutdown = ...
- // .suspend = ...
- // .resume = ...
},
};

diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -374,9 +374,6 @@ static struct usb_gadget_driver gs_gadge
.disconnect = gs_disconnect,
.driver = {
.name = GS_SHORT_NAME,
- /* .shutdown = ... */
- /* .suspend = ... */
- /* .resume = ... */
},
};

diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -1303,9 +1303,6 @@ static struct usb_gadget_driver zero_dri
.driver = {
.name = (char *) shortname,
.owner = THIS_MODULE,
- // .shutdown = ...
- // .suspend = ...
- // .resume = ...
},
};

2006-01-06 11:41:11

by Russell King

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

Signed-off-by: Russell King <[email protected]>

(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(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -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;
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -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;

diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -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;

diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -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,
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -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,
};
diff --git a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -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);

/*

2006-01-06 11:42:12

by Russell King

[permalink] [raw]
Subject: [CFT 3/3] Add bttv sub bus_type probe and remove methods

Signed-off-by: Russell King <[email protected]>

(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(-)

diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -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)
diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bttv-gpio.c
--- a/drivers/media/video/bttv-gpio.c
+++ b/drivers/media/video/bttv-gpio.c
@@ -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);

diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h
--- a/drivers/media/video/bttv.h
+++ b/drivers/media/video/bttv.h
@@ -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);
};
diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c
--- a/drivers/media/video/ir-kbd-gpio.c
+++ b/drivers/media/video/ir-kbd-gpio.c
@@ -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);

2006-01-06 11:48:31

by Russell King

[permalink] [raw]
Subject: Re: [CFT 1/29] Add bus_type probe, remove, shutdown methods.

On Thu, Jan 05, 2006 at 02:29:51PM +0000, Russell King wrote:
> 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?

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

2006-01-06 13:38:29

by Cornelia Huck

[permalink] [raw]
Subject: Re: [CFT 1/29] Add bus_type probe, remove, shutdown methods.

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

> 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

2006-01-06 16:36:03

by James Bottomley

[permalink] [raw]
Subject: Re: [CFT 1/29] Add bus_type probe, remove, shutdown methods.

On Fri, 2006-01-06 at 11:48 +0000, Russell King wrote:
> 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


2006-01-06 16:57:30

by Russell King

[permalink] [raw]
Subject: Re: [CFT 1/29] Add bus_type probe, remove, shutdown methods.

On Fri, Jan 06, 2006 at 10:34:49AM -0600, James Bottomley wrote:
> On Fri, 2006-01-06 at 11:48 +0000, Russell King wrote:
> > 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?

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?

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

2006-01-10 15:05:53

by Michael Krufky

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

On 1/6/06, Russell King <[email protected]> wrote:
> Signed-off-by: Russell King <[email protected]>
>
> (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(-)
>
> diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
> --- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
> +++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
> @@ -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)
> diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bttv-gpio.c
> --- a/drivers/media/video/bttv-gpio.c
> +++ b/drivers/media/video/bttv-gpio.c
> @@ -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);
>
> diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h
> --- a/drivers/media/video/bttv.h
> +++ b/drivers/media/video/bttv.h
> @@ -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);
> };
> diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c
> --- a/drivers/media/video/ir-kbd-gpio.c
> +++ b/drivers/media/video/ir-kbd-gpio.c
> @@ -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);
>
> --
> 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

2006-01-11 09:57:08

by Cornelia Huck

[permalink] [raw]
Subject: [PATCH] Add {css,ccw}_bus_type probe, remove, shutdown methods.

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.

Signed-off-by: Cornelia Huck <[email protected]>
CC: Martin Schwidefsky <[email protected]>

css.c | 36 ++++++++++++++++++++++++++++++++++--
css.h | 4 ++++
device.c | 50 ++++++++++++++++++++++++--------------------------
3 files changed, 62 insertions(+), 28 deletions(-)

diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index e565193..2d319fb 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -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);
diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h
index 251ebd7..aa5ab5d 100644
--- a/drivers/s390/cio/css.h
+++ b/drivers/s390/cio/css.h
@@ -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 *);
};

/*
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index fa3e4c0..eb73605 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -107,33 +107,29 @@ ccw_uevent (struct device *dev, char **e
return 0;
}

-struct bus_type ccw_bus_type = {
- .name = "ccw",
- .match = &ccw_bus_match,
- .uevent = &ccw_uevent,
-};
+struct bus_type ccw_bus_type;

-static int io_subchannel_probe (struct device *);
-static int io_subchannel_remove (struct device *);
+static int io_subchannel_probe (struct subchannel *);
+static int io_subchannel_remove (struct subchannel *);
void io_subchannel_irq (struct device *);
static int io_subchannel_notify(struct device *, int);
static void io_subchannel_verify(struct device *);
static void io_subchannel_ioterm(struct device *);
-static void io_subchannel_shutdown(struct device *);
+static void io_subchannel_shutdown(struct subchannel *);

struct css_driver io_subchannel_driver = {
.subchannel_type = SUBCHANNEL_TYPE_IO,
.drv = {
.name = "io_subchannel",
.bus = &css_bus_type,
- .probe = &io_subchannel_probe,
- .remove = &io_subchannel_remove,
- .shutdown = &io_subchannel_shutdown,
},
.irq = io_subchannel_irq,
.notify = io_subchannel_notify,
.verify = io_subchannel_verify,
.termination = io_subchannel_ioterm,
+ .probe = io_subchannel_probe,
+ .remove = io_subchannel_remove,
+ .shutdown = io_subchannel_shutdown,
};

struct workqueue_struct *ccw_device_work;
@@ -803,14 +799,12 @@ io_subchannel_recog(struct ccw_device *c
}

static int
-io_subchannel_probe (struct device *pdev)
+io_subchannel_probe (struct subchannel *sch)
{
- struct subchannel *sch;
struct ccw_device *cdev;
int rc;
unsigned long flags;

- sch = to_subchannel(pdev);
if (sch->dev.driver_data) {
/*
* This subchannel already has an associated ccw_device.
@@ -846,7 +840,7 @@ io_subchannel_probe (struct device *pdev
memset(cdev->private, 0, sizeof(struct ccw_device_private));
atomic_set(&cdev->private->onoff, 0);
cdev->dev = (struct device) {
- .parent = pdev,
+ .parent = &sch->dev,
.release = ccw_device_release,
};
INIT_LIST_HEAD(&cdev->private->kick_work.entry);
@@ -859,7 +853,7 @@ io_subchannel_probe (struct device *pdev
return -ENODEV;
}

- rc = io_subchannel_recog(cdev, to_subchannel(pdev));
+ rc = io_subchannel_recog(cdev, sch);
if (rc) {
spin_lock_irqsave(&sch->lock, flags);
sch->dev.driver_data = NULL;
@@ -883,17 +877,17 @@ ccw_device_unregister(void *data)
}

static int
-io_subchannel_remove (struct device *dev)
+io_subchannel_remove (struct subchannel *sch)
{
struct ccw_device *cdev;
unsigned long flags;

- if (!dev->driver_data)
+ if (!sch->dev.driver_data)
return 0;
- cdev = dev->driver_data;
+ cdev = sch->dev.driver_data;
/* Set ccw device to not operational and drop reference. */
spin_lock_irqsave(cdev->ccwlock, flags);
- dev->driver_data = NULL;
+ sch->dev.driver_data = NULL;
cdev->private->state = DEV_STATE_NOT_OPER;
spin_unlock_irqrestore(cdev->ccwlock, flags);
/*
@@ -948,14 +942,12 @@ io_subchannel_ioterm(struct device *dev)
}

static void
-io_subchannel_shutdown(struct device *dev)
+io_subchannel_shutdown(struct subchannel *sch)
{
- struct subchannel *sch;
struct ccw_device *cdev;
int ret;

- sch = to_subchannel(dev);
- cdev = dev->driver_data;
+ cdev = sch->dev.driver_data;

if (cio_is_console(sch->schid))
return;
@@ -1129,6 +1121,14 @@ ccw_device_remove (struct device *dev)
return 0;
}

+struct bus_type ccw_bus_type = {
+ .name = "ccw",
+ .match = ccw_bus_match,
+ .uevent = ccw_uevent,
+ .probe = ccw_device_probe,
+ .remove = ccw_device_remove,
+};
+
int
ccw_driver_register (struct ccw_driver *cdriver)
{
@@ -1136,8 +1136,6 @@ ccw_driver_register (struct ccw_driver *

drv->bus = &ccw_bus_type;
drv->name = cdriver->name;
- drv->probe = ccw_device_probe;
- drv->remove = ccw_device_remove;

return driver_register(drv);
}

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

On 1/6/06, Russell King <[email protected]> wrote:
> Signed-off-by: Russell King <[email protected]>
>
> (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:

Acked-by: Bartlomiej Zolnierkiewicz <[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(-)

2006-01-12 09:46:07

by Paul Jackson

[permalink] [raw]
Subject: 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.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401

2006-01-12 10:32:30

by Paul Jackson

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

pj wrote:
> This patch looks broken. I see the lines:
>
> + .remove = cx_device_remove,
> - cx_driver->driver.remove = cx_driver_remove;

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

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401