From patchwork Wed Dec 9 13:13:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57960 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp659452lbb; Wed, 9 Dec 2015 05:13:22 -0800 (PST) X-Received: by 10.98.11.153 with SMTP id 25mr12895954pfl.102.1449666802715; Wed, 09 Dec 2015 05:13:22 -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.22; Wed, 09 Dec 2015 05:13:22 -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 S1752937AbbLINNW (ORCPT + 4 others); Wed, 9 Dec 2015 08:13:22 -0500 Received: from mail-lf0-f45.google.com ([209.85.215.45]:36628 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753362AbbLINNV (ORCPT ); Wed, 9 Dec 2015 08:13:21 -0500 Received: by lfs39 with SMTP id 39so34078561lfs.3 for ; Wed, 09 Dec 2015 05:13:19 -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=FOC1oJvHxVRmpBvyKMZHfsURHZTyGQTUOy3/WiNq3oY=; b=kbZMrgQta8a4Tee/CdAvv1N24DtSixq9ptjblBP0Bwu9HvSYE+XuVrC+hSX/1N+Y0o c9ntCzVDRleh/+ZMP7P1awRjLzWUn+D1h7bEnpZ3wcSipRlXHLKWcMJcUNX7cQt8E6Nb Uru3uMwcIZXLpRMgry4dEPAdigDd0cdIMdrXu0e4jp5W5yxmh8XMkEwwAVP20PSpmvK+ oiB2GNnG/vyWUyXlUFAF1SKa6LOnAJ1PXGew1/+KzSms0E9wj63aM6SUMKYQPA3nhSAB AeB2dOeByHT6NtVqP2KH7ngSVNQgBsRnjOudttepibmlRWIseACpiD+/PbHxBi9mun47 +cDw== 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=FOC1oJvHxVRmpBvyKMZHfsURHZTyGQTUOy3/WiNq3oY=; b=mkkNUDJLkAiLh67CmQBhADHxnE63Bk9/5x9es63v6AC+hLuNwxrRY4g1w0+VWh+NYC PTdbyaeqs/5HZXoq8dP9629qp2XJE/xZj9JVi+ZfIK87eGGtGoxODj6SdaBzxJGAeHpF 2RcPnhNGeFCPdhBlZJX4H404zKgJGk7J0g++CnSNA9g+RK8KWUEJc1tc9eWpefUGL12+ GQSsdyThftRn+ArGswB780PgUlGNfxzqSaeZBnhhIsJiEx0oIi1lJ0HNU589IpqXkgYx j/uL8wTSOtKDeYF62omn8K3pJdViiZPJkHCyOHTb7TIWXn6O2TVTkgCtubJg1U8Q7HCW D2Bg== X-Gm-Message-State: ALoCoQnq0WVMAB9d/dFRpver7EdHj7j/sRIBMLSjex/RE+HL5wfDneJKEIOmsHExOdJh/1Ms47dN8X2uBT+sfCDKWZuH2JGNKA== X-Received: by 10.25.165.202 with SMTP id o193mr2152839lfe.83.1449666799900; Wed, 09 Dec 2015 05:13:19 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id d196sm1429942lfd.38.2015.12.09.05.13.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:13:19 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , William Breathitt Gray Subject: [PATCH 005/182] gpio: 104-idi-48: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:13:15 +0100 Message-Id: <1449666795-29971-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: William Breathitt Gray Signed-off-by: Linus Walleij --- drivers/gpio/gpio-104-idi-48.c | 15 +++++---------- 1 file changed, 5 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-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c index b5c693409a58..779db930da8b 100644 --- a/drivers/gpio/gpio-104-idi-48.c +++ b/drivers/gpio/gpio-104-idi-48.c @@ -62,14 +62,9 @@ static int idi_48_gpio_direction_input(struct gpio_chip *chip, unsigned offset) return 0; } -static struct idi_48_gpio *to_idi48gpio(struct gpio_chip *gc) -{ - return container_of(gc, struct idi_48_gpio, chip); -} - static int idi_48_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct idi_48_gpio *const idi48gpio = to_idi48gpio(chip); + struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip); unsigned i; const unsigned register_offset[6] = { 0, 1, 2, 4, 5, 6 }; unsigned base_offset; @@ -90,7 +85,7 @@ static int idi_48_gpio_get(struct gpio_chip *chip, unsigned offset) static void idi_48_irq_ack(struct irq_data *data) { struct gpio_chip *chip = irq_data_get_irq_chip_data(data); - struct idi_48_gpio *const idi48gpio = to_idi48gpio(chip); + struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip); unsigned long flags; spin_lock_irqsave(&idi48gpio->lock, flags); @@ -103,7 +98,7 @@ static void idi_48_irq_ack(struct irq_data *data) static void idi_48_irq_mask(struct irq_data *data) { struct gpio_chip *chip = irq_data_get_irq_chip_data(data); - struct idi_48_gpio *const idi48gpio = to_idi48gpio(chip); + struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip); const unsigned offset = irqd_to_hwirq(data); unsigned i; unsigned mask; @@ -134,7 +129,7 @@ static void idi_48_irq_mask(struct irq_data *data) static void idi_48_irq_unmask(struct irq_data *data) { struct gpio_chip *chip = irq_data_get_irq_chip_data(data); - struct idi_48_gpio *const idi48gpio = to_idi48gpio(chip); + struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip); const unsigned offset = irqd_to_hwirq(data); unsigned i; unsigned mask; @@ -256,7 +251,7 @@ static int __init idi_48_probe(struct platform_device *pdev) dev_set_drvdata(dev, idi48gpio); - err = gpiochip_add(&idi48gpio->chip); + err = gpiochip_add_data(&idi48gpio->chip, idi48gpio); if (err) { dev_err(dev, "GPIO registering failed (%d)\n", err); goto err_gpio_register;