From patchwork Wed Dec 9 13:24:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58025 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp666035lbb; Wed, 9 Dec 2015 05:24:15 -0800 (PST) X-Received: by 10.66.154.161 with SMTP id vp1mr7808159pab.25.1449667455531; Wed, 09 Dec 2015 05:24:15 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fc7si12732909pab.144.2015.12.09.05.24.15; Wed, 09 Dec 2015 05:24:15 -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 S1753925AbbLINYO (ORCPT + 4 others); Wed, 9 Dec 2015 08:24:14 -0500 Received: from mail-lb0-f170.google.com ([209.85.217.170]:35708 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753902AbbLINYO (ORCPT ); Wed, 9 Dec 2015 08:24:14 -0500 Received: by lbpu9 with SMTP id u9so29692943lbp.2 for ; Wed, 09 Dec 2015 05:24:13 -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=2iUFlAdmsYq/d3a8MmHXG6Isgkuif5nA1qiV94I0gm0=; b=xMYDFxB9c1vOsDF9Dp16N2hD+qKW48IHmRrcLYnCpSjtz4EkiySBfASz2OUHLwolm3 oKbHiBfO2EqVG9dOkJiWTbOdyfinuVJG1cnheIpcH8QouiSByQJZqVTo6HJ3MS1M5e9e bWr6YWUCSgp6sl0MbBkb65uhQCWC43Z1bFNH+M2Ymro7BGTCkzP2140Vj/qUQL7lWg/E jOqz49/pYuKD/0LF3qUBiTl37PwLD/lD1pYLCzWtrBb4Wbu/wkHMO6cq8BSjXzWuD2jB EPaROlNvL90jZ7ZrL00kfNVwbVYzFo/oheUdX5u8QJxgGi7q2+EyX/6Q2bkgL4+/KQ8A 4PgA== 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=2iUFlAdmsYq/d3a8MmHXG6Isgkuif5nA1qiV94I0gm0=; b=CIgHPST7UIorFiVfk1AT3dCaoWUKV57S7l3TFLnGOtq95gwFnm0QG0crDrcqJz2KnI X/Al4g1sHj1kh/PdXn/9byEhzc6LnojiwFeEYofFfra/D7pEvPfi6IzOJq2mZJVuQwJc 68g2DxlWGc9rDMZOJkR/rIXXhxxPZ0uhxUXlc3uqe0kn8MzyLT2MNeZJNM9WdSyuLioq qaEPgV0RA3FyDQNLMWZJjLt5zpP878uhAMTvKf4IqyasoNBwbuZ9Znh82B79kOys6sC8 ybLtWoLWuZv84dnmalmPHD89Djv2m1XBxAJnpDPwINvDiMPC+5y734deidzMM+TLCCY1 +9TQ== X-Gm-Message-State: ALoCoQlGA4S89PUBPgOTd5UHwvcoSZL0u64qcry+zTfPVcp624jvNHr5fjJvKIo8TYferxGjjKcpnnDHGmCYKB8fgvM5V0+Btw== X-Received: by 10.112.198.131 with SMTP id jc3mr1944854lbc.129.1449667452969; Wed, 09 Dec 2015 05:24:12 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id s63sm1421466lfd.31.2015.12.09.05.24.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:24:12 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Nicolas Saenz Julienne , Margarita Olaya Subject: [PATCH 070/182] gpio: tps65912: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:24:09 +0100 Message-Id: <1449667449-678-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: Nicolas Saenz Julienne Cc: Margarita Olaya Signed-off-by: Linus Walleij --- drivers/gpio/gpio-tps65912.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 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/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c index 0f073ffa74cf..4f2029c7da3a 100644 --- a/drivers/gpio/gpio-tps65912.c +++ b/drivers/gpio/gpio-tps65912.c @@ -26,11 +26,9 @@ struct tps65912_gpio_data { struct gpio_chip gpio_chip; }; -#define to_tgd(gc) container_of(gc, struct tps65912_gpio_data, gpio_chip) - static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) { - struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); + struct tps65912_gpio_data *tps65912_gpio = gpiochip_get_data(gc); struct tps65912 *tps65912 = tps65912_gpio->tps65912; int val; @@ -45,7 +43,7 @@ static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { - struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); + struct tps65912_gpio_data *tps65912_gpio = gpiochip_get_data(gc); struct tps65912 *tps65912 = tps65912_gpio->tps65912; if (value) @@ -59,7 +57,7 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, int value) { - struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); + struct tps65912_gpio_data *tps65912_gpio = gpiochip_get_data(gc); struct tps65912 *tps65912 = tps65912_gpio->tps65912; /* Set the initial value */ @@ -71,7 +69,7 @@ static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset) { - struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); + struct tps65912_gpio_data *tps65912_gpio = gpiochip_get_data(gc); struct tps65912 *tps65912 = tps65912_gpio->tps65912; return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, @@ -108,7 +106,7 @@ static int tps65912_gpio_probe(struct platform_device *pdev) if (pdata && pdata->gpio_base) tps65912_gpio->gpio_chip.base = pdata->gpio_base; - ret = gpiochip_add(&tps65912_gpio->gpio_chip); + ret = gpiochip_add_data(&tps65912_gpio->gpio_chip, tps65912_gpio); if (ret < 0) { dev_err(&pdev->dev, "Failed to register gpiochip, %d\n", ret); return ret;