All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nuno Sá" <nuno.sa@analog.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>,
	linux-iio@vger.kernel.org, Jonathan Cameron <jic23@kernel.org>,
	David Lechner <dlechner@baylibre.com>,
	Andy Shevchenko <andy@kernel.org>
Subject: Re: [PATCH v1 1/1] iio: core: Use an API instead of relying on a specific error code
Date: Fri, 27 Nov 2026 09:36:52 +0000	[thread overview]
Message-ID: <awlPJU524BnRWbDU@nsa> (raw)
In-Reply-To: <20261124103842.600399-1-andriy.shevchenko@linux.intel.com>

On Tue, Nov 24, 2026 at 11:38:41AM +0100, Andy Shevchenko wrote:
> Use device_property_present() instead of relying on a specific error code
> when parsing mount matrix to reliably detect absence of a property.
> 
> No functional changes intended.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  drivers/iio/industrialio-core.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 3b66d7b765d5..5f9d6e852286 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -567,6 +567,10 @@ int iio_read_mount_matrix(struct device *dev, struct iio_mount_matrix *matrix)
>  	size_t len = ARRAY_SIZE(iio_mount_idmatrix.rotation);
>  	int err;
>  
> +	if (!device_property_present(dev, "mount-matrix"))
> +		/* Matrix was not declared at all: fallback to identity. */
> +		return iio_setup_mount_idmatrix(dev, matrix);
> +
>  	err = device_property_read_string_array(dev, "mount-matrix", matrix->rotation, len);
>  	if (err == len)
>  		return 0;
> @@ -575,12 +579,8 @@ int iio_read_mount_matrix(struct device *dev, struct iio_mount_matrix *matrix)
>  		/* Invalid number of matrix entries. */
>  		return -EINVAL;
>  
> -	if (err != -EINVAL)
> -		/* Invalid matrix declaration format. */
> -		return err;
> -
> -	/* Matrix was not declared at all: fallback to identity. */
> -	return iio_setup_mount_idmatrix(dev, matrix);
> +	/* Invalid matrix declaration format. */
> +	return err;
>  }
>  EXPORT_SYMBOL(iio_read_mount_matrix);
>  
> -- 
> 2.50.1
> 

  parent reply	other threads:[~2026-11-27  9:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 10:38 [PATCH v1 1/1] iio: core: Use an API instead of relying on a specific error code Andy Shevchenko
2026-11-24 12:58 ` Joshua Crofts
2026-11-27  9:36 ` Nuno Sá [this message]
2026-11-28 21:00 ` Jonathan Cameron

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=awlPJU524BnRWbDU@nsa \
    --to=nuno.sa@analog.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=jonathan.cameron@oss.qualcomm.com \
    --cc=linux-iio@vger.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.