All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] gpio: dwapb: Get rid of unnecessary conjunction over 32-bit value
@ 2020-04-22 11:06 Andy Shevchenko
  2020-04-22 11:06 ` [PATCH v1 2/2] gpio: dwapb: Amend indentation in some cases Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andy Shevchenko @ 2020-04-22 11:06 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, linux-gpio
  Cc: Andy Shevchenko, Serge Semin

When we mask interrupts before sleep, there is no need to have a conjunction
with 0xffffffff since the accepted by dwapb_write() value is 32-bit.

Cc: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-dwapb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 31d29ec6ab5c3..9d8476afaba3d 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -743,8 +743,7 @@ static int dwapb_gpio_suspend(struct device *dev)
 			ctx->int_deb	= dwapb_read(gpio, GPIO_PORTA_DEBOUNCE);
 
 			/* Mask out interrupts */
-			dwapb_write(gpio, GPIO_INTMASK,
-				    0xffffffff & ~ctx->wake_en);
+			dwapb_write(gpio, GPIO_INTMASK, ~ctx->wake_en);
 		}
 	}
 	spin_unlock_irqrestore(&gc->bgpio_lock, flags);
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 2/2] gpio: dwapb: Amend indentation in some cases
  2020-04-22 11:06 [PATCH v1 1/2] gpio: dwapb: Get rid of unnecessary conjunction over 32-bit value Andy Shevchenko
@ 2020-04-22 11:06 ` Andy Shevchenko
  2020-04-22 16:32   ` Sergey Semin
  2020-04-22 16:28 ` [PATCH v1 1/2] gpio: dwapb: Get rid of unnecessary conjunction over 32-bit value Sergey Semin
  2020-04-28 12:53 ` Linus Walleij
  2 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2020-04-22 11:06 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, linux-gpio
  Cc: Andy Shevchenko, Serge Semin

In some cases indentation makes code harder to read. Amend indentation
in those cases despite of lines go a bit over 80 character limit.

Cc: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-dwapb.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 9d8476afaba3d..8639c4a7f4697 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -437,7 +437,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio,
 		}
 	}
 
-	for (hwirq = 0 ; hwirq < ngpio ; hwirq++)
+	for (hwirq = 0; hwirq < ngpio; hwirq++)
 		irq_create_mapping(gpio->domain, hwirq);
 
 	port->gc.to_irq = dwapb_gpio_to_irq;
@@ -453,7 +453,7 @@ static void dwapb_irq_teardown(struct dwapb_gpio *gpio)
 	if (!gpio->domain)
 		return;
 
-	for (hwirq = 0 ; hwirq < ngpio ; hwirq++)
+	for (hwirq = 0; hwirq < ngpio; hwirq++)
 		irq_dispose_mapping(irq_find_mapping(gpio->domain, hwirq));
 
 	irq_domain_remove(gpio->domain);
@@ -478,10 +478,9 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
 		return -ENOMEM;
 #endif
 
-	dat = gpio->regs + GPIO_EXT_PORTA + (pp->idx * GPIO_EXT_PORT_STRIDE);
-	set = gpio->regs + GPIO_SWPORTA_DR + (pp->idx * GPIO_SWPORT_DR_STRIDE);
-	dirout = gpio->regs + GPIO_SWPORTA_DDR +
-		(pp->idx * GPIO_SWPORT_DDR_STRIDE);
+	dat = gpio->regs + GPIO_EXT_PORTA + pp->idx * GPIO_EXT_PORT_STRIDE;
+	set = gpio->regs + GPIO_SWPORTA_DR + pp->idx * GPIO_SWPORT_DR_STRIDE;
+	dirout = gpio->regs + GPIO_SWPORTA_DDR + pp->idx * GPIO_SWPORT_DDR_STRIDE;
 
 	/* This registers 32 GPIO lines per port */
 	err = bgpio_init(&port->gc, gpio->dev, 4, dat, set, NULL, dirout,
@@ -588,8 +587,7 @@ static struct dwapb_platform_data *dwapb_gpio_get_pdata(struct device *dev)
 			return ERR_PTR(-EINVAL);
 		}
 
-		if (fwnode_property_read_u32(fwnode, "snps,nr-gpios",
-					 &pp->ngpio)) {
+		if (fwnode_property_read_u32(fwnode, "snps,nr-gpios", &pp->ngpio)) {
 			dev_info(dev,
 				 "failed to get number of gpios for port%d\n",
 				 i);
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/2] gpio: dwapb: Get rid of unnecessary conjunction over 32-bit value
  2020-04-22 11:06 [PATCH v1 1/2] gpio: dwapb: Get rid of unnecessary conjunction over 32-bit value Andy Shevchenko
  2020-04-22 11:06 ` [PATCH v1 2/2] gpio: dwapb: Amend indentation in some cases Andy Shevchenko
@ 2020-04-22 16:28 ` Sergey Semin
  2020-04-28 12:53 ` Linus Walleij
  2 siblings, 0 replies; 5+ messages in thread
From: Sergey Semin @ 2020-04-22 16:28 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio

On Wed, Apr 22, 2020 at 02:06:53PM +0300, Andy Shevchenko wrote:
> When we mask interrupts before sleep, there is no need to have a conjunction
> with 0xffffffff since the accepted by dwapb_write() value is 32-bit.

Thanks!

Acked-by: Serge Semin <fancer.lancer@gmail.com>

> 
> Cc: Serge Semin <fancer.lancer@gmail.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpio-dwapb.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index 31d29ec6ab5c3..9d8476afaba3d 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -743,8 +743,7 @@ static int dwapb_gpio_suspend(struct device *dev)
>  			ctx->int_deb	= dwapb_read(gpio, GPIO_PORTA_DEBOUNCE);
>  
>  			/* Mask out interrupts */
> -			dwapb_write(gpio, GPIO_INTMASK,
> -				    0xffffffff & ~ctx->wake_en);
> +			dwapb_write(gpio, GPIO_INTMASK, ~ctx->wake_en);
>  		}
>  	}
>  	spin_unlock_irqrestore(&gc->bgpio_lock, flags);
> -- 
> 2.26.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 2/2] gpio: dwapb: Amend indentation in some cases
  2020-04-22 11:06 ` [PATCH v1 2/2] gpio: dwapb: Amend indentation in some cases Andy Shevchenko
@ 2020-04-22 16:32   ` Sergey Semin
  0 siblings, 0 replies; 5+ messages in thread
From: Sergey Semin @ 2020-04-22 16:32 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio

On Wed, Apr 22, 2020 at 02:06:54PM +0300, Andy Shevchenko wrote:
> In some cases indentation makes code harder to read. Amend indentation
> in those cases despite of lines go a bit over 80 character limit.

Acked-by: Serge Semin <fancer.lancer@gmail.com>

> 
> Cc: Serge Semin <fancer.lancer@gmail.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpio-dwapb.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index 9d8476afaba3d..8639c4a7f4697 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -437,7 +437,7 @@ static void dwapb_configure_irqs(struct dwapb_gpio *gpio,
>  		}
>  	}
>  
> -	for (hwirq = 0 ; hwirq < ngpio ; hwirq++)
> +	for (hwirq = 0; hwirq < ngpio; hwirq++)
>  		irq_create_mapping(gpio->domain, hwirq);
>  
>  	port->gc.to_irq = dwapb_gpio_to_irq;
> @@ -453,7 +453,7 @@ static void dwapb_irq_teardown(struct dwapb_gpio *gpio)
>  	if (!gpio->domain)
>  		return;
>  
> -	for (hwirq = 0 ; hwirq < ngpio ; hwirq++)
> +	for (hwirq = 0; hwirq < ngpio; hwirq++)
>  		irq_dispose_mapping(irq_find_mapping(gpio->domain, hwirq));
>  
>  	irq_domain_remove(gpio->domain);
> @@ -478,10 +478,9 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
>  		return -ENOMEM;
>  #endif
>  
> -	dat = gpio->regs + GPIO_EXT_PORTA + (pp->idx * GPIO_EXT_PORT_STRIDE);
> -	set = gpio->regs + GPIO_SWPORTA_DR + (pp->idx * GPIO_SWPORT_DR_STRIDE);
> -	dirout = gpio->regs + GPIO_SWPORTA_DDR +
> -		(pp->idx * GPIO_SWPORT_DDR_STRIDE);
> +	dat = gpio->regs + GPIO_EXT_PORTA + pp->idx * GPIO_EXT_PORT_STRIDE;
> +	set = gpio->regs + GPIO_SWPORTA_DR + pp->idx * GPIO_SWPORT_DR_STRIDE;
> +	dirout = gpio->regs + GPIO_SWPORTA_DDR + pp->idx * GPIO_SWPORT_DDR_STRIDE;
>  
>  	/* This registers 32 GPIO lines per port */
>  	err = bgpio_init(&port->gc, gpio->dev, 4, dat, set, NULL, dirout,
> @@ -588,8 +587,7 @@ static struct dwapb_platform_data *dwapb_gpio_get_pdata(struct device *dev)
>  			return ERR_PTR(-EINVAL);
>  		}
>  
> -		if (fwnode_property_read_u32(fwnode, "snps,nr-gpios",
> -					 &pp->ngpio)) {
> +		if (fwnode_property_read_u32(fwnode, "snps,nr-gpios", &pp->ngpio)) {
>  			dev_info(dev,
>  				 "failed to get number of gpios for port%d\n",
>  				 i);
> -- 
> 2.26.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/2] gpio: dwapb: Get rid of unnecessary conjunction over 32-bit value
  2020-04-22 11:06 [PATCH v1 1/2] gpio: dwapb: Get rid of unnecessary conjunction over 32-bit value Andy Shevchenko
  2020-04-22 11:06 ` [PATCH v1 2/2] gpio: dwapb: Amend indentation in some cases Andy Shevchenko
  2020-04-22 16:28 ` [PATCH v1 1/2] gpio: dwapb: Get rid of unnecessary conjunction over 32-bit value Sergey Semin
@ 2020-04-28 12:53 ` Linus Walleij
  2 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2020-04-28 12:53 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, open list:GPIO SUBSYSTEM, Serge Semin

On Wed, Apr 22, 2020 at 1:06 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> When we mask interrupts before sleep, there is no need to have a conjunction
> with 0xffffffff since the accepted by dwapb_write() value is 32-bit.
>
> Cc: Serge Semin <fancer.lancer@gmail.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Both patches applied with Sergey's review tags, thanks!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-28 12:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22 11:06 [PATCH v1 1/2] gpio: dwapb: Get rid of unnecessary conjunction over 32-bit value Andy Shevchenko
2020-04-22 11:06 ` [PATCH v1 2/2] gpio: dwapb: Amend indentation in some cases Andy Shevchenko
2020-04-22 16:32   ` Sergey Semin
2020-04-22 16:28 ` [PATCH v1 1/2] gpio: dwapb: Get rid of unnecessary conjunction over 32-bit value Sergey Semin
2020-04-28 12:53 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.