Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serdev: Provide a bustype shutdown function

To prepare serdev driver to migrate away from struct device_driver::shutdown
(and then eventually remove that callback) create a serdev driver shutdown
callback and migration code to keep the existing behaviour. Note this
introduces a warning for each driver at register time that isn't converted
yet to that callback.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/ab518883e3ed0976a19cb5b5b5faf42bd3a655b7.1765526117.git.u.kleine-koenig@baylibre.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
6d71c62b 42eeed6d

+22
+21
drivers/tty/serdev/core.c
··· 414 414 sdrv->remove(to_serdev_device(dev)); 415 415 } 416 416 417 + static void serdev_drv_shutdown(struct device *dev) 418 + { 419 + const struct serdev_device_driver *sdrv = 420 + to_serdev_device_driver(dev->driver); 421 + 422 + if (dev->driver && sdrv->shutdown) 423 + sdrv->shutdown(to_serdev_device(dev)); 424 + } 425 + 417 426 static const struct bus_type serdev_bus_type = { 418 427 .name = "serial", 419 428 .match = serdev_device_match, 420 429 .probe = serdev_drv_probe, 421 430 .remove = serdev_drv_remove, 431 + .shutdown = serdev_drv_shutdown, 422 432 }; 423 433 424 434 /** ··· 824 814 } 825 815 EXPORT_SYMBOL_GPL(serdev_controller_remove); 826 816 817 + static void serdev_legacy_shutdown(struct serdev_device *serdev) 818 + { 819 + struct device *dev = &serdev->dev; 820 + struct device_driver *driver = dev->driver; 821 + 822 + driver->shutdown(dev); 823 + } 824 + 827 825 /** 828 826 * __serdev_device_driver_register() - Register client driver with serdev core 829 827 * @sdrv: client driver to be associated with client-device. ··· 847 829 848 830 /* force drivers to async probe so I/O is possible in probe */ 849 831 sdrv->driver.probe_type = PROBE_PREFER_ASYNCHRONOUS; 832 + 833 + if (!sdrv->shutdown && sdrv->driver.shutdown) 834 + sdrv->shutdown = serdev_legacy_shutdown; 850 835 851 836 return driver_register(&sdrv->driver); 852 837 }
+1
include/linux/serdev.h
··· 65 65 struct device_driver driver; 66 66 int (*probe)(struct serdev_device *); 67 67 void (*remove)(struct serdev_device *); 68 + void (*shutdown)(struct serdev_device *); 68 69 }; 69 70 70 71 static inline struct serdev_device_driver *to_serdev_device_driver(struct device_driver *d)