mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Frank Li <Frank.li@nxp.com>
Cc: Mark Brown <broonie@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: regmap I3C support
Date: Tue, 19 Nov 2024 13:57:38 -0800	[thread overview]
Message-ID: <0779827f-c51c-4407-8544-c87ca6d76500@roeck-us.net> (raw)
In-Reply-To: <ZzznQknCF7VVHyDK@lizhi-Precision-Tower-5810>

On 11/19/24 11:30, Frank Li wrote:
> On Tue, Nov 19, 2024 at 10:41:05AM -0800, Guenter Roeck wrote:
>> On 11/19/24 09:46, Mark Brown wrote:
>>> On Fri, Nov 15, 2024 at 08:35:04PM -0800, Guenter Roeck wrote:
>>>> On 11/14/24 09:26, Mark Brown wrote:
>>>
>>>>> Right, so the fact that I3C depends on I2C deals with a lot of the
>>>>> problems that plague the I2C/SPI combination.  Ugh.  I guess the helper
>>>>> should be OK and there's not much doing for I2C/SPI.
>>>
>>>> It looks like we can use
>>>
>>>>          if (IS_ENABLED(CONFIG_REGMAP_I3C)) {
>>>>                  regmap = devm_regmap_init_i3c(i3cdev, &tmp108_regmap_config);
>>>>                  if (IS_ERR(regmap))
>>>>                          return dev_err_probe(dev, PTR_ERR(regmap),
>>>>                                               "Failed to register i3c regmap\n");
>>>> 		...
>>>> 	}
>>>
>>>> even if a stub function is not available as long as there is an external
>>>> declaration.
>>>
>>>> I don't really like it, but it turns out that this kind of code is already used
>>>> elsewhere in the kernel. It looks like dead code elimination can now assumed
>>>> to be available when building kernel code. We live and learn.
>>>
>>> Ah, that solves that problem then I guess?
>>
>>
>> Yes. It actually goes a step further - the IS_ENABLED(CONFIG_REGMAP_I3C)) in the
>> probe function isn't needed either because the entire i3c probe function is
>> optimized away if CONFIG_I3C=n.
>>
>> I'll send a patch dropping the #ifdef in the tmp108 driver after the commit
>> window closes.
> 
> Already tried this at v3
> https://lore.kernel.org/imx/7bdd2db8-41c8-43d8-ae73-84a221d2d004@roeck-us.net/
> 

Yes, I know. Sorry for that. We live and learn. I didn't think this works,
but it does.

> but I am not sure if it is good on rely on the compiler. Maybe some option
> like some debug option or -O0 cause problem.
> 

Yes, I thought so too, but it turns out that the kernel doesn't build anymore
with -O0 anyway, and other code already _does_ depend on dead code elimination.

Guenter


  reply	other threads:[~2024-11-19 21:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-11 19:07 Guenter Roeck
2024-11-13 14:01 ` Mark Brown
2024-11-13 14:15   ` Guenter Roeck
2024-11-13 14:41     ` Mark Brown
2024-11-13 20:16       ` Guenter Roeck
2024-11-14 11:31         ` Mark Brown
2024-11-14 14:45           ` Guenter Roeck
2024-11-14 17:26             ` Mark Brown
2024-11-15  6:58               ` Guenter Roeck
2024-11-15 15:06                 ` Mark Brown
2024-11-15 15:46                   ` Guenter Roeck
2024-11-16  4:35               ` Guenter Roeck
2024-11-19 17:46                 ` Mark Brown
2024-11-19 18:41                   ` Guenter Roeck
2024-11-19 19:30                     ` Frank Li
2024-11-19 21:57                       ` Guenter Roeck [this message]
2024-11-19 22:22                         ` Frank Li

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=0779827f-c51c-4407-8544-c87ca6d76500@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Frank.li@nxp.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.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®