From patchwork Wed Dec 9 13:16:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 554497 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A98B2140311 for ; Thu, 10 Dec 2015 00:16:43 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro-org.20150623.gappssmtp.com header.i=@linaro-org.20150623.gappssmtp.com header.b=o2FWEop3; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753362AbbLINQn (ORCPT ); Wed, 9 Dec 2015 08:16:43 -0500 Received: from mail-lf0-f53.google.com ([209.85.215.53]:36383 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753145AbbLINQm (ORCPT ); Wed, 9 Dec 2015 08:16:42 -0500 Received: by lfs39 with SMTP id 39so34142994lfs.3 for ; Wed, 09 Dec 2015 05:16:41 -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=BF0O9/ew3lmxtf65tihXvc1ZrDBOzEwZ2cqh8yduJEc=; b=o2FWEop326f3qNaMs7WToYYixszEBoSHwGNM4IKiA/B/cdxoK71EDvT9xFh0bXlCga usCej4ydxLxni2+yh7VPrIB4jyEEMk6W2iAuD0cReLlybWLoMh7CmVeXjS8BY5qd1ENs Se3LxRPGqkkIyVpmKvNas2X+rrHoI0WTma5UWHEaTa3kOi2K8ZqWM4AN8KOQOY4Xj3Mb 70CEKYODUhlMfp8fi+hUw9jSKiXPvzgv00FcZCDgPhKp+n6vbwJhpd8zyHv4Is9wCw1g e7KT5zmGmS8E93R0cQodLGoqcpuHQIY6vXU5bgOjHAHckywrRGtoJ3uxqMzH9DgR/d+i Njqg== 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=BF0O9/ew3lmxtf65tihXvc1ZrDBOzEwZ2cqh8yduJEc=; b=gmwiAWb1loRdFTYZ4prLCWyhzbDWmXzDgTmK3tM17u0fjBKL+LFb5dDILgvBr0oPrn 9qcZCehcb8R2UrWcfqdB6A0SPRajicUrHbD9jrvAaVqa7GFx4Hf7tNc14a0cVxSy9dyQ hANmFZoeB5JhFk32AdyLKFYQEJA5ktD4PMKkzlXbMHh3mSjEZWsN0ZU2eNVgv92YAP1m 400ozh7Ekx2zynfvcyAox0wwWnBikYjOwF0b1hFmoTO8lPrSa9Y49lOJGlqjPomt379b 0wj3sS2fVS3aqJXAMKRSdzQ4XA+sEDL3C8CIn6uHqz8Nh4IivCZtHZopP7Q+eJtLNBXR eaVg== X-Gm-Message-State: ALoCoQlirOdAf9SWgha/kJrQhzkfM/e/wTVB63CsSJdC4dAxYKWwICvNLop/Bp41X9zWdDWDU/SnxjqQGGYDeDMDk9HUnXtJmg== X-Received: by 10.25.64.5 with SMTP id n5mr1925641lfa.18.1449667001540; Wed, 09 Dec 2015 05:16:41 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j123sm1432121lfb.19.2015.12.09.05.16.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:16:40 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Brunner Michael , Guenter Roeck Subject: [PATCH 028/182] gpio: kempld: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:16:37 +0100 Message-Id: <1449666997-31075-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: Brunner Michael Cc: Guenter Roeck Signed-off-by: Linus Walleij --- drivers/gpio/gpio-kempld.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-kempld.c b/drivers/gpio/gpio-kempld.c index 35dd1e0af364..90a3c4e3e4aa 100644 --- a/drivers/gpio/gpio-kempld.c +++ b/drivers/gpio/gpio-kempld.c @@ -65,8 +65,7 @@ static int kempld_gpio_get_bit(struct kempld_device_data *pld, u8 reg, u8 bit) static int kempld_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct kempld_gpio_data *gpio - = container_of(chip, struct kempld_gpio_data, chip); + struct kempld_gpio_data *gpio = gpiochip_get_data(chip); struct kempld_device_data *pld = gpio->pld; return kempld_gpio_get_bit(pld, KEMPLD_GPIO_LVL_NUM(offset), offset); @@ -74,8 +73,7 @@ static int kempld_gpio_get(struct gpio_chip *chip, unsigned offset) static void kempld_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct kempld_gpio_data *gpio - = container_of(chip, struct kempld_gpio_data, chip); + struct kempld_gpio_data *gpio = gpiochip_get_data(chip); struct kempld_device_data *pld = gpio->pld; kempld_get_mutex(pld); @@ -85,8 +83,7 @@ static void kempld_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int kempld_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { - struct kempld_gpio_data *gpio - = container_of(chip, struct kempld_gpio_data, chip); + struct kempld_gpio_data *gpio = gpiochip_get_data(chip); struct kempld_device_data *pld = gpio->pld; kempld_get_mutex(pld); @@ -99,8 +96,7 @@ static int kempld_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int kempld_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) { - struct kempld_gpio_data *gpio - = container_of(chip, struct kempld_gpio_data, chip); + struct kempld_gpio_data *gpio = gpiochip_get_data(chip); struct kempld_device_data *pld = gpio->pld; kempld_get_mutex(pld); @@ -113,8 +109,7 @@ static int kempld_gpio_direction_output(struct gpio_chip *chip, unsigned offset, static int kempld_gpio_get_direction(struct gpio_chip *chip, unsigned offset) { - struct kempld_gpio_data *gpio - = container_of(chip, struct kempld_gpio_data, chip); + struct kempld_gpio_data *gpio = gpiochip_get_data(chip); struct kempld_device_data *pld = gpio->pld; return !kempld_gpio_get_bit(pld, KEMPLD_GPIO_DIR_NUM(offset), offset); @@ -183,7 +178,7 @@ static int kempld_gpio_probe(struct platform_device *pdev) return -ENODEV; } - ret = gpiochip_add(chip); + ret = gpiochip_add_data(chip, gpio); if (ret) { dev_err(dev, "Could not register GPIO chip\n"); return ret;