diff mbox series

[1/3] pinctrl: pinctrl_stm32: Update pinmux_mode definition

Message ID 20220422073831.15538-1-patrice.chotard@foss.st.com
State Accepted
Commit 4382e55c428269c36777b20d7103afbf6be67041
Delegated to: Patrick Delaunay
Headers show
Series [1/3] pinctrl: pinctrl_stm32: Update pinmux_mode definition | expand

Commit Message

Patrice CHOTARD April 22, 2022, 7:38 a.m. UTC
pinmux_mode[] is linked to gpio_function[] defined in gpio-uclass.c
So reuse the same gpio_func_t enum value

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
---

 drivers/pinctrl/pinctrl_stm32.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Patrick Delaunay May 6, 2022, 8:37 a.m. UTC | #1
Hi,

On 4/22/22 09:38, Patrice Chotard wrote:
> pinmux_mode[] is linked to gpio_function[] defined in gpio-uclass.c
> So reuse the same gpio_func_t enum value
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> ---
>
>   drivers/pinctrl/pinctrl_stm32.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
> index 5729799b12..5d8e156d62 100644
> --- a/drivers/pinctrl/pinctrl_stm32.c
> +++ b/drivers/pinctrl/pinctrl_stm32.c
> @@ -42,13 +42,12 @@ struct stm32_gpio_bank {
>   #ifndef CONFIG_SPL_BUILD
>   
>   static char pin_name[PINNAME_SIZE];
> -#define PINMUX_MODE_COUNT		5
> -static const char * const pinmux_mode[PINMUX_MODE_COUNT] = {
> -	"gpio input",
> -	"gpio output",
> -	"analog",
> -	"unknown",
> -	"alt function",
> +static const char * const pinmux_mode[GPIOF_COUNT] = {
> +	[GPIOF_INPUT] = "gpio input",
> +	[GPIOF_OUTPUT] = "gpio output",
> +	[GPIOF_UNUSED] = "analog",
> +	[GPIOF_UNKNOWN] = "unknown",
> +	[GPIOF_FUNC] = "alt function",
>   };
>   
>   static const char * const pinmux_bias[] = {


Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

Thanks
Patrick
Patrice CHOTARD May 10, 2022, 8:06 a.m. UTC | #2
On 5/6/22 10:37, Patrick DELAUNAY wrote:
> Hi,
> 
> On 4/22/22 09:38, Patrice Chotard wrote:
>> pinmux_mode[] is linked to gpio_function[] defined in gpio-uclass.c
>> So reuse the same gpio_func_t enum value
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
>> ---
>>
>>   drivers/pinctrl/pinctrl_stm32.c | 13 ++++++-------
>>   1 file changed, 6 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
>> index 5729799b12..5d8e156d62 100644
>> --- a/drivers/pinctrl/pinctrl_stm32.c
>> +++ b/drivers/pinctrl/pinctrl_stm32.c
>> @@ -42,13 +42,12 @@ struct stm32_gpio_bank {
>>   #ifndef CONFIG_SPL_BUILD
>>     static char pin_name[PINNAME_SIZE];
>> -#define PINMUX_MODE_COUNT        5
>> -static const char * const pinmux_mode[PINMUX_MODE_COUNT] = {
>> -    "gpio input",
>> -    "gpio output",
>> -    "analog",
>> -    "unknown",
>> -    "alt function",
>> +static const char * const pinmux_mode[GPIOF_COUNT] = {
>> +    [GPIOF_INPUT] = "gpio input",
>> +    [GPIOF_OUTPUT] = "gpio output",
>> +    [GPIOF_UNUSED] = "analog",
>> +    [GPIOF_UNKNOWN] = "unknown",
>> +    [GPIOF_FUNC] = "alt function",
>>   };
>>     static const char * const pinmux_bias[] = {
> 
> 
> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> 
> Thanks
> Patrick
> 
> 
Applied to u-boot-stm32

Thanks
Patrice
diff mbox series

Patch

diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
index 5729799b12..5d8e156d62 100644
--- a/drivers/pinctrl/pinctrl_stm32.c
+++ b/drivers/pinctrl/pinctrl_stm32.c
@@ -42,13 +42,12 @@  struct stm32_gpio_bank {
 #ifndef CONFIG_SPL_BUILD
 
 static char pin_name[PINNAME_SIZE];
-#define PINMUX_MODE_COUNT		5
-static const char * const pinmux_mode[PINMUX_MODE_COUNT] = {
-	"gpio input",
-	"gpio output",
-	"analog",
-	"unknown",
-	"alt function",
+static const char * const pinmux_mode[GPIOF_COUNT] = {
+	[GPIOF_INPUT] = "gpio input",
+	[GPIOF_OUTPUT] = "gpio output",
+	[GPIOF_UNUSED] = "analog",
+	[GPIOF_UNKNOWN] = "unknown",
+	[GPIOF_FUNC] = "alt function",
 };
 
 static const char * const pinmux_bias[] = {