From patchwork Wed Dec 9 13:50:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58128 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp680657lbb; Wed, 9 Dec 2015 05:50:12 -0800 (PST) X-Received: by 10.98.71.138 with SMTP id p10mr13147903pfi.61.1449669012726; Wed, 09 Dec 2015 05:50:12 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id af1si12828618pad.198.2015.12.09.05.50.12; Wed, 09 Dec 2015 05:50:12 -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 S1753902AbbLINuM (ORCPT + 4 others); Wed, 9 Dec 2015 08:50:12 -0500 Received: from mail-lf0-f44.google.com ([209.85.215.44]:33107 "EHLO mail-lf0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753131AbbLINuL (ORCPT ); Wed, 9 Dec 2015 08:50:11 -0500 Received: by lfaz4 with SMTP id z4so34645969lfa.0 for ; Wed, 09 Dec 2015 05:50:09 -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=/mV9mBz7DeDVNqsLvyTo9fcG7u4vOXGWhVQjKfiQT3A=; b=MmVLE4XSKbIeDkr97e2I5/gYsaO+PUS0OK5412h15Q+eJjoYa7SoN7X9Iqgzi9aM++ mmtO4EdHhssvyHDEtk4EfMuNPINV916CSauuws8ED+temTm8qczsPxsw+vmU7f8qPTsT ZICGLEGkzSzX2ib1DtknFfShku5d/0bQZjJdUr00y55dtldivYgLG01VuyA5cw8GH1da E32g1lTI/hHKx8L7QZ2/c02RltTq+PqH3xUW4+PC6sHXCvlyz2OZ+pWV6pkhfTrvUsXM YpqG7lcBh7Utvf28zMMNihlH3LrQZWo3sc0sB0vEYZd8ad+drhpBNrzE4YOi2JVIUviO S+XA== 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=/mV9mBz7DeDVNqsLvyTo9fcG7u4vOXGWhVQjKfiQT3A=; b=Yy9/5dvIYPSM3FTLWM4xLJY/FYF6RVyY61rJWbtYX1S5WJGkiCtSy4Tvzr+PWrboBz EZPMMm/SHdT5kSsHbJWUiI7E/D+4DhRiBrf+DL+J6RcaNgSFBJmA1Vc1V9qa5ZzqunoN glqfqE8emHQfXp0UZ3+4TMl2BvoNGs9kBsxCsjHHljwGYP7juIOzujRcbGKqie124fkh 9eR9fyHjQUrWDZNH7TD88uXGgado6JsvQqNubv8EO/YOjrAroGWi2bnqzRrJ0w67kQ0B dLsndyhechqkE3aBXfS2jeyJq3fAYBi0o2cz/iTPIoPcndbTarIOgxHFuTdnbxUsZPKB Xfiw== X-Gm-Message-State: ALoCoQlYhuS5g/B8lzr5AJ167Va6KFrWbqwlKs9aAEaxGIww5J5EGD0TsJW0oSE8o+tVMwDjFzkyusG8RiVZLcxBfZcE1et/lg== X-Received: by 10.25.18.93 with SMTP id h90mr2263242lfi.7.1449669009812; Wed, 09 Dec 2015 05:50:09 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id tv8sm1435206lbb.27.2015.12.09.05.50.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:50:09 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Greg Kroah-Hartman Cc: Linus Walleij , Martyn Welch , Manohar Vanga , devel@driverdev.osuosl.org Subject: [PATCH 172/182] staging: vme: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:50:05 +0100 Message-Id: <1449669005-6835-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: Greg Kroah-Hartman Cc: Martyn Welch Cc: Manohar Vanga Cc: devel@driverdev.osuosl.org Signed-off-by: Linus Walleij --- Greg, please ACK this so I can take this through the GPIO tree. --- drivers/staging/vme/devices/vme_pio2_gpio.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 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/staging/vme/devices/vme_pio2_gpio.c b/drivers/staging/vme/devices/vme_pio2_gpio.c index 77901b345a71..a2b740ab7ffe 100644 --- a/drivers/staging/vme/devices/vme_pio2_gpio.c +++ b/drivers/staging/vme/devices/vme_pio2_gpio.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include @@ -25,16 +25,11 @@ static const char driver_name[] = "pio2_gpio"; -static struct pio2_card *gpio_to_pio2_card(struct gpio_chip *chip) -{ - return container_of(chip, struct pio2_card, gc); -} - static int pio2_gpio_get(struct gpio_chip *chip, unsigned int offset) { u8 reg; int retval; - struct pio2_card *card = gpio_to_pio2_card(chip); + struct pio2_card *card = gpiochip_get_data(chip); if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == OUTPUT) | (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { @@ -72,7 +67,7 @@ static void pio2_gpio_set(struct gpio_chip *chip, unsigned int offset, { u8 reg; int retval; - struct pio2_card *card = gpio_to_pio2_card(chip); + struct pio2_card *card = gpiochip_get_data(chip); if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == INPUT) | (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { @@ -102,7 +97,7 @@ static void pio2_gpio_set(struct gpio_chip *chip, unsigned int offset, static int pio2_gpio_dir_in(struct gpio_chip *chip, unsigned offset) { int data; - struct pio2_card *card = gpio_to_pio2_card(chip); + struct pio2_card *card = gpiochip_get_data(chip); if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == OUTPUT) | (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { @@ -121,7 +116,7 @@ static int pio2_gpio_dir_in(struct gpio_chip *chip, unsigned offset) static int pio2_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int value) { int data; - struct pio2_card *card = gpio_to_pio2_card(chip); + struct pio2_card *card = gpiochip_get_data(chip); if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == INPUT) | (card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) { @@ -207,7 +202,7 @@ int pio2_gpio_init(struct pio2_card *card) card->gc.set = pio2_gpio_set; /* This function adds a memory mapped GPIO chip */ - retval = gpiochip_add(&(card->gc)); + retval = gpiochip_add_data(&(card->gc), card); if (retval) { dev_err(&card->vdev->dev, "Unable to register GPIO\n"); kfree(card->gc.label);