* [PATCH V2] pinctrl: tegra: Correctly check the supported configuration
@ 2016-05-02 17:23 Laxman Dewangan
2016-05-02 17:47 ` Stephen Warren
2016-05-11 9:24 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Laxman Dewangan @ 2016-05-02 17:23 UTC (permalink / raw)
To: linus.walleij, swarren, thierry.reding
Cc: gnurou, rklein, linux-gpio, linux-tegra, linux-kernel,
Laxman Dewangan
The pincontrol registers of Tegra chips has multiple filed per
registers. There is two type of registers mux and drive. All
configurations belongs to one of these registers.
If any configurations are supported then <config>_bit is set to
bit position of these registers otherwise -1 to not support it.
The member is defined as
s32 <config>_bit:6;
So if config is not supported ifor given SoC then it is set to -1
in soc pinmmux table.
In common driver code, to find out that given config is supported
or not, it is checked as:
s8 bit = <config>_bit;
if (bit > 31) {
/* Not supported config */
}
But in this case, bit is s8 and hence for non supporting it is -1.
Correct the check as:
if (bit < 0) {
/* Not supported config */
}
Fixes: e4c02dced975cb ("pinctrl: tegra: use signed bitfields for optional fields")
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
drivers/pinctrl/tegra/pinctrl-tegra.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c
index 861baf2..6e82b29 100644
--- a/drivers/pinctrl/tegra/pinctrl-tegra.c
+++ b/drivers/pinctrl/tegra/pinctrl-tegra.c
@@ -417,7 +417,7 @@ static int tegra_pinconf_reg(struct tegra_pmx *pmx,
return -ENOTSUPP;
}
- if (*reg < 0 || *bit > 31) {
+ if (*reg < 0 || *bit < 0) {
if (report_err) {
const char *prop = "unknown";
int i;
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] pinctrl: tegra: Correctly check the supported configuration
2016-05-02 17:23 [PATCH V2] pinctrl: tegra: Correctly check the supported configuration Laxman Dewangan
@ 2016-05-02 17:47 ` Stephen Warren
2016-05-11 9:24 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2016-05-02 17:47 UTC (permalink / raw)
To: Laxman Dewangan, linus.walleij
Cc: thierry.reding, gnurou, rklein, linux-gpio, linux-tegra,
linux-kernel
On 05/02/2016 11:23 AM, Laxman Dewangan wrote:
> The pincontrol registers of Tegra chips has multiple filed per
> registers. There is two type of registers mux and drive. All
> configurations belongs to one of these registers.
>
> If any configurations are supported then <config>_bit is set to
> bit position of these registers otherwise -1 to not support it.
> The member is defined as
> s32 <config>_bit:6;
>
> So if config is not supported ifor given SoC then it is set to -1
> in soc pinmmux table.
> In common driver code, to find out that given config is supported
> or not, it is checked as:
>
> s8 bit = <config>_bit;
> if (bit > 31) {
> /* Not supported config */
> }
>
> But in this case, bit is s8 and hence for non supporting it is -1.
>
> Correct the check as:
> if (bit < 0) {
> /* Not supported config */
> }
>
> Fixes: e4c02dced975cb ("pinctrl: tegra: use signed bitfields for optional fields")
>
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Nit: There shouldn't be a blank line between the Fixes: and
Signed-off-by: lines. I assume this can be fixed when the patch is applied.
Acked-by: Stephen Warren <swarren@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] pinctrl: tegra: Correctly check the supported configuration
2016-05-02 17:23 [PATCH V2] pinctrl: tegra: Correctly check the supported configuration Laxman Dewangan
2016-05-02 17:47 ` Stephen Warren
@ 2016-05-11 9:24 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2016-05-11 9:24 UTC (permalink / raw)
To: Laxman Dewangan
Cc: Stephen Warren, Thierry Reding, Alexandre Courbot, Rhyland Klein,
linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
On Mon, May 2, 2016 at 7:23 PM, Laxman Dewangan <ldewangan@nvidia.com> wrote:
> The pincontrol registers of Tegra chips has multiple filed per
> registers. There is two type of registers mux and drive. All
> configurations belongs to one of these registers.
>
> If any configurations are supported then <config>_bit is set to
> bit position of these registers otherwise -1 to not support it.
> The member is defined as
> s32 <config>_bit:6;
>
> So if config is not supported ifor given SoC then it is set to -1
> in soc pinmmux table.
> In common driver code, to find out that given config is supported
> or not, it is checked as:
>
> s8 bit = <config>_bit;
> if (bit > 31) {
> /* Not supported config */
> }
>
> But in this case, bit is s8 and hence for non supporting it is -1.
>
> Correct the check as:
> if (bit < 0) {
> /* Not supported config */
> }
>
> Fixes: e4c02dced975cb ("pinctrl: tegra: use signed bitfields for optional fields")
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Patch applied with Stephen's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-11 9:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-02 17:23 [PATCH V2] pinctrl: tegra: Correctly check the supported configuration Laxman Dewangan
2016-05-02 17:47 ` Stephen Warren
2016-05-11 9:24 ` Linus Walleij
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).