public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Advait Dhamorikar <advaitd@mechasystems.com>
Cc: jic23@kernel.org, dlechner@baylibre.com, nuno.sa@analog.com,
	andy@kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: magnetometer: st_magn: fix default DRDY pin selection for LIS2MDL
Date: Thu, 2 Apr 2026 16:18:24 +0300	[thread overview]
Message-ID: <ac5soAtijnX3gCjY@ashevche-desk.local> (raw)
In-Reply-To: <20260402113653.212043-1-advaitd@mechasystems.com>

On Thu, Apr 02, 2026 at 05:06:51PM +0530, Advait Dhamorikar wrote:
> The device tree binding for st,lis2mdl does not support
> st,drdy-int-pin property. However, when no platform data is provided
> and the property is absent, the driver falls back to default_magn_pdata
> which hardcodes drdy_int_pin = 2. This causes 

Trailing white space. Please, drop.

> `st_sensors_set_drdy_int_pin` to fail with -EINVAL because the LIS2MDL
> sensor settings have no INT2 DRDY mask defined.
> 
> Fix this by checking the sensor's INT2 DRDY mask availability at
> probe time and selecting the appropriate default pin. Sensors that
> do not support INT2 DRDY will default to INT1, while all others
> retain the existing default of INT2.

This looks like it requires a Fixes tag.

...

> -	if (!pdata)
> -		pdata = (struct st_sensors_platform_data *)&default_magn_pdata;
> +	if (!pdata) {

> +		if (!mdata->sensor_settings->drdy_irq.int2.mask)
> +			pdata = (struct st_sensors_platform_data *)&alt_magn_pdata;
> +		else
> +			pdata = (struct st_sensors_platform_data *)&default_magn_pdata;

No need to use negative conditional when you have full if-else branches.

> +	}

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-04-02 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 11:36 [PATCH] iio: magnetometer: st_magn: fix default DRDY pin selection for LIS2MDL Advait Dhamorikar
2026-04-02 13:18 ` Andy Shevchenko [this message]

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=ac5soAtijnX3gCjY@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=advaitd@mechasystems.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.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