From patchwork Wed Dec 9 13:50:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58131 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp681033lbb; Wed, 9 Dec 2015 05:50:55 -0800 (PST) X-Received: by 10.98.13.25 with SMTP id v25mr13069278pfi.123.1449669055259; Wed, 09 Dec 2015 05:50:55 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si12904434pfi.77.2015.12.09.05.50.54; Wed, 09 Dec 2015 05:50:55 -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 S1753131AbbLINuy (ORCPT + 4 others); Wed, 9 Dec 2015 08:50:54 -0500 Received: from mail-lb0-f174.google.com ([209.85.217.174]:35922 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754769AbbLINux (ORCPT ); Wed, 9 Dec 2015 08:50:53 -0500 Received: by lbblt2 with SMTP id lt2so30466780lbb.3 for ; Wed, 09 Dec 2015 05:50:52 -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=0L9PNGXS195i/wkcIiwz7s/3PVIAlUqRB315qWKdy2k=; b=FdFTAeYRx7/XEknShJn/MYe+dUYAqiok0LCvJOiwg3x3bYbcWSUMDRBSX8qT3qUOwh 6o+l1PSfmyFyhC0lJ8wEtmq1vYx1d7fmLxMiHDev9tSdPOqbMgA/SCSMz/0Lrzb50RGD CAJPu6keas2OdTWGhi3UDCa6fgyyyBDvi3P191jyypEgvWIjg7laMCnCbIDCE00Sro4R uEJRKp9eWvMmRUM6T+ew6+nvqzaAz0eEqcnGstcSKzWXp2SrZ6kn+4CoGHOld7isjyjL 6ECQ3eL6Ecd8tG8RrunPqoj4UP4UcrdbUZTTboBOaptYKBvi7NZeOtnZvge5wuN8yoee xJ/g== 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=0L9PNGXS195i/wkcIiwz7s/3PVIAlUqRB315qWKdy2k=; b=QvKRvNjcfPOHJpoXZf9LWyi22yuyQ368v8MQeT4eblzReUeIyl0kxuSmfCaCuiz4rY lT1x86mxvYVguHKP8AGypIVEZBMNgOhOOlKJf9foN2/1DkUYtpw5pv9S6hk+qY1Awzd+ zcLSDrzaDjlLvVVn3li17Nb0uvZ1U2U9Lf+K8iptq9aBidnxru/BSDneAfIe71DnYbpr mvHq3dTDeKuoD131ggEUiht6e7ysuz+G8AI/ctAQK3E9P9lwKHdFTe1WiG6YjLiIDlaE iXz8LtVmZFS76xSJvf4sVpf5yaZ5dBNUIUuidtC2me2UzdAGD0SkcYdKTzmNu5V+UPr7 D7bw== X-Gm-Message-State: ALoCoQnvQf4xWuz2Ks3nQx8UibiLEWrlScYeKJqhD92Ac0RT8YEgYMk4pi+LwPZjmeef7SX3liXVvGrcsoEF9BGNYBKrw6Bkfg== X-Received: by 10.112.148.37 with SMTP id tp5mr1992894lbb.84.1449669052297; Wed, 09 Dec 2015 05:50:52 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a75sm1450897lfe.34.2015.12.09.05.50.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:50:51 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Tomi Valkeinen Cc: Linus Walleij , Florian Tobias Schandinat Subject: [PATCH 175/182] video: fbdev: via: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:50:49 +0100 Message-Id: <1449669049-7022-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: Tomi Valkeinen Cc: Florian Tobias Schandinat Signed-off-by: Linus Walleij --- Tomi: please ACK this so I can take it through the GPIO tree. --- drivers/video/fbdev/via/via-gpio.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 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/video/fbdev/via/via-gpio.c b/drivers/video/fbdev/via/via-gpio.c index 6f433b8cee12..ab3a00df9773 100644 --- a/drivers/video/fbdev/via/via-gpio.c +++ b/drivers/video/fbdev/via/via-gpio.c @@ -6,7 +6,7 @@ */ #include -#include +#include #include #include #include @@ -83,9 +83,7 @@ struct viafb_gpio_cfg { static void via_gpio_set(struct gpio_chip *chip, unsigned int nr, int value) { - struct viafb_gpio_cfg *cfg = container_of(chip, - struct viafb_gpio_cfg, - gpio_chip); + struct viafb_gpio_cfg *cfg = gpiochip_get_data(chip); u8 reg; struct viafb_gpio *gpio; unsigned long flags; @@ -115,9 +113,7 @@ static int via_gpio_dir_out(struct gpio_chip *chip, unsigned int nr, */ static int via_gpio_dir_input(struct gpio_chip *chip, unsigned int nr) { - struct viafb_gpio_cfg *cfg = container_of(chip, - struct viafb_gpio_cfg, - gpio_chip); + struct viafb_gpio_cfg *cfg = gpiochip_get_data(chip); struct viafb_gpio *gpio; unsigned long flags; @@ -131,9 +127,7 @@ static int via_gpio_dir_input(struct gpio_chip *chip, unsigned int nr) static int via_gpio_get(struct gpio_chip *chip, unsigned int nr) { - struct viafb_gpio_cfg *cfg = container_of(chip, - struct viafb_gpio_cfg, - gpio_chip); + struct viafb_gpio_cfg *cfg = gpiochip_get_data(chip); u8 reg; struct viafb_gpio *gpio; unsigned long flags; @@ -255,7 +249,8 @@ static int viafb_gpio_probe(struct platform_device *platdev) * Get registered. */ viafb_gpio_config.gpio_chip.base = -1; /* Dynamic */ - ret = gpiochip_add(&viafb_gpio_config.gpio_chip); + ret = gpiochip_add_data(&viafb_gpio_config.gpio_chip, + &viafb_gpio_config); if (ret) { printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret); viafb_gpio_config.gpio_chip.ngpio = 0;