From patchwork Wed Dec 9 13:19:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58005 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp663883lbb; Wed, 9 Dec 2015 05:20:34 -0800 (PST) X-Received: by 10.67.6.1 with SMTP id cq1mr7801383pad.78.1449667233987; Wed, 09 Dec 2015 05:20:33 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 83si12739448pfh.104.2015.12.09.05.20.33; Wed, 09 Dec 2015 05:20:33 -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 S1754185AbbLINUZ (ORCPT + 4 others); Wed, 9 Dec 2015 08:20:25 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:36058 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754172AbbLINTw (ORCPT ); Wed, 9 Dec 2015 08:19:52 -0500 Received: by lfs39 with SMTP id 39so34205962lfs.3 for ; Wed, 09 Dec 2015 05:19:51 -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=I1ewQ86r3g3QzpUG++/vZdr8iItQyBpc++Zw3y1x9oI=; b=olElX2WTAGHgI5YO1rLSypqRYx+ChqiL3uD/t64MeZAyHgKSnXdD2RvXBiGmMxNyoH s3ZBMQskzvKv3367IPirNV65EyYdXH93x33wV4IT6ZPmFw6U5UCwjUsCtPhGyvTt1XFX tCQyt8/J/rI3E2HEWWOFi0MP2uOBf+WDePC1qNCBMoKnwpOU13B1rn3cogt16rrUxiiW 7XIY5sGP/1O86+cA+Onc8/oJfqGzLiJ8uUAgEir0KmSE/HPhvBhE6hrlVsnGyDHNw/qD L3/lZtbYfKN7Mkj7QqdDKqlvl7T+7pQopVyLs76boe/D9fXKKBW333ywjII/JiLD9wj1 AGyw== 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=I1ewQ86r3g3QzpUG++/vZdr8iItQyBpc++Zw3y1x9oI=; b=kcP0bkzulfa70Z+2hNW6gHlMjyHzXIgNvBu/k0rP2DdXdm7sW88ZkLqOttEB6WkFmR +rmFKy4mMqZTpbNS4w1gMplhusbCH5QzHrr5tcCjS4dIhtTRC/wyafRSzLqLWIuunAUX SLc2I7L2WzWdxfOo8cdyp95I8IdRNDT2Zjdsw4logTi3/xytZMm76R9rP6cxV7OMYFes ToZ63J8fXKQ94KaFwZrWh+j5ZOBVNP84nAde64fjaRO4R7i7vHtVNLAaSsGDJAKqs77R fCstJNdO8OWF4uFHKVIqt82jIYOi43SjgMQtgUJN6eYRcWFICgICfnWJBRTGFJWGCjwl LsLg== X-Gm-Message-State: ALoCoQlkQAr7eeG/AivQ8AYKhBmblvZuYz511Vp/xe7cg6LLbtep8eZfct+hyYO/eWqkrCvFLQcjfsZnagXY/BJ+3qxx6X7Tpw== X-Received: by 10.25.148.204 with SMTP id w195mr2231310lfd.108.1449667191601; Wed, 09 Dec 2015 05:19:51 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t12sm1436570lbs.5.2015.12.09.05.19.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:19:50 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Thierry Reding , Daniel Krueger , Jean Delvare Subject: [PATCH 050/182] gpio: pch: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:19:48 +0100 Message-Id: <1449667188-32127-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: Thierry Reding Cc: Daniel Krueger Cc: Jean Delvare Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pch.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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-pch.c b/drivers/gpio/gpio-pch.c index e43db64e52b3..9349351afb47 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c @@ -109,7 +109,7 @@ struct pch_gpio { static void pch_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) { u32 reg_val; - struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); + struct pch_gpio *chip = gpiochip_get_data(gpio); unsigned long flags; spin_lock_irqsave(&chip->spinlock, flags); @@ -125,7 +125,7 @@ static void pch_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) static int pch_gpio_get(struct gpio_chip *gpio, unsigned nr) { - struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); + struct pch_gpio *chip = gpiochip_get_data(gpio); return ioread32(&chip->reg->pi) & (1 << nr); } @@ -133,7 +133,7 @@ static int pch_gpio_get(struct gpio_chip *gpio, unsigned nr) static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, int val) { - struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); + struct pch_gpio *chip = gpiochip_get_data(gpio); u32 pm; u32 reg_val; unsigned long flags; @@ -158,7 +158,7 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, static int pch_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) { - struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); + struct pch_gpio *chip = gpiochip_get_data(gpio); u32 pm; unsigned long flags; @@ -211,7 +211,7 @@ static void pch_gpio_restore_reg_conf(struct pch_gpio *chip) static int pch_gpio_to_irq(struct gpio_chip *gpio, unsigned offset) { - struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); + struct pch_gpio *chip = gpiochip_get_data(gpio); return chip->irq_base + offset; } @@ -394,7 +394,7 @@ static int pch_gpio_probe(struct pci_dev *pdev, pci_set_drvdata(pdev, chip); spin_lock_init(&chip->spinlock); pch_gpio_setup(chip); - ret = gpiochip_add(&chip->gpio); + ret = gpiochip_add_data(&chip->gpio, chip); if (ret) { dev_err(&pdev->dev, "PCH gpio: Failed to register GPIO\n"); goto err_gpiochip_add;