From patchwork Wed Dec 9 13:23:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58017 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp665496lbb; Wed, 9 Dec 2015 05:23:16 -0800 (PST) X-Received: by 10.98.1.75 with SMTP id 72mr12982070pfb.14.1449667396866; Wed, 09 Dec 2015 05:23:16 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e66si12740587pfb.179.2015.12.09.05.23.16; Wed, 09 Dec 2015 05:23:16 -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 S1753592AbbLINXO (ORCPT + 4 others); Wed, 9 Dec 2015 08:23:14 -0500 Received: from mail-lf0-f48.google.com ([209.85.215.48]:33719 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753145AbbLINXM (ORCPT ); Wed, 9 Dec 2015 08:23:12 -0500 Received: by lfaz4 with SMTP id z4so34115330lfa.0 for ; Wed, 09 Dec 2015 05:23:10 -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=1C2YS0wmZuXX6+DP9RCseHkNNmiYKmxidg26vQdBPsM=; b=X9F2ZhiUHI8GKL+uBjLj/4R+Vvndh6epJ8+1IqPaHfDwrLDaSuZSoHqXnsWxWHteO1 3ADaxlZ0WOtWtoh1CZuwvNkyFmY6kKaQRDJbBI+QL6ooNkiHv9oE527XUMAInCHM6mPs ZyRwNMQirynq+S9SKsfuhS9Kjb4aPwpue3j+biKx7pLrhVd8UNVdei3G0vInLlN/jC3B XMxP5fAQq4CCc4jlezx2OMpl2rinjihzDm6EoTYldQvURpTmJLHQB9aSWcilUWqlf34j ODdP7IKWKSc7lilj/3el8R8V3t8AAf6Q9eMCHXO+na0d0yKE1QVt7GNo0itstLGbKxpS zs7w== 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=1C2YS0wmZuXX6+DP9RCseHkNNmiYKmxidg26vQdBPsM=; b=kBxNeOMOXgaXkswr87rLJ8HMZojbH+mdGdbMgHjRE7SPWO1DpAGYwa6mHPOs5VjokG DE/PXXQj6Cw1Yae7ZqSVPYrtmF3/+UQ1sAw6UurCNipK6XfVE565itVDqX4YLgHY8a8q U9G6w9UhISKrrVp9w0qz/nhmibdbX7eF0e4ikdHeZ1YPeAYAHN6IXwMeq+0ZyCVkkWO8 zOpdnrLA+zJDlnG9SnHZrJeVUV7Kloag+5lm2FPOG7s8Gt+AyoRXy3xYdTn4SdGR31cI GVSmDl6UPOI1hOCC3psGLs3rtBlKO80jsDsgM0T9UP+6eLCvBWT+1PKnnXwo3alSH/Oz e3TQ== X-Gm-Message-State: ALoCoQlf4eWYbAVVtetucJ2ncuHM65N0jogomS8RRmQmhfeCrCvzwAgBR9aWkz27qqQQ/uC+IFbgI6pSPRMii8tNmwFEFK1qYA== X-Received: by 10.25.90.195 with SMTP id o186mr2250532lfb.9.1449667390917; Wed, 09 Dec 2015 05:23:10 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l81sm1426733lfb.40.2015.12.09.05.23.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:23:09 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Martin Blumenstingl Subject: [PATCH 062/182] gpio: stp-xway: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:23:07 +0100 Message-Id: <1449667387-32720-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: Martin Blumenstingl Signed-off-by: Linus Walleij --- drivers/gpio/gpio-stp-xway.c | 8 +++----- 1 file changed, 3 insertions(+), 5 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-stp-xway.c b/drivers/gpio/gpio-stp-xway.c index c250f21b9e40..d11dd48570b2 100644 --- a/drivers/gpio/gpio-stp-xway.c +++ b/drivers/gpio/gpio-stp-xway.c @@ -100,8 +100,7 @@ struct xway_stp { */ static void xway_stp_set(struct gpio_chip *gc, unsigned gpio, int val) { - struct xway_stp *chip = - container_of(gc, struct xway_stp, gc); + struct xway_stp *chip = gpiochip_get_data(gc); if (val) chip->shadow |= BIT(gpio); @@ -135,8 +134,7 @@ static int xway_stp_dir_out(struct gpio_chip *gc, unsigned gpio, int val) */ static int xway_stp_request(struct gpio_chip *gc, unsigned gpio) { - struct xway_stp *chip = - container_of(gc, struct xway_stp, gc); + struct xway_stp *chip = gpiochip_get_data(gc); if ((gpio < 8) && (chip->reserved & BIT(gpio))) { dev_err(gc->parent, "GPIO %d is driven by hardware\n", gpio); @@ -260,7 +258,7 @@ static int xway_stp_probe(struct platform_device *pdev) ret = xway_stp_hw_init(chip); if (!ret) - ret = gpiochip_add(&chip->gc); + ret = gpiochip_add_data(&chip->gc, chip); if (!ret) dev_info(&pdev->dev, "Init done\n");