[PATCH] thermal: imx_sc_thermal: Drop empty platform remove function

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Tue Dec 13 00:13:55 PST 2022


Hello Daniel,

On Tue, Dec 13, 2022 at 08:46:45AM +0100, Daniel Lezcano wrote:
> On 12/12/2022 23:02, Uwe Kleine-König wrote:
> > A remove callback just returning 0 is equivalent to no remove callback
> > at all. So drop the useless function.
> 
> AFAIU, without the remove callback the module can not be unloaded, no?

This is a wrong expectation. As Marko already pointed out the relevant
code path in platform_remove(), having no remove callback is equivalent
to a remove callback that returns zero unconditionally.

Note that driver unbinding and module unloading are two separate
concepts.

If you want to prevent driver unbinding, you can set struct
device_driver::suppress_bind_attrs.

For modules your assumption is true: If there is an init but no exit
function, a module cannot be unloaded[1]. Also while a reference to the
module is held, the module won't go away. (E.g. a bound device holds
such a reference.)

Best regards
Uwe

[1] apart from MODULE_FORCE_UNLOAD

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20221213/f85149fb/attachment-0001.sig>


More information about the linux-arm-kernel mailing list