public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Stephen Kitt <steve@sk2.org>
Cc: Jean Delvare <jdelvare@suse.com>,
	linux-hwmon@vger.kernel.org, linux-i2c@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon/pmbus: use simple i2c probe function
Date: Thu, 6 Aug 2020 14:48:58 -0700	[thread overview]
Message-ID: <e378e4e6-73b3-0a11-bca6-ec0d4225a010@roeck-us.net> (raw)
In-Reply-To: <20200806221232.278c3878@heffalump.sk2.org>


[-- Attachment #1.1: Type: text/plain, Size: 2283 bytes --]

On 8/6/20 1:12 PM, Stephen Kitt wrote:
> On Thu, 6 Aug 2020 12:15:55 -0700, Guenter Roeck <linux@roeck-us.net> wrote:
>> On 8/6/20 9:16 AM, Stephen Kitt wrote:
>>> pmbus_do_probe doesn't use the id information provided in its second
>>> argument, so this can be removed, which then allows using the
>>> single-parameter i2c probe function ("probe_new") for probes which
>>> don't use the id information either.
>>>
>>> This avoids scanning the identifier tables during probes.
>>>
>>> Additionally, in cases where the id information (driver_data) isn't
>>> used, the corresponding declarations are removed from the id_table,
>>> and .name is specified explicitly.
>>>   
>>
>> The ultimate idea seems to be to remove the "old" i2c probe function
>> entirely. This means we'll have to touch the various drivers again
>> to make that happen if they are not converted to probe_new.
>>
>> With that in mind, since we are at it, why not use probe_new() in
>> every driver and call i2c_match_id() in cases where it is actually
>> needed/used ?
> 
> Yes, I was planning on doing that in a second phase, but I can do it right
> now (perhaps as a patch series) if that would be better.
> 
>> Also, I am not convinced that replacements such as
>>
>> -	{ "ipsps1", 0 },
>> +	{ .name = "ipsps1" },
>>
>> are an improvement. I would suggest to leave that alone for
>> consistency (and to make it easier to add more devices to the
>> various drivers if that happens in the future).
> 
> From reading through all the drivers using id_table, it seems to me that we
> could do away with driver_data altogether and move all that to driver-local
> structures, in many cases covering more than just an id. By only initialising
> the elements of the structure that are really needed, I was hoping to (a)
> make it more obvious that driver_data isn’t used, and (b) allow removing it
> without touching all the code again.
> 

I don't see it as an improvement to replace a common data structure with
per-driver data structures. That sounds too much like "let's re-invent
the wheel over and over again". If that is where things are going, I'd
rather have it implemented everywhere else first. I am ok with the other
changes, but not with this.

Guenter


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-08-06 21:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06 16:16 [PATCH] hwmon/pmbus: use simple i2c probe function Stephen Kitt
2020-08-06 19:15 ` Guenter Roeck
2020-08-06 20:12   ` Stephen Kitt
2020-08-06 21:48     ` Guenter Roeck [this message]
2020-08-07  6:23       ` Stephen Kitt
2020-08-07 14:15         ` Guenter Roeck
2020-08-06 21:57 ` kernel test robot
2020-08-06 23:01 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e378e4e6-73b3-0a11-bca6-ec0d4225a010@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steve@sk2.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox