mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
serdev: Provide a bustype shutdown function
[ Upstream commit6d71c62b13] 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> Stable-dep-of:375ba74841("Bluetooth: hci_qca: Convert timeout from jiffies to ms") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ca2f48b9c0
commit
123724bb6e
@@ -441,11 +441,21 @@ static void serdev_drv_remove(struct device *dev)
|
||||
dev_pm_domain_detach(dev, true);
|
||||
}
|
||||
|
||||
static void serdev_drv_shutdown(struct device *dev)
|
||||
{
|
||||
const struct serdev_device_driver *sdrv =
|
||||
to_serdev_device_driver(dev->driver);
|
||||
|
||||
if (dev->driver && sdrv->shutdown)
|
||||
sdrv->shutdown(to_serdev_device(dev));
|
||||
}
|
||||
|
||||
static const struct bus_type serdev_bus_type = {
|
||||
.name = "serial",
|
||||
.match = serdev_device_match,
|
||||
.probe = serdev_drv_probe,
|
||||
.remove = serdev_drv_remove,
|
||||
.shutdown = serdev_drv_shutdown,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -839,6 +849,14 @@ void serdev_controller_remove(struct serdev_controller *ctrl)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(serdev_controller_remove);
|
||||
|
||||
static void serdev_legacy_shutdown(struct serdev_device *serdev)
|
||||
{
|
||||
struct device *dev = &serdev->dev;
|
||||
struct device_driver *driver = dev->driver;
|
||||
|
||||
driver->shutdown(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* __serdev_device_driver_register() - Register client driver with serdev core
|
||||
* @sdrv: client driver to be associated with client-device.
|
||||
@@ -855,6 +873,9 @@ int __serdev_device_driver_register(struct serdev_device_driver *sdrv, struct mo
|
||||
/* force drivers to async probe so I/O is possible in probe */
|
||||
sdrv->driver.probe_type = PROBE_PREFER_ASYNCHRONOUS;
|
||||
|
||||
if (!sdrv->shutdown && sdrv->driver.shutdown)
|
||||
sdrv->shutdown = serdev_legacy_shutdown;
|
||||
|
||||
return driver_register(&sdrv->driver);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__serdev_device_driver_register);
|
||||
|
||||
@@ -65,6 +65,7 @@ struct serdev_device_driver {
|
||||
struct device_driver driver;
|
||||
int (*probe)(struct serdev_device *);
|
||||
void (*remove)(struct serdev_device *);
|
||||
void (*shutdown)(struct serdev_device *);
|
||||
};
|
||||
|
||||
static inline struct serdev_device_driver *to_serdev_device_driver(struct device_driver *d)
|
||||
|
||||
Reference in New Issue
Block a user