From patchwork Wed Dec 9 13:34:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58079 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp672168lbb; Wed, 9 Dec 2015 05:34:46 -0800 (PST) X-Received: by 10.66.63.33 with SMTP id d1mr7952191pas.120.1449668086174; Wed, 09 Dec 2015 05:34:46 -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.45; Wed, 09 Dec 2015 05:34:46 -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 S1754224AbbLINep (ORCPT + 4 others); Wed, 9 Dec 2015 08:34:45 -0500 Received: from mail-lb0-f174.google.com ([209.85.217.174]:33300 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751869AbbLINep (ORCPT ); Wed, 9 Dec 2015 08:34:45 -0500 Received: by lbbkw15 with SMTP id kw15so30082191lbb.0 for ; Wed, 09 Dec 2015 05:34:43 -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=smwtYHPhmhBa7baZUlmSuIR2UQrYIO8rxDFxG4soH1k=; b=Y35OfpnHR7ridlJtMPLvTfyg+Hhwu7cPnPhElpFu+wnhiBLJpXGVP4Qg8OpGePmg3L QCQxZvtF6uzs22H32H8fmi9/JWtlSjEdpo4XQ/0eicH01PF2hggFAL0mAiKUvCnsT7qx 0vWgs3D+9K5JytZdvUmG9nE93Do0jqB1NZZNLAMxE04jz0H0vhNIYVs/MTIyySMswvag PS1GbPEuUDKUwBzohQQROsXGcCqivGwX8c6mgCy9sEleKpMKENa0XdGqygmMaa6MrPcM TnLrzc6OKk0Ecq0QT6whGpuKCv30twlRXr510HY7l2qy8Zs6K1B4V6m7qj7cnYb1ky6c PEfg== 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=smwtYHPhmhBa7baZUlmSuIR2UQrYIO8rxDFxG4soH1k=; b=L8HX5ZkcU/0WHeXRialYNNdWgA2jVCUd+vAkNMie4AIUCF12ldhSwjyfDJzzQ8qSIl Z/6M/v5gB35M+yZAOB+xLt4dQD1owGxn/7MOHjcGlRXSH5Q9EuVFOfnMjB4uM+sIXrhv d8WFAKjzCU8zM5Y1AC2AJolVHAUOfNlN8q+qOh9WknzSHmwunGwaJYyxYep2YQaVcFoe M0FRotY0MP+DxiEGZ63mseKwmYebciXDPs1qsZNm2numM965ah/GvrcmdDdRm7cZqWZg /T3FnHNDMOQV3xaCnmC9HbqIWIMOQyBGVZpTNbX0zOqtky8SM6wyrVbznNfNGtUjlxCX y2sQ== X-Gm-Message-State: ALoCoQmJ9ayCDdN7nr5cjtwlCg+N11uKyRgYm0iMewc0tecN7pZTZlXVUDi88zgWF9SnqeeYqqIgQaeCHBW/uff23LnbLfv3DQ== X-Received: by 10.112.162.226 with SMTP id yd2mr2379524lbb.49.1449668083778; Wed, 09 Dec 2015 05:34:43 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id s185sm1428847lfe.24.2015.12.09.05.34.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:34:43 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , arm@kernel.org, Richard Purdie Subject: [PATCH 123/182] ARM: scoop: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:34:40 +0100 Message-Id: <1449668080-3626-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: arm@kernel.org Cc: Richard Purdie Signed-off-by: Linus Walleij --- ARM SoC people: please ACK this so I can take it with the rest of the refactoring through the GPIO tree. --- arch/arm/common/scoop.c | 10 +++++----- 1 file changed, 5 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/arch/arm/common/scoop.c b/arch/arm/common/scoop.c index 45f4c21e393c..20ff61b2d179 100644 --- a/arch/arm/common/scoop.c +++ b/arch/arm/common/scoop.c @@ -69,7 +69,7 @@ static void __scoop_gpio_set(struct scoop_dev *sdev, static void scoop_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct scoop_dev *sdev = container_of(chip, struct scoop_dev, gpio); + struct scoop_dev *sdev = gpiochip_get_data(chip); unsigned long flags; spin_lock_irqsave(&sdev->scoop_lock, flags); @@ -81,7 +81,7 @@ static void scoop_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int scoop_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct scoop_dev *sdev = container_of(chip, struct scoop_dev, gpio); + struct scoop_dev *sdev = gpiochip_get_data(chip); /* XXX: I'm unsure, but it seems so */ return ioread16(sdev->base + SCOOP_GPRR) & (1 << (offset + 1)); @@ -90,7 +90,7 @@ static int scoop_gpio_get(struct gpio_chip *chip, unsigned offset) static int scoop_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { - struct scoop_dev *sdev = container_of(chip, struct scoop_dev, gpio); + struct scoop_dev *sdev = gpiochip_get_data(chip); unsigned long flags; unsigned short gpcr; @@ -108,7 +108,7 @@ static int scoop_gpio_direction_input(struct gpio_chip *chip, static int scoop_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) { - struct scoop_dev *sdev = container_of(chip, struct scoop_dev, gpio); + struct scoop_dev *sdev = gpiochip_get_data(chip); unsigned long flags; unsigned short gpcr; @@ -224,7 +224,7 @@ static int scoop_probe(struct platform_device *pdev) devptr->gpio.direction_input = scoop_gpio_direction_input; devptr->gpio.direction_output = scoop_gpio_direction_output; - ret = gpiochip_add(&devptr->gpio); + ret = gpiochip_add_data(&devptr->gpio, devptr); if (ret) goto err_gpio; }