From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Johan Hovold <johan@kernel.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Pho Tran <photranvan0712@gmail.com>,
Hung.Nguyen@silabs.com, Tung.Pham@silabs.com,
USB <linux-usb@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] USB: serial: cp210x: add gpio-configuration debug printk
Date: Fri, 9 Apr 2021 19:22:26 +0300 [thread overview]
Message-ID: <CAHp75VdEgDuwrRPFm1BXQXQFSNZzC2qQnBG-DJt+GqLzJ+HwuA@mail.gmail.com> (raw)
In-Reply-To: <20210409155216.31867-3-johan@kernel.org>
On Fri, Apr 9, 2021 at 6:52 PM Johan Hovold <johan@kernel.org> wrote:
>
> Add a debug printk to dump the GPIO configuration stored in EEPROM
> during probe.
>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/usb/serial/cp210x.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
> index ceb3a656a075..ee595d1bea0a 100644
> --- a/drivers/usb/serial/cp210x.c
> +++ b/drivers/usb/serial/cp210x.c
> @@ -1543,10 +1543,16 @@ static int cp210x_gpio_init_valid_mask(struct gpio_chip *gc,
> {
> struct usb_serial *serial = gpiochip_get_data(gc);
> struct cp210x_serial_private *priv = usb_get_serial_data(serial);
> + struct device *dev = &serial->interface->dev;
> unsigned long altfunc_mask = priv->gpio_altfunc;
>
> bitmap_complement(valid_mask, &altfunc_mask, ngpios);
>
> + if (bitmap_empty(valid_mask, ngpios))
> + dev_dbg(dev, "no pin configured for GPIO\n");
Shouldn't we drop the GPIO device completely in such a case?
Bart, wouldn't it be a good idea for GPIO library to do something like
this on driver's behalf?
> + else
> + dev_dbg(dev, "GPIO.%*pbl configured for GPIO\n", ngpios,
> + valid_mask);
A nit-pick:
I would change GPIO -> pin in the second message in the first occurrence.
> return 0;
> }
>
> --
> 2.26.3
>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2021-04-09 16:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 15:52 [PATCH 0/2] USB: serial: cp210x: provide gpio valid mask Johan Hovold
2021-04-09 15:52 ` [PATCH 1/2] " Johan Hovold
2021-04-09 15:52 ` [PATCH 2/2] USB: serial: cp210x: add gpio-configuration debug printk Johan Hovold
2021-04-09 16:22 ` Andy Shevchenko [this message]
2021-04-09 16:32 ` Johan Hovold
2021-04-09 16:23 ` [PATCH 0/2] USB: serial: cp210x: provide gpio valid mask Andy Shevchenko
2021-04-12 10:00 ` Johan Hovold
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=CAHp75VdEgDuwrRPFm1BXQXQFSNZzC2qQnBG-DJt+GqLzJ+HwuA@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=Hung.Nguyen@silabs.com \
--cc=Tung.Pham@silabs.com \
--cc=bgolaszewski@baylibre.com \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=photranvan0712@gmail.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;
as well as URLs for NNTP newsgroup(s).