]> git.baikalelectronics.ru Git - kernel.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)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Aug 2020 22:38:02 +0000 (15:38 -0700)
commit02bc3ab12e89c0fe3ef06273a7dc55061d4f9f6a
tree2998c83924b7b4e963187a8fb2ba1510f6b5a8d6
parentff7fc36e208bb3dce718611dc767dc52829c7fa7
ravb: Fixed to be able to unload modules

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: bfafa9ee6042 ("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>
drivers/net/ethernet/renesas/ravb_main.c