From patchwork Wed Dec 9 13:39:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58094 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp674893lbb; Wed, 9 Dec 2015 05:39:43 -0800 (PST) X-Received: by 10.98.72.18 with SMTP id v18mr12953573pfa.68.1449668383139; Wed, 09 Dec 2015 05:39:43 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wp13si12766750pac.180.2015.12.09.05.39.42; Wed, 09 Dec 2015 05:39:43 -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 S1752952AbbLINjm (ORCPT + 4 others); Wed, 9 Dec 2015 08:39:42 -0500 Received: from mail-lf0-f53.google.com ([209.85.215.53]:35528 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752002AbbLINjm (ORCPT ); Wed, 9 Dec 2015 08:39:42 -0500 Received: by lfdl133 with SMTP id l133so34261949lfd.2 for ; Wed, 09 Dec 2015 05:39:40 -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=HfL5T8Hbnyj2DI50W10FAhciZjvO4f2+euThIwtKe/c=; b=VG6SRoEOHN1QOPMNAXCrV1pXBNkjCCeZKtQNbMDyGFboAJngWtPXvlPSwtJEaHmQlO 30WRW//yXCOjDAJTYsXCeOpNPPu++bNzcyTl8OOc8BYqTiRyO6S0iKWjxblOyPl2Csvi yRPHl68oDaTatUREofBjKahtEIw1GZ1JaIqf3TNWraWlkJoyvtMQ+XKBDHjLXylconGp VbjHTIHDXCWnsqkBrDrfSfNp4KH/NQSDmBWP0uL/87/8kt7C7jUzP8BGiy7DXwhahiPE B45j/IYbwAlKMw5rHnAVCs2GCGiw61SWt6HSWj7KLI1P1UDRQ6tIadSArYF1Gbt29gjS WSnw== 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=HfL5T8Hbnyj2DI50W10FAhciZjvO4f2+euThIwtKe/c=; b=cpnD7WRIOMTfYyywbd7jiuexpxZ0wEgEcEGTScBQrj9L6Y2dMK/jyENmwTgwT7VwNH 3jH18Xn9TwTpICnmOo0+rIFcl723AIAKh7YeRs9iegUHy6Hi8X1MwPM8khXkly52Qiig +NB0sonBMFFhTdjz8boZQ/DxhjxdNZoOo62/adT6mtIpw1VZFX29A9Go/ro4q3vHMAE5 Xa0SZTIO7qbeTDQM6O/sf5aqePTfoUrfFRm5TrR0o48BlptblO+LPXqal3JtCFBxus6m HPt7EDMuD14fel3eLjKHby5FiQp21SEXhx6fVIqwvG3rtKV5aolprqlAIdOj9BzAGdVW BvkQ== X-Gm-Message-State: ALoCoQncNzcLBthaHWaH6IDBTq49qkI5RzS0R4cO0C7TKX4hfXBbwyBKCfkTTHBLL5Mj3KFBKAGgOUZudNQEGXbS005TcCXGlA== X-Received: by 10.25.209.77 with SMTP id i74mr2225336lfg.143.1449668380644; Wed, 09 Dec 2015 05:39:40 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a2sm1432268lbp.37.2015.12.09.05.39.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:39:40 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Ralf Baechle Cc: Linus Walleij , linux-mips@linux-mips.org Subject: [PATCH 138/182] MIPS: jz4740: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:39:32 +0100 Message-Id: <1449668372-4587-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: Ralf Baechle Cc: linux-mips@linux-mips.org Signed-off-by: Linus Walleij --- Ralf: please ACK this so I can take it through the GPIO tree. BTW: would be nice if the MIPS GPIO drivers could move down to drivers/gpio in the long run. --- arch/mips/jz4740/gpio.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c index 8c6d76c9b2d6..c2607e8ec758 100644 --- a/arch/mips/jz4740/gpio.c +++ b/arch/mips/jz4740/gpio.c @@ -18,6 +18,8 @@ #include #include +#include +/* FIXME: needed for gpio_request(), try to remove consumer API from driver */ #include #include #include @@ -91,9 +93,9 @@ static inline struct jz_gpio_chip *gpio_to_jz_gpio_chip(unsigned int gpio) return &jz4740_gpio_chips[gpio >> 5]; } -static inline struct jz_gpio_chip *gpio_chip_to_jz_gpio_chip(struct gpio_chip *gpio_chip) +static inline struct jz_gpio_chip *gpio_chip_to_jz_gpio_chip(struct gpio_chip *gc) { - return container_of(gpio_chip, struct jz_gpio_chip, gpio_chip); + return gpiochip_get_data(gc); } static inline struct jz_gpio_chip *irq_to_jz_gpio_chip(struct irq_data *data) @@ -234,7 +236,7 @@ static int jz_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) static int jz_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) { - struct jz_gpio_chip *jz_gpio = gpio_chip_to_jz_gpio_chip(chip); + struct jz_gpio_chip *jz_gpio = gpiochip_get_data(chip); return jz_gpio->irq_base + gpio; } @@ -449,7 +451,7 @@ static void jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id) irq_setup_generic_chip(gc, IRQ_MSK(chip->gpio_chip.ngpio), IRQ_GC_INIT_NESTED_LOCK, 0, IRQ_NOPROBE | IRQ_LEVEL); - gpiochip_add(&chip->gpio_chip); + gpiochip_add_data(&chip->gpio_chip, chip); } static int __init jz4740_gpio_init(void)