From patchwork Wed Dec 9 13:33:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58074 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp671793lbb; Wed, 9 Dec 2015 05:34:08 -0800 (PST) X-Received: by 10.98.1.213 with SMTP id 204mr13025013pfb.128.1449668048110; Wed, 09 Dec 2015 05:34:08 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nx14si12797123pab.69.2015.12.09.05.34.07; Wed, 09 Dec 2015 05:34:08 -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 S1754531AbbLINeE (ORCPT + 4 others); Wed, 9 Dec 2015 08:34:04 -0500 Received: from mail-lb0-f172.google.com ([209.85.217.172]:34155 "EHLO mail-lb0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754452AbbLINeA (ORCPT ); Wed, 9 Dec 2015 08:34:00 -0500 Received: by lbbcs9 with SMTP id cs9so29988748lbb.1 for ; Wed, 09 Dec 2015 05:33:58 -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; bh=Tqaz2SDz+yEVtgkm1OuC/QZcrg1v9eKnKjxfm9MZW0w=; b=GasjQq4Eie3+cy5hA788QFfF1ki4jCoR+axotkK9Blt3VEoBxHEE4ayKKtHTa6W/F1 TSUQSi77a8iMT7gp7LXIRbeVRDYBiyvpb+aLt1AadxUjwD5fZGHVTTJuzneShUZLY5hw uknnEp0sgeE9c8+174a+hVVx4bEy1/yqfI0PK4Jbwo3Wl6Vwe85drPldDyvPUfnZf67x rSLS3qXWBXsYf1m9LaXbCESdxF+UqnA9tQad5m0Hb1e5D82Wh5uJA5YO9SA7gGIhvSif 7QDUsaHuNAFDnPPS4TgcuBnPgIemuAFP4triQJA/8OihFBDTmvBVajnTyIQoXvM60FHm wTxg== 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=Tqaz2SDz+yEVtgkm1OuC/QZcrg1v9eKnKjxfm9MZW0w=; b=hnKRm/b2g07v+Mt2opWP2YCm03F8KyTufNTpaGPY3asSDmFpuPryWIhNuDCjeW0u/i yB4EsWDX2781HeE7LPhQnxn6SJtrSjKPHYw9RRRDvpAIUzsEQuXfJUvcxb+iiaoxsWU5 ddsdMydfKar1LwEaTqzu8qW9WBAnAioGCgPquEEVc3+OVeIW/qQgCIOXkzHT4WXhT2xF 3oXXTypQhvGz7SOcdxgzWtW1H9oEFEY9nI1BNOaDJ1e8q3gJkOnXAmy46lilEgtyDVNR Y7x7Z017jvgAnZzsh47DXHKTIxP7pvlVd73p+Fil3Ctl2ZOsVSBxKE2BZ5hgVJTx6uT4 kU6Q== X-Gm-Message-State: ALoCoQkSuvw5JqLzrC3hRUFqJRL5m0aQY+I3JVOzEyiYYf9VWLn7cIkOexW4EJLQYH3A+wSGAfLcEzCmPBRGSr43BR98AZLx5A== X-Received: by 10.112.145.72 with SMTP id ss8mr2421474lbb.54.1449668038923; Wed, 09 Dec 2015 05:33:58 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id nq2sm1421133lbb.33.2015.12.09.05.33.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:33:58 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Matthias Brugger Subject: [PATCH 118/182] pinctrl: mediatek: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:33:56 +0100 Message-Id: <1449668036-3391-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 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: Matthias Brugger Signed-off-by: Linus Walleij --- drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c index a71f68362967..57644aa0ad2a 100644 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c @@ -14,7 +14,7 @@ */ #include -#include +#include #include #include #include @@ -95,7 +95,7 @@ static void mtk_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { unsigned int reg_addr; unsigned int bit; - struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); + struct mtk_pinctrl *pctl = gpiochip_get_data(chip); reg_addr = mtk_get_port(pctl, offset) + pctl->devdata->dout_offset; bit = BIT(offset & 0xf); @@ -742,7 +742,7 @@ static int mtk_gpio_get_direction(struct gpio_chip *chip, unsigned offset) unsigned int bit; unsigned int read_val = 0; - struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); + struct mtk_pinctrl *pctl = gpiochip_get_data(chip); reg_addr = mtk_get_port(pctl, offset) + pctl->devdata->dir_offset; bit = BIT(offset & 0xf); @@ -755,7 +755,7 @@ static int mtk_gpio_get(struct gpio_chip *chip, unsigned offset) unsigned int reg_addr; unsigned int bit; unsigned int read_val = 0; - struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); + struct mtk_pinctrl *pctl = gpiochip_get_data(chip); if (mtk_gpio_get_direction(chip, offset)) reg_addr = mtk_get_port(pctl, offset) + @@ -772,7 +772,7 @@ static int mtk_gpio_get(struct gpio_chip *chip, unsigned offset) static int mtk_gpio_to_irq(struct gpio_chip *chip, unsigned offset) { const struct mtk_desc_pin *pin; - struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); + struct mtk_pinctrl *pctl = gpiochip_get_data(chip); int irq; pin = pctl->devdata->pins + offset; @@ -1351,7 +1351,7 @@ int mtk_pctrl_init(struct platform_device *pdev, pctl->chip->parent = &pdev->dev; pctl->chip->base = -1; - ret = gpiochip_add(pctl->chip); + ret = gpiochip_add_data(pctl->chip, pctl); if (ret) { ret = -EINVAL; goto pctrl_error;