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.

sdio: Provide a bustype shutdown function

To prepare sdio drivers 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 that isn't converted yet to that
callback at register time.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://patch.msgid.link/397f45c2818f6632151f92b70e547262f373c3b6.1768232321.git.u.kleine-koenig@baylibre.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Uwe Kleine-König and committed by
Johannes Berg
c5c57e56 853800c7

+26
+25
drivers/mmc/core/sdio_bus.c
··· 232 232 pm_runtime_put_sync(dev); 233 233 } 234 234 235 + static void sdio_bus_shutdown(struct device *dev) 236 + { 237 + struct sdio_driver *drv = to_sdio_driver(dev->driver); 238 + struct sdio_func *func = dev_to_sdio_func(dev); 239 + 240 + if (dev->driver && drv->shutdown) 241 + drv->shutdown(func); 242 + } 243 + 235 244 static const struct dev_pm_ops sdio_bus_pm_ops = { 236 245 SET_SYSTEM_SLEEP_PM_OPS(pm_generic_suspend, pm_generic_resume) 237 246 SET_RUNTIME_PM_OPS( ··· 257 248 .uevent = sdio_bus_uevent, 258 249 .probe = sdio_bus_probe, 259 250 .remove = sdio_bus_remove, 251 + .shutdown = sdio_bus_shutdown, 260 252 .pm = &sdio_bus_pm_ops, 261 253 }; 262 254 ··· 271 261 bus_unregister(&sdio_bus_type); 272 262 } 273 263 264 + static void sdio_legacy_shutdown(struct sdio_func *func) 265 + { 266 + struct device *dev = &func->dev; 267 + struct device_driver *driver = dev->driver; 268 + 269 + driver->shutdown(dev); 270 + } 271 + 274 272 /** 275 273 * __sdio_register_driver - register a function driver 276 274 * @drv: SDIO function driver ··· 289 271 drv->drv.name = drv->name; 290 272 drv->drv.bus = &sdio_bus_type; 291 273 drv->drv.owner = owner; 274 + 275 + /* 276 + * This driver needs updating. Note that driver_register() warns about 277 + * this, so we're not adding another warning here. 278 + */ 279 + if (!drv->shutdown && drv->drv.shutdown) 280 + drv->shutdown = sdio_legacy_shutdown; 292 281 293 282 return driver_register(&drv->drv); 294 283 }
+1
include/linux/mmc/sdio_func.h
··· 78 78 79 79 int (*probe)(struct sdio_func *, const struct sdio_device_id *); 80 80 void (*remove)(struct sdio_func *); 81 + void (*shutdown)(struct sdio_func *); 81 82 82 83 struct device_driver drv; 83 84 };