All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] gpio-langwell: bugfix and amendments
@ 2013-05-22 10:20 Andy Shevchenko
  2013-05-22 10:20 ` [PATCH v3 1/5] gpio-langwell: initialize lock before usage Andy Shevchenko
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Andy Shevchenko @ 2013-05-22 10:20 UTC (permalink / raw)
  To: Linus Walleij, David Cohen, Mika Westerberg, linux-kernel; +Cc: Andy Shevchenko

There is locking bug fix and few amendments. Each commit message verbose
enoough I think.

Since v2:
 - apply ACKs
 - addressed Mika's comment for patch 3/4
 - append patch 5/5

Since v1:
 - patch 2/4 ("amend error messages") moved to 4/4
 - minor fix in patch 3/4 ("use managed ...")
 - fix patch 4/4 ("amend error messages") to be real amendment

Andy Shevchenko (5):
  gpio-langwell: initialize lock before usage
  gpio-langwell: do not use direct access to iomapped memory
  gpio-langwell: use managed functions pcim_* and devm_*
  gpio-langwell: amend error messages
  gpio-langwell: drop away explicit casting

 drivers/gpio/gpio-langwell.c | 117 ++++++++++++++-----------------------------
 1 file changed, 38 insertions(+), 79 deletions(-)

-- 
1.8.2.rc0.22.gb3600c3


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

* [PATCH v3 1/5] gpio-langwell: initialize lock before usage
  2013-05-22 10:20 [PATCH v3 0/5] gpio-langwell: bugfix and amendments Andy Shevchenko
@ 2013-05-22 10:20 ` Andy Shevchenko
  2013-05-30 17:20   ` Linus Walleij
  2013-05-31 12:01   ` Linus Walleij
  2013-05-22 10:20 ` [PATCH v3 2/5] gpio-langwell: do not use direct access to iomapped memory Andy Shevchenko
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: Andy Shevchenko @ 2013-05-22 10:20 UTC (permalink / raw)
  To: Linus Walleij, David Cohen, Mika Westerberg, linux-kernel; +Cc: Andy Shevchenko

Otherwise we will end up with traceback from LOCKDEP:

INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0-rc2-next-20130521-00028-g09aa9fc #487
 00000000 00000000 f6c55c54 c1541fe4 f6040bf8 f6c55c8c c1069ef1 c1726bc1
 c1726cc8 c1726c9e 00000000 f6c584e0 f6c58000 f6c55ce8 00000000 f6040bf8
 f6040bf8 00000046 f6c58000 f6c55d00 c106a18d 00000a2b 00000003 00004f02
Call Trace:
 [<c1541fe4>] dump_stack+0x49/0x77
 [<c1069ef1>] register_lock_class+0x58/0x260
 [<c106a18d>] __lock_acquire+0x94/0xcff
 [<c106adc8>] ? __lock_acquire+0xccf/0xcff
 [<c106b2ad>] lock_acquire+0xcc/0x10d
 [<c1269c7c>] ? lnw_irq_type+0x63/0xe9
 [<c1545da0>] _raw_spin_lock_irqsave+0x32/0x42
 [<c1269c7c>] ? lnw_irq_type+0x63/0xe9
 [<c1269c7c>] lnw_irq_type+0x63/0xe9
 [<c108f454>] __irq_set_trigger+0x98/0x123
 [<c1090225>] irq_set_irq_type+0x2f/0x51
 [<c1090225>] ? irq_set_irq_type+0x2f/0x51
 [<c1269d02>] ? lnw_irq_type+0xe9/0xe9
 [<c1269d34>] lnw_gpio_irq_map+0x32/0x3b
 [<c10914f2>] irq_domain_add_legacy+0xe2/0x107
 [<c1091b53>] irq_domain_add_simple+0x47/0x60
 [<c1269f6e>] lnw_gpio_probe+0x119/0x217
 [<c1271018>] pci_device_probe+0x5a/0x92
...

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/gpio/gpio-langwell.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index 62ef10a..c1f33dd 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -380,6 +380,8 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 	lnw->chip.can_sleep = 0;
 	lnw->pdev = pdev;
 
+	spin_lock_init(&lnw->lock);
+
 	lnw->domain = irq_domain_add_simple(pdev->dev.of_node, ngpio, irq_base,
 					    &lnw_gpio_irq_ops, lnw);
 	if (!lnw->domain) {
@@ -399,8 +401,6 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 	irq_set_handler_data(pdev->irq, lnw);
 	irq_set_chained_handler(pdev->irq, lnw_irq_handler);
 
-	spin_lock_init(&lnw->lock);
-
 	pm_runtime_put_noidle(&pdev->dev);
 	pm_runtime_allow(&pdev->dev);
 
-- 
1.8.2.rc0.22.gb3600c3


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

* [PATCH v3 2/5] gpio-langwell: do not use direct access to iomapped memory
  2013-05-22 10:20 [PATCH v3 0/5] gpio-langwell: bugfix and amendments Andy Shevchenko
  2013-05-22 10:20 ` [PATCH v3 1/5] gpio-langwell: initialize lock before usage Andy Shevchenko
@ 2013-05-22 10:20 ` Andy Shevchenko
  2013-05-30 17:21   ` Linus Walleij
  2013-05-22 10:20 ` [PATCH v3 3/5] gpio-langwell: use managed functions pcim_* and devm_* Andy Shevchenko
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Andy Shevchenko @ 2013-05-22 10:20 UTC (permalink / raw)
  To: Linus Walleij, David Cohen, Mika Westerberg, linux-kernel; +Cc: Andy Shevchenko

We better to use readl() function instead of bad looking direct access.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/gpio/gpio-langwell.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index c1f33dd..8203084 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -65,7 +65,7 @@ enum GPIO_REG {
 
 struct lnw_gpio {
 	struct gpio_chip		chip;
-	void				*reg_base;
+	void __iomem			*reg_base;
 	spinlock_t			lock;
 	struct pci_dev			*pdev;
 	struct irq_domain		*domain;
@@ -318,9 +318,9 @@ static const struct dev_pm_ops lnw_gpio_pm_ops = {
 };
 
 static int lnw_gpio_probe(struct pci_dev *pdev,
-			const struct pci_device_id *id)
+			  const struct pci_device_id *id)
 {
-	void *base;
+	void __iomem *base;
 	resource_size_t start, len;
 	struct lnw_gpio *lnw;
 	u32 gpio_base;
@@ -346,8 +346,10 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 		retval = -EFAULT;
 		goto err_ioremap;
 	}
-	irq_base = *(u32 *)base;
-	gpio_base = *((u32 *)base + 1);
+
+	irq_base = readl(base);
+	gpio_base = readl(sizeof(u32) + base);
+
 	/* release the IO mapping, since we already get the info from bar1 */
 	iounmap(base);
 	/* get the register base from bar0 */
-- 
1.8.2.rc0.22.gb3600c3


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

* [PATCH v3 3/5] gpio-langwell: use managed functions pcim_* and devm_*
  2013-05-22 10:20 [PATCH v3 0/5] gpio-langwell: bugfix and amendments Andy Shevchenko
  2013-05-22 10:20 ` [PATCH v3 1/5] gpio-langwell: initialize lock before usage Andy Shevchenko
  2013-05-22 10:20 ` [PATCH v3 2/5] gpio-langwell: do not use direct access to iomapped memory Andy Shevchenko
@ 2013-05-22 10:20 ` Andy Shevchenko
  2013-05-22 11:06   ` Mika Westerberg
  2013-05-30 17:25   ` Linus Walleij
  2013-05-22 10:20 ` [PATCH v3 4/5] gpio-langwell: amend error messages Andy Shevchenko
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 19+ messages in thread
From: Andy Shevchenko @ 2013-05-22 10:20 UTC (permalink / raw)
  To: Linus Walleij, David Cohen, Mika Westerberg, linux-kernel; +Cc: Andy Shevchenko

This makes the error handling much more simpler than open-coding everything and
in addition makes the probe function smaller an tidier.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-langwell.c | 79 ++++++++++++--------------------------------
 1 file changed, 21 insertions(+), 58 deletions(-)

diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index 8203084..54b6caf 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -321,55 +321,37 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 			  const struct pci_device_id *id)
 {
 	void __iomem *base;
-	resource_size_t start, len;
 	struct lnw_gpio *lnw;
 	u32 gpio_base;
 	u32 irq_base;
 	int retval;
 	int ngpio = id->driver_data;
 
-	retval = pci_enable_device(pdev);
+	retval = pcim_enable_device(pdev);
 	if (retval)
 		return retval;
 
-	retval = pci_request_regions(pdev, "langwell_gpio");
+	retval = pcim_iomap_regions(pdev, 1 << 0 | 1 << 1, pci_name(pdev));
 	if (retval) {
-		dev_err(&pdev->dev, "error requesting resources\n");
-		goto err_pci_req_region;
-	}
-	/* get the gpio_base from bar1 */
-	start = pci_resource_start(pdev, 1);
-	len = pci_resource_len(pdev, 1);
-	base = ioremap_nocache(start, len);
-	if (!base) {
-		dev_err(&pdev->dev, "error mapping bar1\n");
-		retval = -EFAULT;
-		goto err_ioremap;
+		dev_err(&pdev->dev, "I/O memory mapping error\n");
+		return retval;
 	}
 
+	base = pcim_iomap_table(pdev)[1];
+
 	irq_base = readl(base);
 	gpio_base = readl(sizeof(u32) + base);
 
 	/* release the IO mapping, since we already get the info from bar1 */
-	iounmap(base);
-	/* get the register base from bar0 */
-	start = pci_resource_start(pdev, 0);
-	len = pci_resource_len(pdev, 0);
-	base = devm_ioremap_nocache(&pdev->dev, start, len);
-	if (!base) {
-		dev_err(&pdev->dev, "error mapping bar0\n");
-		retval = -EFAULT;
-		goto err_ioremap;
-	}
+	pcim_iounmap_regions(pdev, 1 << 1);
 
 	lnw = devm_kzalloc(&pdev->dev, sizeof(*lnw), GFP_KERNEL);
 	if (!lnw) {
 		dev_err(&pdev->dev, "can't allocate langwell_gpio chip data\n");
-		retval = -ENOMEM;
-		goto err_ioremap;
+		return -ENOMEM;
 	}
 
-	lnw->reg_base = base;
+	lnw->reg_base = pcim_iomap_table(pdev)[0];
 	lnw->chip.label = dev_name(&pdev->dev);
 	lnw->chip.request = lnw_gpio_request;
 	lnw->chip.direction_input = lnw_gpio_direction_input;
@@ -386,16 +368,14 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 
 	lnw->domain = irq_domain_add_simple(pdev->dev.of_node, ngpio, irq_base,
 					    &lnw_gpio_irq_ops, lnw);
-	if (!lnw->domain) {
-		retval = -ENOMEM;
-		goto err_ioremap;
-	}
+	if (!lnw->domain)
+		return -ENOMEM;
 
 	pci_set_drvdata(pdev, lnw);
 	retval = gpiochip_add(&lnw->chip);
 	if (retval) {
 		dev_err(&pdev->dev, "langwell gpiochip_add error %d\n", retval);
-		goto err_ioremap;
+		return retval;
 	}
 
 	lnw_irq_init_hw(lnw);
@@ -407,12 +387,6 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 	pm_runtime_allow(&pdev->dev);
 
 	return 0;
-
-err_ioremap:
-	pci_release_regions(pdev);
-err_pci_req_region:
-	pci_disable_device(pdev);
-	return retval;
 }
 
 static struct pci_driver lnw_gpio_driver = {
@@ -430,23 +404,20 @@ static int wp_gpio_probe(struct platform_device *pdev)
 	struct lnw_gpio *lnw;
 	struct gpio_chip *gc;
 	struct resource *rc;
-	int retval = 0;
-
-	rc = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!rc)
-		return -EINVAL;
+	int retval;
 
-	lnw = kzalloc(sizeof(struct lnw_gpio), GFP_KERNEL);
+	lnw = devm_kzalloc(&pdev->dev, sizeof(struct lnw_gpio), GFP_KERNEL);
 	if (!lnw) {
 		dev_err(&pdev->dev,
 			"can't allocate whitneypoint_gpio chip data\n");
 		return -ENOMEM;
 	}
-	lnw->reg_base = ioremap_nocache(rc->start, resource_size(rc));
-	if (lnw->reg_base == NULL) {
-		retval = -EINVAL;
-		goto err_kmalloc;
-	}
+
+	rc = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	lnw->reg_base = devm_ioremap_resource(&pdev->dev, rc);
+	if (IS_ERR(lnw->reg_base))
+		return PTR_ERR(lnw->reg_base);
+
 	spin_lock_init(&lnw->lock);
 	gc = &lnw->chip;
 	gc->label = dev_name(&pdev->dev);
@@ -463,15 +434,10 @@ static int wp_gpio_probe(struct platform_device *pdev)
 	if (retval) {
 		dev_err(&pdev->dev, "whitneypoint gpiochip_add error %d\n",
 								retval);
-		goto err_ioremap;
+		return retval;
 	}
 	platform_set_drvdata(pdev, lnw);
 	return 0;
-err_ioremap:
-	iounmap(lnw->reg_base);
-err_kmalloc:
-	kfree(lnw);
-	return retval;
 }
 
 static int wp_gpio_remove(struct platform_device *pdev)
@@ -481,9 +447,6 @@ static int wp_gpio_remove(struct platform_device *pdev)
 	err = gpiochip_remove(&lnw->chip);
 	if (err)
 		dev_err(&pdev->dev, "failed to remove gpio_chip.\n");
-	iounmap(lnw->reg_base);
-	kfree(lnw);
-	platform_set_drvdata(pdev, NULL);
 	return 0;
 }
 
-- 
1.8.2.rc0.22.gb3600c3


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

* [PATCH v3 4/5] gpio-langwell: amend error messages
  2013-05-22 10:20 [PATCH v3 0/5] gpio-langwell: bugfix and amendments Andy Shevchenko
                   ` (2 preceding siblings ...)
  2013-05-22 10:20 ` [PATCH v3 3/5] gpio-langwell: use managed functions pcim_* and devm_* Andy Shevchenko
@ 2013-05-22 10:20 ` Andy Shevchenko
  2013-05-30 17:27   ` Linus Walleij
  2013-05-22 10:20 ` [PATCH v3 5/5] gpio-langwell: drop away explicit casting Andy Shevchenko
  2013-05-22 16:28 ` [PATCH v3 0/5] gpio-langwell: bugfix and amendments David Cohen
  5 siblings, 1 reply; 19+ messages in thread
From: Andy Shevchenko @ 2013-05-22 10:20 UTC (permalink / raw)
  To: Linus Walleij, David Cohen, Mika Westerberg, linux-kernel; +Cc: Andy Shevchenko

There is no need to use hardcoded device name in the error messages, because
dev_err() prefixes the message with the device name anyway.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/gpio/gpio-langwell.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index 54b6caf..313d190 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -347,7 +347,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 
 	lnw = devm_kzalloc(&pdev->dev, sizeof(*lnw), GFP_KERNEL);
 	if (!lnw) {
-		dev_err(&pdev->dev, "can't allocate langwell_gpio chip data\n");
+		dev_err(&pdev->dev, "can't allocate chip data\n");
 		return -ENOMEM;
 	}
 
@@ -374,7 +374,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 	pci_set_drvdata(pdev, lnw);
 	retval = gpiochip_add(&lnw->chip);
 	if (retval) {
-		dev_err(&pdev->dev, "langwell gpiochip_add error %d\n", retval);
+		dev_err(&pdev->dev, "gpiochip_add error %d\n", retval);
 		return retval;
 	}
 
@@ -408,8 +408,7 @@ static int wp_gpio_probe(struct platform_device *pdev)
 
 	lnw = devm_kzalloc(&pdev->dev, sizeof(struct lnw_gpio), GFP_KERNEL);
 	if (!lnw) {
-		dev_err(&pdev->dev,
-			"can't allocate whitneypoint_gpio chip data\n");
+		dev_err(&pdev->dev, "can't allocate chip data\n");
 		return -ENOMEM;
 	}
 
@@ -432,8 +431,7 @@ static int wp_gpio_probe(struct platform_device *pdev)
 	gc->can_sleep = 0;
 	retval = gpiochip_add(gc);
 	if (retval) {
-		dev_err(&pdev->dev, "whitneypoint gpiochip_add error %d\n",
-								retval);
+		dev_err(&pdev->dev, "gpiochip_add error %d\n", retval);
 		return retval;
 	}
 	platform_set_drvdata(pdev, lnw);
-- 
1.8.2.rc0.22.gb3600c3


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

* [PATCH v3 5/5] gpio-langwell: drop away explicit casting
  2013-05-22 10:20 [PATCH v3 0/5] gpio-langwell: bugfix and amendments Andy Shevchenko
                   ` (3 preceding siblings ...)
  2013-05-22 10:20 ` [PATCH v3 4/5] gpio-langwell: amend error messages Andy Shevchenko
@ 2013-05-22 10:20 ` Andy Shevchenko
  2013-05-22 11:07   ` Mika Westerberg
  2013-05-30 17:28   ` Linus Walleij
  2013-05-22 16:28 ` [PATCH v3 0/5] gpio-langwell: bugfix and amendments David Cohen
  5 siblings, 2 replies; 19+ messages in thread
From: Andy Shevchenko @ 2013-05-22 10:20 UTC (permalink / raw)
  To: Linus Walleij, David Cohen, Mika Westerberg, linux-kernel; +Cc: Andy Shevchenko

Since the type of the reg_base member is void __iomem * we don't need to have
explicit casting in gpio_reg() and gpio_reg_2bit().

Update year in the copyright notice as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-langwell.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index 313d190..fec85ca 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -1,7 +1,7 @@
 /*
  * Moorestown platform Langwell chip GPIO driver
  *
- * Copyright (c) 2008 - 2009,  Intel Corporation.
+ * Copyright (c) 2008, 2009, 2013, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -74,15 +74,13 @@ struct lnw_gpio {
 #define to_lnw_priv(chip)	container_of(chip, struct lnw_gpio, chip)
 
 static void __iomem *gpio_reg(struct gpio_chip *chip, unsigned offset,
-			enum GPIO_REG reg_type)
+			      enum GPIO_REG reg_type)
 {
 	struct lnw_gpio *lnw = to_lnw_priv(chip);
 	unsigned nreg = chip->ngpio / 32;
 	u8 reg = offset / 32;
-	void __iomem *ptr;
 
-	ptr = (void __iomem *)(lnw->reg_base + reg_type * nreg * 4 + reg * 4);
-	return ptr;
+	return lnw->reg_base + reg_type * nreg * 4 + reg * 4;
 }
 
 static void __iomem *gpio_reg_2bit(struct gpio_chip *chip, unsigned offset,
@@ -91,10 +89,8 @@ static void __iomem *gpio_reg_2bit(struct gpio_chip *chip, unsigned offset,
 	struct lnw_gpio *lnw = to_lnw_priv(chip);
 	unsigned nreg = chip->ngpio / 32;
 	u8 reg = offset / 16;
-	void __iomem *ptr;
 
-	ptr = (void __iomem *)(lnw->reg_base + reg_type * nreg * 4 + reg * 4);
-	return ptr;
+	return lnw->reg_base + reg_type * nreg * 4 + reg * 4;
 }
 
 static int lnw_gpio_request(struct gpio_chip *chip, unsigned offset)
-- 
1.8.2.rc0.22.gb3600c3


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

* Re: [PATCH v3 3/5] gpio-langwell: use managed functions pcim_* and devm_*
  2013-05-22 10:20 ` [PATCH v3 3/5] gpio-langwell: use managed functions pcim_* and devm_* Andy Shevchenko
@ 2013-05-22 11:06   ` Mika Westerberg
  2013-05-30 17:25   ` Linus Walleij
  1 sibling, 0 replies; 19+ messages in thread
From: Mika Westerberg @ 2013-05-22 11:06 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Linus Walleij, David Cohen, linux-kernel

On Wed, May 22, 2013 at 01:20:12PM +0300, Andy Shevchenko wrote:
> This makes the error handling much more simpler than open-coding everything and
> in addition makes the probe function smaller an tidier.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH v3 5/5] gpio-langwell: drop away explicit casting
  2013-05-22 10:20 ` [PATCH v3 5/5] gpio-langwell: drop away explicit casting Andy Shevchenko
@ 2013-05-22 11:07   ` Mika Westerberg
  2013-05-30 17:28   ` Linus Walleij
  1 sibling, 0 replies; 19+ messages in thread
From: Mika Westerberg @ 2013-05-22 11:07 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Linus Walleij, David Cohen, linux-kernel

On Wed, May 22, 2013 at 01:20:14PM +0300, Andy Shevchenko wrote:
> Since the type of the reg_base member is void __iomem * we don't need to have
> explicit casting in gpio_reg() and gpio_reg_2bit().
> 
> Update year in the copyright notice as well.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH v3 0/5] gpio-langwell: bugfix and amendments
  2013-05-22 10:20 [PATCH v3 0/5] gpio-langwell: bugfix and amendments Andy Shevchenko
                   ` (4 preceding siblings ...)
  2013-05-22 10:20 ` [PATCH v3 5/5] gpio-langwell: drop away explicit casting Andy Shevchenko
@ 2013-05-22 16:28 ` David Cohen
  2013-05-28  8:05   ` Andy Shevchenko
  5 siblings, 1 reply; 19+ messages in thread
From: David Cohen @ 2013-05-22 16:28 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Linus Walleij, Mika Westerberg, linux-kernel

On 05/22/2013 03:20 AM, Andy Shevchenko wrote:
> There is locking bug fix and few amendments. Each commit message verbose
> enoough I think.
>
> Since v2:
>   - apply ACKs
>   - addressed Mika's comment for patch 3/4
>   - append patch 5/5
>
> Since v1:
>   - patch 2/4 ("amend error messages") moved to 4/4
>   - minor fix in patch 3/4 ("use managed ...")
>   - fix patch 4/4 ("amend error messages") to be real amendment
>
> Andy Shevchenko (5):
>    gpio-langwell: initialize lock before usage
>    gpio-langwell: do not use direct access to iomapped memory
>    gpio-langwell: use managed functions pcim_* and devm_*
>    gpio-langwell: amend error messages
>    gpio-langwell: drop away explicit casting
>
>   drivers/gpio/gpio-langwell.c | 117 ++++++++++++++-----------------------------
>   1 file changed, 38 insertions(+), 79 deletions(-)
>
For the whole set:
Acked-by: David Cohen <david.a.cohen@intel.com>

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

* Re: [PATCH v3 0/5] gpio-langwell: bugfix and amendments
  2013-05-22 16:28 ` [PATCH v3 0/5] gpio-langwell: bugfix and amendments David Cohen
@ 2013-05-28  8:05   ` Andy Shevchenko
  2013-05-30 17:30     ` Linus Walleij
  0 siblings, 1 reply; 19+ messages in thread
From: Andy Shevchenko @ 2013-05-28  8:05 UTC (permalink / raw)
  To: David Cohen; +Cc: Andy Shevchenko, Linus Walleij, Mika Westerberg, linux-kernel

On Wed, May 22, 2013 at 7:28 PM, David Cohen <david.a.cohen@intel.com> wrote:
> On 05/22/2013 03:20 AM, Andy Shevchenko wrote:
>>
>> There is locking bug fix and few amendments. Each commit message verbose
>> enoough I think.
>>
>> Since v2:
>>   - apply ACKs
>>   - addressed Mika's comment for patch 3/4
>>   - append patch 5/5
>>
>> Since v1:
>>   - patch 2/4 ("amend error messages") moved to 4/4
>>   - minor fix in patch 3/4 ("use managed ...")
>>   - fix patch 4/4 ("amend error messages") to be real amendment
>>
>> Andy Shevchenko (5):
>>    gpio-langwell: initialize lock before usage
>>    gpio-langwell: do not use direct access to iomapped memory
>>    gpio-langwell: use managed functions pcim_* and devm_*
>>    gpio-langwell: amend error messages
>>    gpio-langwell: drop away explicit casting
>>
>>   drivers/gpio/gpio-langwell.c | 117 ++++++++++++++-----------------------------
>>   1 file changed, 38 insertions(+), 79 deletions(-)
>>
> For the whole set:
> Acked-by: David Cohen <david.a.cohen@intel.com>

Linus, do you have any comments on this?

--
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v3 1/5] gpio-langwell: initialize lock before usage
  2013-05-22 10:20 ` [PATCH v3 1/5] gpio-langwell: initialize lock before usage Andy Shevchenko
@ 2013-05-30 17:20   ` Linus Walleij
  2013-05-31 12:01   ` Linus Walleij
  1 sibling, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2013-05-30 17:20 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: David Cohen, Mika Westerberg, linux-kernel

On Wed, May 22, 2013 at 12:20 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Otherwise we will end up with traceback from LOCKDEP:
>
> INFO: trying to register non-static key.
> the code is fine but needs lockdep annotation.
> turning off the locking correctness validator.
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.10.0-rc2-next-20130521-00028-g09aa9fc #487
>  00000000 00000000 f6c55c54 c1541fe4 f6040bf8 f6c55c8c c1069ef1 c1726bc1
>  c1726cc8 c1726c9e 00000000 f6c584e0 f6c58000 f6c55ce8 00000000 f6040bf8
>  f6040bf8 00000046 f6c58000 f6c55d00 c106a18d 00000a2b 00000003 00004f02
> Call Trace:
>  [<c1541fe4>] dump_stack+0x49/0x77
>  [<c1069ef1>] register_lock_class+0x58/0x260
>  [<c106a18d>] __lock_acquire+0x94/0xcff
>  [<c106adc8>] ? __lock_acquire+0xccf/0xcff
>  [<c106b2ad>] lock_acquire+0xcc/0x10d
>  [<c1269c7c>] ? lnw_irq_type+0x63/0xe9
>  [<c1545da0>] _raw_spin_lock_irqsave+0x32/0x42
>  [<c1269c7c>] ? lnw_irq_type+0x63/0xe9
>  [<c1269c7c>] lnw_irq_type+0x63/0xe9
>  [<c108f454>] __irq_set_trigger+0x98/0x123
>  [<c1090225>] irq_set_irq_type+0x2f/0x51
>  [<c1090225>] ? irq_set_irq_type+0x2f/0x51
>  [<c1269d02>] ? lnw_irq_type+0xe9/0xe9
>  [<c1269d34>] lnw_gpio_irq_map+0x32/0x3b
>  [<c10914f2>] irq_domain_add_legacy+0xe2/0x107
>  [<c1091b53>] irq_domain_add_simple+0x47/0x60
>  [<c1269f6e>] lnw_gpio_probe+0x119/0x217
>  [<c1271018>] pci_device_probe+0x5a/0x92
> ...
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH v3 2/5] gpio-langwell: do not use direct access to iomapped memory
  2013-05-22 10:20 ` [PATCH v3 2/5] gpio-langwell: do not use direct access to iomapped memory Andy Shevchenko
@ 2013-05-30 17:21   ` Linus Walleij
  0 siblings, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2013-05-30 17:21 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: David Cohen, Mika Westerberg, linux-kernel

On Wed, May 22, 2013 at 12:20 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> We better to use readl() function instead of bad looking direct access.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH v3 3/5] gpio-langwell: use managed functions pcim_* and devm_*
  2013-05-22 10:20 ` [PATCH v3 3/5] gpio-langwell: use managed functions pcim_* and devm_* Andy Shevchenko
  2013-05-22 11:06   ` Mika Westerberg
@ 2013-05-30 17:25   ` Linus Walleij
  2013-05-31  7:57     ` Andy Shevchenko
  1 sibling, 1 reply; 19+ messages in thread
From: Linus Walleij @ 2013-05-30 17:25 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: David Cohen, Mika Westerberg, linux-kernel

On Wed, May 22, 2013 at 12:20 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> This makes the error handling much more simpler than open-coding everything and
> in addition makes the probe function smaller an tidier.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied with Mika's ACK.

I had to rebase this thing since there was a patch removing the line
setting platform data to NULL on remove(), check that I did the right
thing in the result.

Yours,
Linus Walleij

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

* Re: [PATCH v3 4/5] gpio-langwell: amend error messages
  2013-05-22 10:20 ` [PATCH v3 4/5] gpio-langwell: amend error messages Andy Shevchenko
@ 2013-05-30 17:27   ` Linus Walleij
  0 siblings, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2013-05-30 17:27 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: David Cohen, Mika Westerberg, linux-kernel

On Wed, May 22, 2013 at 12:20 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> There is no need to use hardcoded device name in the error messages, because
> dev_err() prefixes the message with the device name anyway.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Patch applied.

Yours,
Linus Walleij

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

* Re: [PATCH v3 5/5] gpio-langwell: drop away explicit casting
  2013-05-22 10:20 ` [PATCH v3 5/5] gpio-langwell: drop away explicit casting Andy Shevchenko
  2013-05-22 11:07   ` Mika Westerberg
@ 2013-05-30 17:28   ` Linus Walleij
  1 sibling, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2013-05-30 17:28 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: David Cohen, Mika Westerberg, linux-kernel

On Wed, May 22, 2013 at 12:20 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Since the type of the reg_base member is void __iomem * we don't need to have
> explicit casting in gpio_reg() and gpio_reg_2bit().
>
> Update year in the copyright notice as well.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Patch applied with Mika's ACK.

Yours,
Linus Walleij

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

* Re: [PATCH v3 0/5] gpio-langwell: bugfix and amendments
  2013-05-28  8:05   ` Andy Shevchenko
@ 2013-05-30 17:30     ` Linus Walleij
  0 siblings, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2013-05-30 17:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: David Cohen, Andy Shevchenko, Mika Westerberg, linux-kernel

On Tue, May 28, 2013 at 10:05 AM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:

> Linus, do you have any comments on this?

Sorry for the delay. I have applied the v3 patchset now.

I'll also edit in David Cohen's ACK on all patches.

Yours,
Linus Walleij

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

* Re: [PATCH v3 3/5] gpio-langwell: use managed functions pcim_* and devm_*
  2013-05-30 17:25   ` Linus Walleij
@ 2013-05-31  7:57     ` Andy Shevchenko
  0 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2013-05-31  7:57 UTC (permalink / raw)
  To: Linus Walleij; +Cc: David Cohen, Mika Westerberg, linux-kernel

On Thu, 2013-05-30 at 19:25 +0200, Linus Walleij wrote: 
> On Wed, May 22, 2013 at 12:20 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> 
> > This makes the error handling much more simpler than open-coding everything and
> > in addition makes the probe function smaller an tidier.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Applied with Mika's ACK.
> 
> I had to rebase this thing since there was a patch removing the line
> setting platform data to NULL on remove(), check that I did the right
> thing in the result.

Yes, that is correct. Thanks!

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

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

* Re: [PATCH v3 1/5] gpio-langwell: initialize lock before usage
  2013-05-22 10:20 ` [PATCH v3 1/5] gpio-langwell: initialize lock before usage Andy Shevchenko
  2013-05-30 17:20   ` Linus Walleij
@ 2013-05-31 12:01   ` Linus Walleij
  2013-05-31 14:03     ` Andy Shevchenko
  1 sibling, 1 reply; 19+ messages in thread
From: Linus Walleij @ 2013-05-31 12:01 UTC (permalink / raw)
  To: Andy Shevchenko, Grant Likely; +Cc: David Cohen, Mika Westerberg, linux-kernel

On Wed, May 22, 2013 at 12:20 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Otherwise we will end up with traceback from LOCKDEP:

Andy do you consider this a regression that needs to go into fixes?

I.e. is this used in in-tree code and causing problems with v3.10...

I'm asking because it creates a mess as the rest of the series depend
on it.

It is currently applied for v3.11.

Yours,
Linus Walleij

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

* Re: [PATCH v3 1/5] gpio-langwell: initialize lock before usage
  2013-05-31 12:01   ` Linus Walleij
@ 2013-05-31 14:03     ` Andy Shevchenko
  0 siblings, 0 replies; 19+ messages in thread
From: Andy Shevchenko @ 2013-05-31 14:03 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Andy Shevchenko, Grant Likely, David Cohen, Mika Westerberg,
	linux-kernel

On Fri, May 31, 2013 at 3:01 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Wed, May 22, 2013 at 12:20 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
>
>> Otherwise we will end up with traceback from LOCKDEP:
>
> Andy do you consider this a regression that needs to go into fixes?

I think so. The commit
2519f9abced15b4327f03d7b8666827517582c29
was the recent one which probably brought such behaviour.

> I.e. is this used in in-tree code and causing problems with v3.10...
>
> I'm asking because it creates a mess as the rest of the series depend
> on it.
>
> It is currently applied for v3.11.

Perhaps it should go to v3.10 as well.

--
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2013-05-31 14:03 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-22 10:20 [PATCH v3 0/5] gpio-langwell: bugfix and amendments Andy Shevchenko
2013-05-22 10:20 ` [PATCH v3 1/5] gpio-langwell: initialize lock before usage Andy Shevchenko
2013-05-30 17:20   ` Linus Walleij
2013-05-31 12:01   ` Linus Walleij
2013-05-31 14:03     ` Andy Shevchenko
2013-05-22 10:20 ` [PATCH v3 2/5] gpio-langwell: do not use direct access to iomapped memory Andy Shevchenko
2013-05-30 17:21   ` Linus Walleij
2013-05-22 10:20 ` [PATCH v3 3/5] gpio-langwell: use managed functions pcim_* and devm_* Andy Shevchenko
2013-05-22 11:06   ` Mika Westerberg
2013-05-30 17:25   ` Linus Walleij
2013-05-31  7:57     ` Andy Shevchenko
2013-05-22 10:20 ` [PATCH v3 4/5] gpio-langwell: amend error messages Andy Shevchenko
2013-05-30 17:27   ` Linus Walleij
2013-05-22 10:20 ` [PATCH v3 5/5] gpio-langwell: drop away explicit casting Andy Shevchenko
2013-05-22 11:07   ` Mika Westerberg
2013-05-30 17:28   ` Linus Walleij
2013-05-22 16:28 ` [PATCH v3 0/5] gpio-langwell: bugfix and amendments David Cohen
2013-05-28  8:05   ` Andy Shevchenko
2013-05-30 17:30     ` 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.