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: 58001 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp663092lbb; Wed, 9 Dec 2015 05:19:16 -0800 (PST) X-Received: by 10.98.72.152 with SMTP id q24mr12862524pfi.156.1449667156194; Wed, 09 Dec 2015 05:19:16 -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.19.15; Wed, 09 Dec 2015 05:19:16 -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 S1754104AbbLINTP (ORCPT + 4 others); 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 --- drivers/gpio/gpio-omap.c | 20 ++++++++++---------- 1 file changed, 10 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-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;