From patchwork Wed Dec 9 13:32:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58063 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp670865lbb; Wed, 9 Dec 2015 05:32:39 -0800 (PST) X-Received: by 10.98.17.152 with SMTP id 24mr12947030pfr.41.1449667959345; Wed, 09 Dec 2015 05:32:39 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18si12793619pfj.115.2015.12.09.05.32.39; Wed, 09 Dec 2015 05:32:39 -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.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754187AbbLINci (ORCPT + 4 others); Wed, 9 Dec 2015 08:32:38 -0500 Received: from mail-lf0-f54.google.com ([209.85.215.54]:35800 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754153AbbLINci (ORCPT ); Wed, 9 Dec 2015 08:32:38 -0500 Received: by lfdl133 with SMTP id l133so34123994lfd.2 for ; Wed, 09 Dec 2015 05:32:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=R9ZuCpoyxx70FdboYT6cmEtL3yVrk1r9N7+sT/iZcmw=; b=rh2dk0wHo0nirVUg4DGqFxlV3oXbPPycI7DKH6dq48kCpzWo6t/mbxPkDjPTgkydps oduVYeeZC2qHUxNZPmMTwiYn+q8YgtWuYo06HA0tMnKYYs+13T3F4KLHywlCZ02YLYe0 0AtlU1wCFuVR79HTkSlqV4mnMSGjRodBXj0X9rOIhf//gnbXm7sle5nAZcsmPRgDPTgP 2zo0DRSouvTQgVR5HPaDf+FE8HiyVb1rtaK6y2UkNTetsJvA7R1gZ4r9gaTDa6qbLyS1 ZGP/+hTfAnZcx0o4OzNY1fOPxXCBq+0D0NEQYY7h+6ALwhicAiNmqxNBzBPxbDQyY4VW //RQ== 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:mime-version :content-type:content-transfer-encoding; bh=R9ZuCpoyxx70FdboYT6cmEtL3yVrk1r9N7+sT/iZcmw=; b=QuGPifn6PGa6wpuOcXNbt/SESziKds4ZpijRrMc/tR4nxtvFF/+JWSVuN8hn4jShL2 ylthQq2zxyLjlEyiUfoQjlYWgsjKEQE0MVGWChUVXU724z8b0kfLjq8CHChBdovv4NzO RnyJntAmbGV7xK6+QJ1FvcLuQ2HuOp2a6DDKOEDS+XnAuPHTz8rLd0UsVgA3frE4RC0n +awylTUo+TmvxMnlBRHzQUhhPtvpt48y1HPJBrnajZMpHEWkEEu765O+/xmHOW5xqvxY pPBd9KChXOuJQaN/6Mo9uonudK4waNE4O1578ZkJLHpAIaDKBzCwB1YinhQM8zQdd30v LTjw== X-Gm-Message-State: ALoCoQnafwbQ+JKIrJYQJ0jdEZz6v2akS9ENTx0ePgWzavJ+2sf5OHW2/K1hfbViiO4G3SlEqG4wzgptaJi2oX3A7MpoI4LeDA== X-Received: by 10.25.165.202 with SMTP id o193mr2196574lfe.83.1449667956609; Wed, 09 Dec 2015 05:32:36 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id dq10sm1417403lbc.12.2015.12.09.05.32.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:32:35 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Stephen Boyd , =?UTF-8?q?Bj=C3=B6rn=20Andersson?= Subject: [PATCH 107/182] pinctrl: msm: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:32:33 +0100 Message-Id: <1449667953-2847-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: Stephen Boyd Cc: Björn Andersson Signed-off-by: Linus Walleij --- drivers/pinctrl/qcom/pinctrl-msm.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 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/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index af2a13040898..8777cf083eef 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -69,11 +69,6 @@ struct msm_pinctrl { void __iomem *regs; }; -static inline struct msm_pinctrl *to_msm_pinctrl(struct gpio_chip *gc) -{ - return container_of(gc, struct msm_pinctrl, chip); -} - static int msm_get_groups_count(struct pinctrl_dev *pctldev) { struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); @@ -381,7 +376,7 @@ static struct pinctrl_desc msm_pinctrl_desc = { static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { const struct msm_pingroup *g; - struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); + struct msm_pinctrl *pctrl = gpiochip_get_data(chip); unsigned long flags; u32 val; @@ -401,7 +396,7 @@ static int msm_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) { const struct msm_pingroup *g; - struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); + struct msm_pinctrl *pctrl = gpiochip_get_data(chip); unsigned long flags; u32 val; @@ -428,7 +423,7 @@ static int msm_gpio_direction_output(struct gpio_chip *chip, unsigned offset, in static int msm_gpio_get(struct gpio_chip *chip, unsigned offset) { const struct msm_pingroup *g; - struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); + struct msm_pinctrl *pctrl = gpiochip_get_data(chip); u32 val; g = &pctrl->soc->groups[offset]; @@ -440,7 +435,7 @@ static int msm_gpio_get(struct gpio_chip *chip, unsigned offset) static void msm_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { const struct msm_pingroup *g; - struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); + struct msm_pinctrl *pctrl = gpiochip_get_data(chip); unsigned long flags; u32 val; @@ -468,7 +463,7 @@ static void msm_gpio_dbg_show_one(struct seq_file *s, unsigned gpio) { const struct msm_pingroup *g; - struct msm_pinctrl *pctrl = container_of(chip, struct msm_pinctrl, chip); + struct msm_pinctrl *pctrl = gpiochip_get_data(chip); unsigned func; int is_out; int drive; @@ -567,7 +562,7 @@ static void msm_gpio_update_dual_edge_pos(struct msm_pinctrl *pctrl, static void msm_gpio_irq_mask(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); + struct msm_pinctrl *pctrl = gpiochip_get_data(gc); const struct msm_pingroup *g; unsigned long flags; u32 val; @@ -588,7 +583,7 @@ static void msm_gpio_irq_mask(struct irq_data *d) static void msm_gpio_irq_unmask(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); + struct msm_pinctrl *pctrl = gpiochip_get_data(gc); const struct msm_pingroup *g; unsigned long flags; u32 val; @@ -613,7 +608,7 @@ static void msm_gpio_irq_unmask(struct irq_data *d) static void msm_gpio_irq_ack(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); + struct msm_pinctrl *pctrl = gpiochip_get_data(gc); const struct msm_pingroup *g; unsigned long flags; u32 val; @@ -638,7 +633,7 @@ static void msm_gpio_irq_ack(struct irq_data *d) static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); + struct msm_pinctrl *pctrl = gpiochip_get_data(gc); const struct msm_pingroup *g; unsigned long flags; u32 val; @@ -732,7 +727,7 @@ static int msm_gpio_irq_set_type(struct irq_data *d, unsigned int type) static int msm_gpio_irq_set_wake(struct irq_data *d, unsigned int on) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); + struct msm_pinctrl *pctrl = gpiochip_get_data(gc); unsigned long flags; spin_lock_irqsave(&pctrl->lock, flags); @@ -757,7 +752,7 @@ static void msm_gpio_irq_handler(struct irq_desc *desc) { struct gpio_chip *gc = irq_desc_get_handler_data(desc); const struct msm_pingroup *g; - struct msm_pinctrl *pctrl = to_msm_pinctrl(gc); + struct msm_pinctrl *pctrl = gpiochip_get_data(gc); struct irq_chip *chip = irq_desc_get_chip(desc); int irq_pin; int handled = 0; @@ -804,7 +799,7 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) chip->owner = THIS_MODULE; chip->of_node = pctrl->dev->of_node; - ret = gpiochip_add(&pctrl->chip); + ret = gpiochip_add_data(&pctrl->chip, pctrl); if (ret) { dev_err(pctrl->dev, "Failed register gpiochip\n"); return ret;