linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: 104-idio-16: Use lowercase symbol names for const variables
@ 2015-11-04 12:30 William Breathitt Gray
  2015-11-08 23:53 ` Alexandre Courbot
  2015-11-17 11:04 ` Linus Walleij
  0 siblings, 2 replies; 5+ messages in thread
From: William Breathitt Gray @ 2015-11-04 12:30 UTC (permalink / raw)
  To: linus.walleij, gnurou; +Cc: linux-gpio, linux-kernel

To prevent confusion and to match existing coding style used in other
gpio drivers symbol names within the 104-idio-16 gpio driver should be
lowercase.

Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
 drivers/gpio/gpio-104-idio-16.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/gpio/gpio-104-idio-16.c b/drivers/gpio/gpio-104-idio-16.c
index 5400d7d..dbb1d38 100644
--- a/drivers/gpio/gpio-104-idio-16.c
+++ b/drivers/gpio/gpio-104-idio-16.c
@@ -70,21 +70,21 @@ static struct idio_16_gpio *to_idio16gpio(struct gpio_chip *gc)
 static int idio_16_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
 	struct idio_16_gpio *const idio16gpio = to_idio16gpio(chip);
-	const unsigned BIT_MASK = 1U << (offset-16);
+	const unsigned mask = 1U << (offset-16);
 
 	if (offset < 16)
 		return -EINVAL;
 
 	if (offset < 24)
-		return !!(inb(idio16gpio->base + 1) & BIT_MASK);
+		return !!(inb(idio16gpio->base + 1) & mask);
 
-	return !!(inb(idio16gpio->base + 5) & (BIT_MASK>>8));
+	return !!(inb(idio16gpio->base + 5) & (mask>>8));
 }
 
 static void idio_16_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
 	struct idio_16_gpio *const idio16gpio = to_idio16gpio(chip);
-	const unsigned BIT_MASK = 1U << offset;
+	const unsigned mask = 1U << offset;
 	unsigned long flags;
 
 	if (offset > 15)
@@ -93,9 +93,9 @@ static void idio_16_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 	spin_lock_irqsave(&idio16gpio->lock, flags);
 
 	if (value)
-		idio16gpio->out_state |= BIT_MASK;
+		idio16gpio->out_state |= mask;
 	else
-		idio16gpio->out_state &= ~BIT_MASK;
+		idio16gpio->out_state &= ~mask;
 
 	if (offset > 7)
 		outb(idio16gpio->out_state >> 8, idio16gpio->base + 4);
@@ -109,24 +109,23 @@ static int __init idio_16_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct idio_16_gpio *idio16gpio;
+	const unsigned base = idio_16_base;
+	const unsigned extent = 8;
+	const char *const name = dev_name(dev);
 	int err;
 
-	const unsigned BASE = idio_16_base;
-	const unsigned EXTENT = 8;
-	const char *const NAME = dev_name(dev);
-
 	idio16gpio = devm_kzalloc(dev, sizeof(*idio16gpio), GFP_KERNEL);
 	if (!idio16gpio)
 		return -ENOMEM;
 
-	if (!request_region(BASE, EXTENT, NAME)) {
+	if (!request_region(base, extent, name)) {
 		dev_err(dev, "Unable to lock %s port addresses (0x%X-0x%X)\n",
-			NAME, BASE, BASE + EXTENT);
+			name, base, base + extent);
 		err = -EBUSY;
 		goto err_lock_io_port;
 	}
 
-	idio16gpio->chip.label = NAME;
+	idio16gpio->chip.label = name;
 	idio16gpio->chip.dev = dev;
 	idio16gpio->chip.owner = THIS_MODULE;
 	idio16gpio->chip.base = -1;
@@ -136,8 +135,8 @@ static int __init idio_16_probe(struct platform_device *pdev)
 	idio16gpio->chip.direction_output = idio_16_gpio_direction_output;
 	idio16gpio->chip.get = idio_16_gpio_get;
 	idio16gpio->chip.set = idio_16_gpio_set;
-	idio16gpio->base = BASE;
-	idio16gpio->extent = EXTENT;
+	idio16gpio->base = base;
+	idio16gpio->extent = extent;
 	idio16gpio->out_state = 0xFFFF;
 
 	spin_lock_init(&idio16gpio->lock);
@@ -153,7 +152,7 @@ static int __init idio_16_probe(struct platform_device *pdev)
 	return 0;
 
 err_gpio_register:
-	release_region(BASE, EXTENT);
+	release_region(base, extent);
 err_lock_io_port:
 	return err;
 }
-- 
2.4.10


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

* Re: [PATCH] gpio: 104-idio-16: Use lowercase symbol names for const variables
  2015-11-04 12:30 [PATCH] gpio: 104-idio-16: Use lowercase symbol names for const variables William Breathitt Gray
@ 2015-11-08 23:53 ` Alexandre Courbot
  2015-11-09  1:28   ` William Breathitt Gray
  2015-11-17 11:04 ` Linus Walleij
  1 sibling, 1 reply; 5+ messages in thread
From: Alexandre Courbot @ 2015-11-08 23:53 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Linus Walleij, linux-gpio@vger.kernel.org,
	Linux Kernel Mailing List

On Wed, Nov 4, 2015 at 9:30 PM, William Breathitt Gray
<vilhelm.gray@gmail.com> wrote:
> To prevent confusion and to match existing coding style used in other
> gpio drivers symbol names within the 104-idio-16 gpio driver should be
> lowercase.

... and for the same styling reasons "GPIO" should be spelled in
uppercase in your commit message. ;)

Apart from that this patch seems harmless and the repositioning of
some constant declarations is also welcome.

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

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

* Re: [PATCH] gpio: 104-idio-16: Use lowercase symbol names for const variables
  2015-11-08 23:53 ` Alexandre Courbot
@ 2015-11-09  1:28   ` William Breathitt Gray
  2015-11-09  6:09     ` Alexandre Courbot
  0 siblings, 1 reply; 5+ messages in thread
From: William Breathitt Gray @ 2015-11-09  1:28 UTC (permalink / raw)
  To: Alexandre Courbot
  Cc: Linus Walleij, linux-gpio@vger.kernel.org,
	Linux Kernel Mailing List

On 11/08/2015 06:53 PM, Alexandre Courbot wrote:
> Apart from that this patch seems harmless and the repositioning of
> some constant declarations is also welcome.

I'll create a separate patch to reposition the constant declarations. Where in
particular do you believe would be best for them to be positioned?

William Breathitt Gray

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

* Re: [PATCH] gpio: 104-idio-16: Use lowercase symbol names for const variables
  2015-11-09  1:28   ` William Breathitt Gray
@ 2015-11-09  6:09     ` Alexandre Courbot
  0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Courbot @ 2015-11-09  6:09 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Linus Walleij, linux-gpio@vger.kernel.org,
	Linux Kernel Mailing List

On Mon, Nov 9, 2015 at 10:28 AM, William Breathitt Gray
<vilhelm.gray@gmail.com> wrote:
> On 11/08/2015 06:53 PM, Alexandre Courbot wrote:
>> Apart from that this patch seems harmless and the repositioning of
>> some constant declarations is also welcome.
>
> I'll create a separate patch to reposition the constant declarations. Where in
> particular do you believe would be best for them to be positioned?

I was talking about what you did here:

@@ -109,24 +109,23 @@ static int __init idio_16_probe(struct
platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
        struct idio_16_gpio *idio16gpio;
+       const unsigned base = idio_16_base;
+       const unsigned extent = 8;
+       const char *const name = dev_name(dev);
        int err;

-       const unsigned BASE = idio_16_base;
-       const unsigned EXTENT = 8;
-       const char *const NAME = dev_name(dev);

So this is already done - sorry for not having been clear.

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

* Re: [PATCH] gpio: 104-idio-16: Use lowercase symbol names for const variables
  2015-11-04 12:30 [PATCH] gpio: 104-idio-16: Use lowercase symbol names for const variables William Breathitt Gray
  2015-11-08 23:53 ` Alexandre Courbot
@ 2015-11-17 11:04 ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2015-11-17 11:04 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Alexandre Courbot, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Wed, Nov 4, 2015 at 1:30 PM, William Breathitt Gray
<vilhelm.gray@gmail.com> wrote:

> To prevent confusion and to match existing coding style used in other
> gpio drivers symbol names within the 104-idio-16 gpio driver should be
> lowercase.
>
> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>

This patch doesn not apply on top of the IRQ support I just
merged, so please rebase it and resend, include Alex' review tag.

Yours,
Linus Walleij

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

end of thread, other threads:[~2015-11-17 11:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-04 12:30 [PATCH] gpio: 104-idio-16: Use lowercase symbol names for const variables William Breathitt Gray
2015-11-08 23:53 ` Alexandre Courbot
2015-11-09  1:28   ` William Breathitt Gray
2015-11-09  6:09     ` Alexandre Courbot
2015-11-17 11:04 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).