From: Linus Walleij <linus.walleij@linaro.org>
To: linux-kernel@vger.kernel.org, Barry Song <Baohua.Song@csr.com>,
Barry Song <baohua@kernel.org>
Cc: linux-gpio@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>,
Guoying Zhang <Guoying.Zhang@csr.com>,
Wei Chen <Wei.Chen@csr.com>
Subject: [PATCH] pinctrl: sirf/atlas7: stop poking around in GPIO internals
Date: Fri, 12 Feb 2016 09:31:13 +0100 [thread overview]
Message-ID: <1455265873-21534-1-git-send-email-linus.walleij@linaro.org> (raw)
This code is poking around in the gpio_chip:s internal structures
to achieve some kind of pin to GPIO mappings.
- It is wrong to poke around in these structs and the pinctrl
maintainer was stupid to let it pass unnoticed, mea culpa.
- The right interface to use is gpiochip_add_pin_range()
- The code appears unused: the pin control part of the driver
is not adding any ranges, so we're iterating over an empty
list. Maybe it is poking around in some other pin controllers
GPIO ranges, and that's just totally wrong, again use
gpiochip_add_pin_range() and specify the right pin
controller.
Cc: Barry Song <baohua@kernel.org>
Cc: Guoying Zhang <Guoying.Zhang@csr.com>
Cc: Wei Chen <Wei.Chen@csr.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
SiRF maintainers: look at this immediately and explain what is
going on.
---
drivers/pinctrl/sirf/pinctrl-atlas7.c | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/drivers/pinctrl/sirf/pinctrl-atlas7.c b/drivers/pinctrl/sirf/pinctrl-atlas7.c
index beb024c31a5d..3d233fc3448a 100644
--- a/drivers/pinctrl/sirf/pinctrl-atlas7.c
+++ b/drivers/pinctrl/sirf/pinctrl-atlas7.c
@@ -338,7 +338,6 @@ struct atlas7_pinctrl_data {
#define ATLAS7_GPIO_CTL_DATAIN_MASK BIT(7)
struct atlas7_gpio_bank {
- struct pinctrl_dev *pctldev;
int id;
int irq;
void __iomem *base;
@@ -6070,7 +6069,6 @@ static int atlas7_gpio_probe(struct platform_device *pdev)
}
for (idx = 0; idx < nbank; idx++) {
- struct gpio_pin_range *pin_range;
struct atlas7_gpio_bank *bank;
bank = &a7gc->banks[idx];
@@ -6088,22 +6086,6 @@ static int atlas7_gpio_probe(struct platform_device *pdev)
gpiochip_set_chained_irqchip(chip, &atlas7_gpio_irq_chip,
bank->irq, atlas7_gpio_handle_irq);
-
- /* Records gpio_pin_range to a7gc */
- list_for_each_entry(pin_range, &chip->pin_ranges, node) {
- struct pinctrl_gpio_range *range;
-
- range = &pin_range->range;
- if (range->id == NGPIO_OF_BANK * idx) {
- bank->gpio_offset = range->id;
- bank->ngpio = range->npins;
- bank->gpio_pins = range->pins;
- bank->pctldev = pin_range->pctldev;
- break;
- }
- }
-
- BUG_ON(!bank->pctldev);
}
platform_set_drvdata(pdev, a7gc);
--
2.4.3
next reply other threads:[~2016-02-12 8:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-12 8:31 Linus Walleij [this message]
2016-02-18 2:50 ` [PATCH] pinctrl: sirf/atlas7: stop poking around in GPIO internals Barry Song
2016-02-18 20:42 ` Linus Walleij
2016-02-19 3:21 ` Barry Song
2016-02-19 8:21 ` Linus Walleij
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=1455265873-21534-1-git-send-email-linus.walleij@linaro.org \
--to=linus.walleij@linaro.org \
--cc=Baohua.Song@csr.com \
--cc=Guoying.Zhang@csr.com \
--cc=Wei.Chen@csr.com \
--cc=baohua@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@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).