diff mbox

[2/2,2/2] iio: adc: sun4i-gpadc-iio: Fix module autoload when OF devices are registered

Message ID 20170501224559.21028-2-edu.molinas@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Eduardo Molinas May 1, 2017, 10:45 p.m. UTC
If the driver is built as a module, it won't be autloaded if the devices
are registered via OF code because the OF device table
entries are not exported as aliases

Before the patch:
$ modinfo drivers/iio/adc/sun4i-gpadc-iio.ko | grep alias
alias:          platform:sun6i-a31-gpadc-iio
alias:          platform:sun5i-a13-gpadc-iio
alias:          platform:sun4i-a10-gpadc-iio

After the patch:
$ modinfo drivers/iio/adc/sun4i-gpadc-iio.ko | grep alias
alias:          of:N*T*Callwinner,sun8i-a33-thsC*
alias:          of:N*T*Callwinner,sun8i-a33-ths
alias:          platform:sun6i-a31-gpadc-iio
alias:          platform:sun5i-a13-gpadc-iio
alias:          platform:sun4i-a10-gpadc-iio

Signed-off-by: Eduardo Molinas <edu.molinas@gmail.com>
---
---
 drivers/iio/adc/sun4i-gpadc-iio.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Chen-Yu Tsai May 2, 2017, 2:09 a.m. UTC | #1
On Tue, May 2, 2017 at 6:45 AM, Eduardo Molinas <edu.molinas@gmail.com> wrote:
> If the driver is built as a module, it won't be autloaded if the devices
> are registered via OF code because the OF device table
> entries are not exported as aliases
>
> Before the patch:
> $ modinfo drivers/iio/adc/sun4i-gpadc-iio.ko | grep alias
> alias:          platform:sun6i-a31-gpadc-iio
> alias:          platform:sun5i-a13-gpadc-iio
> alias:          platform:sun4i-a10-gpadc-iio
>
> After the patch:
> $ modinfo drivers/iio/adc/sun4i-gpadc-iio.ko | grep alias
> alias:          of:N*T*Callwinner,sun8i-a33-thsC*
> alias:          of:N*T*Callwinner,sun8i-a33-ths
> alias:          platform:sun6i-a31-gpadc-iio
> alias:          platform:sun5i-a13-gpadc-iio
> alias:          platform:sun4i-a10-gpadc-iio
>
> Signed-off-by: Eduardo Molinas <edu.molinas@gmail.com>

Acked-by: Chen-Yu Tsai <wens@csie.org>

Can we merge this as a fix for 4.12?
Jonathan Cameron May 7, 2017, 1:46 p.m. UTC | #2
On 02/05/17 03:09, Chen-Yu Tsai wrote:
> On Tue, May 2, 2017 at 6:45 AM, Eduardo Molinas <edu.molinas@gmail.com> wrote:
>> If the driver is built as a module, it won't be autloaded if the devices
>> are registered via OF code because the OF device table
>> entries are not exported as aliases
>>
>> Before the patch:
>> $ modinfo drivers/iio/adc/sun4i-gpadc-iio.ko | grep alias
>> alias:          platform:sun6i-a31-gpadc-iio
>> alias:          platform:sun5i-a13-gpadc-iio
>> alias:          platform:sun4i-a10-gpadc-iio
>>
>> After the patch:
>> $ modinfo drivers/iio/adc/sun4i-gpadc-iio.ko | grep alias
>> alias:          of:N*T*Callwinner,sun8i-a33-thsC*
>> alias:          of:N*T*Callwinner,sun8i-a33-ths
>> alias:          platform:sun6i-a31-gpadc-iio
>> alias:          platform:sun5i-a13-gpadc-iio
>> alias:          platform:sun4i-a10-gpadc-iio
>>
>> Signed-off-by: Eduardo Molinas <edu.molinas@gmail.com>
> 
> Acked-by: Chen-Yu Tsai <wens@csie.org>
> 
> Can we merge this as a fix for 4.12?
Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
diff mbox

Patch

diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
index c3d7ba100a48..1c83b45043bf 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -712,6 +712,7 @@  static struct platform_driver sun4i_gpadc_driver = {
 	.probe = sun4i_gpadc_probe,
 	.remove = sun4i_gpadc_remove,
 };
+MODULE_DEVICE_TABLE(of, sun4i_gpadc_of_id);
 
 module_platform_driver(sun4i_gpadc_driver);