From: Jonathan Cameron <jic23@kernel.org>
To: Antoniu Miclaus <antoniu.miclaus@analog.com>
Cc: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers: iio: dac: ad5592r: add gpio_chip names
Date: Wed, 23 Nov 2022 20:48:32 +0000 [thread overview]
Message-ID: <20221123204832.3e514378@jic23-huawei> (raw)
In-Reply-To: <20221117090130.51702-1-antoniu.miclaus@analog.com>
On Thu, 17 Nov 2022 11:01:30 +0200
Antoniu Miclaus <antoniu.miclaus@analog.com> wrote:
> Add array of explicit gpio names for the `gpiochip` structure of
> ad5592r, mainly for debug purposes.
Can you give an example of when this is more useful than the offset?
(which I'm assuming is also available when debugging?)
Jonathan
>
> Since the gpios are configurable via the dts, generic names are
> used.
>
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---
> drivers/iio/dac/ad5592r-base.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c
> index 7a9b5fc1e579..076bc9ecfb49 100644
> --- a/drivers/iio/dac/ad5592r-base.c
> +++ b/drivers/iio/dac/ad5592r-base.c
> @@ -124,6 +124,10 @@ static int ad5592r_gpio_request(struct gpio_chip *chip, unsigned offset)
> return 0;
> }
>
> +static const char * const ad5592r_gpio_names[] = {
> + "GPIO0", "GPIO1", "GPIO2", "GPIO3", "GPIO4", "GPIO5", "GPIO6", "GPIO7",
> +};
> +
> static int ad5592r_gpio_init(struct ad5592r_state *st)
> {
> if (!st->gpio_map)
> @@ -140,6 +144,7 @@ static int ad5592r_gpio_init(struct ad5592r_state *st)
> st->gpiochip.set = ad5592r_gpio_set;
> st->gpiochip.request = ad5592r_gpio_request;
> st->gpiochip.owner = THIS_MODULE;
> + st->gpiochip.names = ad5592r_gpio_names;
>
> mutex_init(&st->gpio_lock);
>
next prev parent reply other threads:[~2022-11-23 20:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 9:01 [PATCH] drivers: iio: dac: ad5592r: add gpio_chip names Antoniu Miclaus
2022-11-23 20:48 ` Jonathan Cameron [this message]
2023-01-28 18:03 ` Jonathan Cameron
2023-02-01 13:11 ` Miclaus, Antoniu
2023-02-05 15:02 ` 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=20221123204832.3e514378@jic23-huawei \
--to=jic23@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox