From patchwork Wed Dec 9 13:14:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57968 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp660213lbb; Wed, 9 Dec 2015 05:14:36 -0800 (PST) X-Received: by 10.66.101.36 with SMTP id fd4mr7939582pab.76.1449666876677; Wed, 09 Dec 2015 05:14:36 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s26si12711651pfi.57.2015.12.09.05.14.36; Wed, 09 Dec 2015 05:14:36 -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 S1753598AbbLINOg (ORCPT + 4 others); Wed, 9 Dec 2015 08:14:36 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:36253 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753317AbbLINOf (ORCPT ); Wed, 9 Dec 2015 08:14:35 -0500 Received: by lfs39 with SMTP id 39so34102128lfs.3 for ; Wed, 09 Dec 2015 05:14:34 -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=v2jgh7CU0NcPfjOWhmOGtnJmBfp4TJNBcVp9PboFSP4=; b=LmPXRs+jx24VJ43Brmpfqp97cS7fYKGTfCVFaIUnAM/E8z+Lkn1gIHNPW9/I+rKONC YkOnwvoDzHLlu0cG3Yuf+gXLQz813gYbveiKUdDPu5VsPexILPASctlMxWsOJvoLpm/T iqlMVBF3craTHrYCLJDwWIeyRQdrEa6ciinlttY7krxGcNyBQC7FE3wolJy8/ALW36uw K9WFizIx/lbOGXn+T9w/7sgX4Vpaf+ZA1zWm521ZYTfp0/JHZIluGtRf3EsKDLcE/ivH dgV3cwRHqIy2whZf3UxqHxv/tfc05k/H3yZyCGZxHKnRfYCVCenZ+0t3te1Tncg8Eoaa oxGQ== 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=v2jgh7CU0NcPfjOWhmOGtnJmBfp4TJNBcVp9PboFSP4=; b=NmYmn7MavDiYyrS+ktsj0goUtEDgDFBt2HEDb3Y6+6QtXajj0KCe90o7vQlfhYqacs Ei+T1dhnM6ag3WgxHyuXTxX8C1kac7+/vsDzTS+awsAQFS4lQCqxTvrgPyRk6G2xvEA/ aH1OCR9pIaZZoAeIuqJoR33LKFYfjPFaosKtvfj8BfaAhW0NlUqZ0qej5KvEePou/L7G Wdm3eKKvqXHNp0Zi9GnY3SVXPiubhd56V0edXTPvBqyilkJvElixNuO2QLT84LIM/cZh Jbi/0Re4dTtRd3f96tYswv/lySCPXhSmsF0WO5uP1hfHxfG2DdUHdtj6q0YnOAXQ7dJk q0pw== X-Gm-Message-State: ALoCoQkPRYYuNm5f1DkHhhJbnuNqSD/mNAk/LRLpM/z+6QcXxtfUIAmBJXH5ucwMxOb7/ufBa/7ZWrQqnKhy04AeuxMrX9X85g== X-Received: by 10.25.159.206 with SMTP id i197mr2207934lfe.89.1449666874076; Wed, 09 Dec 2015 05:14:34 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id g80sm1437725lfg.44.2015.12.09.05.14.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:14:33 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , YD Tseng Subject: [PATCH 013/182] gpio: amdpt: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:14:30 +0100 Message-Id: <1449666870-30357-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: YD Tseng Signed-off-by: Linus Walleij --- drivers/gpio/gpio-amdpt.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 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-amdpt.c b/drivers/gpio/gpio-amdpt.c index f842ccc45e64..c2484046e8e9 100644 --- a/drivers/gpio/gpio-amdpt.c +++ b/drivers/gpio/gpio-amdpt.c @@ -31,11 +31,9 @@ struct pt_gpio_chip { spinlock_t lock; }; -#define to_pt_gpio(c) container_of(c, struct pt_gpio_chip, gc) - static int pt_gpio_request(struct gpio_chip *gc, unsigned offset) { - struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); + struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); unsigned long flags; u32 using_pins; @@ -60,7 +58,7 @@ static int pt_gpio_request(struct gpio_chip *gc, unsigned offset) static void pt_gpio_free(struct gpio_chip *gc, unsigned offset) { - struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); + struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); unsigned long flags; u32 using_pins; @@ -77,7 +75,7 @@ static void pt_gpio_free(struct gpio_chip *gc, unsigned offset) static void pt_gpio_set_value(struct gpio_chip *gc, unsigned offset, int value) { - struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); + struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); unsigned long flags; u32 data; @@ -97,7 +95,7 @@ static void pt_gpio_set_value(struct gpio_chip *gc, unsigned offset, int value) static int pt_gpio_get_value(struct gpio_chip *gc, unsigned offset) { - struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); + struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); unsigned long flags; u32 data; @@ -124,7 +122,7 @@ static int pt_gpio_get_value(struct gpio_chip *gc, unsigned offset) static int pt_gpio_direction_input(struct gpio_chip *gc, unsigned offset) { - struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); + struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); unsigned long flags; u32 data; @@ -144,7 +142,7 @@ static int pt_gpio_direction_input(struct gpio_chip *gc, unsigned offset) static int pt_gpio_direction_output(struct gpio_chip *gc, unsigned offset, int value) { - struct pt_gpio_chip *pt_gpio = to_pt_gpio(gc); + struct pt_gpio_chip *pt_gpio = gpiochip_get_data(gc); unsigned long flags; u32 data; @@ -214,7 +212,7 @@ static int pt_gpio_probe(struct platform_device *pdev) #if defined(CONFIG_OF_GPIO) pt_gpio->gc.of_node = pdev->dev.of_node; #endif - ret = gpiochip_add(&pt_gpio->gc); + ret = gpiochip_add_data(&pt_gpio->gc, pt_gpio); if (ret) { dev_err(&pdev->dev, "Failed to register GPIO lib\n"); return ret;