diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-15 14:10:09 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-15 14:10:09 -0800 |
commit | 2911ed9f47b47cb5ab87d03314b3b9fe008e607f (patch) | |
tree | 7357e609aac80001b12a3933122060a777e67578 /drivers/siox/siox-core.c | |
parent | 7240153a9bdb77217b99b76fd73105bce12770be (diff) | |
parent | 93f998879cd95b3e4f2836e7b17d6d5ae035cf90 (diff) |
Merge tag 'char-misc-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char / misc driver updates from Greg KH:
"Here is the big char/misc driver update for 5.11-rc1.
Continuing the tradition of previous -rc1 pulls, there seems to be
more and more tiny driver subsystems flowing through this tree.
Lots of different things, all of which have been in linux-next for a
while with no reported issues:
- extcon driver updates
- habannalab driver updates
- mei driver updates
- uio driver updates
- binder fixes and features added
- soundwire driver updates
- mhi bus driver updates
- phy driver updates
- coresight driver updates
- fpga driver updates
- speakup driver updates
- slimbus driver updates
- various small char and misc driver updates"
* tag 'char-misc-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (305 commits)
extcon: max77693: Fix modalias string
extcon: fsa9480: Support TI TSU6111 variant
extcon: fsa9480: Rewrite bindings in YAML and extend
dt-bindings: extcon: add binding for TUSB320
extcon: Add driver for TI TUSB320
slimbus: qcom: fix potential NULL dereference in qcom_slim_prg_slew()
siox: Make remove callback return void
siox: Use bus_type functions for probe, remove and shutdown
spmi: Add driver shutdown support
spmi: fix some coding style issues at the spmi core
spmi: get rid of a warning when built with W=1
uio: uio_hv_generic: use devm_kzalloc() for private data alloc
uio: uio_fsl_elbc_gpcm: use device-managed allocators
uio: uio_aec: use devm_kzalloc() for uio_info object
uio: uio_cif: use devm_kzalloc() for uio_info object
uio: uio_netx: use devm_kzalloc() for or uio_info object
uio: uio_mf624: use devm_kzalloc() for uio_info object
uio: uio_sercos3: use device-managed functions for simple allocs
uio: uio_dmem_genirq: finalize conversion of probe to devm_ handlers
uio: uio_dmem_genirq: convert simple allocations to device-managed
...
Diffstat (limited to 'drivers/siox/siox-core.c')
-rw-r--r-- | drivers/siox/siox-core.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c index f8c08fb9891d..1794ff0106bc 100644 --- a/drivers/siox/siox-core.c +++ b/drivers/siox/siox-core.c @@ -512,41 +512,47 @@ static int siox_match(struct device *dev, struct device_driver *drv) return 1; } -static struct bus_type siox_bus_type = { - .name = "siox", - .match = siox_match, -}; - -static int siox_driver_probe(struct device *dev) +static int siox_probe(struct device *dev) { struct siox_driver *sdriver = to_siox_driver(dev->driver); struct siox_device *sdevice = to_siox_device(dev); - int ret; - ret = sdriver->probe(sdevice); - return ret; + return sdriver->probe(sdevice); } -static int siox_driver_remove(struct device *dev) +static int siox_remove(struct device *dev) { struct siox_driver *sdriver = container_of(dev->driver, struct siox_driver, driver); struct siox_device *sdevice = to_siox_device(dev); - int ret; - ret = sdriver->remove(sdevice); - return ret; + if (sdriver->remove) + sdriver->remove(sdevice); + + return 0; } -static void siox_driver_shutdown(struct device *dev) +static void siox_shutdown(struct device *dev) { - struct siox_driver *sdriver = - container_of(dev->driver, struct siox_driver, driver); struct siox_device *sdevice = to_siox_device(dev); + struct siox_driver *sdriver; + + if (!dev->driver) + return; - sdriver->shutdown(sdevice); + sdriver = container_of(dev->driver, struct siox_driver, driver); + if (sdriver->shutdown) + sdriver->shutdown(sdevice); } +static struct bus_type siox_bus_type = { + .name = "siox", + .match = siox_match, + .probe = siox_probe, + .remove = siox_remove, + .shutdown = siox_shutdown, +}; + static ssize_t active_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -882,7 +888,8 @@ int __siox_driver_register(struct siox_driver *sdriver, struct module *owner) if (unlikely(!siox_is_registered)) return -EPROBE_DEFER; - if (!sdriver->set_data && !sdriver->get_data) { + if (!sdriver->probe || + (!sdriver->set_data && !sdriver->get_data)) { pr_err("Driver %s doesn't provide needed callbacks\n", sdriver->driver.name); return -EINVAL; @@ -891,13 +898,6 @@ int __siox_driver_register(struct siox_driver *sdriver, struct module *owner) sdriver->driver.owner = owner; sdriver->driver.bus = &siox_bus_type; - if (sdriver->probe) - sdriver->driver.probe = siox_driver_probe; - if (sdriver->remove) - sdriver->driver.remove = siox_driver_remove; - if (sdriver->shutdown) - sdriver->driver.shutdown = siox_driver_shutdown; - ret = driver_register(&sdriver->driver); if (ret) pr_err("Failed to register siox driver %s (%d)\n", |