mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: adc: max9611: fix module auto-loading
@ 2017-12-29  7:14 Dmitry Mastykin
  2017-12-29  9:11 ` jacopo mondi
  2017-12-29  9:12 ` Andy Shevchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Mastykin @ 2017-12-29  7:14 UTC (permalink / raw)
  Cc: Dmitry Mastykin, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, Jacopo Mondi,
	Rob Herring, Dan Carpenter, linux-iio, linux-kernel

Module auto-load doesn't work because i2c table is not exported.

Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>
---
 drivers/iio/adc/max9611.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c
index b1dd17c..7924b5c 100644
--- a/drivers/iio/adc/max9611.c
+++ b/drivers/iio/adc/max9611.c
@@ -516,13 +516,20 @@ static int max9611_init(struct max9611_dev *max9611)
 	return 0;
 }
 
+static const struct i2c_device_id max9611_id[] = {
+	{ "max9611", 0 },
+	{ "max9612", 0 },
+	{ },
+ };
+MODULE_DEVICE_TABLE(i2c, max9611_id);
+
 static const struct of_device_id max9611_of_table[] = {
 	{.compatible = "maxim,max9611", .data = "max9611"},
 	{.compatible = "maxim,max9612", .data = "max9612"},
 	{ },
 };
-
 MODULE_DEVICE_TABLE(of, max9611_of_table);
+
 static int max9611_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: max9611: fix module auto-loading
  2017-12-29  7:14 [PATCH] iio: adc: max9611: fix module auto-loading Dmitry Mastykin
@ 2017-12-29  9:11 ` jacopo mondi
  2017-12-29  9:12 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: jacopo mondi @ 2017-12-29  9:11 UTC (permalink / raw)
  To: Dmitry Mastykin
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Jacopo Mondi, Rob Herring, Dan Carpenter,
	linux-iio, linux-kernel

Hi Dmitry,

On Fri, Dec 29, 2017 at 10:14:27AM +0300, Dmitry Mastykin wrote:
> Module auto-load doesn't work because i2c table is not exported.
>
> Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>
> ---
>  drivers/iio/adc/max9611.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c
> index b1dd17c..7924b5c 100644
> --- a/drivers/iio/adc/max9611.c
> +++ b/drivers/iio/adc/max9611.c
> @@ -516,13 +516,20 @@ static int max9611_init(struct max9611_dev *max9611)
>  	return 0;
>  }
>
> +static const struct i2c_device_id max9611_id[] = {
> +	{ "max9611", 0 },
> +	{ "max9612", 0 },
> +	{ },
> + };
> +MODULE_DEVICE_TABLE(i2c, max9611_id);
> +

Wouldn't you need to also set the "id_table" field of "struct
i2c_driver" to point this?

Thanks
   j


>  static const struct of_device_id max9611_of_table[] = {
>  	{.compatible = "maxim,max9611", .data = "max9611"},
>  	{.compatible = "maxim,max9612", .data = "max9612"},
>  	{ },
>  };
> -
>  MODULE_DEVICE_TABLE(of, max9611_of_table);
> +
>  static int max9611_probe(struct i2c_client *client,
>  			 const struct i2c_device_id *id)
>  {
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: max9611: fix module auto-loading
  2017-12-29  7:14 [PATCH] iio: adc: max9611: fix module auto-loading Dmitry Mastykin
  2017-12-29  9:11 ` jacopo mondi
@ 2017-12-29  9:12 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2017-12-29  9:12 UTC (permalink / raw)
  To: Dmitry Mastykin
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Jacopo Mondi, Rob Herring, Dan Carpenter,
	linux-iio, Linux Kernel Mailing List

On Fri, Dec 29, 2017 at 9:14 AM, Dmitry Mastykin <mastichi@gmail.com> wrote:
> Module auto-load doesn't work because i2c table is not exported.
>

The simplest fix is to move to ->probe_new() since the driver is not
used out of DT/ACPI enumeration.

> Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>
> ---
>  drivers/iio/adc/max9611.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c
> index b1dd17c..7924b5c 100644
> --- a/drivers/iio/adc/max9611.c
> +++ b/drivers/iio/adc/max9611.c
> @@ -516,13 +516,20 @@ static int max9611_init(struct max9611_dev *max9611)
>         return 0;
>  }
>
> +static const struct i2c_device_id max9611_id[] = {
> +       { "max9611", 0 },
> +       { "max9612", 0 },
> +       { },
> + };
> +MODULE_DEVICE_TABLE(i2c, max9611_id);
> +
>  static const struct of_device_id max9611_of_table[] = {
>         {.compatible = "maxim,max9611", .data = "max9611"},
>         {.compatible = "maxim,max9612", .data = "max9612"},
>         { },
>  };
> -
>  MODULE_DEVICE_TABLE(of, max9611_of_table);
> +
>  static int max9611_probe(struct i2c_client *client,
>                          const struct i2c_device_id *id)
>  {
> --
> 2.7.4
>



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-29  9:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-29  7:14 [PATCH] iio: adc: max9611: fix module auto-loading Dmitry Mastykin
2017-12-29  9:11 ` jacopo mondi
2017-12-29  9:12 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®