Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Linus Torvalds committed Jan 14, 2006
2 parents 3824ba7 + 9c08a93 commit 3e2b32b
Show file tree
Hide file tree
Showing 48 changed files with 358 additions and 256 deletions.
4 changes: 2 additions & 2 deletions arch/arm/common/locomo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,14 +1103,14 @@ static int locomo_bus_remove(struct device *dev)
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);
}
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/common/sa1111.c
Original file line number Diff line number Diff line change
Expand Up @@ -1247,14 +1247,14 @@ static int sa1111_bus_remove(struct device *dev)
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);
}
Expand Down
14 changes: 8 additions & 6 deletions arch/arm/kernel/ecard.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,9 +1147,11 @@ static void ecard_drv_shutdown(struct device *dev)
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.
Expand All @@ -1164,9 +1166,6 @@ static void ecard_drv_shutdown(struct device *dev)
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);
}
Expand Down Expand Up @@ -1195,6 +1194,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)
Expand Down
36 changes: 18 additions & 18 deletions arch/arm/mach-integrator/lm.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ static int lm_match(struct device *dev, struct device_driver *drv)
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);
Expand All @@ -49,16 +35,30 @@ static int lm_bus_remove(struct device *dev)
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);
}

Expand Down
16 changes: 8 additions & 8 deletions arch/ia64/sn/kernel/tiocx.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ static void tiocx_bus_release(struct device *dev)
kfree(to_cx_dev(dev));
}

struct bus_type tiocx_bus_type = {
.name = "tiocx",
.match = tiocx_match,
.uevent = tiocx_uevent,
};

/**
* cx_device_match - Find cx_device in the id table.
* @ids: id table from driver
Expand Down Expand Up @@ -149,6 +143,14 @@ static int cx_driver_remove(struct device *dev)
return 0;
}

struct bus_type tiocx_bus_type = {
.name = "tiocx",
.match = tiocx_match,
.uevent = tiocx_uevent,
.probe = cx_device_probe,
.remove = cx_driver_remove,
};

/**
* cx_driver_register - Register the driver.
* @cx_driver: driver table (cx_drv struct) from driver
Expand All @@ -162,8 +164,6 @@ int cx_driver_register(struct cx_drv *cx_driver)
{
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);
}
Expand Down
4 changes: 2 additions & 2 deletions arch/parisc/kernel/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ int register_parisc_driver(struct parisc_driver *driver)
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);
Expand Down Expand Up @@ -575,6 +573,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,
};

/**
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/kernel/of_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ static int of_device_resume(struct device * dev)
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,
};
Expand All @@ -150,8 +152,6 @@ int of_register_driver(struct of_platform_driver *drv)
/* 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);
Expand Down
8 changes: 4 additions & 4 deletions arch/powerpc/kernel/vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static void vio_bus_shutdown(struct device *dev)
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);
}

Expand All @@ -91,9 +91,6 @@ int vio_register_driver(struct vio_driver *viodrv)

/* 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);
}
Expand Down Expand Up @@ -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,
};
4 changes: 2 additions & 2 deletions arch/ppc/syslib/ocp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -210,8 +212,6 @@ ocp_register_driver(struct ocp_driver *drv)
/* 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);
Expand Down
34 changes: 17 additions & 17 deletions arch/sh/kernel/cpu/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,6 @@ static int sh_bus_resume(struct device *dev)
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);
Expand All @@ -90,6 +75,23 @@ static int sh_device_remove(struct device *dev)
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)
Expand Down Expand Up @@ -133,8 +135,6 @@ int sh_driver_register(struct sh_driver *drv)
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);
Expand Down
12 changes: 10 additions & 2 deletions drivers/base/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ int driver_probe_device(struct device_driver * drv, struct device * dev)
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;
Expand Down Expand Up @@ -203,7 +209,9 @@ static void __device_release_driver(struct device * dev)
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);
Expand Down
5 changes: 5 additions & 0 deletions drivers/base/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ static void klist_devices_put(struct klist_node *n)
*/
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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ EXPORT_SYMBOL_GPL(platform_device_register);
* @pdev: platform device we're unregistering
*
* Unregistration is done in 2 steps. Fisrt we release all resources
* and remove it from the sybsystem, then we drop reference count by
* and remove it from the subsystem, then we drop reference count by
* calling platform_device_put().
*/
void platform_device_unregister(struct platform_device * pdev)
Expand Down
9 changes: 6 additions & 3 deletions drivers/base/power/shutdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ extern int sysdev_shutdown(void);
*/
void device_shutdown(void)
{
struct device * dev;
struct device * dev, *devn;

down_write(&devices_subsys.rwsem);
list_for_each_entry_reverse(dev, &devices_subsys.kset.list,
list_for_each_entry_safe_reverse(dev, devn, &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);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/dio/dio-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ int dio_register_driver(struct dio_driver *drv)
/* 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);
Expand Down Expand Up @@ -145,7 +144,8 @@ static int dio_bus_match(struct device *dev, struct device_driver *drv)

struct bus_type dio_bus_type = {
.name = "dio",
.match = dio_bus_match
.match = dio_bus_match,
.probe = dio_device_probe,
};


Expand Down
Loading

0 comments on commit 3e2b32b

Please sign in to comment.