diff mbox series

[v2] pinctrl: bcm: bcm6362: fix warning

Message ID 20210330103225.3949-1-noltari@gmail.com
State Superseded
Headers show
Series [v2] pinctrl: bcm: bcm6362: fix warning | expand

Commit Message

Álvaro Fernández Rojas March 30, 2021, 10:32 a.m. UTC
The current implementation of bcm6362_set_gpio() produces the following
warning on x86_64:
drivers/pinctrl/bcm/pinctrl-bcm6362.c: In function 'bcm6362_set_gpio':
drivers/pinctrl/bcm/pinctrl-bcm6362.c:503:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  503 |        (uint32_t) desc->drv_data, 0);
      |        ^

Modify the code to make it similar to bcm63268_set_gpio() in order to fix
the warning.

Fixes: 705791e23ecd ("pinctrl: add a pincontrol driver for BCM6362")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 drivers/pinctrl/bcm/pinctrl-bcm6362.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Álvaro Fernández Rojas March 30, 2021, 1:41 p.m. UTC | #1
Hi Andy,

El 30/03/2021 a las 12:55, Andy Shevchenko escribió:
> On Tue, Mar 30, 2021 at 1:33 PM Álvaro Fernández Rojas
> <noltari@gmail.com> wrote:
>>
>> The current implementation of bcm6362_set_gpio() produces the following
>> warning on x86_64:
>> drivers/pinctrl/bcm/pinctrl-bcm6362.c: In function 'bcm6362_set_gpio':
>> drivers/pinctrl/bcm/pinctrl-bcm6362.c:503:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>>    503 |        (uint32_t) desc->drv_data, 0);
>>        |        ^
>>
>> Modify the code to make it similar to bcm63268_set_gpio() in order to fix
>> the warning.
> 
> Seems good to me, thanks!
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
>> Fixes: 705791e23ecd ("pinctrl: add a pincontrol driver for BCM6362")
>> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
>> ---
> 
> Missed changelog here.

Yes, sorry about that but I added it to v1 patch by mistake... ;D
  v2: use uintptr_t, remove unneeded space and modify put
  regmap_update_bits() call on a single line.

> 
>>   drivers/pinctrl/bcm/pinctrl-bcm6362.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/pinctrl/bcm/pinctrl-bcm6362.c b/drivers/pinctrl/bcm/pinctrl-bcm6362.c
>> index eb7ec80353e9..40ef495b6301 100644
>> --- a/drivers/pinctrl/bcm/pinctrl-bcm6362.c
>> +++ b/drivers/pinctrl/bcm/pinctrl-bcm6362.c
>> @@ -496,11 +496,11 @@ static int bcm6362_pinctrl_get_groups(struct pinctrl_dev *pctldev,
>>   static void bcm6362_set_gpio(struct bcm63xx_pinctrl *pc, unsigned pin)
>>   {
>>          const struct pinctrl_pin_desc *desc = &bcm6362_pins[pin];
>> +       unsigned int basemode = (uintptr_t)desc->drv_data;
>>          unsigned int mask = bcm63xx_bank_pin(pin);
>>
>> -       if (desc->drv_data)
>> -               regmap_update_bits(pc->regs, BCM6362_BASEMODE_REG,
>> -                                  (uint32_t) desc->drv_data, 0);
>> +       if (basemode)
>> +               regmap_update_bits(pc->regs, BCM6362_BASEMODE_REG, basemode, 0);
>>
>>          if (pin < BCM63XX_BANK_GPIOS) {
>>                  /* base mode 0 => gpio 1 => mux function */
>> --
>> 2.20.1
>>
> 
> 

Best regards,
Álvaro.
Linus Walleij March 31, 2021, 12:34 p.m. UTC | #2
On Tue, Mar 30, 2021 at 12:32 PM Álvaro Fernández Rojas
<noltari@gmail.com> wrote:

> The current implementation of bcm6362_set_gpio() produces the following

> warning on x86_64:

> drivers/pinctrl/bcm/pinctrl-bcm6362.c: In function 'bcm6362_set_gpio':

> drivers/pinctrl/bcm/pinctrl-bcm6362.c:503:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

>   503 |        (uint32_t) desc->drv_data, 0);

>       |        ^

>

> Modify the code to make it similar to bcm63268_set_gpio() in order to fix

> the warning.

>

> Fixes: 705791e23ecd ("pinctrl: add a pincontrol driver for BCM6362")

> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>


Patch applied! Thanks!

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/pinctrl/bcm/pinctrl-bcm6362.c b/drivers/pinctrl/bcm/pinctrl-bcm6362.c
index eb7ec80353e9..40ef495b6301 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm6362.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm6362.c
@@ -496,11 +496,11 @@  static int bcm6362_pinctrl_get_groups(struct pinctrl_dev *pctldev,
 static void bcm6362_set_gpio(struct bcm63xx_pinctrl *pc, unsigned pin)
 {
 	const struct pinctrl_pin_desc *desc = &bcm6362_pins[pin];
+	unsigned int basemode = (uintptr_t)desc->drv_data;
 	unsigned int mask = bcm63xx_bank_pin(pin);
 
-	if (desc->drv_data)
-		regmap_update_bits(pc->regs, BCM6362_BASEMODE_REG,
-				   (uint32_t) desc->drv_data, 0);
+	if (basemode)
+		regmap_update_bits(pc->regs, BCM6362_BASEMODE_REG, basemode, 0);
 
 	if (pin < BCM63XX_BANK_GPIOS) {
 		/* base mode 0 => gpio 1 => mux function */