From: dmitry pervushin Replace probe/remove/shutdown functions in device_driver structure by corresponding methods of spi_bus_type. Signed-off-by: dmitry pervushin Cc: Greg KH Cc: David Brownell Signed-off-by: Andrew Morton --- drivers/spi/spi.c | 22 ++++++++++------------ 1 files changed, 10 insertions(+), 12 deletions(-) diff -puN drivers/spi/spi.c~spi-add-bus-methods-instead-of-drivers-ones drivers/spi/spi.c --- 25/drivers/spi/spi.c~spi-add-bus-methods-instead-of-drivers-ones Tue Jan 10 15:50:36 2006 +++ 25-akpm/drivers/spi/spi.c Tue Jan 10 15:50:36 2006 @@ -125,42 +125,40 @@ struct bus_type spi_bus_type = { .dev_attrs = spi_dev_attrs, .match = spi_match_device, .uevent = spi_uevent, + .probe = spi_bus_probe, + .remove = spi_bus_remove, + .shutdown = spi_bus_shutdown, .suspend = spi_suspend, .resume = spi_resume, }; EXPORT_SYMBOL_GPL(spi_bus_type); -static int spi_drv_probe(struct device *dev) +static int spi_bus_probe(struct device *dev) { const struct spi_driver *sdrv = to_spi_driver(dev->driver); - return sdrv->probe(to_spi_device(dev)); + return sdrv->probe ? sdrv->probe(to_spi_device(dev)) : -ENODEV; } -static int spi_drv_remove(struct device *dev) +static int spi_bus_remove(struct device *dev) { const struct spi_driver *sdrv = to_spi_driver(dev->driver); - return sdrv->remove(to_spi_device(dev)); + return sdrv->remove ? sdrv->remove(to_spi_device(dev)) : -EFAULT; } -static void spi_drv_shutdown(struct device *dev) +static void spi_bus_shutdown(struct device *dev) { const struct spi_driver *sdrv = to_spi_driver(dev->driver); - sdrv->shutdown(to_spi_device(dev)); + if (sdrv->shutdown) + sdrv->shutdown(to_spi_device(dev)); } int spi_register_driver(struct spi_driver *sdrv) { sdrv->driver.bus = &spi_bus_type; - if (sdrv->probe) - sdrv->driver.probe = spi_drv_probe; - if (sdrv->remove) - sdrv->driver.remove = spi_drv_remove; - if (sdrv->shutdown) - sdrv->driver.shutdown = spi_drv_shutdown; return driver_register(&sdrv->driver); } EXPORT_SYMBOL_GPL(spi_register_driver); _