Re: [PATCH 3/3] regulator: s2mps11: Copy supported regulators from initconst

From: Krzysztof Kozlowski
Date: Mon Mar 03 2014 - 06:54:28 EST


Hi,

On Mon, 2014-03-03 at 10:09 +0800, Mark Brown wrote:
> On Fri, Feb 28, 2014 at 11:01:50AM +0100, Krzysztof Kozlowski wrote:
> > Add __initconst to 'regulator_desc' array with supported regulators.
> > During probe choose how many and which regulators will be supported
> > according to device ID. Then copy the 'regulator_desc' array to
> > allocated memory so the regulator core can use it.
>
> Applied, thanks.

Thanks! Unfortunately I wonder now whether it was a good idea to mark
the regulator_desc array as __initconst. I've seen the warning from
kbuild test robot:
--------
>> WARNING: vmlinux.o(.text+0xf0faab): Section mismatch in reference
from the function s2mps11_pmic_probe() to the
variable .init.rodata:s2mps11_regulators
The function s2mps11_pmic_probe() references
the variable __initconst s2mps11_regulators.
This is often because s2mps11_pmic_probe lacks a __initconst
annotation or the annotation of s2mps11_regulators is wrong.
--------

I have two ideas for fixing this:
1. The s2mps11_pmic_probe() could be marked with __init and
platform_driver_probe() should be used. Unfortunately this does not work
because the driver is registered and probed a little later after
s2mps11_pmic_init() when I2C bus driver is probed. During that time the
drv->probe() is actually NULL.

2. The s2mps11_pmic_probe() won't be marked as __init and could copy the
regulator_desc (__initconst) array to local static variable. This way if
it would be called twice the mentioned array __initconst won't be
dereferenced. Unfortunately this won't remove the warning.

Any ideas for solving this?

Best regards,
Krzysztof





--
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/