Linux IIO development
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Alejandro Tafalla <atafalla@dnyon.com>
Cc: jic23@kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht
Subject: Re: [RESEND PATCH v2] iio: imu: lsm6dsx: Fix mount matrix retrieval
Date: Thu, 13 Jul 2023 08:45:44 +0200	[thread overview]
Message-ID: <ZK+dmF9juAnj5YYr@lore-desk> (raw)
In-Reply-To: <4847336.31r3eYUQgx@alexbook>

[-- Attachment #1: Type: text/plain, Size: 1757 bytes --]

On Jul 13, Alejandro Tafalla wrote:
> The function lsm6dsx_get_acpi_mount_matrix should return an error when ACPI
> support is not enabled to allow executing iio_read_mount_matrix in the
> probe function.
> 
> Fixes: dc3d25f22b88 ("iio: imu: lsm6dsx: Add ACPI mount matrix retrieval")
> 
> Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com>
> ---
> Changes in v2:
> - Use of error codes instead of true/false
> 
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index 6a18b363cf73..1a4752c95601 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -2687,7 +2687,7 @@ static int lsm6dsx_get_acpi_mount_matrix(struct device *dev,
>  static int lsm6dsx_get_acpi_mount_matrix(struct device *dev,
>  					  struct iio_mount_matrix *orientation)
>  {
> -	return false;
> +	return -EOPNOTSUPP;
>  }
>  
>  #endif
> @@ -2767,11 +2767,11 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
>  	}
>  
>  	err = lsm6dsx_get_acpi_mount_matrix(hw->dev, &hw->orientation);
> -	if (err) {
> +	if (err == -EOPNOTSUPP)

why do you need this extra check? According to the previous codebase, even if
lsm6dsx_get_acpi_mount_matrix() fails we want to fallback to
iio_read_mount_matrix(), right?

Regards,
Lorenzo

>  		err = iio_read_mount_matrix(hw->dev, &hw->orientation);
> -		if (err)
> -			return err;
> -	}
> +
> +	if (err)
> +		return err;
>  
>  	for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) {
>  		if (!hw->iio_devs[i])
> -- 
> 2.41.0
> 
> 
> 
> 
> 
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2023-07-13  6:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13  5:35 [RESEND PATCH v2] iio: imu: lsm6dsx: Fix mount matrix retrieval Alejandro Tafalla
2023-07-13  6:45 ` Lorenzo Bianconi [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=ZK+dmF9juAnj5YYr@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=atafalla@dnyon.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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