From patchwork Wed Dec 9 13:21:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58006 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp664381lbb; Wed, 9 Dec 2015 05:21:23 -0800 (PST) X-Received: by 10.98.9.88 with SMTP id e85mr12707777pfd.7.1449667283431; Wed, 09 Dec 2015 05:21:23 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d21si12740700pfj.167.2015.12.09.05.21.23; Wed, 09 Dec 2015 05:21:23 -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 S1753186AbbLINVW (ORCPT + 4 others); Wed, 9 Dec 2015 08:21:22 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:34872 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752672AbbLINVV (ORCPT ); Wed, 9 Dec 2015 08:21:21 -0500 Received: by lfdl133 with SMTP id l133so33908254lfd.2 for ; Wed, 09 Dec 2015 05:21:20 -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=Sr3MhZx87wq/yRJgFLyp8U4pwQThawCiYRGkLxJMhGQ=; b=EiqjQ0mX6Cr77XQcGJ9LcKfAOP8lVAEcdTmS9W0DF90MSk1YB09tsG4wwPfQJhgtBF DLtS+/Q4lr3A9JwV9fdEw/wmN8bHXZJhX1pWpTZ9zC8Kgls6SQZOI+DYaDsaA4gQONTD DpNgguIvE9kcbXR/rRnzKV77DwusJzakQsBGX8cwDjAVqlYGpOCSJAEVVGIwqSR8ddpi aqOR7ywBPQT5S+1Vh2SBm3D4FgVXxqYVCwhZvyLCab1XhhYwV3RgvxrF0hA5VJ6ze7i5 hfTHOTA5ZC+R3WnIGBC2KKpNYZXVpTo42zZFATbn6HFM/Jovj2hfNCxnrjZVRfj8c4qP v6Ow== 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=Sr3MhZx87wq/yRJgFLyp8U4pwQThawCiYRGkLxJMhGQ=; b=UnKiZsgSHFU8VC2yuWYhPjCYQcNdUiVdII9RUq61i80gJHAW9G6u2oPJaXlhk1PGht zqtB0lij3IxeUv6as/09p6y/HZ3Wktp1gnOeFMwO1Twrd5Hvnj/EC/Qy5dz/iye6RiNj ZECTzoLDLKQcHX7ArADxxNR+F/y49MAZMBKG0SDzx2/GMlWqGX6QAxyxezHDiPIjO771 I4EaXElqFBswGo8KijDgvlM4KNNXLTzM9Ut00sMdku2oH0qk+M8tCbAXLuZBeYSwhV1V UXGSdH7HFnyw87UZ55Mi3WRsGLIpe88SNL++43Ivmm6geqKcGbFv5Rv2agrpdnl0UBtn SD1A== X-Gm-Message-State: ALoCoQmD9xRjHlFc+PQNw3L/S7MLxsoeSme399IjymIzFmHnmo4dnecMeXlV5rxYhLf0ZTs7LitmbhrWajCTI/VYV+A1l1Vqpw== X-Received: by 10.25.17.232 with SMTP id 101mr2359557lfr.38.1449667280165; Wed, 09 Dec 2015 05:21:20 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i194sm1424998lfg.20.2015.12.09.05.21.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:21:19 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Haojian Zhuang Subject: [PATCH 051/182] gpio: pl061: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:21:16 +0100 Message-Id: <1449667276-32196-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: Haojian Zhuang Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pl061.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-pl061.c b/drivers/gpio/gpio-pl061.c index e041639adc14..9a61385488eb 100644 --- a/drivers/gpio/gpio-pl061.c +++ b/drivers/gpio/gpio-pl061.c @@ -60,7 +60,7 @@ struct pl061_gpio { static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) { - struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); + struct pl061_gpio *chip = gpiochip_get_data(gc); unsigned long flags; unsigned char gpiodir; @@ -79,7 +79,7 @@ static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) static int pl061_direction_output(struct gpio_chip *gc, unsigned offset, int value) { - struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); + struct pl061_gpio *chip = gpiochip_get_data(gc); unsigned long flags; unsigned char gpiodir; @@ -104,14 +104,14 @@ static int pl061_direction_output(struct gpio_chip *gc, unsigned offset, static int pl061_get_value(struct gpio_chip *gc, unsigned offset) { - struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); + struct pl061_gpio *chip = gpiochip_get_data(gc); return !!readb(chip->base + (BIT(offset + 2))); } static void pl061_set_value(struct gpio_chip *gc, unsigned offset, int value) { - struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); + struct pl061_gpio *chip = gpiochip_get_data(gc); writeb(!!value << offset, chip->base + (BIT(offset + 2))); } @@ -119,7 +119,7 @@ static void pl061_set_value(struct gpio_chip *gc, unsigned offset, int value) static int pl061_irq_type(struct irq_data *d, unsigned trigger) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); + struct pl061_gpio *chip = gpiochip_get_data(gc); int offset = irqd_to_hwirq(d); unsigned long flags; u8 gpiois, gpioibe, gpioiev; @@ -209,7 +209,7 @@ static void pl061_irq_handler(struct irq_desc *desc) unsigned long pending; int offset; struct gpio_chip *gc = irq_desc_get_handler_data(desc); - struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); + struct pl061_gpio *chip = gpiochip_get_data(gc); struct irq_chip *irqchip = irq_desc_get_chip(desc); chained_irq_enter(irqchip, desc); @@ -227,7 +227,7 @@ static void pl061_irq_handler(struct irq_desc *desc) static void pl061_irq_mask(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); + struct pl061_gpio *chip = gpiochip_get_data(gc); u8 mask = BIT(irqd_to_hwirq(d) % PL061_GPIO_NR); u8 gpioie; @@ -240,7 +240,7 @@ static void pl061_irq_mask(struct irq_data *d) static void pl061_irq_unmask(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); + struct pl061_gpio *chip = gpiochip_get_data(gc); u8 mask = BIT(irqd_to_hwirq(d) % PL061_GPIO_NR); u8 gpioie; @@ -261,7 +261,7 @@ static void pl061_irq_unmask(struct irq_data *d) static void pl061_irq_ack(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); + struct pl061_gpio *chip = gpiochip_get_data(gc); u8 mask = BIT(irqd_to_hwirq(d) % PL061_GPIO_NR); spin_lock(&chip->lock); @@ -319,7 +319,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) chip->gc.parent = dev; chip->gc.owner = THIS_MODULE; - ret = gpiochip_add(&chip->gc); + ret = gpiochip_add_data(&chip->gc, chip); if (ret) return ret;