From patchwork Fri Feb 12 08:31:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 61833 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp683121lbl; Fri, 12 Feb 2016 00:31:27 -0800 (PST) X-Received: by 10.67.6.10 with SMTP id cq10mr366104pad.120.1455265887552; Fri, 12 Feb 2016 00:31:27 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dg7si18517596pad.75.2016.02.12.00.31.27; Fri, 12 Feb 2016 00:31:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751035AbcBLIb0 (ORCPT + 4 others); Fri, 12 Feb 2016 03:31:26 -0500 Received: from mail-lf0-f52.google.com ([209.85.215.52]:34377 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750816AbcBLIbZ (ORCPT ); Fri, 12 Feb 2016 03:31:25 -0500 Received: by mail-lf0-f52.google.com with SMTP id j78so47180562lfb.1 for ; Fri, 12 Feb 2016 00:31:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=laGWAJUOaHxN2HPpKgjpgO6Tztojp1Y1x6jIEKs3Lfg=; b=D/bX0QqQcJZ6G0Gq8Dww1E2MBTLRmA3JuzAbDLmfeO2W91XFyXCbz1gCDI8kDM20b/ 5+6vKQnGiprf9JdekDf1U1UjznNEWnJZo5C9U3V3wtbQ4dqyDNc+WfEl4+HJwpHSFlfX BBByFk9O5XRm6JQVp8EsBhaDPasQAca25LPvw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=laGWAJUOaHxN2HPpKgjpgO6Tztojp1Y1x6jIEKs3Lfg=; b=KXNCKXhS6K6T9Pfmf1U7CWTxpEZtwjqMolwExWuLdhzI6BVoPPyZeUD4eyu/BXtv2K EDm/bDnyXAZg5pj03rwzw0Q+XvofyJnNlAaNphO6NAn0g4ptx8e7xvcGbAM8o6mddNIt LHfyAf7XP4/UWcZzzCF+qTtRa13Ecm7Yjv2Amt+Fh/84NPOOteED/fX3DGRqeBNQ1Pr/ sDd+FWPEfwPZ6pOR05q+L4wJwVAQ+De+j2lTFNiIjlQ1RzcFIUP0htGGRwlTfBN6NLJs 8kIsDPeYsZxkIkYNLwS1kivkcMwjv1yo3+Up18YIc5dxDSv83Th2O4OUyyImKd6H3opD shXQ== X-Gm-Message-State: AG10YOR7Me+YEWQqVq2+CFHwH+L0MwekzNkaEnjGzV8k6ka5UvyGtDkOGkIVydMQt0t2MNZl X-Received: by 10.25.43.212 with SMTP id r203mr135261lfr.162.1455265884184; Fri, 12 Feb 2016 00:31:24 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id z193sm1809583lfd.0.2016.02.12.00.31.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Feb 2016 00:31:22 -0800 (PST) From: Linus Walleij To: linux-kernel@vger.kernel.org, Barry Song , Barry Song Cc: linux-gpio@vger.kernel.org, Linus Walleij , Guoying Zhang , Wei Chen Subject: [PATCH] pinctrl: sirf/atlas7: stop poking around in GPIO internals Date: Fri, 12 Feb 2016 09:31:13 +0100 Message-Id: <1455265873-21534-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 Cc: Guoying Zhang Cc: Wei Chen Signed-off-by: Linus Walleij --- SiRF maintainers: look at this immediately and explain what is going on. --- drivers/pinctrl/sirf/pinctrl-atlas7.c | 18 ------------------ 1 file changed, 18 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);