From patchwork Wed Dec 9 13:14:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57969 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp660285lbb; Wed, 9 Dec 2015 05:14:44 -0800 (PST) X-Received: by 10.98.64.136 with SMTP id f8mr12831139pfd.95.1449666884231; Wed, 09 Dec 2015 05:14:44 -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.44; Wed, 09 Dec 2015 05:14:44 -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 S1754116AbbLINOn (ORCPT + 4 others); Wed, 9 Dec 2015 08:14:43 -0500 Received: from mail-lb0-f175.google.com ([209.85.217.175]:32969 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754108AbbLINOn (ORCPT ); Wed, 9 Dec 2015 08:14:43 -0500 Received: by lbbkw15 with SMTP id kw15so29742336lbb.0 for ; Wed, 09 Dec 2015 05:14:41 -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=UK5qXpYRlI3hir25mNwTnrXei2e7Y97L7nCfioy2vsQ=; b=0VXyjqsjbcss+XpERw8NhCzJEGW9nw91mVBn7De9s2yjjOZl7tjPkC0tL+vopaIE+w g9dzvgij4YQeC/dSrICXdtl7E8UQH3KQo1HXslSTv363L2qlBV4fZAm6yOT0VpV8amuu 4uFPdLWXfHGjBe6FdwZCKKk5MfhDtuw1F7+5FOpJgN7t6tabOHN59WVekq1pXLp5YIms Kfzdz2Kxg13pZ9Et1mXiwSxkyaxEyo05hUkyxSAhvX2Jkwor80/xYP0yB0TC4QLVSaSk 4Ir07UZfLA0YkoeYLaobpCQcxfTOxI/f4fwcMQIll0Xo4xeb1A9kW9PAcgToeTB+p88L mFsg== 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=UK5qXpYRlI3hir25mNwTnrXei2e7Y97L7nCfioy2vsQ=; b=I/AwE4oYvZCqMlbfThLq21O7Nu1IAbCQBh9FruwgdiKmHlpijCnu5I41Y3MkxZlN+R TSMkTxxh1TEXTDt6gqnJyZ7EErLhtKBfteDkgyTmrAugqEvXlfigFTImeJrR3azf1oXy JguszVPgVGe7ZK/E+H0WWtKVW/rt622uoNqC5FV1qY6SZcOkpYxgP5b2Uc9kjja935mq tM0PE/4+KbolXPTf3avpO6pre9Cc5nQr0LJSdKeiaX2J4w8Z8al3yL7nhvI3qZ8LDiO8 c6/9NXlYywzW4UMmhgTdcJLmeVRDGeYahNIzoXCdkp7cRz9j147A3L9nRQrKD3C2HVj9 s0FQ== X-Gm-Message-State: ALoCoQk0bnLEHgwYQjA/5Ij3/YgQgEzBU3WQEXOLc/KC7+XMD5IpSxS0UD5Ez1zQIY7zfgE2jqcy5Yq0H5u/v5w3c/OIc1SKgQ== X-Received: by 10.112.134.66 with SMTP id pi2mr2252023lbb.83.1449666881732; Wed, 09 Dec 2015 05:14:41 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a75sm1425745lfe.34.2015.12.09.05.14.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:14:41 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Richard Fitzgerald , Mark Brown Subject: [PATCH 014/182] gpio: arizona: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:14:38 +0100 Message-Id: <1449666878-30404-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: Richard Fitzgerald Cc: Mark Brown Signed-off-by: Linus Walleij --- drivers/gpio/gpio-arizona.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 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-arizona.c b/drivers/gpio/gpio-arizona.c index 412d131b513d..c729fee1dcdf 100644 --- a/drivers/gpio/gpio-arizona.c +++ b/drivers/gpio/gpio-arizona.c @@ -28,14 +28,9 @@ struct arizona_gpio { struct gpio_chip gpio_chip; }; -static inline struct arizona_gpio *to_arizona_gpio(struct gpio_chip *chip) -{ - return container_of(chip, struct arizona_gpio, gpio_chip); -} - static int arizona_gpio_direction_in(struct gpio_chip *chip, unsigned offset) { - struct arizona_gpio *arizona_gpio = to_arizona_gpio(chip); + struct arizona_gpio *arizona_gpio = gpiochip_get_data(chip); struct arizona *arizona = arizona_gpio->arizona; return regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset, @@ -44,7 +39,7 @@ static int arizona_gpio_direction_in(struct gpio_chip *chip, unsigned offset) static int arizona_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct arizona_gpio *arizona_gpio = to_arizona_gpio(chip); + struct arizona_gpio *arizona_gpio = gpiochip_get_data(chip); struct arizona *arizona = arizona_gpio->arizona; unsigned int val; int ret; @@ -62,7 +57,7 @@ static int arizona_gpio_get(struct gpio_chip *chip, unsigned offset) static int arizona_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { - struct arizona_gpio *arizona_gpio = to_arizona_gpio(chip); + struct arizona_gpio *arizona_gpio = gpiochip_get_data(chip); struct arizona *arizona = arizona_gpio->arizona; if (value) @@ -74,7 +69,7 @@ static int arizona_gpio_direction_out(struct gpio_chip *chip, static void arizona_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct arizona_gpio *arizona_gpio = to_arizona_gpio(chip); + struct arizona_gpio *arizona_gpio = gpiochip_get_data(chip); struct arizona *arizona = arizona_gpio->arizona; if (value) @@ -133,7 +128,7 @@ static int arizona_gpio_probe(struct platform_device *pdev) else arizona_gpio->gpio_chip.base = -1; - ret = gpiochip_add(&arizona_gpio->gpio_chip); + ret = gpiochip_add_data(&arizona_gpio->gpio_chip, arizona_gpio); if (ret < 0) { dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);