Re: regmap I3C support

From: Guenter Roeck
Date: Tue Nov 19 2024 - 14:00:58 EST


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.

Thanks,
Guenter