From patchwork Wed Dec 9 13:16:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57980 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp661310lbb; Wed, 9 Dec 2015 05:16:19 -0800 (PST) X-Received: by 10.66.192.193 with SMTP id hi1mr7793411pac.110.1449666979308; Wed, 09 Dec 2015 05:16:19 -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.16.19; Wed, 09 Dec 2015 05:16:19 -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 S1753186AbbLINQS (ORCPT + 4 others); Wed, 9 Dec 2015 08:16:18 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:33106 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753156AbbLINQS (ORCPT ); Wed, 9 Dec 2015 08:16:18 -0500 Received: by lfaz4 with SMTP id z4so33981454lfa.0 for ; Wed, 09 Dec 2015 05:16:16 -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=wj/YSlN7wxKFcM9KWYgcCKaE7hCO2tHeLopsez3RovE=; b=vu87/ZAquOtKEZ0A5uiVKMQrJ9t5GWj51HOrMWzzZGKnq6Y3Gqi+vihS4Tcge8o8sO LYr3XY6ZtzDB7M+PhTirK/LRLPPnxQsYzxKdMPi5h/Nm4wtCvsgVhUuYuosz4fYT6zpB rmc11R4bbNHsD5pELTTvCzjFwL7BXDmH5TvIl1IHfKrjPGBN1JbvfJfG785VdROsrxho o8bT8kJ8ug1MrtfV7OI4igippOLnsGrTVFMAQAEpPAox52C4TZQ9ni9GqkU6xxbwd+02 8y52HvUKjBwX+y5KR7dk3skEUknEw9uyDelynd7kFwfVjiCvZV2wZnRgbiPxsyu7zvva 1DPw== 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=wj/YSlN7wxKFcM9KWYgcCKaE7hCO2tHeLopsez3RovE=; b=fXAftvoC5pwD9HvIQ043dmdDrJu/YA1L5oQZHYMwJFax12st/G/Dkya6PH/dZBibr/ d5Cnt0gTNuK57hWuPs4zaTXE6LFgibUOtZIUmUtMePdFPMH7Y8nds2WXMnxq6UTnh8SY 38ntZYwTBNCSWGHhNv4a5Y0WcJjq3i7mq2L3lJG1ESbbA/QkhV9vqq+INVR/Hn9k63ab 8rsteMZSAzyNwKndqiBY/22c7VVCLMhUcpf05JyOdWnGjkjP7/U7tgbXc6ExTz4ECu9l gYuPW+0fXOq0L7JPtAUc3PE0W6c0ZoNGIsRDmMalJxYcBRu+T8qq28wd4tPqumwgE/ow 0t3w== X-Gm-Message-State: ALoCoQlwxxESo//5i5gQQoBxabwc9GXtkVbwZIAnlS9zUqH7sVt/+YMeVsz9v6YBx7uhlMWHm2h3vsUYIhv83Nej/EFFWUTmpg== X-Received: by 10.25.207.14 with SMTP id f14mr1835821lfg.29.1449666976894; Wed, 09 Dec 2015 05:16:16 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id of8sm1405257lbb.7.2015.12.09.05.16.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:16:13 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Andreas Bofjall , Simon Guinot Subject: [PATCH 025/182] gpio: f7188: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:16:10 +0100 Message-Id: <1449666970-30929-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: Andreas Bofjall Cc: Simon Guinot Signed-off-by: Linus Walleij --- drivers/gpio/gpio-f7188x.c | 14 +++++--------- 1 file changed, 5 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-f7188x.c b/drivers/gpio/gpio-f7188x.c index 2be7337cf4ae..d62fd6bbaf82 100644 --- a/drivers/gpio/gpio-f7188x.c +++ b/drivers/gpio/gpio-f7188x.c @@ -193,8 +193,7 @@ static struct f7188x_gpio_bank f71889_gpio_bank[] = { static int f7188x_gpio_direction_in(struct gpio_chip *chip, unsigned offset) { int err; - struct f7188x_gpio_bank *bank = - container_of(chip, struct f7188x_gpio_bank, chip); + struct f7188x_gpio_bank *bank = gpiochip_get_data(chip); struct f7188x_sio *sio = bank->data->sio; u8 dir; @@ -215,8 +214,7 @@ static int f7188x_gpio_direction_in(struct gpio_chip *chip, unsigned offset) static int f7188x_gpio_get(struct gpio_chip *chip, unsigned offset) { int err; - struct f7188x_gpio_bank *bank = - container_of(chip, struct f7188x_gpio_bank, chip); + struct f7188x_gpio_bank *bank = gpiochip_get_data(chip); struct f7188x_sio *sio = bank->data->sio; u8 dir, data; @@ -241,8 +239,7 @@ static int f7188x_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { int err; - struct f7188x_gpio_bank *bank = - container_of(chip, struct f7188x_gpio_bank, chip); + struct f7188x_gpio_bank *bank = gpiochip_get_data(chip); struct f7188x_sio *sio = bank->data->sio; u8 dir, data_out; @@ -270,8 +267,7 @@ static int f7188x_gpio_direction_out(struct gpio_chip *chip, static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { int err; - struct f7188x_gpio_bank *bank = - container_of(chip, struct f7188x_gpio_bank, chip); + struct f7188x_gpio_bank *bank = gpiochip_get_data(chip); struct f7188x_sio *sio = bank->data->sio; u8 data_out; @@ -336,7 +332,7 @@ static int f7188x_gpio_probe(struct platform_device *pdev) bank->chip.parent = &pdev->dev; bank->data = data; - err = gpiochip_add(&bank->chip); + err = gpiochip_add_data(&bank->chip, bank); if (err) { dev_err(&pdev->dev, "Failed to register gpiochip %d: %d\n",