Skip to contentSkip to conversation

iio: adc: max9611: fix module auto-loading

PATCH In review Dmitry Mastykin 4 participants 16 messages Dec 29, 2017 – Jan 15, 2018 IIO

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iio: adc: max9611: fix module auto-loading

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

---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max9611.c +2 -3
index b1dd17c..ce0115a 100644
@@ -523,8 +523,7 @@ static const struct of_device_id max9611_of_table[] = {
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-			 const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
 	const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
 	const struct device_node *of_node = client->dev.of_node;
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver = {
 		   .owner = THIS_MODULE,
 		   .of_match_table = max9611_of_table,
 	},
-	.probe = max9611_probe,
+	.probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
Signature · 1 line
2.7.4
Reviewed-by on v2 1/1
#1 lore raw
Quoted 3 lines · Dmitry Mastykin

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

I suppose, and

Thanks!

Quoted 31 lines
---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max9611.c +2 -4
index b1dd17c..ce0115a 100644
@@ -523,8 +523,7 @@ static const struct of_device_id max9611_of_table[] = {
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
        const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
        const struct device_node *of_node = client->dev.of_node;
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = max9611_of_table,
        },
-       .probe = max9611_probe,
+       .probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
--

2.7.4

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#2 lore raw
Quoted 10 lines · On Fri, 29 Dec 2017 17:30:39 +0200 Andy Shevchenko <[email protected]>…
Quoted 3 lines · Dmitry Mastykin

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

I suppose, and

I'm a little confused. Why does this now make module autoloading work where it previously didn't?

Jonathan

Quoted 37 lines

Thanks!

Quoted 31 lines
---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max9611.c +2 -4
index b1dd17c..ce0115a 100644
@@ -523,8 +523,7 @@ static const struct of_device_id max9611_of_table[] = {
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
        const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
        const struct device_node *of_node = client->dev.of_node;
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = max9611_of_table,
        },
-       .probe = max9611_probe,
+       .probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
--

2.7.4

#3 lore raw
Quoted 4 lines
Quoted 2 lines · On Fri, 29 Dec 2017 17:30:39 +0200 Andy Shevchenko <[email protected]>…

I was not aware of this tag, that's what I wanted to write, thanks!

Quoted 3 lines · Jonathan Cameron

I'm a little confused. Why does this now make module autoloading work where it previously didn't?

As I understand, .probe is not called if module doesn't export i2c id table, there is nothing to put into second argument.
But .probe_new is called, because it's supposed to do of_match_device itself.

Kind regards,
Dmitry

Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max9611.c +2 -4
index b1dd17c..ce0115a 100644
@@ -523,8 +523,7 @@ static const struct of_device_id max9611_of_table[] = {
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
        const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
        const struct device_node *of_node = client->dev.of_node;
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = max9611_of_table,
        },
-       .probe = max9611_probe,
+       .probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
--

2.7.4

maintainer
#4 lore raw
Quoted 6 lines · On Sat, 30 Dec 2017 15:43:38 +0300 Dmitry Mastykin <[email protected]> wrote:
Quoted 4 lines
Quoted 2 lines · On Fri, 29 Dec 2017 17:30:39 +0200 Andy Shevchenko <[email protected]>…

I was not aware of this tag, that's what I wanted to write, thanks!

Quoted 7 lines
Quoted 3 lines · Jonathan Cameron

I'm a little confused. Why does this now make module autoloading work where it previously didn't?

As I understand, .probe is not called if module doesn't export i2c id table, there is nothing to put into second argument.
But .probe_new is called, because it's supposed to do of_match_device itself.

Not that I can see. They are a straight swap in drivers/i2c/i2c-core-base.c presumably intended to drop the parameter that is unused in the devicetree and acpi cases.

This isn't an area I know that much about so I've just played follow the code for a few minutes.

Module autoloading relies on the MODULE_DEVICE_TABLE macro. This creates an alias so the scripts/mod/file2alias.c file can work out what MODULE_ALIAS lines need to be created. This results in entries being added to section .modinfo of the module which userspace can then read to work out which module does what.

Here you already have that for the device tree case so this should already work with or without this change.

So what circumstance did you have where this module did not autoprobe correctly?

I may well be missing some subtle detail of course having spent only a few minute looking at this!

Jonathan

Quoted 35 lines

Kind regards,
Dmitry

Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max9611.c +2 -4
index b1dd17c..ce0115a 100644
@@ -523,8 +523,7 @@ static const struct of_device_id max9611_of_table[] = {
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
        const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
        const struct device_node *of_node = client->dev.of_node;
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = max9611_of_table,
        },
-       .probe = max9611_probe,
+       .probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
--

2.7.4

#5 lore raw
Quoted 16 lines · Jonathan Cameron

Not that I can see. They are a straight swap in drivers/i2c/i2c-core-base.c presumably intended to drop the parameter that is unused in the devicetree and acpi cases.

This isn't an area I know that much about so I've just played follow the code for a few minutes.

Module autoloading relies on the MODULE_DEVICE_TABLE macro. This creates an alias so the scripts/mod/file2alias.c file can work out what MODULE_ALIAS lines need to be created. This results in entries being added to section .modinfo of the module which userspace can then read to work out which module does what.

Here you already have that for the device tree case so this should already work with or without this change.

Quoted 6 lines

So what circumstance did you have where this module did not autoprobe correctly?

I may well be missing some subtle detail of course having spent only a few minute looking at this!

Jonathan

Hi Johnatan,
Thank you for the answer, I think you're right.
I use the driver as module and one my colleague as built-in.
With current driver module auto-load doesn't work, but built-in does auto-probe well.
In patch v1 I added MODULE_DEVICE_TABLE(i2c,... and auto-load started to work. Then in patch v2 I removed the table and switched to probe_new.
I think v2 worked only because I forgot to do depmod after replacing .ko-file. I will have chance to try it again after 2 weeks.
May be better way for me is to build in the driver, because it seems strange to add the table
to driver whereas people get rid of this table in other drivers.

Kind regards,
Dmitry

Quoted 32 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max9611.c +2 -4
index b1dd17c..ce0115a 100644
@@ -523,8 +523,7 @@ static const struct of_device_id max9611_of_table[] = {
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
        const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
        const struct device_node *of_node = client->dev.of_node;
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = max9611_of_table,
        },
-       .probe = max9611_probe,
+       .probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
--

2.7.4

maintainer
#6 lore raw
Quoted 25 lines · On Wed, 3 Jan 2018 15:41:13 +0300 Dmitry Mastykin <[email protected]> wrote:
Quoted 16 lines · Jonathan Cameron

Not that I can see. They are a straight swap in drivers/i2c/i2c-core-base.c presumably intended to drop the parameter that is unused in the devicetree and acpi cases.

This isn't an area I know that much about so I've just played follow the code for a few minutes.

Module autoloading relies on the MODULE_DEVICE_TABLE macro. This creates an alias so the scripts/mod/file2alias.c file can work out what MODULE_ALIAS lines need to be created. This results in entries being added to section .modinfo of the module which userspace can then read to work out which module does what.

Here you already have that for the device tree case so this should already work with or without this change.

Quoted 6 lines

So what circumstance did you have where this module did not autoprobe correctly?

I may well be missing some subtle detail of course having spent only a few minute looking at this!

Jonathan

Quoted 12 lines

Hi Johnatan,
Thank you for the answer, I think you're right.
I use the driver as module and one my colleague as built-in.
With current driver module auto-load doesn't work, but built-in does auto-probe well.
In patch v1 I added MODULE_DEVICE_TABLE(i2c,... and auto-load started to work. Then in patch v2 I removed the table and switched to probe_new.
I think v2 worked only because I forgot to do depmod after replacing .ko-file. I will have chance to try it again after 2 weeks.
May be better way for me is to build in the driver, because it seems strange to add the table
to driver whereas people get rid of this table in other drivers.

Are you using devicetree or some other method to instantiate the device? i.e. How does the kernel know it exists?

Quoted 36 lines

Kind regards,
Dmitry

Quoted 32 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max9611.c +2 -4
index b1dd17c..ce0115a 100644
@@ -523,8 +523,7 @@ static const struct of_device_id max9611_of_table[] = {
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
        const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
        const struct device_node *of_node = client->dev.of_node;
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = max9611_of_table,
        },
-       .probe = max9611_probe,
+       .probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
--

2.7.4

#7 lore raw
Quoted 3 lines · Jonathan Cameron

Are you using devicetree or some other method to instantiate the device? i.e. How does the kernel know it exists?

Yes, I'm using device-tree (in a way like in bindings txt). I have also max1137 connected, which is loaded and probed well. Thank you!
Dmitry

Quoted 33 lines
Quoted 32 lines
Quoted 32 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max9611.c +2 -4
index b1dd17c..ce0115a 100644
@@ -523,8 +523,7 @@ static const struct of_device_id max9611_of_table[] = {
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
        const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
        const struct device_node *of_node = client->dev.of_node;
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = max9611_of_table,
        },
-       .probe = max9611_probe,
+       .probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
--

2.7.4

maintainer
#8 lore raw
Quoted 7 lines · On Sun, 7 Jan 2018 00:37:44 +0300 Dmitry Mastykin <[email protected]> wrote:
Quoted 3 lines · Jonathan Cameron

Are you using devicetree or some other method to instantiate the device? i.e. How does the kernel know it exists?

Yes, I'm using device-tree (in a way like in bindings txt). I have also max1137 connected, which is loaded and probed well. Thank you!

If you wouldn't mind, could you post the snippet of the tree for this device. I'm still not sure why it isn't probing, but it could be that the manufacturer isn't specified, but just the part number?

Jonathan

Quoted 39 lines

Dmitry

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max9611.c +2 -3
index b1dd17c..ce0115a 100644
@@ -523,8 +523,7 @@ static const struct of_device_id max9611_of_table[] = {
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
        const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
        const struct device_node *of_node = client->dev.of_node;
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = max9611_of_table,
        },
-       .probe = max9611_probe,
+       .probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

--
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw
Quoted 4 lines · Jonathan Cameron

If you wouldn't mind, could you post the snippet of the tree for this device. I'm still not sure why it isn't probing, but it could be that the manufacturer isn't specified, but just the part number?

&i2c0 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2c0_pins_default>;
    status = "okay";
    cadc0: max9611_0_70@70 {
        status = "okay";
        compatible = "maxim,max9611";
        reg = <0x70>;

        shunt-resistor-micro-ohms = <500000>;
    };
};

Thank you!
Dmitry

Quoted 38 lines
Quoted 37 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max9611.c +2 -3
index b1dd17c..ce0115a 100644
@@ -523,8 +523,7 @@ static const struct of_device_id max9611_of_table[] = {
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
        const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
        const struct device_node *of_node = client->dev.of_node;
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = max9611_of_table,
        },
-       .probe = max9611_probe,
+       .probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

--
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

Hello Johnatan,
I think the issue is the same as Javier Martinez Canillas wrote:
"What is not correct is to require OF-only drivers to have an I2C device ID table just as a workaround to have their modules auto-loading working."
Please see: http://lkml.iu.edu/hypermail/linux/kernel/1712.0/01779.html
So the problem is not in driver, but in auto-loading procedure.

Kind regards,
Dmitry

Quoted 45 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Review

Quoted 5 lines
---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/iio/adc/max9611.c

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

drivers/iio/adc/max9611.c static const struct of_device_id

Quoted 4 lines

index b1dd17c..ce0115a 100644

drivers/iio/adc/max9611.c +0 -0
@@ -523,8 +523,7 @@ static const struct of_device_id

max9611_of_table[] = {

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/iio/adc/max9611.c static const struct of_device_id · line 528

Quoted 8 lines
drivers/iio/adc/max9611.c +1 -2
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
        const char * const shunt_res_prop =

"shunt-resistor-micro-ohms";

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/iio/adc/max9611.c static const struct of_device_id · line 529

Quoted 1 line
drivers/iio/adc/max9611.c +0 -0
        const struct device_node *of_node =

client->dev.of_node;

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/iio/adc/max9611.c static struct i2c_driver max9611_driver

Quoted 1 line
drivers/iio/adc/max9611.c +0 -0
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver

= {

Quoted 18 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/iio/adc/max9611.c +1 -1
                   .owner = THIS_MODULE,
                   .of_match_table = max9611_of_table,
        },
-       .probe = max9611_probe,
+       .probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

--
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
In reply to Dmitry Mastykin

Hello Johnatan,
May be the issue is the same as Javier Martinez Canillas wrote:
"What is not correct is to require OF-only drivers to have an I2C device ID table just as a workaround to have their modules auto-loading working."
Please see: http://lkml.iu.edu/hypermail/linux/kernel/1712.0/01779.html
So the problem is not in driver, but in auto-loading procedure. Thank you!

Kind regards,
Dmitry

Quoted 38 lines
Quoted 38 lines
Quoted 37 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
---
 drivers/iio/adc/max9611.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iio/adc/max9611.c +2 -3
index b1dd17c..ce0115a 100644
@@ -523,8 +523,7 @@ static const struct of_device_id max9611_of_table[] = {
 };
 
 MODULE_DEVICE_TABLE(of, max9611_of_table);
-static int max9611_probe(struct i2c_client *client,
-                        const struct i2c_device_id *id)
+static int max9611_probe(struct i2c_client *client)
 {
        const char * const shunt_res_prop = "shunt-resistor-micro-ohms";
        const struct device_node *of_node = client->dev.of_node;
@@ -576,7 +575,7 @@ static struct i2c_driver max9611_driver = {
                   .owner = THIS_MODULE,
                   .of_match_table = max9611_of_table,
        },
-       .probe = max9611_probe,
+       .probe_new = max9611_probe,
 };
 module_i2c_driver(max9611_driver);
 
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

--
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw

Hello Dmitry,

Quoted 7 lines · Dmitry Mastykin

Hello Johnatan,
May be the issue is the same as Javier Martinez Canillas wrote:
"What is not correct is to require OF-only drivers to have an I2C device ID table just as a workaround to have their modules auto-loading working."
Please see: http://lkml.iu.edu/hypermail/linux/kernel/1712.0/01779.html
So the problem is not in driver, but in auto-loading procedure.

I've posted [0] a fix for the I2C core some time ago. Could you please give a try to that and maybe provide your {Tested,Reviewed}-by tag?

[0]: https://patchwork.kernel.org/patch/10089425/

Best regards,
Javier

#13 lore raw
In reply to Jonathan Cameron

Hello Jonathan,

On Mon, Jan 1, 2018 at 10:53 AM, Jonathan Cameron <[email protected]> wrote:

[snip]

Quoted 4 lines

I may well be missing some subtle detail of course having spent only a few minute looking at this!

Your understanding is correct. This change has nothing to do with module autoloading.

The .probe_new callback is only used to avoid requiring an I2C device ID table since the old .probe callback has a struct i2c_device_id as a parameter and so requires a table even in OF (or ACPI) only drivers.

Quoted 1 line

Jonathan

Best regards,
Javier

maintainer
#14 lore raw
Quoted 11 lines · On Wed, 10 Jan 2018 12:01:07 +0100 Javier Martinez Canillas…

Hello Jonathan,

On Mon, Jan 1, 2018 at 10:53 AM, Jonathan Cameron <[email protected]> wrote:

[snip]

Quoted 4 lines

I may well be missing some subtle detail of course having spent only a few minute looking at this!

Quoted 6 lines

Your understanding is correct. This change has nothing to do with module autoloading.

The .probe_new callback is only used to avoid requiring an I2C device ID table since the old .probe callback has a struct i2c_device_id as a parameter and so requires a table even in OF (or ACPI) only drivers.

OK, then let us revisit this patch once we have an answer on your one fixing the autoprobing more generally. Until we then we don't know whether we need to add the i2c table in or not whether this suffices.

Jonathan

Quoted 9 lines
Quoted 2 lines

Jonathan

Best regards,
Javier
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw
Quoted 17 lines · Jonathan Cameron
Quoted 14 lines · On Wed, 10 Jan 2018 12:01:07 +0100 Javier Martinez Canillas…

Hello Jonathan,

On Mon, Jan 1, 2018 at 10:53 AM, Jonathan Cameron <[email protected]> wrote:

[snip]

Quoted 4 lines

I may well be missing some subtle detail of course having spent only a few minute looking at this!

Your understanding is correct. This change has nothing to do with module autoloading.

Quoted 8 lines
Quoted 3 lines

The .probe_new callback is only used to avoid requiring an I2C device ID table since the old .probe callback has a struct i2c_device_id as a parameter and so requires a table even in OF (or ACPI) only drivers.

OK, then let us revisit this patch once we have an answer on your one fixing the autoprobing more generally. Until we then we don't know whether we need to add the i2c table in or not whether this suffices.

That's correct. If the driver is for a device that's OF-only (e.g:
will never be used from a non-DT platform) then I don't think we should add a I2C table.

Now, if Wolfram nacks my patch then we should add it as a workaround to have auto-loading working.

Quoted 2 lines

Jonathan

Best regards,
Javier