All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dimitri Fedrau <dima.fedrau@gmail.com>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: dimitri.fedrau@liebherr.com, Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v2] pwm: mc33xs2410: add support for temperature sensors
Date: Mon, 19 May 2025 14:40:28 +0200	[thread overview]
Message-ID: <20250519124028.GA423953@legfed1> (raw)
In-Reply-To: <mjmrgvw7dg6wlipvku4yzaazbxomsfpr42hdvh37c3r5zybjyh@4olym5bwde45>

Hi Uwe,

Am Fri, May 16, 2025 at 11:24:33AM +0200 schrieb Uwe Kleine-König:
> Hello Dimitri,
> 
> On Thu, May 15, 2025 at 02:40:54PM +0200, Dimitri Fedrau via B4 Relay wrote:
> > From: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > 
> > The MC33XS2410 provides temperature sensors for the central die temperature
> > and the four outputs. Additionally a common temperature warning threshold
> > can be configured for the outputs. Add hwmon support for the sensors.
> > 
> > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > ---
> > Changes in v2:
> > - Remove helper mc33xs2410_hwmon_read_out_status and report the last
> >   latched status.
> > - Link to v1: https://lore.kernel.org/r/20250512-mc33xs2410-hwmon-v1-1-addba77c78f9@liebherr.com
> > ---
> 
> Mostly fine from my POV. I suggest to squash the following change into
> your patch:
> 
> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> index a0c077af9c98..d9bcd1e8413e 100644
> --- a/drivers/pwm/Kconfig
> +++ b/drivers/pwm/Kconfig
> @@ -425,7 +425,6 @@ config PWM_LPSS_PLATFORM
>  
>  config PWM_MC33XS2410
>  	tristate "MC33XS2410 PWM support"
> -	depends on HWMON || HWMON=n
>  	depends on OF
>  	depends on SPI
>  	help
> diff --git a/drivers/pwm/pwm-mc33xs2410.c b/drivers/pwm/pwm-mc33xs2410.c
> index c1b99b114314..f5bba1a7bcc5 100644
> --- a/drivers/pwm/pwm-mc33xs2410.c
> +++ b/drivers/pwm/pwm-mc33xs2410.c
> @@ -163,7 +163,6 @@ static int mc33xs2410_modify_reg(struct spi_device *spi, u8 reg, u8 mask, u8 val
>  	return mc33xs2410_write_reg(spi, reg, tmp);
>  }
>  
> -#if IS_ENABLED(CONFIG_HWMON)
>  static const struct hwmon_channel_info * const mc33xs2410_hwmon_info[] = {
>  	HWMON_CHANNEL_INFO(temp,
>  			   HWMON_T_LABEL | HWMON_T_INPUT,
> @@ -286,21 +285,20 @@ static const struct hwmon_chip_info mc33xs2410_hwmon_chip_info = {
>  static int mc33xs2410_hwmon_probe(struct spi_device *spi)
>  {
>  	struct device *dev = &spi->dev;
> -	struct device *hwmon;
>  
> -	hwmon = devm_hwmon_device_register_with_info(dev, NULL, spi,
> -						     &mc33xs2410_hwmon_chip_info,
> -						     NULL);
> +	if (IS_REACHABLE(CONFIG_HWMON)) {
> +		struct device *hwmon;
>  
> -	return PTR_ERR_OR_ZERO(hwmon);
> -}
> +		hwmon = devm_hwmon_device_register_with_info(dev, NULL, spi,
> +							     &mc33xs2410_hwmon_chip_info,
> +							     NULL);
>  
> -#else
> -static int mc33xs2410_hwmon_probe(struct spi_device *spi)
> -{
> -	return 0;
> +		return PTR_ERR_OR_ZERO(hwmon);
> +	} else {
> +		dev_dbg(dev, "Not registering hwmon sensors\n");
> +		return 0;
> +	}
>  }
> -#endif
>  
>  static u8 mc33xs2410_pwm_get_freq(u64 period)
>  {
> @@ -523,7 +521,11 @@ static int mc33xs2410_probe(struct spi_device *spi)
>  	if (ret < 0)
>  		return dev_err_probe(dev, ret, "Failed to add pwm chip\n");
>  
> -	return mc33xs2410_hwmon_probe(spi);
> +	ret = mc33xs2410_hwmon_probe(spi);
> +	if (ret < 0)
> +		return dev_err_probe(dev, ret, "Failed to register hwmon sensors\n");
> +
> +	return 0;
>  }
>  
>  static const struct spi_device_id mc33xs2410_spi_id[] = {

Perfering IS_REACHABLE over IS_ENABLED is fine for me. Is there a reason
why you just didn't replace IS_ENABLED with IS_REACHABLE ?

Best regards,
Dimitri Fedrau


  reply	other threads:[~2025-05-19 12:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-15 12:40 [PATCH v2] pwm: mc33xs2410: add support for temperature sensors Dimitri Fedrau
2025-05-15 12:40 ` Dimitri Fedrau via B4 Relay
2025-05-16  1:33 ` Guenter Roeck
2025-05-16  9:24 ` Uwe Kleine-König
2025-05-19 12:40   ` Dimitri Fedrau [this message]
2025-05-19 13:47     ` Uwe Kleine-König
2025-05-19 14:12       ` Dimitri Fedrau
2025-06-18 18:00         ` Uwe Kleine-König

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=20250519124028.GA423953@legfed1 \
    --to=dima.fedrau@gmail.com \
    --cc=dimitri.fedrau@liebherr.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=ukleinek@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.