From patchwork Wed Dec 9 13:13:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57962 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp659658lbb; Wed, 9 Dec 2015 05:13:42 -0800 (PST) X-Received: by 10.66.164.234 with SMTP id yt10mr7738438pab.11.1449666822617; Wed, 09 Dec 2015 05:13:42 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bc9si12670093pad.140.2015.12.09.05.13.42; Wed, 09 Dec 2015 05:13:42 -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 S1752952AbbLINNm (ORCPT + 4 others); Wed, 9 Dec 2015 08:13:42 -0500 Received: from mail-lf0-f45.google.com ([209.85.215.45]:34001 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752672AbbLINNl (ORCPT ); Wed, 9 Dec 2015 08:13:41 -0500 Received: by lffu14 with SMTP id u14so33948405lff.1 for ; Wed, 09 Dec 2015 05:13:40 -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=skkG7x0BEeog4gdTq2v/o9HxyCgC5R5MRirK1E+5l2k=; b=Ytjlj5bu9l2g4iUIz04TfVB5aE3KbTk4s54mtosAQ1crfIC2TMjJThGXXDu8ZljXSU Q4YRD0lXfj7bSabuxLu/sO3UI8U6aBEom4nS4KoMcjdpg5d5xgsCdNIf8D7A+bXv9hQp /zQFf+3kDgTMdbeEtde7Q9N53xy1P8257EFkq1eTaYgTlyprWMzuuD1FklHAVjdjHmf3 rLP860/7BL4chvpfAMtFHH1peJOuvf8a+iYQPO6bC0I1D08GLtYTWLIt27IKxYMcbBrG yXNQr/u5U66gZMgcYyYesVukAeLaqPy8xiGpqdCZdfLz8Hy9sOU+6TRaejddA0H3/Ec5 GUww== 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=skkG7x0BEeog4gdTq2v/o9HxyCgC5R5MRirK1E+5l2k=; b=LIZP/qHujyXqt7QHN/j0P7oVNoU0lpdpqvHv3p2CoBkC0a6Hx3ErKl+TzgMXthDlTU McqXV7tm7saiqtxEwlb7Hk1doplfYfo4+CqyREbhV/N9RskNEY81UDlcbnigR3H86Oa8 6/9pRtwkSA0X3JhunhQ8PiS5MeTkrn4o+mL16rKihBZH5kSbzQXMQPgJfpGrkgIwKJTD 3/V5f0XGf5OQuwgpq9JX62z1itpMQ7e+2Qj0Ei9IMY9nIOLpuNDgtg1hz8lBRlebd4wm GXBmpebzXuW9HEqGou61+wAy++sETfRba1MS340pk80WTrTPAyzjXhn3/9tEuU4s8bi0 Oojg== X-Gm-Message-State: ALoCoQl5BTCEdcjRBT9Zy3MdYZo9QQph6lBrBjuXK8Rwwp3ngXvfuTRv9PKfPIZKSs1pHvgFiGR0SG49BV+5r/kbdvTV8NyUTg== X-Received: by 10.25.149.139 with SMTP id x133mr1765000lfd.57.1449666820034; Wed, 09 Dec 2015 05:13:40 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l5sm1401692lbc.36.2015.12.09.05.13.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:13:39 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Alexander Shiyan Subject: [PATCH 007/182] gpio: 74x164: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:13:33 +0100 Message-Id: <1449666813-30065-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: Alexander Shiyan Signed-off-by: Linus Walleij --- drivers/gpio/gpio-74x164.c | 11 +++-------- 1 file changed, 3 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/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index fb555300008f..34c20e802da9 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c @@ -26,11 +26,6 @@ struct gen_74x164_chip { u32 registers; }; -static struct gen_74x164_chip *gpio_to_74x164_chip(struct gpio_chip *gc) -{ - return container_of(gc, struct gen_74x164_chip, gpio_chip); -} - static int __gen_74x164_write_config(struct gen_74x164_chip *chip) { struct spi_device *spi = to_spi_device(chip->gpio_chip.parent); @@ -68,7 +63,7 @@ static int __gen_74x164_write_config(struct gen_74x164_chip *chip) static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset) { - struct gen_74x164_chip *chip = gpio_to_74x164_chip(gc); + struct gen_74x164_chip *chip = gpiochip_get_data(gc); u8 bank = offset / 8; u8 pin = offset % 8; int ret; @@ -83,7 +78,7 @@ static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset) static void gen_74x164_set_value(struct gpio_chip *gc, unsigned offset, int val) { - struct gen_74x164_chip *chip = gpio_to_74x164_chip(gc); + struct gen_74x164_chip *chip = gpiochip_get_data(gc); u8 bank = offset / 8; u8 pin = offset % 8; @@ -154,7 +149,7 @@ static int gen_74x164_probe(struct spi_device *spi) goto exit_destroy; } - ret = gpiochip_add(&chip->gpio_chip); + ret = gpiochip_add_data(&chip->gpio_chip, chip); if (!ret) return 0;