diff options
author | Sergey Ryazanov <ryazanov.s.a@gmail.com> | 2021-06-22 01:50:57 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-22 20:01:16 +0300 |
commit | 9f0248ea476ee59d336d7c8bf1a5d0919d93d030 (patch) | |
tree | a012e1c1b0cd41284f25628478910cf3babdef03 /include/linux/wwan.h | |
parent | 322a0ba99c50d6abadeda709f0552eb8dac6668c (diff) | |
download | linux-9f0248ea476ee59d336d7c8bf1a5d0919d93d030.tar.xz |
wwan: core: no more hold netdev ops owning module
The WWAN netdev ops owner holding was used to protect from the
unexpected memory disappear. This approach causes a dependency cycle
(driver -> core -> driver) and effectively prevents a WWAN driver
unloading. E.g. WWAN hwsim could not be unloaded until all simulated
devices are removed:
~# modprobe wwan_hwsim devices=2
~# lsmod | grep wwan
wwan_hwsim 16384 2
wwan 20480 1 wwan_hwsim
~# rmmod wwan_hwsim
rmmod: ERROR: Module wwan_hwsim is in use
~# echo > /sys/kernel/debug/wwan_hwsim/hwsim0/destroy
~# echo > /sys/kernel/debug/wwan_hwsim/hwsim1/destroy
~# lsmod | grep wwan
wwan_hwsim 16384 0
wwan 20480 1 wwan_hwsim
~# rmmod wwan_hwsim
For a real device driver this will cause an inability to unload module
until a served device is physically detached.
Since the last commit we are removing all child netdev(s) when a driver
unregister the netdev ops. This allows us to permit the driver
unloading, since any sane driver will call ops unregistering on a device
deinitialization. So, remove the holding of an ops owner to make it
easier to unload a driver module. The owner field has also beed removed
from the ops structure as there are no more users of this field.
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/wwan.h')
-rw-r--r-- | include/linux/wwan.h | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/include/linux/wwan.h b/include/linux/wwan.h index 34222230360c..e1981ea3a2fd 100644 --- a/include/linux/wwan.h +++ b/include/linux/wwan.h @@ -128,14 +128,12 @@ void *wwan_port_get_drvdata(struct wwan_port *port); /** * struct wwan_ops - WWAN device ops - * @owner: module owner of the WWAN ops * @priv_size: size of private netdev data area * @setup: set up a new netdev * @newlink: register the new netdev * @dellink: remove the given netdev */ struct wwan_ops { - struct module *owner; unsigned int priv_size; void (*setup)(struct net_device *dev); int (*newlink)(void *ctxt, struct net_device *dev, |