From patchwork Wed Dec 9 13:40:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58096 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp675145lbb; Wed, 9 Dec 2015 05:40:08 -0800 (PST) X-Received: by 10.98.15.91 with SMTP id x88mr13059341pfi.144.1449668408438; Wed, 09 Dec 2015 05:40:08 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hm2si12792065pac.186.2015.12.09.05.40.08; Wed, 09 Dec 2015 05:40:08 -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 S1754378AbbLINkH (ORCPT + 4 others); Wed, 9 Dec 2015 08:40:07 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:33998 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753AbbLINkG (ORCPT ); Wed, 9 Dec 2015 08:40:06 -0500 Received: by lffu14 with SMTP id u14so34464822lff.1 for ; Wed, 09 Dec 2015 05:40:05 -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=DapTIGfKV12u1PbvFg8CPKZWivl+01aV+88DpkulEc8=; b=CJfxPbyUEhaa0BGMfoEyrqZGFa/IM3OWMGAPY+z+SO4NqX8rgYoH5KFeYveH2n3YXE uGh4GxPZi2JyalROIQ0xh4tD7Lr9VC9MAkXZojD4dmVYacte5VZIhE6AB+kh50OUobsC 8jAq+LVEo4nEfoZVwXxdabxG3XwRxLN94/AcwrhSFZic03sXVn5CmzJnR4x7RIOtTwfh 5OfzqfuI1qAnD5xUoRCfSGH/W/XA2QZv6Mkrq1T16SkVhwxz8hz1ShM4AyiaHQaG3wTF kMlkTxUBy1SLKZKkR2DF0yIj0cOFM3hMNUbIuFB8P3gr69i2Sef7yI6rgOTddV4VckDx 3q1A== 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=DapTIGfKV12u1PbvFg8CPKZWivl+01aV+88DpkulEc8=; b=LxsrAKBRei+re/LPSjCv1R9ztMG7mZnLw0+yS0fNoGKXTpPQn1ixcCoBUGCH4kJFmK doO6GwfuUqLif8DTfLNkgYzQuyFC0uJhOtgGOskiMUuQb99MrdQoAjyTUezwKr0LfeiH 041+5Km0NRNcXVAh/1CnE2+EWnmeHadmDZTWG/fUBn6wzRqZIDdXlUA9RUxNLsc+uRs2 iFz1d78/tLs8OcDsGWIOv4Ga+HzD8YlqYLU8jafD5EapImWy8B5YOSOA93wVD7CoG9Wp 7HDOV20Wq/C/z8eWsWw2tSc4ktewPyJrXcesWk7GQOab+3sX2ATccFKyPn7K4U+i28WC wcOQ== X-Gm-Message-State: ALoCoQlo1o/hoVG9bG7wYFCNTCzDu4NX7Lo1lHh/Iajwo1S1R4UgE/CKAghZXEkWnD2vggS1mceCki75WmxbVmQkVSMeFOUZgg== X-Received: by 10.25.15.22 with SMTP id e22mr2262752lfi.92.1449668404946; Wed, 09 Dec 2015 05:40:04 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id d130sm1458709lfe.18.2015.12.09.05.40.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:40:04 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Ralf Baechle Cc: Linus Walleij , linux-mips@linux-mips.org Subject: [PATCH 140/182] MIPS: rb532: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:40:01 +0100 Message-Id: <1449668401-4687-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: Ralf Baechle Cc: linux-mips@linux-mips.org Signed-off-by: Linus Walleij --- Ralf: please ACK this so I can take it through the GPIO tree. BTW: would be nice if the MIPS GPIO drivers could move down to drivers/gpio in the long run. This should compile with just #include , I hope that works. --- arch/mips/rb532/gpio.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/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c index 650d5d39f34d..97a5e2c3797b 100644 --- a/arch/mips/rb532/gpio.c +++ b/arch/mips/rb532/gpio.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include @@ -88,7 +88,7 @@ static int rb532_gpio_get(struct gpio_chip *chip, unsigned offset) { struct rb532_gpio_chip *gpch; - gpch = container_of(chip, struct rb532_gpio_chip, chip); + gpch = gpiochip_get_data(chip); return rb532_get_bit(offset, gpch->regbase + GPIOD); } @@ -100,7 +100,7 @@ static void rb532_gpio_set(struct gpio_chip *chip, { struct rb532_gpio_chip *gpch; - gpch = container_of(chip, struct rb532_gpio_chip, chip); + gpch = gpiochip_get_data(chip); rb532_set_bit(value, offset, gpch->regbase + GPIOD); } @@ -111,7 +111,7 @@ static int rb532_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { struct rb532_gpio_chip *gpch; - gpch = container_of(chip, struct rb532_gpio_chip, chip); + gpch = gpiochip_get_data(chip); /* disable alternate function in case it's set */ rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC); @@ -128,7 +128,7 @@ static int rb532_gpio_direction_output(struct gpio_chip *chip, { struct rb532_gpio_chip *gpch; - gpch = container_of(chip, struct rb532_gpio_chip, chip); + gpch = gpiochip_get_data(chip); /* disable alternate function in case it's set */ rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC); @@ -200,7 +200,7 @@ int __init rb532_gpio_init(void) } /* Register our GPIO chip */ - gpiochip_add(&rb532_gpio_chip->chip); + gpiochip_add_data(&rb532_gpio_chip->chip, rb532_gpio_chip); return 0; }