devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: linux-gpio@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devicetree@vger.kernel.org
Subject: [PATCH] gpio/serial: revert "linux,first-pin" property handling
Date: Mon, 10 Jul 2017 16:09:02 +0200	[thread overview]
Message-ID: <20170710140902.21935-1-linus.walleij@linaro.org> (raw)

This is not a legal device tree property, because its binding has
not been reviewed and approved, nor does it exist in any device
tree binding document.

It is further wrong, because it is added to the GPIO offset which
is by definition controller-local.

Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
This got in because I was stressed and was not paying attention.
Sorry about not noticing earlier, but I usually strongly nix any
such properties, please discuss this on the device tree list
first.
---
 drivers/gpio/gpio-exar.c            | 25 +++++++++----------------
 drivers/tty/serial/8250/8250_exar.c |  2 --
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/gpio/gpio-exar.c b/drivers/gpio/gpio-exar.c
index fb8d304cfa17..d02c5260525f 100644
--- a/drivers/gpio/gpio-exar.c
+++ b/drivers/gpio/gpio-exar.c
@@ -31,7 +31,6 @@ struct exar_gpio_chip {
 	int index;
 	void __iomem *regs;
 	char name[20];
-	unsigned int first_pin;
 };
 
 static void exar_update(struct gpio_chip *chip, unsigned int reg, int val,
@@ -53,9 +52,9 @@ static int exar_set_direction(struct gpio_chip *chip, int direction,
 			      unsigned int offset)
 {
 	struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip);
-	unsigned int addr = (offset + exar_gpio->first_pin) / 8 ?
+	unsigned int addr = offset / 8 ?
 		EXAR_OFFSET_MPIOSEL_HI : EXAR_OFFSET_MPIOSEL_LO;
-	unsigned int bit  = (offset + exar_gpio->first_pin) % 8;
+	unsigned int bit  = offset % 8;
 
 	exar_update(chip, addr, direction, bit);
 	return 0;
@@ -76,9 +75,9 @@ static int exar_get(struct gpio_chip *chip, unsigned int reg)
 static int exar_get_direction(struct gpio_chip *chip, unsigned int offset)
 {
 	struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip);
-	unsigned int addr = (offset + exar_gpio->first_pin) / 8 ?
+	unsigned int addr = offset / 8 ?
 		EXAR_OFFSET_MPIOSEL_HI : EXAR_OFFSET_MPIOSEL_LO;
-	unsigned int bit  = (offset + exar_gpio->first_pin) % 8;
+	unsigned int bit  = offset % 8;
 
 	return !!(exar_get(chip, addr) & BIT(bit));
 }
@@ -86,9 +85,9 @@ static int exar_get_direction(struct gpio_chip *chip, unsigned int offset)
 static int exar_get_value(struct gpio_chip *chip, unsigned int offset)
 {
 	struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip);
-	unsigned int addr = (offset + exar_gpio->first_pin) / 8 ?
+	unsigned int addr = offset / 8 ?
 		EXAR_OFFSET_MPIOLVL_HI : EXAR_OFFSET_MPIOLVL_LO;
-	unsigned int bit  = (offset + exar_gpio->first_pin) % 8;
+	unsigned int bit  = offset % 8;
 
 	return !!(exar_get(chip, addr) & BIT(bit));
 }
@@ -97,9 +96,9 @@ static void exar_set_value(struct gpio_chip *chip, unsigned int offset,
 			   int value)
 {
 	struct exar_gpio_chip *exar_gpio = gpiochip_get_data(chip);
-	unsigned int addr = (offset + exar_gpio->first_pin) / 8 ?
+	unsigned int addr = offset / 8 ?
 		EXAR_OFFSET_MPIOLVL_HI : EXAR_OFFSET_MPIOLVL_LO;
-	unsigned int bit  = (offset + exar_gpio->first_pin) % 8;
+	unsigned int bit  = offset % 8;
 
 	exar_update(chip, addr, value, bit);
 }
@@ -120,7 +119,7 @@ static int gpio_exar_probe(struct platform_device *pdev)
 {
 	struct pci_dev *pcidev = to_pci_dev(pdev->dev.parent);
 	struct exar_gpio_chip *exar_gpio;
-	u32 first_pin, ngpios;
+	u32 ngpios;
 	void __iomem *p;
 	int index, ret;
 
@@ -132,11 +131,6 @@ static int gpio_exar_probe(struct platform_device *pdev)
 	if (!p)
 		return -ENOMEM;
 
-	ret = device_property_read_u32(&pdev->dev, "linux,first-pin",
-				       &first_pin);
-	if (ret)
-		return ret;
-
 	ret = device_property_read_u32(&pdev->dev, "ngpios", &ngpios);
 	if (ret)
 		return ret;
@@ -161,7 +155,6 @@ static int gpio_exar_probe(struct platform_device *pdev)
 	exar_gpio->gpio_chip.ngpio = ngpios;
 	exar_gpio->regs = p;
 	exar_gpio->index = index;
-	exar_gpio->first_pin = first_pin;
 
 	ret = devm_gpiochip_add_data(&pdev->dev,
 				     &exar_gpio->gpio_chip, exar_gpio);
diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
index b5c98e5bf524..4fb3a4ed4a1f 100644
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -261,7 +261,6 @@ __xr17v35x_register_gpio(struct pci_dev *pcidev,
 }
 
 static const struct property_entry exar_gpio_properties[] = {
-	PROPERTY_ENTRY_U32("linux,first-pin", 0),
 	PROPERTY_ENTRY_U32("ngpios", 16),
 	{ }
 };
@@ -326,7 +325,6 @@ static int iot2040_rs485_config(struct uart_port *port,
 }
 
 static const struct property_entry iot2040_gpio_properties[] = {
-	PROPERTY_ENTRY_U32("linux,first-pin", 10),
 	PROPERTY_ENTRY_U32("ngpios", 1),
 	{ }
 };
-- 
2.9.4


             reply	other threads:[~2017-07-10 14:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10 14:09 Linus Walleij [this message]
2017-07-10 14:23 ` [PATCH] gpio/serial: revert "linux,first-pin" property handling Jan Kiszka
2017-07-11 15:42   ` Jan Kiszka
2017-07-12  9:30     ` Linus Walleij
2017-07-12 11:30       ` Jan Kiszka
2017-07-12 11:39         ` Linus Walleij
     [not found]           ` <CACRpkdZAwXZn+dJ-XB6wEbVLLiOfhumdrXDx4K-bMFN-p3-PSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-12 11:56             ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170710140902.21935-1-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jan.kiszka@siemens.com \
    --cc=linux-gpio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).