MMCI: use _cansleep GPIO functions
Subsystems (2)
PATCH 1/1 MMCI: use _cansleep GPIO functions
Currently the kernel is screaming about slowpath at me for the wp/cd callbacks. Swicth to the _cansleep variants so as to silence this. Also remove the double-negate in front of the cd GPIO read.
--- drivers/mmc/host/mmci.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/mmci.c +3 -2
@@ -614,7 +614,7 @@ static int mmci_get_ro(struct mmc_host *mmc)if (host->gpio_wp == -ENOSYS )return -ENOSYS ; -return gpio_get_value (host->gpio_wp); +return gpio_get_value_cansleep (host->gpio_wp); }static int mmci_get_cd (struct mmc_host *mmc)
@@ -629,7 +629,8 @@ static int mmci_get_cd(struct mmc_host *mmc) status = plat->status (mmc_dev (host->mmc)); }else - status = !!gpio_get_value (host->gpio_cd) ^ plat->cd_invert; + status =gpio_get_value_cansleep (host->gpio_cd) ^ + plat->cd_invert;/* * Use positive logic throughout - status is zero for no card,
Signature · 1 line
1.6.3.3
PATCH 1/1 MMCI: use _cansleep GPIO functions
Quoted 3 lines · Linus Walleij
- ? ? ? ? ? ? ? status = !!gpio_get_value(host->gpio_cd) ^
plat->cd_invert;
+ ? ? ? ? ? ? ? status =gpio_get_value_cansleep(host->gpio_cd)^
+ ? ? ? ? ? ? ? ? ? ? ?plat->cd_invert;
Why do you remove the double negation? gpio_get_value*() can return non-zero values, and we need to make it 1 for the inversion xor to work.
PATCH 1/1 MMCI: use _cansleep GPIO functions
2010/9/11 Rabin Vincent <[email protected]>:
Quoted 9 lines
Quoted 3 lines · Linus Walleij
- ? ? ? ? ? ? ? status = !!gpio_get_value(host->gpio_cd) ^
plat->cd_invert;
+ ? ? ? ? ? ? ? status =gpio_get_value_cansleep(host->gpio_cd)^
+ ? ? ? ? ? ? ? ? ? ? ?plat->cd_invert;Why do you remove the double negation? ?gpio_get_value*() can return non-zero values, and we need to make it 1 for the inversion xor to work.
Aha I get it. But !! is a bit hard to parse in head is it not...
Cast a non-zero to C internal bool type, negate it and then negate the negation so the end result is bool, not just non-zero. I never saw that idiom before.
I don't know if I'm particularly dumb but it makes my reading take time.
I'll slam in some intermediate bool or something so it's super clear what's happening, OK?
Yours,
Linus Walleij
PATCH 1/1 MMCI: use _cansleep GPIO functions
2010/9/11 Linus Walleij <[email protected]>:
Quoted 2 lines
I'll slam in some intermediate bool or something so it's super clear what's happening, OK?
Like this (untested):
From: Linus Walleij <[email protected]>
Date: Sat, 11 Sep 2010 13:29:04 +0200
Subject: [PATCH] MMCI: use _cansleep GPIO functions
Currently the kernel is screaming about slowpath at me for the wp/cd callbacks. Swicth to the _cansleep variants so as to silence this. Also rewrite the double-negate in front of the cd GPIO read to make it more clear what is happening.
--- drivers/mmc/host/mmci.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/host/mmci.c +4 -2
@@ -614,7 +614,7 @@ static int mmci_get_ro(struct mmc_host *mmc)if (host->gpio_wp == -ENOSYS )return -ENOSYS ; -return gpio_get_value (host->gpio_wp); +return gpio_get_value_cansleep (host->gpio_wp); }static int mmci_get_cd (struct mmc_host *mmc)
@@ -629,7 +629,9 @@ static int mmci_get_cd(struct mmc_host *mmc) status = plat->status (mmc_dev (host->mmc)); }else - status = !!gpio_get_value (host->gpio_cd) ^ plat->cd_invert; +/* Convert the status to boolean and optionally invert */ + status = (gpio_get_value_cansleep (host->gpio_cd) ?1 :0 ) + ^ plat->cd_invert;/* * Use positive logic throughout - status is zero for no card,
Signature · 1 line
1.7.2.2
PATCH 1/1 MMCI: use _cansleep GPIO functions
In reply to Linus WalleijQuoted 2 lines · Linus Walleij
I'll slam in some intermediate bool or something so it's super clear what's happening, OK?
No - once you've learnt that !! turns an int into a bool, there's nothing more that needs to be done.
You'll find !! used throughout the kernel sources.
PATCH 1/1 MMCI: use _cansleep GPIO functions
2010/9/11 Russell King - ARM Linux <[email protected]>:
Quoted 1 line
You'll find !! used throughout the kernel sources.
Aha it's a kernel idiom, OK!!
I'll just test it on hardware and I'll put it in the patch tracker.
From: Linus Walleij <[email protected]>
Date: Sat, 11 Sep 2010 13:36:20 +0200
Subject: [PATCH] MMCI: use _cansleep GPIO functions
Currently the kernel is screaming about slowpath at me for the wp/cd callbacks. Swicth to the _cansleep variants so as to silence this.
--- drivers/mmc/host/mmci.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/mmci.c +3 -2
@@ -614,7 +614,7 @@ static int mmci_get_ro(struct mmc_host *mmc)if (host->gpio_wp == -ENOSYS )return -ENOSYS ; -return gpio_get_value (host->gpio_wp); +return gpio_get_value_cansleep (host->gpio_wp); }static int mmci_get_cd (struct mmc_host *mmc)
@@ -629,7 +629,8 @@ static int mmci_get_cd(struct mmc_host *mmc) status = plat->status (mmc_dev (host->mmc)); }else - status = !!gpio_get_value (host->gpio_cd) ^ plat->cd_invert; + status = !!gpio_get_value_cansleep (host->gpio_cd) + ^ plat->cd_invert;/* * Use positive logic throughout - status is zero for no card,
Signature · 1 line
1.7.2.2
PATCH 1/1 MMCI: use _cansleep GPIO functions
Quoted 8 lines · Linus Walleij
2010/9/11 Russell King - ARM Linux <[email protected]>:
Quoted 1 line
You'll find !! used throughout the kernel sources.
Aha it's a kernel idiom, OK!!
I'll just test it on hardware and I'll put it in the patch tracker.
Quoted 7 lines
From: Linus Walleij <[email protected]>
Date: Sat, 11 Sep 2010 13:36:20 +0200
Subject: [PATCH] MMCI: use_cansleepGPIO functionsCurrently the kernel is screaming about slowpath at me for the wp/cd callbacks. Swicth to the
_cansleepvariants so as to silence this.
You may wish to correct that spelling error.
PATCH 1/1 MMCI: use _cansleep GPIO functions
In reply to Linus WalleijHello.
Quoted 17 lines · Linus Walleij
From: Linus Walleij <[email protected]>
Date: Sat, 11 Sep 2010 13:36:20 +0200
Subject: [PATCH] MMCI: use_cansleepGPIO functionsCurrently the kernel is screaming about slowpath at me for the wp/cd callbacks. Swicth to the
_cansleepvariants so as to silence this.Signed-off-by Linus Walleij <[email protected]>--- drivers/mmc/host/mmci.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)drivers/mmc/host/mmci.c +0
-0
[...]
drivers/mmc/host/mmci.c static int mmci_get_cd(struct mmc_host *mmc) · line 633
Quoted 8 lines
static int
mmci_get_cd(struct mmc_host *mmc)drivers/mmc/host/mmci.c +2
-1@@ -629,7 +629,8 @@ static int mmci_get_cd(struct mmc_host *mmc) status = plat->status (mmc_dev (host->mmc)); }else - status = !!gpio_get_value (host->gpio_cd) ^ plat->cd_invert; + status = !!gpio_get_value_cansleep (host->gpio_cd) + ^ plat->cd_invert;
Should be no space between ^ and operand, no?
WBR, Sergei
PATCH 1/1 MMCI: use _cansleep GPIO functions
Quoted 21 lines · I wrote:
Quoted 17 lines
From: Linus Walleij <[email protected]>
Date: Sat, 11 Sep 2010 13:36:20 +0200
Subject: [PATCH] MMCI: use_cansleepGPIO functionsCurrently the kernel is screaming about slowpath at me for the wp/cd callbacks. Swicth to the
_cansleepvariants so as to silence this.Signed-off-by Linus Walleij <[email protected]>--- drivers/mmc/host/mmci.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)drivers/mmc/host/mmci.c +0
-0[...]
Quoted 3 lines
static int
mmci_get_cd(struct mmc_host *mmc)drivers/mmc/host/mmci.c +0
-0@@ -629,7 +629,8 @@ static int mmci_get_cd(struct mmc_host *mmc)
Quoted 7 lines
drivers/mmc/host/mmci.c static int mmci_get_cd(struct mmc_host *mmc) · line 633
Quoted 5 lines
drivers/mmc/host/mmci.c +2
-1status = plat->status (mmc_dev (host->mmc)); }else - status = !!gpio_get_value (host->gpio_cd) ^ plat->cd_invert; + status = !!gpio_get_value_cansleep (host->gpio_cd) + ^ plat->cd_invert;Should be no space between ^ and operand, no?
Oops, I've mixed it with ~. Still, I'd have left ^ on the first line.
WBR, Sergei