From: Florian Fainelli <florian.fainelli@broadcom.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Jan Dabros <jsd@semihalf.com>, Andi Shyti <andi.shyti@kernel.org>,
Lee Jones <lee@kernel.org>, Jiawen Wu <jiawenwu@trustnetic.com>,
Mengyuan Lou <mengyuanlou@net-swift.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
Andrew Lunn <andrew@lunn.ch>,
Duanqiang Wen <duanqiangwen@net-swift.com>,
"open list:SYNOPSYS DESIGNWARE I2C DRIVER"
<linux-i2c@vger.kernel.org>,
"open list:WANGXUN ETHERNET DRIVER" <netdev@vger.kernel.org>
Subject: Re: [PATCH 3/4] mfd: intel_quark_i2c_gpio: Utilize i2c-designware.h
Date: Wed, 24 Apr 2024 09:35:28 -0700 [thread overview]
Message-ID: <c0296f12-5850-4112-861d-a6a35e164852@broadcom.com> (raw)
In-Reply-To: <CAHp75VdaYOy0uuLuNCVKY4Y_fxx5_+xCEFGSR3dCKxkkDfGxBQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2277 bytes --]
On 4/24/24 05:37, Andy Shevchenko wrote:
> On Wed, Apr 24, 2024 at 4:28 AM Florian Fainelli
> <florian.fainelli@broadcom.com> wrote:
>> On 4/23/2024 5:01 PM, Andy Shevchenko wrote:
>>> Tue, Apr 23, 2024 at 04:36:21PM -0700, Florian Fainelli kirjoitti:
>>>> Rather than open code the i2c_designware string, utilize the newly
>>>> defined constant in i2c-designware.h.
>
> ...
>
>>>> -#define INTEL_QUARK_I2C_CONTROLLER_CLK "i2c_designware.0"
>>>> +#define INTEL_QUARK_I2C_CONTROLLER_CLK I2C_DESIGNWARE_NAME ".0"
>>>
>>> So, if you build a module separately for older version of the kernel (assuming
>>> it allows you to modprobe), this won't work anymore.
>>
>> Sorry not following, was that comment supposed to be for patch #1 where
>> I changed the i2c-designware-pci to i2c_designware-pci? modprobe
>> recognizes both - and _ as interchangeable BTW.
>
> I'm talking about something different. Let's assume you have a running
> kernel (w.o. signature or version requirement for the modules), then
> you have a new patch on top of it and then for an unknown reason you
> changed. e.g., designware to DW in that definition. The newly built
> module may not be loaded on the running kernel. Also note, here is the
> instance name and not an ID in use. The replacement is wrong
> semantically.
>
See my response in the cover letter, the instance base name is not
independent from the i2c-designware-platdrv::driver::name because
otherwise the clock lookup done by devm_clk_get_optional() will fail. So
that change in this patch is entirely intentional and actually ensures
correctness if someone were to change the i2c_designware platform driver
name in the future for whatever reasons.
As far as catering to the specific example you gave, is not this just
fraught with peril regardless of what is being changed in the kernel?
Any constant that is serves as a contract between independent parts
getting out of sync will result in some misbehavior. The only solution
that I can think of which is edging towards over engineering is to
export a string symbol which contains I2C_DESIGNWARE_NAME and then make
other modules dependent upon that symbol to enforce some sort of runtime
resolution, though I think your example could still be made to fail.
--
Florian
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]
next prev parent reply other threads:[~2024-04-24 16:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 23:36 [PATCH 0/4] Define i2c_designware in a header file Florian Fainelli
2024-04-23 23:36 ` [PATCH 1/4] i2c: designware: Create shared header hosting driver name Florian Fainelli
2024-04-23 23:59 ` Andy Shevchenko
2024-04-24 1:22 ` Florian Fainelli
2024-04-24 12:18 ` Andrew Lunn
2024-04-24 12:45 ` Andy Shevchenko
2024-04-25 8:33 ` Jarkko Nikula
2024-04-25 9:20 ` Andy Shevchenko
2024-04-23 23:36 ` [PATCH 2/4] mfd: intel-lpss: Utilize i2c-designware.h Florian Fainelli
2024-04-24 0:00 ` Andy Shevchenko
2024-04-24 3:20 ` Florian Fainelli
2024-05-02 7:17 ` Lee Jones
2024-05-02 16:19 ` Florian Fainelli
2024-05-02 16:42 ` Lee Jones
2024-04-23 23:36 ` [PATCH 3/4] mfd: intel_quark_i2c_gpio: " Florian Fainelli
2024-04-24 0:01 ` Andy Shevchenko
2024-04-24 1:28 ` Florian Fainelli
2024-04-24 12:37 ` Andy Shevchenko
2024-04-24 16:35 ` Florian Fainelli [this message]
2024-04-23 23:36 ` [PATCH 4/4] net: txgbe: " Florian Fainelli
2024-04-24 16:14 ` Simon Horman
2024-04-24 16:22 ` Florian Fainelli
2024-04-24 17:34 ` Simon Horman
2024-04-23 23:56 ` [PATCH 0/4] Define i2c_designware in a header file Andy Shevchenko
2024-04-24 1:21 ` Florian Fainelli
2024-04-24 14:26 ` Andy Shevchenko
2024-04-24 16:26 ` Florian Fainelli
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=c0296f12-5850-4112-861d-a6a35e164852@broadcom.com \
--to=florian.fainelli@broadcom.com \
--cc=andi.shyti@kernel.org \
--cc=andrew@lunn.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=davem@davemloft.net \
--cc=duanqiangwen@net-swift.com \
--cc=edumazet@google.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=jiawenwu@trustnetic.com \
--cc=jsd@semihalf.com \
--cc=kuba@kernel.org \
--cc=lee@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=mengyuanlou@net-swift.com \
--cc=mika.westerberg@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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®