]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ravb: Fixed to be able to unload modules
authorYuusuke Ashizuka <ashiduka@fujitsu.com>
Thu, 20 Aug 2020 09:43:07 +0000 (18:43 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 12 Sep 2020 09:45:32 +0000 (11:45 +0200)
commit38f2f49b7bf236fc4c23a5fb4b64761432e0120d
tree965c22e156ad4194d1f66c896a77b8ac57d9435c
parent1b4a82a834b43ccdc8599df0f1094577fe423af6
ravb: Fixed to be able to unload modules

commit 1838d6c62f57836639bd3d83e7855e0ee4f6defc upstream.

When this driver is built as a module, I cannot rmmod it after insmoding
it.
This is because that this driver calls ravb_mdio_init() at the time of
probe, and module->refcnt is incremented by alloc_mdio_bitbang() called
after that.
Therefore, even if ifup is not performed, the driver is in use and rmmod
cannot be performed.

$ lsmod
Module                  Size  Used by
ravb                   40960  1
$ rmmod ravb
rmmod: ERROR: Module ravb is in use

Call ravb_mdio_init() at open and free_mdio_bitbang() at close, thereby
rmmod is possible in the ifdown state.

Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
Signed-off-by: Yuusuke Ashizuka <ashiduka@fujitsu.com>
Reviewed-by: Sergei Shtylyov <sergei.shtylyov@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/renesas/ravb_main.c