From patchwork Wed Dec 9 13:19: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: 554516 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 1AF4114030F for ; Thu, 10 Dec 2015 00:19:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro-org.20150623.gappssmtp.com header.i=@linaro-org.20150623.gappssmtp.com header.b=OGmZrYBq; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754104AbbLINTP (ORCPT ); Wed, 9 Dec 2015 08:19:15 -0500 Received: from mail-lb0-f174.google.com ([209.85.217.174]:36063 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbbLINTP (ORCPT ); Wed, 9 Dec 2015 08:19:15 -0500 Received: by lbblt2 with SMTP id lt2so29923606lbb.3 for ; Wed, 09 Dec 2015 05:19:13 -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=VI/SZL8daoYNpv7YEy2jS3GLTd7OsGim4PnRgH5RlnM=; b=OGmZrYBqI7n2rCD8FeZa+HH7QQBUUG05Zcz6aZkfNguL9fh8w1I6fbHVofo8muWRnZ VXmP1m74kI3jpqF/Kok2d2BfsIyO0p09EDazXCCGoPXdlp/5aNLFzXYUIAzwaydBSWUI MU6uB6SfXUh6xTQQf5uOxnVQPJV9+zy8lYcdKABa6CdQXjDF8sJbIPwxByMAHFggCSlw IaW5tiW0r9UBCBbvgRNziIKDXpfobitPeaCTYv7rWQwKNNZkrfJlLx5EkqL8ktFhH7Uz 8ENc2ScmoziG818zwLHIaJemHTupuvypP5bkI0wbA+3ppVfICynLfh/UhTdEGBf1o1Vd QngQ== 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=VI/SZL8daoYNpv7YEy2jS3GLTd7OsGim4PnRgH5RlnM=; b=CBS2KlhTGgnPnBR8W0w1rXNTRgarh2pp0/9Z6FMIE8Pi3P/mLJE6eoAMRuXhIB38/L huC8G85FhKEL6IBraCRyJcLWVddgqY97XOU0xUbww8xOQ5aD52K98YFTlGKMwW/MWFXN 2QqJo3pS5jx4kZ47FWRgIhFHslNPv3jXf+Ut2fpAK9LZRYj81U94kFsRJS1KgoraLMQp EZkkAiAtTAnhyqyirDPR3ui5suujY4gM5juRKKiqHyIGbu1AArbyZqicIGGtbSVdsQhk 35oesFG+T4gAxGNqPrNDGRff29Ot3Vh04f2vo2jel0BFU4iyJBnXkoSEuKmEzIEpQpeE 2orA== X-Gm-Message-State: ALoCoQn3925r1mT86mh/qu+swhBBPBRTkB0ZxpPCFaGZ9dhGTKZNre/ywOFFySFmozdH3MKY1clF8wRKRv1PoZVTfaSXEb4gOA== X-Received: by 10.112.141.42 with SMTP id rl10mr2457505lbb.24.1449667153593; Wed, 09 Dec 2015 05:19:13 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t12sm1436014lbs.5.2015.12.09.05.19.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:19:12 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Grygorii Strashko , Tony Lindgren , Santosh Shilimkar Subject: [PATCH 046/182] gpio: omap: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:19:10 +0100 Message-Id: <1449667150-31930-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: Grygorii Strashko Cc: Tony Lindgren Cc: Santosh Shilimkar Signed-off-by: Linus Walleij Acked-by: Santosh Shilimkar --- drivers/gpio/gpio-omap.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 7e4f7c5f999a..c764a135048a 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -93,7 +93,7 @@ static void omap_gpio_unmask_irq(struct irq_data *d); static inline struct gpio_bank *omap_irq_data_get_bank(struct irq_data *d) { struct gpio_chip *chip = irq_data_get_irq_chip_data(d); - return container_of(chip, struct gpio_bank, chip); + return gpiochip_get_data(chip); } static void omap_set_gpio_direction(struct gpio_bank *bank, int gpio, @@ -661,7 +661,7 @@ static int omap_gpio_wake_enable(struct irq_data *d, unsigned int enable) static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) { - struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip); + struct gpio_bank *bank = gpiochip_get_data(chip); unsigned long flags; /* @@ -681,7 +681,7 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) { - struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip); + struct gpio_bank *bank = gpiochip_get_data(chip); unsigned long flags; raw_spin_lock_irqsave(&bank->lock, flags); @@ -954,7 +954,7 @@ static int omap_gpio_get_direction(struct gpio_chip *chip, unsigned offset) void __iomem *reg; int dir; - bank = container_of(chip, struct gpio_bank, chip); + bank = gpiochip_get_data(chip); reg = bank->base + bank->regs->direction; raw_spin_lock_irqsave(&bank->lock, flags); dir = !!(readl_relaxed(reg) & BIT(offset)); @@ -967,7 +967,7 @@ static int omap_gpio_input(struct gpio_chip *chip, unsigned offset) struct gpio_bank *bank; unsigned long flags; - bank = container_of(chip, struct gpio_bank, chip); + bank = gpiochip_get_data(chip); raw_spin_lock_irqsave(&bank->lock, flags); omap_set_gpio_direction(bank, offset, 1); raw_spin_unlock_irqrestore(&bank->lock, flags); @@ -978,7 +978,7 @@ static int omap_gpio_get(struct gpio_chip *chip, unsigned offset) { struct gpio_bank *bank; - bank = container_of(chip, struct gpio_bank, chip); + bank = gpiochip_get_data(chip); if (omap_gpio_is_input(bank, offset)) return omap_get_gpio_datain(bank, offset); @@ -991,7 +991,7 @@ static int omap_gpio_output(struct gpio_chip *chip, unsigned offset, int value) struct gpio_bank *bank; unsigned long flags; - bank = container_of(chip, struct gpio_bank, chip); + bank = gpiochip_get_data(chip); raw_spin_lock_irqsave(&bank->lock, flags); bank->set_dataout(bank, offset, value); omap_set_gpio_direction(bank, offset, 0); @@ -1005,7 +1005,7 @@ static int omap_gpio_debounce(struct gpio_chip *chip, unsigned offset, struct gpio_bank *bank; unsigned long flags; - bank = container_of(chip, struct gpio_bank, chip); + bank = gpiochip_get_data(chip); raw_spin_lock_irqsave(&bank->lock, flags); omap2_set_gpio_debounce(bank, offset, debounce); @@ -1019,7 +1019,7 @@ static void omap_gpio_set(struct gpio_chip *chip, unsigned offset, int value) struct gpio_bank *bank; unsigned long flags; - bank = container_of(chip, struct gpio_bank, chip); + bank = gpiochip_get_data(chip); raw_spin_lock_irqsave(&bank->lock, flags); bank->set_dataout(bank, offset, value); raw_spin_unlock_irqrestore(&bank->lock, flags); @@ -1098,7 +1098,7 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc) } bank->chip.ngpio = bank->width; - ret = gpiochip_add(&bank->chip); + ret = gpiochip_add_data(&bank->chip, bank); if (ret) { dev_err(bank->dev, "Could not register gpio chip %d\n", ret); return ret;