From patchwork Wed Dec 9 13:18:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57999 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp662931lbb; Wed, 9 Dec 2015 05:18:58 -0800 (PST) X-Received: by 10.98.16.71 with SMTP id y68mr13029543pfi.108.1449667138214; Wed, 09 Dec 2015 05:18:58 -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.18.57; Wed, 09 Dec 2015 05:18:58 -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 S1754086AbbLINS5 (ORCPT + 4 others); Wed, 9 Dec 2015 08:18:57 -0500 Received: from mail-lb0-f171.google.com ([209.85.217.171]:35269 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbbLINS5 (ORCPT ); Wed, 9 Dec 2015 08:18:57 -0500 Received: by lbpu9 with SMTP id u9so29602944lbp.2 for ; Wed, 09 Dec 2015 05:18:55 -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=AItCv560ol8UYuPnZ4+BdU0McwY9jPZxsL6goPxbZqI=; b=IZiyoAPGMA9KLXk/7K3WbI5sj199Zp17XN/XCF4aZuC/DioaTbVNQ0jSXYbg9iYCjO rjaGRJDOIazQzzYc56TFO6ZSg7aSw/UlJDnd7q2bn04laNt1Xsn+EPMyU/9Z/xvDlc3Z WLZZQYfCJXxnbwgTA9OdmhMaQiyDlqJkYEJ684nOTkguTQre2GnQbzeb6f1uVTMWpU1p 9lyIZM4kI/BG2cJS3mcYqZCBiKw224E6R7trwMAWtKM5v8MYd6jOWeHFoHcd0Eys+1Bw 5N9hJcfTBvuTRo18SJOQ+BltNrKL8f9cfMyAp6TmmcYoOOjNDmdEmmwpT8C892Aac7/S jhuw== 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=AItCv560ol8UYuPnZ4+BdU0McwY9jPZxsL6goPxbZqI=; b=DROFawfej97JUHWmfhZr6WUIb0OMz3StqU3FIVx18IIRF43n67u8+1k3hHu+ZjTRjW CRce5+IixiKLLlNcE7BQBceVWPTU8MBMccoAQ6D8Dbc3TSyJh9bdjyDqrB1s388PE2bA QLB7UNi7uzuLmtQ/ofsxigIcIgLloGhHUKhe095UKo2VIo2Y6xEk7KtzN8spBvlutwar htMDX/kCmnqJAY2qpz9I3NiI0hL7En9C3dXqECYGgaecosBftjPZD7VgY3EY5Gv1X470 YFT0cjFz++8ErCp9LZ7ohYUbE2Qeen78VehFC+VnZOUmPe4QBfZwIhz0dMBm2F1CamWY ovMw== X-Gm-Message-State: ALoCoQlV7RXUYlR1OeSTbKhLXJFuqtJpzmbLWm+Jpxv3drQ4LTGky//dRdGIvlo1jKku1z6lZbgDJ0laffvdri44TfzR9sXkFA== X-Received: by 10.112.126.106 with SMTP id mx10mr2380663lbb.3.1449667135506; Wed, 09 Dec 2015 05:18:55 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 70sm1446609lfw.2.2015.12.09.05.18.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:18:54 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Gregory CLEMENT , Thomas Petazzoni Subject: [PATCH 044/182] gpio: mvebu: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:18:52 +0100 Message-Id: <1449667132-31834-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: Gregory CLEMENT Cc: Thomas Petazzoni Signed-off-by: Linus Walleij --- drivers/gpio/gpio-mvebu.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 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-mvebu.c b/drivers/gpio/gpio-mvebu.c index 6acedf4e9b1c..a5eacc1dff09 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -187,8 +187,7 @@ static void __iomem *mvebu_gpioreg_level_mask(struct mvebu_gpio_chip *mvchip) static void mvebu_gpio_set(struct gpio_chip *chip, unsigned pin, int value) { - struct mvebu_gpio_chip *mvchip = - container_of(chip, struct mvebu_gpio_chip, chip); + struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip); unsigned long flags; u32 u; @@ -204,8 +203,7 @@ static void mvebu_gpio_set(struct gpio_chip *chip, unsigned pin, int value) static int mvebu_gpio_get(struct gpio_chip *chip, unsigned pin) { - struct mvebu_gpio_chip *mvchip = - container_of(chip, struct mvebu_gpio_chip, chip); + struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip); u32 u; if (readl_relaxed(mvebu_gpioreg_io_conf(mvchip)) & (1 << pin)) { @@ -220,8 +218,7 @@ static int mvebu_gpio_get(struct gpio_chip *chip, unsigned pin) static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value) { - struct mvebu_gpio_chip *mvchip = - container_of(chip, struct mvebu_gpio_chip, chip); + struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip); unsigned long flags; u32 u; @@ -237,8 +234,7 @@ static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value) static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned pin) { - struct mvebu_gpio_chip *mvchip = - container_of(chip, struct mvebu_gpio_chip, chip); + struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip); unsigned long flags; int ret; u32 u; @@ -261,8 +257,7 @@ static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned pin) static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin, int value) { - struct mvebu_gpio_chip *mvchip = - container_of(chip, struct mvebu_gpio_chip, chip); + struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip); unsigned long flags; int ret; u32 u; @@ -287,8 +282,7 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin, static int mvebu_gpio_to_irq(struct gpio_chip *chip, unsigned pin) { - struct mvebu_gpio_chip *mvchip = - container_of(chip, struct mvebu_gpio_chip, chip); + struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip); return irq_create_mapping(mvchip->domain, pin); } @@ -494,8 +488,7 @@ static void mvebu_gpio_irq_handler(struct irq_desc *desc) static void mvebu_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) { - struct mvebu_gpio_chip *mvchip = - container_of(chip, struct mvebu_gpio_chip, chip); + struct mvebu_gpio_chip *mvchip = gpiochip_get_data(chip); u32 out, io_conf, blink, in_pol, data_in, cause, edg_msk, lvl_msk; int i; @@ -763,7 +756,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) BUG(); } - gpiochip_add(&mvchip->chip); + gpiochip_add_data(&mvchip->chip, mvchip); /* Some gpio controllers do not provide irq support */ if (!of_irq_count(np))