From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Stefan Wahren <wahrenst@gmx.net>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
bcm-kernel-feedback-list@broadcom.com,
linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rpi-kernel@lists.infradead.org
Subject: Re: [PATCH V2 1/2] pinctrl: bcm2835: Implement bcm2835_pinconf_get
Date: Sat, 2 Mar 2024 19:40:05 +0200 [thread overview]
Message-ID: <ZeNkdeRoUta-s45T@surfacebook.localdomain> (raw)
In-Reply-To: <20240302095430.4871-2-wahrenst@gmx.net>
Sat, Mar 02, 2024 at 10:54:29AM +0100, Stefan Wahren kirjoitti:
> Even the driver already has implemented pin_dbg_show, it could
> be helpful to implement pin_conf_get for a more generic behavior.
> Contrary to the BCM2711, the BCM2835 SOC doesn't allow to read
> the bias config, so the implementation is limited to the basics.
> + switch (param) {
> + case PIN_CONFIG_INPUT_ENABLE:
> + if (fsel != BCM2835_FSEL_GPIO_IN)
> + return -EINVAL;
> +
> + *config = pinconf_to_config_packed(param, 1);
> + return 0;
Either use break here (and in similar situations)...
> + case PIN_CONFIG_OUTPUT_ENABLE:
> + if (fsel != BCM2835_FSEL_GPIO_OUT)
> + return -EINVAL;
> +
> + *config = pinconf_to_config_packed(param, 1);
> + return 0;
> +
> + case PIN_CONFIG_OUTPUT:
> + if (fsel != BCM2835_FSEL_GPIO_OUT)
> + return -EINVAL;
> +
> + val = bcm2835_gpio_get_bit(pc, GPLEV0, pin);
> + *config = pinconf_to_config_packed(param, val);
> + return 0;
> +
> + default:
> + break;
...and return from here directly.
> + }
> +
> return -ENOTSUPP;
I.o.w. it's better to have a single point of returning a success code.
> }
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-03-02 17:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-02 9:54 [PATCH V2 0/2] pinctrl: bcm2835: Implement pin_conf_get Stefan Wahren
2024-03-02 9:54 ` [PATCH V2 1/2] pinctrl: bcm2835: Implement bcm2835_pinconf_get Stefan Wahren
2024-03-02 17:40 ` Andy Shevchenko [this message]
2024-03-02 9:54 ` [PATCH V2 2/2] pinctrl: bcm2835: Implement bcm2711_pinconf_get Stefan Wahren
2024-03-02 17:42 ` Andy Shevchenko
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=ZeNkdeRoUta-s45T@surfacebook.localdomain \
--to=andy.shevchenko@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=florian.fainelli@broadcom.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=wahrenst@gmx.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).