diff mbox series

hwmon: (tmp108) Do not fail in I3C probe when I3C regmap is a module

Message ID 20241121121819.393104-1-jarkko.nikula@linux.intel.com (mailing list archive)
State Accepted
Headers show
Series hwmon: (tmp108) Do not fail in I3C probe when I3C regmap is a module | expand

Commit Message

Jarkko Nikula Nov. 21, 2024, 12:18 p.m. UTC
I3C device probe fails when CONFIG_REGMAP_I3C=m:

	p3t1085_i3c 0-23615290090: error -ENODEV: Failed to register i3c regmap

Fix this by using the IS_ENABLED(CONFIG_REGMAP_I3C) macro in the code.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/hwmon/tmp108.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck Nov. 21, 2024, 1:56 p.m. UTC | #1
Hi Jarkko,

On 11/21/24 04:18, Jarkko Nikula wrote:
> I3C device probe fails when CONFIG_REGMAP_I3C=m:
> 
> 	p3t1085_i3c 0-23615290090: error -ENODEV: Failed to register i3c regmap
> 
> Fix this by using the IS_ENABLED(CONFIG_REGMAP_I3C) macro in the code.
> 
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

Thanks a lot for the report and the patch. Turns out the ifdef isn't necessary
to start with. I have a patch waiting to remove it which I wanted to send
after the commit window closes. I'll just take yours instead and modify it
to remove the #ifdef.

Thanks,
Guenter

> ---
>   drivers/hwmon/tmp108.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c
> index 1f36af2cd2d9..3dcbbb05ab2b 100644
> --- a/drivers/hwmon/tmp108.c
> +++ b/drivers/hwmon/tmp108.c
> @@ -452,7 +452,7 @@ static int p3t1085_i3c_probe(struct i3c_device *i3cdev)
>   	struct device *dev = i3cdev_to_dev(i3cdev);
>   	struct regmap *regmap;
>   
> -#ifdef CONFIG_REGMAP_I3C
> +#if IS_ENABLED(CONFIG_REGMAP_I3C)
>   	regmap = devm_regmap_init_i3c(i3cdev, &tmp108_regmap_config);
>   #else
>   	regmap = ERR_PTR(-ENODEV);
diff mbox series

Patch

diff --git a/drivers/hwmon/tmp108.c b/drivers/hwmon/tmp108.c
index 1f36af2cd2d9..3dcbbb05ab2b 100644
--- a/drivers/hwmon/tmp108.c
+++ b/drivers/hwmon/tmp108.c
@@ -452,7 +452,7 @@  static int p3t1085_i3c_probe(struct i3c_device *i3cdev)
 	struct device *dev = i3cdev_to_dev(i3cdev);
 	struct regmap *regmap;
 
-#ifdef CONFIG_REGMAP_I3C
+#if IS_ENABLED(CONFIG_REGMAP_I3C)
 	regmap = devm_regmap_init_i3c(i3cdev, &tmp108_regmap_config);
 #else
 	regmap = ERR_PTR(-ENODEV);