Commit 3e2b32b6 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6

parents 3824ba7d 9c08a938
...@@ -1103,14 +1103,14 @@ static int locomo_bus_remove(struct device *dev) ...@@ -1103,14 +1103,14 @@ static int locomo_bus_remove(struct device *dev)
struct bus_type locomo_bus_type = { struct bus_type locomo_bus_type = {
.name = "locomo-bus", .name = "locomo-bus",
.match = locomo_match, .match = locomo_match,
.probe = locomo_bus_probe,
.remove = locomo_bus_remove,
.suspend = locomo_bus_suspend, .suspend = locomo_bus_suspend,
.resume = locomo_bus_resume, .resume = locomo_bus_resume,
}; };
int locomo_driver_register(struct locomo_driver *driver) 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; driver->drv.bus = &locomo_bus_type;
return driver_register(&driver->drv); return driver_register(&driver->drv);
} }
......
...@@ -1247,14 +1247,14 @@ static int sa1111_bus_remove(struct device *dev) ...@@ -1247,14 +1247,14 @@ static int sa1111_bus_remove(struct device *dev)
struct bus_type sa1111_bus_type = { struct bus_type sa1111_bus_type = {
.name = "sa1111-rab", .name = "sa1111-rab",
.match = sa1111_match, .match = sa1111_match,
.probe = sa1111_bus_probe,
.remove = sa1111_bus_remove,
.suspend = sa1111_bus_suspend, .suspend = sa1111_bus_suspend,
.resume = sa1111_bus_resume, .resume = sa1111_bus_resume,
}; };
int sa1111_driver_register(struct sa1111_driver *driver) 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; driver->drv.bus = &sa1111_bus_type;
return driver_register(&driver->drv); return driver_register(&driver->drv);
} }
......
...@@ -1147,9 +1147,11 @@ static void ecard_drv_shutdown(struct device *dev) ...@@ -1147,9 +1147,11 @@ static void ecard_drv_shutdown(struct device *dev)
struct ecard_driver *drv = ECARD_DRV(dev->driver); struct ecard_driver *drv = ECARD_DRV(dev->driver);
struct ecard_request req; struct ecard_request req;
if (drv->shutdown) if (dev->driver) {
drv->shutdown(ec); if (drv->shutdown)
ecard_release(ec); drv->shutdown(ec);
ecard_release(ec);
}
/* /*
* If this card has a loader, call the reset handler. * If this card has a loader, call the reset handler.
...@@ -1164,9 +1166,6 @@ static void ecard_drv_shutdown(struct device *dev) ...@@ -1164,9 +1166,6 @@ static void ecard_drv_shutdown(struct device *dev)
int ecard_register_driver(struct ecard_driver *drv) int ecard_register_driver(struct ecard_driver *drv)
{ {
drv->drv.bus = &ecard_bus_type; 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); return driver_register(&drv->drv);
} }
...@@ -1195,6 +1194,9 @@ struct bus_type ecard_bus_type = { ...@@ -1195,6 +1194,9 @@ struct bus_type ecard_bus_type = {
.name = "ecard", .name = "ecard",
.dev_attrs = ecard_dev_attrs, .dev_attrs = ecard_dev_attrs,
.match = ecard_match, .match = ecard_match,
.probe = ecard_drv_probe,
.remove = ecard_drv_remove,
.shutdown = ecard_drv_shutdown,
}; };
static int ecard_bus_init(void) static int ecard_bus_init(void)
......
...@@ -22,20 +22,6 @@ static int lm_match(struct device *dev, struct device_driver *drv) ...@@ -22,20 +22,6 @@ static int lm_match(struct device *dev, struct device_driver *drv)
return 1; 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) static int lm_bus_probe(struct device *dev)
{ {
struct lm_device *lmdev = to_lm_device(dev); struct lm_device *lmdev = to_lm_device(dev);
...@@ -49,16 +35,30 @@ static int lm_bus_remove(struct device *dev) ...@@ -49,16 +35,30 @@ static int lm_bus_remove(struct device *dev)
struct lm_device *lmdev = to_lm_device(dev); struct lm_device *lmdev = to_lm_device(dev);
struct lm_driver *lmdrv = to_lm_driver(dev->driver); struct lm_driver *lmdrv = to_lm_driver(dev->driver);
lmdrv->remove(lmdev); if (lmdrv->remove)
lmdrv->remove(lmdev);
return 0; 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) int lm_driver_register(struct lm_driver *drv)
{ {
drv->drv.bus = &lm_bustype; drv->drv.bus = &lm_bustype;
drv->drv.probe = lm_bus_probe;
drv->drv.remove = lm_bus_remove;
return driver_register(&drv->drv); return driver_register(&drv->drv);
} }
......
...@@ -77,12 +77,6 @@ static void tiocx_bus_release(struct device *dev) ...@@ -77,12 +77,6 @@ static void tiocx_bus_release(struct device *dev)
kfree(to_cx_dev(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. * cx_device_match - Find cx_device in the id table.
* @ids: id table from driver * @ids: id table from driver
...@@ -149,6 +143,14 @@ static int cx_driver_remove(struct device *dev) ...@@ -149,6 +143,14 @@ static int cx_driver_remove(struct device *dev)
return 0; 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_register - Register the driver.
* @cx_driver: driver table (cx_drv struct) from driver * @cx_driver: driver table (cx_drv struct) from driver
...@@ -162,8 +164,6 @@ int cx_driver_register(struct cx_drv *cx_driver) ...@@ -162,8 +164,6 @@ int cx_driver_register(struct cx_drv *cx_driver)
{ {
cx_driver->driver.name = cx_driver->name; cx_driver->driver.name = cx_driver->name;
cx_driver->driver.bus = &tiocx_bus_type; 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); return driver_register(&cx_driver->driver);
} }
......
...@@ -173,8 +173,6 @@ int register_parisc_driver(struct parisc_driver *driver) ...@@ -173,8 +173,6 @@ int register_parisc_driver(struct parisc_driver *driver)
WARN_ON(driver->drv.probe != NULL); WARN_ON(driver->drv.probe != NULL);
WARN_ON(driver->drv.remove != NULL); WARN_ON(driver->drv.remove != NULL);
driver->drv.probe = parisc_driver_probe;
driver->drv.remove = parisc_driver_remove;
driver->drv.name = driver->name; driver->drv.name = driver->name;
return driver_register(&driver->drv); return driver_register(&driver->drv);
...@@ -575,6 +573,8 @@ struct bus_type parisc_bus_type = { ...@@ -575,6 +573,8 @@ struct bus_type parisc_bus_type = {
.name = "parisc", .name = "parisc",
.match = parisc_generic_match, .match = parisc_generic_match,
.dev_attrs = parisc_device_attrs, .dev_attrs = parisc_device_attrs,
.probe = parisc_driver_probe,
.remove = parisc_driver_remove,
}; };
/** /**
......
...@@ -132,6 +132,8 @@ static int of_device_resume(struct device * dev) ...@@ -132,6 +132,8 @@ static int of_device_resume(struct device * dev)
struct bus_type of_platform_bus_type = { struct bus_type of_platform_bus_type = {
.name = "of_platform", .name = "of_platform",
.match = of_platform_bus_match, .match = of_platform_bus_match,
.probe = of_device_probe,
.remove = of_device_remove,
.suspend = of_device_suspend, .suspend = of_device_suspend,
.resume = of_device_resume, .resume = of_device_resume,
}; };
...@@ -150,8 +152,6 @@ int of_register_driver(struct of_platform_driver *drv) ...@@ -150,8 +152,6 @@ int of_register_driver(struct of_platform_driver *drv)
/* initialize common driver fields */ /* initialize common driver fields */
drv->driver.name = drv->name; drv->driver.name = drv->name;
drv->driver.bus = &of_platform_bus_type; drv->driver.bus = &of_platform_bus_type;
drv->driver.probe = of_device_probe;
drv->driver.remove = of_device_remove;
/* register with core */ /* register with core */
count = driver_register(&drv->driver); count = driver_register(&drv->driver);
......
...@@ -76,7 +76,7 @@ static void vio_bus_shutdown(struct device *dev) ...@@ -76,7 +76,7 @@ static void vio_bus_shutdown(struct device *dev)
struct vio_dev *viodev = to_vio_dev(dev); struct vio_dev *viodev = to_vio_dev(dev);
struct vio_driver *viodrv = to_vio_driver(dev->driver); struct vio_driver *viodrv = to_vio_driver(dev->driver);
if (viodrv->shutdown) if (dev->driver && viodrv->shutdown)
viodrv->shutdown(viodev); viodrv->shutdown(viodev);
} }
...@@ -91,9 +91,6 @@ int vio_register_driver(struct vio_driver *viodrv) ...@@ -91,9 +91,6 @@ int vio_register_driver(struct vio_driver *viodrv)
/* fill in 'struct driver' fields */ /* fill in 'struct driver' fields */
viodrv->driver.bus = &vio_bus_type; 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); return driver_register(&viodrv->driver);
} }
...@@ -295,4 +292,7 @@ struct bus_type vio_bus_type = { ...@@ -295,4 +292,7 @@ struct bus_type vio_bus_type = {
.name = "vio", .name = "vio",
.uevent = vio_hotplug, .uevent = vio_hotplug,
.match = vio_bus_match, .match = vio_bus_match,
.probe = vio_bus_probe,
.remove = vio_bus_remove,
.shutdown = vio_bus_shutdown,
}; };
...@@ -189,6 +189,8 @@ ocp_device_resume(struct device *dev) ...@@ -189,6 +189,8 @@ ocp_device_resume(struct device *dev)
struct bus_type ocp_bus_type = { struct bus_type ocp_bus_type = {
.name = "ocp", .name = "ocp",
.match = ocp_device_match, .match = ocp_device_match,
.probe = ocp_driver_probe,
.remove = ocp_driver_remove,
.suspend = ocp_device_suspend, .suspend = ocp_device_suspend,
.resume = ocp_device_resume, .resume = ocp_device_resume,
}; };
...@@ -210,8 +212,6 @@ ocp_register_driver(struct ocp_driver *drv) ...@@ -210,8 +212,6 @@ ocp_register_driver(struct ocp_driver *drv)
/* initialize common driver fields */ /* initialize common driver fields */
drv->driver.name = drv->name; drv->driver.name = drv->name;
drv->driver.bus = &ocp_bus_type; drv->driver.bus = &ocp_bus_type;
drv->driver.probe = ocp_device_probe;
drv->driver.remove = ocp_device_remove;
/* register with core */ /* register with core */
return driver_register(&drv->driver); return driver_register(&drv->driver);
......
...@@ -53,21 +53,6 @@ static int sh_bus_resume(struct device *dev) ...@@ -53,21 +53,6 @@ static int sh_bus_resume(struct device *dev)
return 0; 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) static int sh_device_probe(struct device *dev)
{ {
struct sh_dev *shdev = to_sh_dev(dev); struct sh_dev *shdev = to_sh_dev(dev);
...@@ -90,6 +75,23 @@ static int sh_device_remove(struct device *dev) ...@@ -90,6 +75,23 @@ static int sh_device_remove(struct device *dev)
return 0; 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) int sh_device_register(struct sh_dev *dev)
{ {
if (!dev) if (!dev)
...@@ -133,8 +135,6 @@ int sh_driver_register(struct sh_driver *drv) ...@@ -133,8 +135,6 @@ int sh_driver_register(struct sh_driver *drv)
return -EINVAL; return -EINVAL;
} }
drv->drv.probe = sh_device_probe;
drv->drv.remove = sh_device_remove;
drv->drv.bus = &sh_bus_types[drv->bus_id]; drv->drv.bus = &sh_bus_types[drv->bus_id];
return driver_register(&drv->drv); return driver_register(&drv->drv);
......
...@@ -78,7 +78,13 @@ int driver_probe_device(struct device_driver * drv, struct device * dev) ...@@ -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", pr_debug("%s: Matched Device %s with Driver %s\n",
drv->bus->name, dev->bus_id, drv->name); drv->bus->name, dev->bus_id, drv->name);
dev->driver = drv; 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); ret = drv->probe(dev);
if (ret) { if (ret) {
dev->driver = NULL; dev->driver = NULL;
...@@ -203,7 +209,9 @@ static void __device_release_driver(struct device * dev) ...@@ -203,7 +209,9 @@ static void __device_release_driver(struct device * dev)
sysfs_remove_link(&dev->kobj, "driver"); sysfs_remove_link(&dev->kobj, "driver");
klist_remove(&dev->knode_driver); klist_remove(&dev->knode_driver);
if (drv->remove) if (dev->bus->remove)
dev->bus->remove(dev);
else if (drv->remove)
drv->remove(dev); drv->remove(dev);
dev->driver = NULL; dev->driver = NULL;
put_driver(drv); put_driver(drv);
......
...@@ -171,6 +171,11 @@ static void klist_devices_put(struct klist_node *n) ...@@ -171,6 +171,11 @@ static void klist_devices_put(struct klist_node *n)
*/ */
int driver_register(struct device_driver * drv) 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); klist_init(&drv->klist_devices, klist_devices_get, klist_devices_put);
init_completion(&drv->unloaded); init_completion(&drv->unloaded);
return bus_add_driver(drv); return bus_add_driver(drv);
......
...@@ -327,7 +327,7 @@ EXPORT_SYMBOL_GPL(platform_device_register); ...@@ -327,7 +327,7 @@ EXPORT_SYMBOL_GPL(platform_device_register);
* @pdev: platform device we're unregistering * @pdev: platform device we're unregistering
* *
* Unregistration is done in 2 steps. Fisrt we release all resources * 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(). * calling platform_device_put().
*/ */
void platform_device_unregister(struct platform_device * pdev) void platform_device_unregister(struct platform_device * pdev)
......
...@@ -35,12 +35,15 @@ extern int sysdev_shutdown(void); ...@@ -35,12 +35,15 @@ extern int sysdev_shutdown(void);
*/ */
void device_shutdown(void) void device_shutdown(void)
{ {
struct device * dev; struct device * dev, *devn;
down_write(&devices_subsys.rwsem); 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) { 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_dbg(dev, "shutdown\n");
dev->driver->shutdown(dev); dev->driver->shutdown(dev);
} }
......
...@@ -83,7 +83,6 @@ int dio_register_driver(struct dio_driver *drv) ...@@ -83,7 +83,6 @@ int dio_register_driver(struct dio_driver *drv)
/* initialize common driver fields */ /* initialize common driver fields */
drv->driver.name = drv->name; drv->driver.name = drv->name;
drv->driver.bus = &dio_bus_type; drv->driver.bus = &dio_bus_type;
drv->driver.probe = dio_device_probe;
/* register with core */ /* register with core */
count = driver_register(&drv->driver); count = driver_register(&drv->driver);
...@@ -145,7 +144,8 @@ static int dio_bus_match(struct device *dev, struct device_driver *drv) ...@@ -145,7 +144,8 @@ static int dio_bus_match(struct device *dev, struct device_driver *drv)
struct bus_type dio_bus_type = { struct bus_type dio_bus_type = {
.name = "dio", .name = "dio",
.match = dio_bus_match .match = dio_bus_match,
.probe = dio_device_probe,
}; };
......
...@@ -63,13 +63,6 @@ static int i2c_bus_resume(struct device * dev) ...@@ -63,13 +63,6 @@ static int i2c_bus_resume(struct device * dev)
return rc; 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) static int i2c_device_probe(struct device *dev)
{ {
return -ENODEV; return -ENODEV;
...@@ -80,6 +73,15 @@ static int i2c_device_remove(struct device *dev) ...@@ -80,6 +73,15 @@ static int i2c_device_remove(struct device *dev)
return 0; 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) void i2c_adapter_dev_release(struct device *dev)
{ {
struct i2c_adapter *adap = dev_to_i2c_adapter(dev); struct i2c_adapter *adap = dev_to_i2c_adapter(dev);
...@@ -90,8 +92,6 @@ struct device_driver i2c_adapter_driver = { ...@@ -90,8 +92,6 @@ struct device_driver i2c_adapter_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "i2c_adapter", .name = "i2c_adapter",
.bus = &i2c_bus_type, .bus = &i2c_bus_type,
.probe = i2c_device_probe,
.remove = i2c_device_remove,
}; };
static void i2c_adapter_class_dev_release(struct class_device *dev) static void i2c_adapter_class_dev_release(struct class_device *dev)
...@@ -294,8 +294,6 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) ...@@ -294,8 +294,6 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
/* add the driver to the list of i2c drivers in the driver core */ /* add the driver to the list of i2c drivers in the driver core */
driver->driver.owner = owner; driver->driver.owner = owner;
driver->driver.bus = &i2c_bus_type; driver->driver.bus = &i2c_bus_type;
driver->driver.probe = i2c_device_probe;
driver->driver.remove = i2c_device_remove;
res = driver_register(&driver->driver); res = driver_register(&driver->driver);
if (res) if (res)
......
...@@ -3256,9 +3256,8 @@ sector_t ide_cdrom_capacity (ide_drive_t *drive) ...@@ -3256,9 +3256,8 @@ sector_t ide_cdrom_capacity (ide_drive_t *drive)
} }
#endif #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; struct cdrom_info *info = drive->driver_data;
ide_unregister_subdriver(drive, info->driver); ide_unregister_subdriver(drive, info->driver);
...@@ -3266,8 +3265,6 @@ static int ide_cd_remove(struct device *dev) ...@@ -3266,8 +3265,6 @@ static int ide_cd_remove(struct device *dev)
del_gendisk(info->disk); del_gendisk(info->disk);
ide_cd_put(info); ide_cd_put(info);
return 0;
} }
static void ide_cd_release(struct kref *kref) static void ide_cd_release(struct kref *kref)
...@@ -3291,7 +3288,7 @@ static void ide_cd_release(struct kref *kref) ...@@ -3291,7 +3288,7 @@ static void ide_cd_release(struct kref *kref)
kfree(info); kfree(info);
} }
static int ide_cd_probe(struct device *); static int ide_cd_probe(ide_drive_t *);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static int proc_idecd_read_capacity static int proc_idecd_read_capacity
...@@ -3317,9 +3314,9 @@ static ide_driver_t ide_cdrom_driver = { ...@@ -3317,9 +3314,9 @@ static ide_driver_t ide_cdrom_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ide-cdrom", .name = "ide-cdrom",
.bus = &ide_bus_type, .bus = &ide_bus_type,
.probe = ide_cd_probe,
.remove = ide_cd_remove,
}, },
.probe = ide_cd_probe,
.remove = ide_cd_remove,
.version = IDECD_VERSION, .version = IDECD_VERSION,
.media = ide_cdrom, .media = ide_cdrom,
.supports_dsc_overlap = 1, .supports_dsc_overlap = 1,
...@@ -3413,9 +3410,8 @@ static char *ignore = NULL; ...@@ -3413,9 +3410,8 @@ static char *ignore = NULL;
module_param(ignore, charp, 0400); module_param(ignore, charp, 0400);
MODULE_DESCRIPTION("ATAPI CD-ROM Driver"); 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 cdrom_info *info;
struct gendisk *g; struct gendisk *g;
struct request_sense sense; struct request_sense sense;
......
...@@ -997,9 +997,8 @@ static void ide_cacheflush_p(ide_drive_t *drive) ...@@ -997,9 +997,8 @@ static void ide_cacheflush_p(ide_drive_t *drive)
printk(KERN_INFO "%s: wcache flush failed!\n", drive->name); 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 ide_disk_obj *idkp = drive->driver_data;
struct gendisk *g = idkp->disk; struct gendisk *g = idkp->disk;
...@@ -1010,8 +1009,6 @@ static int ide_disk_remove(struct device *dev) ...@@ -1010,8 +1009,6 @@ static int ide_disk_remove(struct device *dev)
ide_cacheflush_p(drive); ide_cacheflush_p(drive);
ide_disk_put(idkp); ide_disk_put(idkp);
return 0;
} }
static void ide_disk_release(struct kref *kref) static void ide_disk_release(struct kref *kref)
...@@ -1027,12 +1024,10 @@ static void ide_disk_release(struct kref *kref) ...@@ -1027,12 +1024,10 @@ static void ide_disk_release(struct kref *kref)
kfree(idkp); 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 #ifdef CONFIG_ALPHA
/* On Alpha, halt(8) doesn't actually turn the machine off, /* On Alpha, halt(8) doesn't actually turn the machine off,
it puts you into the sort of firmware monitor. Typically, it puts you into the sort of firmware monitor. Typically,
...@@ -1054,7 +1049,7 @@ static void ide_device_shutdown(struct device *dev) ...@@ -1054,7 +1049,7 @@ static void ide_device_shutdown(struct device *dev)
} }
printk("Shutdown: %s\n", drive->name); 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 = { static ide_driver_t idedisk_driver = {
...@@ -1062,10 +1057,10 @@ static ide_driver_t idedisk_driver = { ...@@ -1062,10 +1057,10 @@ static ide_driver_t idedisk_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ide-disk", .name = "ide-disk",
.bus = &ide_bus_type, .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, .version = IDEDISK_VERSION,
.media = ide_disk, .media = ide_disk,
.supports_dsc_overlap = 0, .supports_dsc_overlap = 0,
...@@ -1182,9 +1177,8 @@ static struct block_device_operations idedisk_ops = { ...@@ -1182,9 +1177,8 @@ static struct block_device_operations idedisk_ops = {
MODULE_DESCRIPTION("ATA DISK Driver"); 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 ide_disk_obj *idkp;
struct gendisk *g; struct gendisk *g;
......
...@@ -1871,9 +1871,8 @@ static void idefloppy_setup (ide_drive_t *drive, idefloppy_floppy_t *floppy) ...@@ -1871,9 +1871,8 @@ static void idefloppy_setup (ide_drive_t *drive, idefloppy_floppy_t *floppy)
idefloppy_add_settings(drive); 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; idefloppy_floppy_t *floppy = drive->driver_data;
struct gendisk *g = floppy->disk; struct gendisk *g = floppy->disk;
...@@ -1882,8 +1881,6 @@ static int ide_floppy_remove(struct device *dev) ...@@ -1882,8 +1881,6 @@ static int ide_floppy_remove(struct device *dev)
del_gendisk(g); del_gendisk(g);
ide_floppy_put(floppy); ide_floppy_put(floppy);
return 0;
} }
static void ide_floppy_release(struct kref *kref) static void ide_floppy_release(struct kref *kref)
...@@ -1922,16 +1919,16 @@ static ide_proc_entry_t idefloppy_proc[] = { ...@@ -1922,16 +1919,16 @@ static ide_proc_entry_t idefloppy_proc[] = {
#endif /* CONFIG_PROC_FS */ #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 = { static ide_driver_t idefloppy_driver = {
.gen_driver = { .gen_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ide-floppy", .name = "ide-floppy",
.bus = &ide_bus_type, .bus = &ide_bus_type,
.probe = ide_floppy_probe,
.remove = ide_floppy_remove,
}, },
.probe = ide_floppy_probe,
.remove = ide_floppy_remove,
.version = IDEFLOPPY_VERSION, .version = IDEFLOPPY_VERSION,
.media = ide_floppy, .media = ide_floppy,
.supports_dsc_overlap = 0, .supports_dsc_overlap = 0,
...@@ -2136,9 +2133,8 @@ static struct block_device_operations idefloppy_ops = { ...@@ -2136,9 +2133,8 @@ static struct block_device_operations idefloppy_ops = {
.revalidate_disk= idefloppy_revalidate_disk .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; idefloppy_floppy_t *floppy;
struct gendisk *g; struct gendisk *g;
......
...@@ -4682,9 +4682,8 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor) ...@@ -4682,9 +4682,8 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor)
idetape_add_settings(drive); 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; idetape_tape_t *tape = drive->driver_data;
ide_unregister_subdriver(drive, tape->driver); ide_unregister_subdriver(drive, tape->driver);
...@@ -4692,8 +4691,6 @@ static int ide_tape_remove(struct device *dev) ...@@ -4692,8 +4691,6 @@ static int ide_tape_remove(struct device *dev)
ide_unregister_region(tape->disk); ide_unregister_region(tape->disk);
ide_tape_put(tape); ide_tape_put(tape);
return 0;
} }
static void ide_tape_release(struct kref *kref) static void ide_tape_release(struct kref *kref)
...@@ -4745,16 +4742,16 @@ static ide_proc_entry_t idetape_proc[] = { ...@@ -4745,16 +4742,16 @@ static ide_proc_entry_t idetape_proc[] = {
#endif #endif
static int ide_tape_probe(struct device *); static int ide_tape_probe(ide_drive_t *);
static ide_driver_t idetape_driver = { static ide_driver_t idetape_driver = {
.gen_driver = { .gen_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "ide-tape", .name = "ide-tape",
.bus = &ide_bus_type, .bus = &ide_bus_type,
.probe = ide_tape_probe,
.remove = ide_tape_remove,
}, },
.probe = ide_tape_probe,
.remove = ide_tape_remove,
.version = IDETAPE_VERSION, .version = IDETAPE_VERSION,
.media = ide_tape, .media = ide_tape,
.supports_dsc_overlap = 1, .supports_dsc_overlap = 1,
...@@ -4825,9 +4822,8 @@ static struct block_device_operations idetape_block_ops = { ...@@ -4825,9 +4822,8 @@ static struct block_device_operations idetape_block_ops = {
.ioctl = idetape_ioctl, .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; idetape_tape_t *tape;
struct gendisk *g; struct gendisk *g;
int minor; int minor;
...@@ -4883,9 +4879,9 @@ static int ide_tape_probe(struct device *dev) ...@@ -4883,9 +4879,9 @@ static int ide_tape_probe(struct device *dev)
idetape_setup(drive, tape, minor); idetape_setup(drive, tape, minor);
class_device_create(idetape_sysfs_class, NULL, 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, 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), devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor),
S_IFCHR | S_IRUGO | S_IWUGO, S_IFCHR | S_IRUGO | S_IWUGO,
......
...@@ -1949,10 +1949,41 @@ static int ide_uevent(struct device *dev, char **envp, int num_envp, ...@@ -1949,10 +1949,41 @@ static int ide_uevent(struct device *dev, char **envp, int num_envp,
return 0; return 0;
} }
static int generic_ide_probe(struct device *dev)
{
ide_drive_t *drive = to_ide_device(dev);
ide_driver_t *drv = to_ide_driver(dev->driver);
return drv->probe ? drv->probe(drive) : -ENODEV;
}
static int generic_ide_remove(struct device *dev)
{
ide_drive_t *drive = to_ide_device(dev);
ide_driver_t *drv = to_ide_driver(dev->driver);
if (drv->remove)
drv->remove(drive);
return 0;
}
static void generic_ide_shutdown(struct device *dev)
{
ide_drive_t *drive = to_ide_device(dev);
ide_driver_t *drv = to_ide_driver(dev->driver);
if (dev->driver && drv->shutdown)
drv->shutdown(drive);
}
struct bus_type ide_bus_type = { struct bus_type ide_bus_type = {
.name = "ide", .name = "ide",
.match = ide_bus_match, .match = ide_bus_match,
.uevent = ide_uevent, .uevent = ide_uevent,
.probe = generic_ide_probe,
.remove = generic_ide_remove,
.shutdown = generic_ide_shutdown,
.dev_attrs = ide_dev_attrs, .dev_attrs = ide_dev_attrs,
.suspend = generic_ide_suspend, .suspend = generic_ide_suspend,
.resume = generic_ide_resume, .resume = generic_ide_resume,
......
...@@ -50,9 +50,7 @@ static DECLARE_MUTEX(gameport_sem); ...@@ -50,9 +50,7 @@ static DECLARE_MUTEX(gameport_sem);
static LIST_HEAD(gameport_list); static LIST_HEAD(gameport_list);
static struct bus_type gameport_bus = { static struct bus_type gameport_bus;
.name = "gameport",
};
static void gameport_add_port(struct gameport *gameport); static void gameport_add_port(struct gameport *gameport);
static void gameport_destroy_port(struct gameport *gameport); static void gameport_destroy_port(struct gameport *gameport);
...@@ -703,11 +701,15 @@ static int gameport_driver_remove(struct device *dev) ...@@ -703,11 +701,15 @@ static int gameport_driver_remove(struct device *dev)
return 0; 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) void __gameport_register_driver(struct gameport_driver *drv, struct module *owner)
{ {
drv->driver.bus = &gameport_bus; 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); gameport_queue_event(drv, owner, GAMEPORT_REGISTER_DRIVER);
} }
......
...@@ -528,40 +528,56 @@ INPUT_DEV_STRING_ATTR_SHOW(name); ...@@ -528,40 +528,56 @@ INPUT_DEV_STRING_ATTR_SHOW(name);
INPUT_DEV_STRING_ATTR_SHOW(phys); INPUT_DEV_STRING_ATTR_SHOW(phys);
INPUT_DEV_STRING_ATTR_SHOW(uniq); INPUT_DEV_STRING_ATTR_SHOW(uniq);
static int print_modalias_bits(char *buf, char prefix, unsigned long *arr, static int print_modalias_bits(char *buf, int size, char prefix, unsigned long *arr,
unsigned int min, unsigned int max) unsigned int min, unsigned int max)
{ {
int len, i; int len, i;
len = sprintf(buf, "%c", prefix); len = snprintf(buf, size, "%c", prefix);
for (i = min; i < max; i++) for (i = min; i < max; i++)
if (arr[LONG(i)] & BIT(i)) if (arr[LONG(i)] & BIT(i))
len += sprintf(buf+len, "%X,", i); len += snprintf(buf + len, size - len, "%X,", i);
return len; return len;
} }
static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf) static int print_modalias(char *buf, int size, struct input_dev *id)
{ {
struct input_dev *id = to_input_dev(dev); int len;
ssize_t len = 0;
len += sprintf(buf+len, "input:b%04Xv%04Xp%04Xe%04X-", len = snprintf(buf, size, "input:b%04Xv%04Xp%04Xe%04X-",
id->id.bustype, id->id.bustype,
id->id.vendor, id->id.vendor,
id->id.product, id->id.product,
id->id.version); id->id.version);
len += print_modalias_bits(buf+len, 'e', id->evbit, 0, EV_MAX); len += print_modalias_bits(buf + len, size - len, 'e', id->evbit,
len += print_modalias_bits(buf+len, 'k', id->keybit, 0, EV_MAX);
len += print_modalias_bits(buf + len, size - len, 'k', id->keybit,
KEY_MIN_INTERESTING, KEY_MAX); KEY_MIN_INTERESTING, KEY_MAX);
len += print_modalias_bits(buf+len, 'r', id->relbit, 0, REL_MAX); len += print_modalias_bits(buf + len, size - len, 'r', id->relbit,
len += print_modalias_bits(buf+len, 'a', id->absbit, 0, ABS_MAX); 0, REL_MAX);
len += print_modalias_bits(buf+len, 'm', id->mscbit, 0, MSC_MAX); len += print_modalias_bits(buf + len, size - len, 'a', id->absbit,
len += print_modalias_bits(buf+len, 'l', id->ledbit, 0, LED_MAX); 0, ABS_MAX);
len += print_modalias_bits(buf+len, 's', id->sndbit, 0, SND_MAX); len += print_modalias_bits(buf + len, size - len, 'm', id->mscbit,
len += print_modalias_bits(buf+len, 'f', id->ffbit, 0, FF_MAX); 0, MSC_MAX);
len += print_modalias_bits(buf+len, 'w', id->swbit, 0, SW_MAX); len += print_modalias_bits(buf + len, size - len, 'l', id->ledbit,
len += sprintf(buf+len, "\n"); 0, LED_MAX);
len += print_modalias_bits(buf + len, size - len, 's', id->sndbit,
0, SND_MAX);
len += print_modalias_bits(buf + len, size - len, 'f', id->ffbit,
0, FF_MAX);
len += print_modalias_bits(buf + len, size - len, 'w', id->swbit,
0, SW_MAX);
return len;
}
static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf)
{
struct input_dev *id = to_input_dev(dev);
ssize_t len;
len = print_modalias(buf, PAGE_SIZE, id);
len += snprintf(buf + len, PAGE_SIZE-len, "\n");
return len; return len;
} }
static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL);
...@@ -728,8 +744,11 @@ static int input_dev_uevent(struct class_device *cdev, char **envp, ...@@ -728,8 +744,11 @@ static int input_dev_uevent(struct class_device *cdev, char **envp,
if (test_bit(EV_SW, dev->evbit)) if (test_bit(EV_SW, dev->evbit))
INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX); INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX);
envp[i] = NULL; envp[i++] = buffer + len;
len += snprintf(buffer + len, buffer_size - len, "MODALIAS=");
len += print_modalias(buffer + len, buffer_size - len, dev) + 1;
envp[i] = NULL;
return 0; return 0;
} }
......
...@@ -59,9 +59,7 @@ static DECLARE_MUTEX(serio_sem); ...@@ -59,9 +59,7 @@ static DECLARE_MUTEX(serio_sem);
static LIST_HEAD(serio_list); static LIST_HEAD(serio_list);
static struct bus_type serio_bus = { static struct bus_type serio_bus;
.name = "serio",
};
static void serio_add_port(struct serio *serio); static void serio_add_port(struct serio *serio);
static void serio_destroy_port(struct serio *serio); static void serio_destroy_port(struct serio *serio);
...@@ -750,11 +748,15 @@ static int serio_driver_remove(struct device *dev) ...@@ -750,11 +748,15 @@ static int serio_driver_remove(struct device *dev)
return 0; 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) void __serio_register_driver(struct serio_driver *drv, struct module *owner)
{ {
drv->driver.bus = &serio_bus; 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); serio_queue_event(drv, owner, SERIO_REGISTER_DRIVER);
} }
......
...@@ -211,6 +211,9 @@ struct bus_type macio_bus_type = { ...@@ -211,6 +211,9 @@ struct bus_type macio_bus_type = {
.name = "macio", .name = "macio",
.match = macio_bus_match, .match = macio_bus_match,
.uevent = macio_uevent, .uevent = macio_uevent,
.probe = macio_device_probe,
.remove = macio_device_remove,
.shutdown = macio_device_shutdown,
.suspend = macio_device_suspend, .suspend = macio_device_suspend,
.resume = macio_device_resume, .resume = macio_device_resume,
.dev_attrs = macio_dev_attrs, .dev_attrs = macio_dev_attrs,
...@@ -528,9 +531,6 @@ int macio_register_driver(struct macio_driver *drv) ...@@ -528,9 +531,6 @@ int macio_register_driver(struct macio_driver *drv)
/* initialize common driver fields */ /* initialize common driver fields */
drv->driver.name = drv->name; drv->driver.name = drv->name;
drv->driver.bus = &macio_bus_type; 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 */ /* register with core */
count = driver_register(&drv->driver); count = driver_register(&drv->driver);
......
...@@ -779,9 +779,8 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) ...@@ -779,9 +779,8 @@ static int __init dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
return 0; 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 dvb_bt8xx_card *card;
struct pci_dev* bttv_pci_dev; struct pci_dev* bttv_pci_dev;
int ret; int ret;
...@@ -890,13 +889,13 @@ static int dvb_bt8xx_probe(struct device *dev) ...@@ -890,13 +889,13 @@ static int dvb_bt8xx_probe(struct device *dev)
return ret; return ret;
} }
dev_set_drvdata(dev, card); dev_set_drvdata(&sub->dev, card);
return 0; 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); dprintk("dvb_bt8xx: unloading card%d\n", card->bttv_nr);
...@@ -919,14 +918,14 @@ static int dvb_bt8xx_remove(struct device *dev) ...@@ -919,14 +918,14 @@ static int dvb_bt8xx_remove(struct device *dev)
static struct bttv_sub_driver driver = { static struct bttv_sub_driver driver = {
.drv = { .drv = {
.name = "dvb-bt8xx", .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) static int __init dvb_bt8xx_init(void)
......
...@@ -47,9 +47,29 @@ static int bttv_sub_bus_match(struct device *dev, struct device_driver *drv) ...@@ -47,9 +47,29 @@ static int bttv_sub_bus_match(struct device *dev, struct device_driver *drv)
return 0; 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 = { struct bus_type bttv_sub_bus_type = {
.name = "bttv-sub", .name = "bttv-sub",
.match = &bttv_sub_bus_match, .match = &bttv_sub_bus_match,
.probe = bttv_sub_probe,
.remove = bttv_sub_remove,
}; };
EXPORT_SYMBOL(bttv_sub_bus_type); EXPORT_SYMBOL(bttv_sub_bus_type);
......
...@@ -365,6 +365,8 @@ struct bttv_sub_device { ...@@ -365,6 +365,8 @@ struct bttv_sub_device {
struct bttv_sub_driver { struct bttv_sub_driver {
struct device_driver drv; struct device_driver drv;
char wanted[BUS_ID_SIZE]; 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); void (*gpio_irq)(struct bttv_sub_device *sub);
}; };
#define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv) #define to_bttv_sub_drv(x) container_of((x), struct bttv_sub_driver, drv)
......
...@@ -77,6 +77,8 @@ static int mcp_bus_resume(struct device *dev) ...@@ -77,6 +77,8 @@ static int mcp_bus_resume(struct device *dev)
static struct bus_type mcp_bus_type = { static struct bus_type mcp_bus_type = {
.name = "mcp", .name = "mcp",
.match = mcp_bus_match, .match = mcp_bus_match,
.probe = mcp_bus_probe,
.remove = mcp_bus_remove,
.suspend = mcp_bus_suspend, .suspend = mcp_bus_suspend,
.resume = mcp_bus_resume, .resume = mcp_bus_resume,
}; };
...@@ -227,8 +229,6 @@ EXPORT_SYMBOL(mcp_host_unregister); ...@@ -227,8 +229,6 @@ EXPORT_SYMBOL(mcp_host_unregister);
int mcp_driver_register(struct mcp_driver *mcpdrv) int mcp_driver_register(struct mcp_driver *mcpdrv)
{ {
mcpdrv->drv.bus = &mcp_bus_type; mcpdrv->drv.bus = &mcp_bus_type;
mcpdrv->drv.probe = mcp_bus_probe;
mcpdrv->drv.remove = mcp_bus_remove;
return driver_register(&mcpdrv->drv); return driver_register(&mcpdrv->drv);
} }
EXPORT_SYMBOL(mcp_driver_register); EXPORT_SYMBOL(mcp_driver_register);
......
...@@ -136,17 +136,7 @@ static int mmc_bus_resume(struct device *dev) ...@@ -136,17 +136,7 @@ static int mmc_bus_resume(struct device *dev)
return ret; return ret;
} }
static struct bus_type mmc_bus_type = { static int mmc_bus_probe(struct device *dev)
.name = "mmc",
.dev_attrs = mmc_dev_attrs,
.match = mmc_bus_match,
.uevent = mmc_bus_uevent,
.suspend = mmc_bus_suspend,
.resume = mmc_bus_resume,
};
static int mmc_drv_probe(struct device *dev)
{ {
struct mmc_driver *drv = to_mmc_driver(dev->driver); struct mmc_driver *drv = to_mmc_driver(dev->driver);
struct mmc_card *card = dev_to_mmc_card(dev); struct mmc_card *card = dev_to_mmc_card(dev);
...@@ -154,7 +144,7 @@ static int mmc_drv_probe(struct device *dev) ...@@ -154,7 +144,7 @@ static int mmc_drv_probe(struct device *dev)
return drv->probe(card); 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_driver *drv = to_mmc_driver(dev->driver);
struct mmc_card *card = dev_to_mmc_card(dev); struct mmc_card *card = dev_to_mmc_card(dev);
...@@ -164,6 +154,16 @@ static int mmc_drv_remove(struct device *dev) ...@@ -164,6 +154,16 @@ static int mmc_drv_remove(struct device *dev)
return 0; return 0;
} }
static struct bus_type mmc_bus_type = {
.name = "mmc",
.dev_attrs = mmc_dev_attrs,
.match = mmc_bus_match,
.uevent = mmc_bus_uevent,
.probe = mmc_bus_probe,
.remove = mmc_bus_remove,
.suspend = mmc_bus_suspend,
.resume = mmc_bus_resume,
};
/** /**
* mmc_register_driver - register a media driver * mmc_register_driver - register a media driver
...@@ -172,8 +172,6 @@ static int mmc_drv_remove(struct device *dev) ...@@ -172,8 +172,6 @@ static int mmc_drv_remove(struct device *dev)
int mmc_register_driver(struct mmc_driver *drv) int mmc_register_driver(struct mmc_driver *drv)
{ {
drv->drv.bus = &mmc_bus_type; drv->drv.bus = &mmc_bus_type;
drv->drv.probe = mmc_drv_probe;
drv->drv.remove = mmc_drv_remove;
return driver_register(&drv->drv); return driver_register(&drv->drv);
} }
......
...@@ -380,8 +380,6 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner) ...@@ -380,8 +380,6 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner)
/* initialize common driver fields */ /* initialize common driver fields */
drv->driver.name = drv->name; drv->driver.name = drv->name;
drv->driver.bus = &pci_bus_type; 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 /* FIXME, once all of the existing PCI drivers have been fixed to set
* the pci shutdown function, this test can go away. */ * the pci shutdown function, this test can go away. */
if (!drv->driver.shutdown) if (!drv->driver.shutdown)
...@@ -513,6 +511,8 @@ struct bus_type pci_bus_type = { ...@@ -513,6 +511,8 @@ struct bus_type pci_bus_type = {
.name = "pci", .name = "pci",
.match = pci_bus_match, .match = pci_bus_match,
.uevent = pci_uevent, .uevent = pci_uevent,
.probe = pci_device_probe,
.remove = pci_device_remove,
.suspend = pci_device_suspend, .suspend = pci_device_suspend,
.resume = pci_device_resume, .resume = pci_device_resume,
.dev_attrs = pci_dev_attrs, .dev_attrs = pci_dev_attrs,
......
...@@ -311,8 +311,6 @@ int pcmcia_register_driver(struct pcmcia_driver *driver) ...@@ -311,8 +311,6 @@ int pcmcia_register_driver(struct pcmcia_driver *driver)
/* initialize common fields */ /* initialize common fields */
driver->drv.bus = &pcmcia_bus_type; driver->drv.bus = &pcmcia_bus_type;
driver->drv.owner = driver->owner; driver->drv.owner = driver->owner;
driver->drv.probe = pcmcia_device_probe;
driver->drv.remove = pcmcia_device_remove;
return driver_register(&driver->drv); return driver_register(&driver->drv);
} }
...@@ -1200,6 +1198,8 @@ struct bus_type pcmcia_bus_type = { ...@@ -1200,6 +1198,8 @@ struct bus_type pcmcia_bus_type = {
.uevent = pcmcia_bus_uevent, .uevent = pcmcia_bus_uevent,
.match = pcmcia_bus_match, .match = pcmcia_bus_match,
.dev_attrs = pcmcia_dev_attrs, .dev_attrs = pcmcia_dev_attrs,
.probe = pcmcia_device_probe,
.remove = pcmcia_device_remove,
.suspend = pcmcia_dev_suspend, .suspend = pcmcia_dev_suspend,
.resume = pcmcia_dev_resume, .resume = pcmcia_dev_resume,
}; };
......
...@@ -195,6 +195,8 @@ static int pnp_bus_resume(struct device *dev) ...@@ -195,6 +195,8 @@ static int pnp_bus_resume(struct device *dev)
struct bus_type pnp_bus_type = { struct bus_type pnp_bus_type = {
.name = "pnp", .name = "pnp",
.match = pnp_bus_match, .match = pnp_bus_match,
.probe = pnp_device_probe,
.remove = pnp_device_remove,
.suspend = pnp_bus_suspend, .suspend = pnp_bus_suspend,
.resume = pnp_bus_resume, .resume = pnp_bus_resume,
}; };
...@@ -215,8 +217,6 @@ int pnp_register_driver(struct pnp_driver *drv) ...@@ -215,8 +217,6 @@ int pnp_register_driver(struct pnp_driver *drv)
drv->driver.name = drv->name; drv->driver.name = drv->name;
drv->driver.bus = &pnp_bus_type; drv->driver.bus = &pnp_bus_type;
drv->driver.probe = pnp_device_probe;
drv->driver.remove = pnp_device_remove;
count = driver_register(&drv->driver); count = driver_register(&drv->driver);
......
...@@ -147,8 +147,6 @@ int rio_register_driver(struct rio_driver *rdrv) ...@@ -147,8 +147,6 @@ int rio_register_driver(struct rio_driver *rdrv)
/* initialize common driver fields */ /* initialize common driver fields */
rdrv->driver.name = rdrv->name; rdrv->driver.name = rdrv->name;
rdrv->driver.bus = &rio_bus_type; rdrv->driver.bus = &rio_bus_type;
rdrv->driver.probe = rio_device_probe;
rdrv->driver.remove = rio_device_remove;
/* register with core */ /* register with core */
return driver_register(&rdrv->driver); return driver_register(&rdrv->driver);
...@@ -204,7 +202,9 @@ static struct device rio_bus = { ...@@ -204,7 +202,9 @@ static struct device rio_bus = {
struct bus_type rio_bus_type = { struct bus_type rio_bus_type = {
.name = "rapidio", .name = "rapidio",
.match = rio_match_bus, .match = rio_match_bus,
.dev_attrs = rio_dev_attrs .dev_attrs = rio_dev_attrs,
.probe = rio_device_probe,
.remove = rio_device_remove,
}; };
/** /**
......
...@@ -52,11 +52,7 @@ ccwgroup_uevent (struct device *dev, char **envp, int num_envp, char *buffer, ...@@ -52,11 +52,7 @@ ccwgroup_uevent (struct device *dev, char **envp, int num_envp, char *buffer,
return 0; return 0;
} }
static struct bus_type ccwgroup_bus_type = { static struct bus_type ccwgroup_bus_type;
.name = "ccwgroup",
.match = ccwgroup_bus_match,
.uevent = ccwgroup_uevent,
};
static inline void static inline void
__ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev)
...@@ -389,6 +385,14 @@ ccwgroup_remove (struct device *dev) ...@@ -389,6 +385,14 @@ ccwgroup_remove (struct device *dev)
return 0; return 0;
} }
static struct bus_type ccwgroup_bus_type = {
.name = "ccwgroup",
.match = ccwgroup_bus_match,
.uevent = ccwgroup_uevent,
.probe = ccwgroup_probe,
.remove = ccwgroup_remove,
};
int int
ccwgroup_driver_register (struct ccwgroup_driver *cdriver) ccwgroup_driver_register (struct ccwgroup_driver *cdriver)
{ {
...@@ -396,8 +400,6 @@ ccwgroup_driver_register (struct ccwgroup_driver *cdriver) ...@@ -396,8 +400,6 @@ ccwgroup_driver_register (struct ccwgroup_driver *cdriver)
cdriver->driver = (struct device_driver) { cdriver->driver = (struct device_driver) {
.bus = &ccwgroup_bus_type, .bus = &ccwgroup_bus_type,
.name = cdriver->name, .name = cdriver->name,
.probe = ccwgroup_probe,
.remove = ccwgroup_remove,
}; };
return driver_register(&cdriver->driver); return driver_register(&cdriver->driver);
......
...@@ -542,9 +542,41 @@ css_bus_match (struct device *dev, struct device_driver *drv) ...@@ -542,9 +542,41 @@ css_bus_match (struct device *dev, struct device_driver *drv)
return 0; 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 = { struct bus_type css_bus_type = {
.name = "css", .name = "css",
.match = &css_bus_match, .match = css_bus_match,
.probe = css_probe,
.remove = css_remove,
.shutdown = css_shutdown,
}; };
subsys_initcall(init_channel_subsystem); subsys_initcall(init_channel_subsystem);
......
...@@ -115,6 +115,7 @@ struct ccw_device_private { ...@@ -115,6 +115,7 @@ struct ccw_device_private {
* Currently, we only care about I/O subchannels (type 0), these * Currently, we only care about I/O subchannels (type 0), these
* have a ccw_device connected to them. * have a ccw_device connected to them.
*/ */
struct subchannel;
struct css_driver { struct css_driver {
unsigned int subchannel_type; unsigned int subchannel_type;
struct device_driver drv; struct device_driver drv;
...@@ -122,6 +123,9 @@ struct css_driver { ...@@ -122,6 +123,9 @@ struct css_driver {
int (*notify)(struct device *, int); int (*notify)(struct device *, int);
void (*verify)(struct device *); void (*verify)(struct device *);
void (*termination)(struct device *); void (*termination)(struct device *);
int (*probe)(struct subchannel *);
int (*remove)(struct subchannel *);
void (*shutdown)(struct subchannel *);
}; };
/* /*
......
...@@ -107,33 +107,29 @@ ccw_uevent (struct device *dev, char **envp, int num_envp, ...@@ -107,33 +107,29 @@ ccw_uevent (struct device *dev, char **envp, int num_envp,
return 0; return 0;
} }
struct bus_type ccw_bus_type = { struct bus_type ccw_bus_type;
.name = "ccw",
.match = &ccw_bus_match,
.uevent = &ccw_uevent,
};
static int io_subchannel_probe (struct device *); static int io_subchannel_probe (struct subchannel *);
static int io_subchannel_remove (struct device *); static int io_subchannel_remove (struct subchannel *);
void io_subchannel_irq (struct device *); void io_subchannel_irq (struct device *);
static int io_subchannel_notify(struct device *, int); static int io_subchannel_notify(struct device *, int);
static void io_subchannel_verify(struct device *); static void io_subchannel_verify(struct device *);
static void io_subchannel_ioterm(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 = { struct css_driver io_subchannel_driver = {
.subchannel_type = SUBCHANNEL_TYPE_IO, .subchannel_type = SUBCHANNEL_TYPE_IO,
.drv = { .drv = {
.name = "io_subchannel", .name = "io_subchannel",
.bus = &css_bus_type, .bus = &css_bus_type,
.probe = &io_subchannel_probe,
.remove = &io_subchannel_remove,
.shutdown = &io_subchannel_shutdown,
}, },
.irq = io_subchannel_irq, .irq = io_subchannel_irq,
.notify = io_subchannel_notify, .notify = io_subchannel_notify,
.verify = io_subchannel_verify, .verify = io_subchannel_verify,
.termination = io_subchannel_ioterm, .termination = io_subchannel_ioterm,
.probe = io_subchannel_probe,
.remove = io_subchannel_remove,
.shutdown = io_subchannel_shutdown,
}; };
struct workqueue_struct *ccw_device_work; struct workqueue_struct *ccw_device_work;
...@@ -803,14 +799,12 @@ io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch) ...@@ -803,14 +799,12 @@ io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch)
} }
static int static int
io_subchannel_probe (struct device *pdev) io_subchannel_probe (struct subchannel *sch)
{ {
struct subchannel *sch;
struct ccw_device *cdev; struct ccw_device *cdev;
int rc; int rc;
unsigned long flags; unsigned long flags;
sch = to_subchannel(pdev);
if (sch->dev.driver_data) { if (sch->dev.driver_data) {
/* /*
* This subchannel already has an associated ccw_device. * This subchannel already has an associated ccw_device.
...@@ -846,7 +840,7 @@ io_subchannel_probe (struct device *pdev) ...@@ -846,7 +840,7 @@ io_subchannel_probe (struct device *pdev)
memset(cdev->private, 0, sizeof(struct ccw_device_private)); memset(cdev->private, 0, sizeof(struct ccw_device_private));
atomic_set(&cdev->private->onoff, 0); atomic_set(&cdev->private->onoff, 0);
cdev->dev = (struct device) { cdev->dev = (struct device) {
.parent = pdev, .parent = &sch->dev,
.release = ccw_device_release, .release = ccw_device_release,
}; };
INIT_LIST_HEAD(&cdev->private->kick_work.entry); INIT_LIST_HEAD(&cdev->private->kick_work.entry);
...@@ -859,7 +853,7 @@ io_subchannel_probe (struct device *pdev) ...@@ -859,7 +853,7 @@ io_subchannel_probe (struct device *pdev)
return -ENODEV; return -ENODEV;
} }
rc = io_subchannel_recog(cdev, to_subchannel(pdev)); rc = io_subchannel_recog(cdev, sch);
if (rc) { if (rc) {
spin_lock_irqsave(&sch->lock, flags); spin_lock_irqsave(&sch->lock, flags);
sch->dev.driver_data = NULL; sch->dev.driver_data = NULL;
...@@ -883,17 +877,17 @@ ccw_device_unregister(void *data) ...@@ -883,17 +877,17 @@ ccw_device_unregister(void *data)
} }
static int static int
io_subchannel_remove (struct device *dev) io_subchannel_remove (struct subchannel *sch)
{ {
struct ccw_device *cdev; struct ccw_device *cdev;
unsigned long flags; unsigned long flags;
if (!dev->driver_data) if (!sch->dev.driver_data)
return 0; return 0;
cdev = dev->driver_data; cdev = sch->dev.driver_data;
/* Set ccw device to not operational and drop reference. */ /* Set ccw device to not operational and drop reference. */
spin_lock_irqsave(cdev->ccwlock, flags); spin_lock_irqsave(cdev->ccwlock, flags);
dev->driver_data = NULL; sch->dev.driver_data = NULL;
cdev->private->state = DEV_STATE_NOT_OPER; cdev->private->state = DEV_STATE_NOT_OPER;
spin_unlock_irqrestore(cdev->ccwlock, flags); spin_unlock_irqrestore(cdev->ccwlock, flags);
/* /*
...@@ -948,14 +942,12 @@ io_subchannel_ioterm(struct device *dev) ...@@ -948,14 +942,12 @@ io_subchannel_ioterm(struct device *dev)
} }
static void static void
io_subchannel_shutdown(struct device *dev) io_subchannel_shutdown(struct subchannel *sch)
{ {
struct subchannel *sch;
struct ccw_device *cdev; struct ccw_device *cdev;
int ret; int ret;
sch = to_subchannel(dev); cdev = sch->dev.driver_data;
cdev = dev->driver_data;
if (cio_is_console(sch->schid)) if (cio_is_console(sch->schid))
return; return;
...@@ -1129,6 +1121,14 @@ ccw_device_remove (struct device *dev) ...@@ -1129,6 +1121,14 @@ ccw_device_remove (struct device *dev)
return 0; 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 int
ccw_driver_register (struct ccw_driver *cdriver) ccw_driver_register (struct ccw_driver *cdriver)
{ {
...@@ -1136,8 +1136,6 @@ ccw_driver_register (struct ccw_driver *cdriver) ...@@ -1136,8 +1136,6 @@ ccw_driver_register (struct ccw_driver *cdriver)
drv->bus = &ccw_bus_type; drv->bus = &ccw_bus_type;
drv->name = cdriver->name; drv->name = cdriver->name;
drv->probe = ccw_device_probe;
drv->remove = ccw_device_remove;
return driver_register(drv); return driver_register(drv);
} }
......
...@@ -221,8 +221,6 @@ static struct bus_type pseudo_lld_bus; ...@@ -221,8 +221,6 @@ static struct bus_type pseudo_lld_bus;
static struct device_driver sdebug_driverfs_driver = { static struct device_driver sdebug_driverfs_driver = {
.name = sdebug_proc_name, .name = sdebug_proc_name,
.bus = &pseudo_lld_bus, .bus = &pseudo_lld_bus,
.probe = sdebug_driver_probe,
.remove = sdebug_driver_remove,
}; };
static const int check_condition_result = static const int check_condition_result =
...@@ -1796,6 +1794,8 @@ static int pseudo_lld_bus_match(struct device *dev, ...@@ -1796,6 +1794,8 @@ static int pseudo_lld_bus_match(struct device *dev,
static struct bus_type pseudo_lld_bus = { static struct bus_type pseudo_lld_bus = {
.name = "pseudo", .name = "pseudo",
.match = pseudo_lld_bus_match, .match = pseudo_lld_bus_match,
.probe = sdebug_driver_probe,
.remove = sdebug_driver_remove,
}; };
static void sdebug_release_adapter(struct device * dev) static void sdebug_release_adapter(struct device * dev)
......
...@@ -175,8 +175,6 @@ int superhyway_register_driver(struct superhyway_driver *drv) ...@@ -175,8 +175,6 @@ int superhyway_register_driver(struct superhyway_driver *drv)
{ {
drv->drv.name = drv->name; drv->drv.name = drv->name;
drv->drv.bus = &superhyway_bus_type; drv->drv.bus = &superhyway_bus_type;
drv->drv.probe = superhyway_device_probe;
drv->drv.remove = superhyway_device_remove;
return driver_register(&drv->drv); return driver_register(&drv->drv);
} }
...@@ -213,6 +211,8 @@ struct bus_type superhyway_bus_type = { ...@@ -213,6 +211,8 @@ struct bus_type superhyway_bus_type = {
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
.dev_attrs = superhyway_dev_attrs, .dev_attrs = superhyway_dev_attrs,
#endif #endif
.probe = superhyway_device_probe,
.remove = superhyway_device_remove,
}; };
static int __init superhyway_bus_init(void) static int __init superhyway_bus_init(void)
......
...@@ -2534,9 +2534,6 @@ static struct usb_gadget_driver eth_driver = { ...@@ -2534,9 +2534,6 @@ static struct usb_gadget_driver eth_driver = {
.driver = { .driver = {
.name = (char *) shortname, .name = (char *) shortname,
.owner = THIS_MODULE, .owner = THIS_MODULE,
// .shutdown = ...
// .suspend = ...
// .resume = ...
}, },
}; };
......
...@@ -1738,9 +1738,6 @@ static struct usb_gadget_driver gadgetfs_driver = { ...@@ -1738,9 +1738,6 @@ static struct usb_gadget_driver gadgetfs_driver = {
.driver = { .driver = {
.name = (char *) shortname, .name = (char *) shortname,
// .shutdown = ...
// .suspend = ...
// .resume = ...
}, },
}; };
......
...@@ -374,9 +374,6 @@ static struct usb_gadget_driver gs_gadget_driver = { ...@@ -374,9 +374,6 @@ static struct usb_gadget_driver gs_gadget_driver = {
.disconnect = gs_disconnect, .disconnect = gs_disconnect,
.driver = { .driver = {
.name = GS_SHORT_NAME, .name = GS_SHORT_NAME,
/* .shutdown = ... */
/* .suspend = ... */
/* .resume = ... */
}, },
}; };
......
...@@ -1303,9 +1303,6 @@ static struct usb_gadget_driver zero_driver = { ...@@ -1303,9 +1303,6 @@ static struct usb_gadget_driver zero_driver = {
.driver = { .driver = {
.name = (char *) shortname, .name = (char *) shortname,
.owner = THIS_MODULE, .owner = THIS_MODULE,
// .shutdown = ...
// .suspend = ...
// .resume = ...
}, },
}; };
......
...@@ -37,11 +37,6 @@ static int usb_serial_device_match (struct device *dev, struct device_driver *dr ...@@ -37,11 +37,6 @@ static int usb_serial_device_match (struct device *dev, struct device_driver *dr
return 0; 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) static int usb_serial_device_probe (struct device *dev)
{ {
struct usb_serial_driver *driver; struct usb_serial_driver *driver;
...@@ -109,14 +104,18 @@ static int usb_serial_device_remove (struct device *dev) ...@@ -109,14 +104,18 @@ static int usb_serial_device_remove (struct device *dev)
return retval; 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 usb_serial_bus_register(struct usb_serial_driver *driver)
{ {
int retval; int retval;
driver->driver.bus = &usb_serial_bus_type; 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); retval = driver_register(&driver->driver);
return retval; return retval;
......
...@@ -77,7 +77,6 @@ int zorro_register_driver(struct zorro_driver *drv) ...@@ -77,7 +77,6 @@ int zorro_register_driver(struct zorro_driver *drv)
/* initialize common driver fields */ /* initialize common driver fields */
drv->driver.name = drv->name; drv->driver.name = drv->name;
drv->driver.bus = &zorro_bus_type; drv->driver.bus = &zorro_bus_type;
drv->driver.probe = zorro_device_probe;
/* register with core */ /* register with core */
count = driver_register(&drv->driver); count = driver_register(&drv->driver);
...@@ -132,7 +131,8 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv) ...@@ -132,7 +131,8 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv)
struct bus_type zorro_bus_type = { struct bus_type zorro_bus_type = {
.name = "zorro", .name = "zorro",
.match = zorro_bus_match .match = zorro_bus_match,
.probe = zorro_device_probe,
}; };
......
...@@ -49,6 +49,9 @@ struct bus_type { ...@@ -49,6 +49,9 @@ struct bus_type {
int (*match)(struct device * dev, struct device_driver * drv); int (*match)(struct device * dev, struct device_driver * drv);
int (*uevent)(struct device *dev, char **envp, int (*uevent)(struct device *dev, char **envp,
int num_envp, char *buffer, int buffer_size); 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 (*suspend)(struct device * dev, pm_message_t state);
int (*resume)(struct device * dev); int (*resume)(struct device * dev);
}; };
......
...@@ -983,8 +983,13 @@ typedef struct ide_driver_s { ...@@ -983,8 +983,13 @@ typedef struct ide_driver_s {
ide_startstop_t (*abort)(ide_drive_t *, struct request *rq); ide_startstop_t (*abort)(ide_drive_t *, struct request *rq);
ide_proc_entry_t *proc; ide_proc_entry_t *proc;
struct device_driver gen_driver; struct device_driver gen_driver;
int (*probe)(ide_drive_t *);
void (*remove)(ide_drive_t *);
void (*shutdown)(ide_drive_t *);
} ide_driver_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); int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment