Re: [PATCH 31/34] move virtrng_remove to .devexit.text

From: Uwe Kleine-König
Date: Thu Oct 01 2009 - 13:41:32 EST


Hello Michael,

> > But note it's not an error in general to use a .text function as remove
> > callback. E.g. take drivers/gpio/twl4030-gpio.c. gpio_twl4030_remove
> > is used in gpio_twl4030_probe which is defined using __devinit. So
> > using __devexit for gpio_twl4030_remove is wrong. (So there is a bug,
> > as gpio_twl4030_remove uses __devexit.) I didn't try, but as far as I
> > understand this will result in a compile error if the driver is built-in
> > with HOTPLUG=n.
>
> Wait a second.
> As far as I understand, __devexit makes it possible to remove code if
> hotplug is off.
right.

> At least for static functions, it's enough to mark their only use
> as _devexit_p, and compiler will remove the text as it's unused.
>
> Isn't that right?
hmm, I don't know. I'll try, one moment. OK, you're right. The
function is discarded with a compiler warning.

> If so, what, again, was the motivation for the patches that added
> __devexit to functions that were already used with __devexit_p?
I thought it saves some memory, but as it looks now it only fixes a
compiler warning.

Note there are two types of errors fixed in this series. One is:

-static int func(void arg)
+static int __devexit func(void arg)

if the only usage of func() is wraped by __devexit_p. This is (as
seen above) not that critical, there is only a warning fixed.

The other type results in a build failure:

-remove = __devexit_p(another_func),
+remove = __exit_p(another_func),

with another_func being defined using __exit. In the case
defined(MODULE) && defined(CONFIG_HOTPLUG) another_func is discarded,
but __devexit_p(another_func) evaluates to another_func and thus the
module doesn't link.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/