lkml.org 
[lkml]   [2018]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] iio: adc: max9611: fix module auto-loading
On Mon, Jan 1, 2018 at 12:53 PM, Jonathan Cameron <jic23@kernel.org> wrote:

> 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

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

>> >> > Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>
>> >> > ---
>> >> > drivers/iio/adc/max9611.c | 5 ++---
>> >> > 1 file changed, 2 insertions(+), 3 deletions(-)
>> >> >
>> >> > diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c
>> >> > index b1dd17c..ce0115a 100644
>> >> > --- a/drivers/iio/adc/max9611.c
>> >> > +++ b/drivers/iio/adc/max9611.c
>> >> > @@ -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
>> >> >
>

\
 
 \ /
  Last update: 2018-01-03 13:42    [W:0.117 / U:1.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site