From patchwork Wed Dec 9 13:31:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58054 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp670134lbb; Wed, 9 Dec 2015 05:31:30 -0800 (PST) X-Received: by 10.98.89.196 with SMTP id k65mr12997169pfj.12.1449667890179; Wed, 09 Dec 2015 05:31:30 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18si12793619pfj.115.2015.12.09.05.31.29; Wed, 09 Dec 2015 05:31:30 -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 S1754594AbbLINb2 (ORCPT + 4 others); Wed, 9 Dec 2015 08:31:28 -0500 Received: from mail-lb0-f174.google.com ([209.85.217.174]:36741 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754518AbbLINbZ (ORCPT ); Wed, 9 Dec 2015 08:31:25 -0500 Received: by lbblt2 with SMTP id lt2so30132095lbb.3 for ; Wed, 09 Dec 2015 05:31:24 -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=s83W4mbSe22xl+EvxAQJulZGX90kshx2IwS5dBWb3Ek=; b=xN0xSsmWQ6e6gRhn+sHZHDFdW2nQOKbP1Z2jUlDHY888PKPFuL0WO0BP1L+Ypkm0W+ HakenLcmCA6ZwUBqpvSIPQAl6U7KCFGeL7igkuZD0Dr2Odb/NriamjsSP8ytf0Nq26cY +mqMmUpFZESqLvsx1I1Tv+CUxTtjjDAfHtnkLW9g7xhzPf602nEw6UdYGgyqSDlotVtq lytxizXeTfffQ7VByqsMNACAh0EehmBnwMfrIQHSquW+Lg5103UzhDvm+hhF7Izs8IZm hRDM4zY2sbW0vWCPP1Czx9gN7ncQWQWwvI5a8UnaSVSwTLetvrOKq526pGajKeaJ3GWQ lGaA== 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=s83W4mbSe22xl+EvxAQJulZGX90kshx2IwS5dBWb3Ek=; b=TJGKciE5NKqHUPLZoILXulPizXu3ct2WBDXKmVtNIXmHkEzZU91JS5DDa9NeDKTOcC fqQf+blOPV2iyD7UwId3dc/67K2RUcH7x/o7VQUO8lhzmYz0UMjhh9m4MoBB39HH4RDi 6u3HNJa5Knzh5q2rTEboHXJASQY5XpOhIPlAn/pOCSPLgbwqndjtbhLPbS0I+9L+IclC XAf8E8kKYx680O2f1rLA9XRWUko8YdWQ2dRzVIA1vy181t3ZoPFk3WOY4HUJlZywEFw9 8qPnBp04Vh6c9hb+6iu1ROzjxxIkuMv6dj0fRMoNL0TCu73qLijgdmyYFAUu2za5PkP9 giaA== X-Gm-Message-State: ALoCoQnWHtLzhjCaRcIgEknvRlvTFCWwgHa/UyXjfG5Bh5Fdt/ae5enbmqvTchXyppzSJdO5AMlX9df+liKD8/eSnXB9stABUQ== X-Received: by 10.112.11.169 with SMTP id r9mr2508300lbb.8.1449667884331; Wed, 09 Dec 2015 05:31:24 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id tm7sm1400379lbb.38.2015.12.09.05.31.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:31:23 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Sonic Zhang Subject: [PATCH 098/182] pinctrl: adi2: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:31:21 +0100 Message-Id: <1449667881-2340-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: Sonic Zhang Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-adi2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 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/pinctrl/pinctrl-adi2.c b/drivers/pinctrl/pinctrl-adi2.c index fd342dffe4dc..9ad1a8d29bbe 100644 --- a/drivers/pinctrl/pinctrl-adi2.c +++ b/drivers/pinctrl/pinctrl-adi2.c @@ -636,7 +636,7 @@ static int adi_pinmux_set(struct pinctrl_dev *pctldev, unsigned func_id, if (range == NULL) /* should not happen */ return -ENODEV; - port = container_of(range->gc, struct gpio_port, chip); + port = gpiochip_get_data(range->gc); spin_lock_irqsave(&port->lock, flags); @@ -684,7 +684,7 @@ static int adi_pinmux_request_gpio(struct pinctrl_dev *pctldev, unsigned long flags; u8 offset; - port = container_of(range->gc, struct gpio_port, chip); + port = gpiochip_get_data(range->gc); offset = pin_to_offset(range, pin); spin_lock_irqsave(&port->lock, flags); @@ -718,7 +718,7 @@ static int adi_gpio_direction_input(struct gpio_chip *chip, unsigned offset) struct gpio_port *port; unsigned long flags; - port = container_of(chip, struct gpio_port, chip); + port = gpiochip_get_data(chip); spin_lock_irqsave(&port->lock, flags); @@ -733,7 +733,7 @@ static int adi_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static void adi_gpio_set_value(struct gpio_chip *chip, unsigned offset, int value) { - struct gpio_port *port = container_of(chip, struct gpio_port, chip); + struct gpio_port *port = gpiochip_get_data(chip); struct gpio_port_t *regs = port->regs; unsigned long flags; @@ -750,7 +750,7 @@ static void adi_gpio_set_value(struct gpio_chip *chip, unsigned offset, static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) { - struct gpio_port *port = container_of(chip, struct gpio_port, chip); + struct gpio_port *port = gpiochip_get_data(chip); struct gpio_port_t *regs = port->regs; unsigned long flags; @@ -770,7 +770,7 @@ static int adi_gpio_direction_output(struct gpio_chip *chip, unsigned offset, static int adi_gpio_get_value(struct gpio_chip *chip, unsigned offset) { - struct gpio_port *port = container_of(chip, struct gpio_port, chip); + struct gpio_port *port = gpiochip_get_data(chip); struct gpio_port_t *regs = port->regs; unsigned long flags; int ret; @@ -786,7 +786,7 @@ static int adi_gpio_get_value(struct gpio_chip *chip, unsigned offset) static int adi_gpio_to_irq(struct gpio_chip *chip, unsigned offset) { - struct gpio_port *port = container_of(chip, struct gpio_port, chip); + struct gpio_port *port = gpiochip_get_data(chip); if (port->irq_base >= 0) return irq_find_mapping(port->domain, offset); @@ -994,7 +994,7 @@ static int adi_gpio_probe(struct platform_device *pdev) port->chip.ngpio = port->width; gpio = port->chip.base + port->width; - ret = gpiochip_add(&port->chip); + ret = gpiochip_add_data(&port->chip, port); if (ret) { dev_err(&pdev->dev, "Fail to add GPIO chip.\n"); goto out_remove_domain;