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

spmi: Add driver shutdown support

Add new shutdown() method. Use it in the standard driver model style.

Link: https://lore.kernel.org/r/1603187810-30481-2-git-send-email-hsin-hsiung.wang@mediatek.com
Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20201210023344.2838141-4-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Hsin-Hsiung Wang and committed by
Greg Kroah-Hartman
d40c2d4e 0be0a733

+10
+9
drivers/spmi/spmi.c
··· 359 359 return 0; 360 360 } 361 361 362 + static void spmi_drv_shutdown(struct device *dev) 363 + { 364 + const struct spmi_driver *sdrv = to_spmi_driver(dev->driver); 365 + 366 + if (sdrv && sdrv->shutdown) 367 + sdrv->shutdown(to_spmi_device(dev)); 368 + } 369 + 362 370 static int spmi_drv_uevent(struct device *dev, struct kobj_uevent_env *env) 363 371 { 364 372 int ret; ··· 383 375 .match = spmi_device_match, 384 376 .probe = spmi_drv_probe, 385 377 .remove = spmi_drv_remove, 378 + .shutdown = spmi_drv_shutdown, 386 379 .uevent = spmi_drv_uevent, 387 380 }; 388 381
+1
include/linux/spmi.h
··· 138 138 struct device_driver driver; 139 139 int (*probe)(struct spmi_device *sdev); 140 140 void (*remove)(struct spmi_device *sdev); 141 + void (*shutdown)(struct spmi_device *sdev); 141 142 }; 142 143 143 144 static inline struct spmi_driver *to_spmi_driver(struct device_driver *d)