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 2/2] pinctrl: bcm2835: Implement bcm2711_pinconf_get
Date: Sat, 2 Mar 2024 19:42:26 +0200 [thread overview]
Message-ID: <ZeNlAry1QR8B00hH@surfacebook.localdomain> (raw)
In-Reply-To: <20240302095430.4871-3-wahrenst@gmx.net>
Sat, Mar 02, 2024 at 10:54:30AM +0100, Stefan Wahren kirjoitti:
> The BCM2711 allows to read the bias config. So implement pin_conf_get
> accordingly. The pull resistor values has been taken from the
> BCM2711/7211 datasheet.
>
> This implementation assumes that BCM7211 behaves the same way.
...
> + switch (param) {
> + case PIN_CONFIG_BIAS_DISABLE:
> + if (((val >> shift) & PUD_2711_MASK) == BCM2711_PULL_NONE)
> + return 0;
> + else
> + return -EINVAL;
Redundant 'else' in all cases. Also as in previous patch, use single return point of success.
if (((val >> shift) & PUD_2711_MASK) != BCM2711_PULL_NONE)
return -EINVAL;
break;
> + case PIN_CONFIG_BIAS_PULL_UP:
> + if (((val >> shift) & PUD_2711_MASK) == BCM2711_PULL_UP) {
> + *config = pinconf_to_config_packed(param, 50000);
> + return 0;
> + } else {
> + return -EINVAL;
> + }
> +
> + case PIN_CONFIG_BIAS_PULL_DOWN:
> + if (((val >> shift) & PUD_2711_MASK) == BCM2711_PULL_DOWN) {
> + *config = pinconf_to_config_packed(param, 50000);
> + return 0;
> + } else {
> + return -EINVAL;
> + }
> +
> + default:
> + break;
Return directly from here.
return bcm2835_pinconf_get(pctldev, pin, config);
> + }
> +
> + return bcm2835_pinconf_get(pctldev, pin, config);
return 0;
> +}
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2024-03-02 17:42 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
2024-03-02 9:54 ` [PATCH V2 2/2] pinctrl: bcm2835: Implement bcm2711_pinconf_get Stefan Wahren
2024-03-02 17:42 ` Andy Shevchenko [this message]
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=ZeNlAry1QR8B00hH@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