mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Lee Jones <lee@kernel.org>
Cc: Andre Przywara <andre.przywara@arm.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Chen-Yu Tsai <wens@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Hans de Goede <hansg@kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	mfd@lists.linux.dev, linux-sunxi@lists.linux.dev,
	Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH v8 2/5] mfd: axp20x-i2c: Fix i2c instantiation
Date: Wed, 18 Nov 2026 15:43:36 +0100	[thread overview]
Message-ID: <1jh5he2o9z.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <1ja4ogfp5l.fsf@starbuckisacylon.baylibre.com>

On mer. 14 oct. 2026 at 14:21, Jerome Brunet <jbrunet@baylibre.com> wrote:

> On mer. 14 oct. 2026 at 11:48, Lee Jones <lee@kernel.org> wrote:
>
>> Note:
>>
>> --- checkpatch.pl (3 issues) ---
>> Line 2: WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
>> Line 3: ERROR: Invalid commit separator - some tools may have problems applying this
>> ----------------------------------
>
> I've checked before sending and checked again now, I don't have those
> warning. I don't see anything long on line 2 or a separator near line 3.
>
> Any specific way I should run the tool reproduce the problem if there is
> one ?
>
>>
>> On Thu, 24 Sep 2026, Jerome Brunet wrote:
>>
>>> On jeu. 24 sept. 2026 at 09:27, Lee Jones <lee@kernel.org> wrote:
>>> 
>>> > On Thu, 10 Sep 2026, Jerome Brunet wrote:
>>> >
>>> >> Apparently this device never really supported i2c instantiation via
>>> >> sysfs, because the driver does not even look at the i2c device data,
>>> >> which are not set. It would only probe if the device matched through DT.
>>> >> 
>>> >> Fix that for correctness, even-though it is probably useless.
>>> >> Add the missing AXP323 while at it.
>>> >> 
>>> >> Reported-by: Sashiko <sashiko-bot@kernel.org>
>>> >> Closes: https://lore.kernel.org/r/20260717090209.2A09B1F000E9@smtp.kernel.org
>>> >> Fixes: 41751b033aaa ("mfd: axp20x-i2c: Add i2c-ids to fix module auto-loading")
>>> >> Acked-by: Chen-Yu Tsai <wens@kernel.org>
>>> >> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
>>> >> ---
>>> >>  drivers/mfd/axp20x-i2c.c   | 24 +++++++++++++-----------
>>> >>  drivers/mfd/axp20x-rsb.c   |  1 +
>>> >>  drivers/mfd/axp20x.c       |  1 -
>>> >>  include/linux/mfd/axp20x.h |  3 +--
>>> >>  4 files changed, 15 insertions(+), 14 deletions(-)
>>> >> 
>>> >> diff --git a/drivers/mfd/axp20x-i2c.c b/drivers/mfd/axp20x-i2c.c
>>> >> index 5c93136f977e..a76bec5604c4 100644
>>> >> --- a/drivers/mfd/axp20x-i2c.c
>>> >> +++ b/drivers/mfd/axp20x-i2c.c
>>> >> @@ -35,6 +35,7 @@ static int axp20x_i2c_probe(struct i2c_client *i2c)
>>> >>  	axp20x->irq = i2c->irq;
>>> >>  	dev_set_drvdata(axp20x->dev, axp20x);
>>> >>  
>>> >> +	axp20x->variant = (kernel_ulong_t)i2c_get_match_data(i2c);
>>> >
>]>> > device_get_match_data() is bus agnostic and should still work from the
>>> > core driver.  What's the purpose of splitting it out and adding
>>> > additional call-sites?
>>> 
>>> device_get_match_data() works when the data comes through that path,
>>> which is generally the case.
>>> 
>>> i2c_get_match_data() calls device_get_match_data() then fallback to the
>>> i2c_device_ids. It covers the instanciation from sysfs mainly, not
>>> something usual.
>>> 
>>> As explained in the description, this changes plugs a hole identified by
>>> sashiko that technically exists but I highly doubt anyone will
>>> instanciate the PMIC through that interface. Those things do not really
>>> come as breakout boards ... That being said, it is cheap to fix.
>>
>> I'm confused.
>>
>> We already call device_get_match_data() in axp20x_match_device().
>
> Not anymore with this change. It is the point.
>
>>
>> So if you populate .driver_data in axp20x_i2c_id[], you should be
>> able to drop these changes altogether, no?
>
> device_get_match_data() only goes through the DT tables.
> Not the i2c_driver.id_table which is purpose here.
>
> My understanding is that if you instanciate the device
> through sysfs (which nobody does for these devices) and you only call
> device_get_match_data(), you will get NULL because there is no fwnode
> associated with the device, which in this case silently translate to
> AXP152_ID.
>
> device_get_match_data() does not go through the i2c_driver.id_table.
> Only the i2c code does, with i2c_get_match_data() and after trying with
> device_get_match_data() internally, which is exactly what we want.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/i2c/i2c-core-base.c?h=v7.3-rc7#n121
>
> As noted earlier, this a problem reported by sashiko that is real but
> extremely unlikely to show up in real world. I'd happy to drop
> the change if you don't want it. It is not need to support the axp318.
>

Hi Lee,

How could progress on this ? I genuinely do not understand the problem.
This change is fixing a sashiko reported issue, in the appropriate
manner I think. device_get_match_data() just does not care for i2c
.id_table so i2c_get_match_data() is needed.

At the same time, what we really care for to progress on the Allwinner
a733 HW support is the rest of the series. So if this bothers you,
I'm happy to re-submit without this fix. Please let me know.

Cheers
Jerome

  reply	other threads:[~2026-11-18 14:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 10:44 [PATCH v8 0/5] regulator: Add X-Powers AXP318W PMIC support Jerome Brunet
2026-09-10 10:44 ` [PATCH v8 1/5] mfd: axp20x: Constify axp313 and axp717 cells Jerome Brunet
2026-09-10 10:44 ` [PATCH v8 2/5] mfd: axp20x-i2c: Fix i2c instantiation Jerome Brunet
2026-09-24  8:27   ` Lee Jones
2026-09-24 13:10     ` Jerome Brunet
2026-10-14 10:48       ` Lee Jones
2026-10-14 12:21         ` Jerome Brunet
2026-11-18 14:43           ` Jerome Brunet [this message]
2026-09-10 10:44 ` [PATCH v8 3/5] dt-bindings: mfd: x-powers,axp152: Document AXP318W Jerome Brunet
2026-09-10 10:44 ` [PATCH v8 4/5] mfd: axp20x: Add support for AXP318W PMIC Jerome Brunet
2026-09-10 10:44 ` [PATCH v8 5/5] regulator: axp20x: add support for the AXP318W Jerome Brunet
2026-09-20 10:04 ` [PATCH v8 0/5] regulator: Add X-Powers AXP318W PMIC support Chen-Yu Tsai

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=1jh5he2o9z.fsf@starbuckisacylon.baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=andre.przywara@arm.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hansg@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=wens@kernel.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

all inboxes | Powered by JetHome®