MIPS: Lantiq: switch vmmc to use gpiod API
Subsystems (2)
PATCH 1/1 MIPS: Lantiq: switch vmmc to use gpiod API
This switches vmmc to use gpiod API instead of OF-specific legacy gpio API that we want to stop exporting from gpiolib.
--- arch/mips/lantiq/xway/vmmc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
arch/mips/lantiq/xway/vmmc.c +13 -9
@@ -4,9 +4,10 @@* Copyright (C) 2012 John Crispin <[email protected]> */ +#include <linux/err.h> #include <linux/export.h> +#include <linux/gpio/consumer.h> #include <linux/of_platform.h> -#include <linux/of_gpio.h> #include <linux/dma-mapping.h> #include <lantiq_soc.h>
@@ -25,6 +26,7 @@ EXPORT_SYMBOL(ltq_get_cp1_base);static int vmmc_probe (struct platform_device *pdev) {#define CP1_SIZE (1 << 20) +struct gpio_desc *gpio;int gpio_count;dma_addr_t dma;
@@ -32,16 +34,18 @@ static int vmmc_probe(struct platform_device *pdev) (void *)CPHYSADDR (dma_alloc_coherent (&pdev->dev,CP1_SIZE , &dma,GFP_KERNEL )); - gpio_count =of_gpio_count (pdev->dev.of_node); + gpio_count =gpiod_count (&pdev->dev,NULL );while (gpio_count >0 ) { -enum of_gpio_flags flags; -int gpio =of_get_gpio_flags (pdev->dev.of_node, - --gpio_count, &flags); -if (gpio_request (gpio,"vmmc-relay" )) + gpio =devm_gpiod_get_index (&pdev->dev, +NULL , --gpio_count,GPIOD_OUT_HIGH ); +if (IS_ERR (gpio)) { +dev_err (&pdev->dev, +"failed to request GPIO idx %d: %d\n" , + gpio_count, PTR_ERR(gpio);continue ; -dev_info (&pdev->dev,"requested GPIO %d\n" , gpio); -gpio_direction_output (gpio, - (flags &OF_GPIO_ACTIVE_LOW ) ? (0 ) : (1 )); + } + +gpio_consumer_set_name (gpio,"vmmc-relay" ); }dev_info (&pdev->dev,"reserved %dMB at 0x%p" ,CP1_SIZE >>20 , cp1_base);
Signature · 5 lines
2.37.3.998.g577e59143f-goog -- Dmitry
Quoted 7 lines · Dmitry Torokhov
This switches vmmc to use gpiod API instead of OF-specific legacy gpio API that we want to stop exporting from gpiolib.
Signed-off-by Dmitry Torokhov <[email protected]>--- arch/mips/lantiq/xway/vmmc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
applied to mips-next.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Hi Thomas,
Quoted 10 lines · Thomas Bogendoerfer
Quoted 7 lines · Dmitry Torokhov
This switches vmmc to use gpiod API instead of OF-specific legacy gpio API that we want to stop exporting from gpiolib.
Signed-off-by Dmitry Torokhov <[email protected]>--- arch/mips/lantiq/xway/vmmc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)applied to mips-next.
My apologies, I screwed up. I thought this patch passed 0day before I sent it to you, but apparently it has not.
Here is a fixup (actually cross-compiled this time), or I can send a v2 incorporating it into the original change.
Thanks.
Signature · 12 lines
Dmitry MIPS: Lantiq: vmmc: fix compile break introduced by gpiod patch "MIPS: Lantiq: switch vmmc to use gpiod API" patch introduced compile errors, this patch fixes them. Signed-off-by: Dmitry Torokhov <[email protected]> --- arch/mips/lantiq/xway/vmmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/lantiq/xway/vmmc.c +2 -2
@@ -41,11 +41,11 @@ static int vmmc_probe(struct platform_device *pdev)if (IS_ERR (gpio)) {dev_err (&pdev->dev,"failed to request GPIO idx %d: %d\n" , - gpio_count, PTR_ERR(gpio); + gpio_count,PTR_ERR (gpio));continue ; } -gpio_consumer_set_name (gpio,"vmmc-relay" ); +gpiod_set_consumer_name (gpio,"vmmc-relay" ); }dev_info (&pdev->dev,"reserved %dMB at 0x%p" ,CP1_SIZE >>20 , cp1_base);
Signature · 1 line
2.38.0.rc1.362.ged0d419d3c-goog
Thomas Bogendoerfer
maintainerQuoted 12 lines · Dmitry Torokhov
Hi Thomas,
Quoted 9 lines · Thomas Bogendoerfer
Quoted 7 lines · Dmitry Torokhov
This switches vmmc to use gpiod API instead of OF-specific legacy gpio API that we want to stop exporting from gpiolib.
Signed-off-by Dmitry Torokhov <[email protected]>--- arch/mips/lantiq/xway/vmmc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
Quoted 7 lines
Quoted 1 line
applied to mips-next.
My apologies, I screwed up. I thought this patch passed 0day before I sent it to you, but apparently it has not.
Here is a fixup (actually cross-compiled this time), or I can send a v2 incorporating it into the original change.
I need a fixup, but this one still fails in my build:
/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c: In function ‘vmmc_probe’:
/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c:43:5: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Werror=format=]
"failed to request GPIO idx %d: %d\n",
^
/local/tbogendoerfer/korg/linux/include/linux/dev_printk.h:110:16: note: in definition of macro ‘dev_printk_index_wrap’
_p_func(dev, fmt, ##__VA_ARGS__); \
^~~
/local/tbogendoerfer/korg/linux/include/linux/dev_printk.h:144:49: note: in expansion of macro ‘dev_fmt’
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~
/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c:42:4: note: in expansion of macro ‘dev_err’
dev_err(&pdev->dev,
^~~~~~~Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Quoted 21 lines · Thomas Bogendoerfer
Quoted 12 lines · Dmitry Torokhov
Hi Thomas,
Quoted 9 lines · Thomas Bogendoerfer
Quoted 7 lines · Dmitry Torokhov
This switches vmmc to use gpiod API instead of OF-specific legacy gpio API that we want to stop exporting from gpiolib.
Signed-off-by Dmitry Torokhov <[email protected]>--- arch/mips/lantiq/xway/vmmc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)Quoted 7 lines
Quoted 1 line
applied to mips-next.
My apologies, I screwed up. I thought this patch passed 0day before I sent it to you, but apparently it has not.
Here is a fixup (actually cross-compiled this time), or I can send a v2 incorporating it into the original change.
Quoted 6 lines
I need a fixup, but this one still fails in my build:
/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c: In function ‘vmmc_probe’:
/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c:43:5: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Werror=format=]
"failed to request GPIO idx %d: %d\n",
^
I see, I did not realize PTR_ERR() is actually long. I guess I can introduce a temp variable and use PTR_ERR_OR_ZERO(), but there are a lot of places in the kernel that use %d and PTR_ERR(). I wonder why we can't define PTR_ERR() as (int)(long)ptr or something.
What compiler/version are you using for your builds?
Thanks.
Signature · 1 line
Dmitry
Thomas Bogendoerfer
maintainerQuoted 24 lines · Dmitry Torokhov
Quoted 23 lines · Thomas Bogendoerfer
Quoted 12 lines · Dmitry Torokhov
Hi Thomas,
Quoted 9 lines · Thomas Bogendoerfer
Quoted 7 lines · Dmitry Torokhov
This switches vmmc to use gpiod API instead of OF-specific legacy gpio API that we want to stop exporting from gpiolib.
Signed-off-by Dmitry Torokhov <[email protected]>--- arch/mips/lantiq/xway/vmmc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)Quoted 7 lines
Quoted 1 line
applied to mips-next.
My apologies, I screwed up. I thought this patch passed 0day before I sent it to you, but apparently it has not.
Here is a fixup (actually cross-compiled this time), or I can send a v2 incorporating it into the original change.
I need a fixup, but this one still fails in my build:
Quoted 8 lines
Quoted 4 lines
/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c: In function ‘vmmc_probe’:
/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c:43:5: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Werror=format=]
"failed to request GPIO idx %d: %d\n",
^I see, I did not realize
PTR_ERR()is actually long. I guess I can introduce a temp variable and usePTR_ERR_OR_ZERO(), but there are a lot of places in the kernel that use %d andPTR_ERR(). I wonder why we can't definePTR_ERR()as (int)(long)ptr or something.What compiler/version are you using for your builds?
it's rather old:
gcc version 6.1.1 20160621 (Red Hat Cross 6.1.1-2) (GCC)
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Quoted 30 lines · Thomas Bogendoerfer
Quoted 29 lines · Dmitry Torokhov
Quoted 27 lines · Thomas Bogendoerfer
Quoted 12 lines · Dmitry Torokhov
Hi Thomas,
Quoted 9 lines · Thomas Bogendoerfer
Quoted 7 lines · Dmitry Torokhov
This switches vmmc to use gpiod API instead of OF-specific legacy gpio API that we want to stop exporting from gpiolib.
Signed-off-by Dmitry Torokhov <[email protected]>--- arch/mips/lantiq/xway/vmmc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)Quoted 7 lines
Quoted 1 line
applied to mips-next.
My apologies, I screwed up. I thought this patch passed 0day before I sent it to you, but apparently it has not.
Here is a fixup (actually cross-compiled this time), or I can send a v2 incorporating it into the original change.
I need a fixup, but this one still fails in my build:
/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c: In function ‘vmmc_probe’:
/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c:43:5: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Werror=format=]
"failed to request GPIO idx %d: %d\n",
^
Quoted 7 lines
Quoted 3 lines
I see, I did not realize
PTR_ERR()is actually long. I guess I can introduce a temp variable and usePTR_ERR_OR_ZERO(), but there are a lot of places in the kernel that use %d andPTR_ERR(). I wonder why we can't definePTR_ERR()as (int)(long)ptr or something.What compiler/version are you using for your builds?
it's rather old:
gcc version 6.1.1 20160621 (Red Hat Cross 6.1.1-2) (GCC)
OK, I tried the below with gcc 12.1.0 cross-compiler, hopefully this does not trip on 6.1.1.
Thanks.
Signature · 11 lines
Dmitry MIPS: Lantiq: vmmc: fix compile break introduced by gpiod patch "MIPS: Lantiq: switch vmmc to use gpiod API" patch introduced compile errors, this patch fixes them. Signed-off-by: Dmitry Torokhov <[email protected]> --- arch/mips/lantiq/xway/vmmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/mips/lantiq/xway/vmmc.c +5 -3
@@ -29,6 +29,7 @@ static int vmmc_probe(struct platform_device *pdev)struct gpio_desc *gpio;int gpio_count;dma_addr_t dma; +int error; cp1_base = (void *) CPHYSADDR(dma_alloc_coherent(&pdev->dev, CP1_SIZE,
@@ -38,14 +39,15 @@ static int vmmc_probe(struct platform_device *pdev)while (gpio_count >0 ) { gpio =devm_gpiod_get_index (&pdev->dev,NULL , --gpio_count,GPIOD_OUT_HIGH ); -if (IS_ERR (gpio)) { + error =PTR_ERR_OR_ZERO (gpio); +if (error) {dev_err (&pdev->dev,"failed to request GPIO idx %d: %d\n" , - gpio_count, PTR_ERR(gpio); + gpio_count, error);continue ; } -gpio_consumer_set_name (gpio,"vmmc-relay" ); +gpiod_set_consumer_name (gpio,"vmmc-relay" ); }dev_info (&pdev->dev,"reserved %dMB at 0x%p" ,CP1_SIZE >>20 , cp1_base);
Signature · 1 line
2.38.0.rc1.362.ged0d419d3c-goog
Thomas Bogendoerfer
maintainerQuoted 33 lines · Dmitry Torokhov
Quoted 32 lines · Thomas Bogendoerfer
Quoted 31 lines · Dmitry Torokhov
Quoted 21 lines · Thomas Bogendoerfer
Quoted 12 lines · Dmitry Torokhov
Hi Thomas,
Quoted 9 lines · Thomas Bogendoerfer
Quoted 7 lines · Dmitry Torokhov
This switches vmmc to use gpiod API instead of OF-specific legacy gpio API that we want to stop exporting from gpiolib.
Signed-off-by Dmitry Torokhov <[email protected]>--- arch/mips/lantiq/xway/vmmc.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)Quoted 7 lines
Quoted 1 line
applied to mips-next.
My apologies, I screwed up. I thought this patch passed 0day before I sent it to you, but apparently it has not.
Here is a fixup (actually cross-compiled this time), or I can send a v2 incorporating it into the original change.
Quoted 6 lines
I need a fixup, but this one still fails in my build:
/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c: In function ‘vmmc_probe’:
/local/tbogendoerfer/korg/linux/arch/mips/lantiq/xway/vmmc.c:43:5: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Werror=format=]
"failed to request GPIO idx %d: %d\n",
^I see, I did not realize
PTR_ERR()is actually long. I guess I can introduce a temp variable and usePTR_ERR_OR_ZERO(), but there are a lot of places in the kernel that use %d andPTR_ERR(). I wonder why we can't definePTR_ERR()as (int)(long)ptr or something.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
What compiler/version are you using for your builds?
it's rather old:
gcc version 6.1.1 20160621 (Red Hat Cross 6.1.1-2) (GCC)
OK, I tried the below with gcc 12.1.0 cross-compiler, hopefully this does not trip on 6.1.1.
works with 6.1.1 as well. Applied to mips-next.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]