linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandru Ardelean <ardeleanalex@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Bastien Nocera <hadess@hadess.net>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio <linux-iio@vger.kernel.org>
Subject: Re: [PATCH 1/3] iio: core: Allow drivers to specify a label without it coming from of
Date: Mon, 8 Feb 2021 09:27:38 +0200	[thread overview]
Message-ID: <CA+U=DsriyMvU5=iRrh73UJxHxT7FuA_P_pCHVaY9JskmLSffNA@mail.gmail.com> (raw)
In-Reply-To: <20210207160901.110643-2-hdegoede@redhat.com>

On Sun, Feb 7, 2021 at 6:11 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Only set indio_dev->label from of/dt if there actually is a label
> specified in of.
>
> This allows drivers to set a label without this being overwritten with
> NULL when there is no label specified in of. This is esp. useful on
> devices where of is not used at all, such as your typical x86/ACPI device.

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>


>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/iio/industrialio-core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index e9ee9363fed0..b409e076818b 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -1755,6 +1755,7 @@ static const struct iio_buffer_setup_ops noop_ring_setup_ops;
>
>  int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod)
>  {
> +       const char *label;
>         int ret;
>
>         if (!indio_dev->info)
> @@ -1765,8 +1766,9 @@ int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod)
>         if (!indio_dev->dev.of_node && indio_dev->dev.parent)
>                 indio_dev->dev.of_node = indio_dev->dev.parent->of_node;
>
> -       indio_dev->label = of_get_property(indio_dev->dev.of_node, "label",
> -                                          NULL);
> +       label = of_get_property(indio_dev->dev.of_node, "label", NULL);
> +       if (label)
> +               indio_dev->label = label;
>
>         ret = iio_check_unique_scan_index(indio_dev);
>         if (ret < 0)
> --
> 2.30.0
>

  reply	other threads:[~2021-02-08  7:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-07 16:08 [PATCH 0/3] iio: add labels with accel-location to bmc150 and kxcjk-1013 drivers Hans de Goede
2021-02-07 16:08 ` [PATCH 1/3] iio: core: Allow drivers to specify a label without it coming from of Hans de Goede
2021-02-08  7:27   ` Alexandru Ardelean [this message]
2021-02-07 16:09 ` [PATCH 2/3] iio: accel: bmc150: Set label based on accel-location on 2-accel yoga-style 2-in-1s Hans de Goede
2021-02-07 16:09 ` [PATCH 3/3] iio: accel: kxcjk-1013: " Hans de Goede
2021-02-12 18:33 ` [PATCH 0/3] iio: add labels with accel-location to bmc150 and kxcjk-1013 drivers Jonathan Cameron
2021-02-12 18:39   ` Hans de Goede
2021-02-15 12:37     ` 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='CA+U=DsriyMvU5=iRrh73UJxHxT7FuA_P_pCHVaY9JskmLSffNA@mail.gmail.com' \
    --to=ardeleanalex@gmail.com \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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;
as well as URLs for NNTP newsgroup(s).