From patchwork Wed Dec 9 13:15:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57975 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp660822lbb; Wed, 9 Dec 2015 05:15:33 -0800 (PST) X-Received: by 10.98.65.76 with SMTP id o73mr12834174pfa.119.1449666933745; Wed, 09 Dec 2015 05:15:33 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s26si12711651pfi.57.2015.12.09.05.15.33; Wed, 09 Dec 2015 05:15:33 -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 S1753962AbbLINPd (ORCPT + 4 others); Wed, 9 Dec 2015 08:15:33 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:33997 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751617AbbLINPc (ORCPT ); Wed, 9 Dec 2015 08:15:32 -0500 Received: by lffu14 with SMTP id u14so33985125lff.1 for ; Wed, 09 Dec 2015 05:15:31 -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=qvnNs31IA5/755dybgNflJZVm76A6VjTxrMZtxehyDA=; b=BKZOpl6p6i5dYSxgqxkPBV5/4C7luOc4MhzGqe1ubL2uWZOMLb6DOBC5U2P1ghbVDT VQz9tJGpYasWGsyv5Mv7s/VSSB2EarcUt/sSWUNNrFtc4M1NCNTpG4Ua5gXYca0c65sW kIiQAPvN4pE5/XLqzautvfSd3i0sC/tWmJx9DQ/8xKRz4JN27wuzLHquFHQobSQwVvvo ShaCm0+3K0FBGmKn0Th9Th5lN8tcByRDrfrK+ru2coSNdZFvTL/5SetR6BT4r32Wj0qY oRWYLPquYSTgGWVRi7ZXampdWoOU7OGtBtc/MtMt9HTXM8jI/hBEAM5VAqCAdYNv0MUi AJNA== 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=qvnNs31IA5/755dybgNflJZVm76A6VjTxrMZtxehyDA=; b=XBywiBUY29VUZ6y9wNRVhl6SA74Pe1gluBoXEdv8n+b+V1c/6N97JMZPKQ2YhsnfSl /3wnk0xb0/gg+VbeW5oi8GtwjQG34SwuFh+4QTwbIeM5KmcL/WNJkxhmhFfi1kZ6G1g4 l/uYPS3y5DqG0/7E9fdP1oau8F3ow+vaAjY/XVerkCwBVhpfE79rnnrKBs3xj4MYuhI0 L2aJcWsLXVCYuwoX1jImLjbjwV/LleZISWEerYdpQipAizwJC/XAAvhxCrdNc9eY7SsW OkWVY6ghkjua0x3qxQM4vAOd1y6iyCYN+Q7NAQ9+nwwAOaa/QovfWuSmNi7o6GVmck6c Z5zQ== X-Gm-Message-State: ALoCoQn5BOvBZeZemQwIdW1DV1CkFNS0wQPiXxX9JZqddJ8nx1JSF5iuva/995kvtL+IDoNnOsAEM/PC4MXjUSW3jfnisTsKNA== X-Received: by 10.25.148.204 with SMTP id w195mr2221216lfd.108.1449666931225; Wed, 09 Dec 2015 05:15:31 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 102sm1410588lft.21.2015.12.09.05.15.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:15:30 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Ashish Jangam Subject: [PATCH 020/182] gpio: da9052: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:15:28 +0100 Message-Id: <1449666928-30690-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: Ashish Jangam Signed-off-by: Linus Walleij --- drivers/gpio/gpio-da9052.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/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c index 2e9578ec0ca1..b9fba2156216 100644 --- a/drivers/gpio/gpio-da9052.c +++ b/drivers/gpio/gpio-da9052.c @@ -51,11 +51,6 @@ struct da9052_gpio { struct gpio_chip gp; }; -static inline struct da9052_gpio *to_da9052_gpio(struct gpio_chip *chip) -{ - return container_of(chip, struct da9052_gpio, gp); -} - static unsigned char da9052_gpio_port_odd(unsigned offset) { return offset % 2; @@ -63,7 +58,7 @@ static unsigned char da9052_gpio_port_odd(unsigned offset) static int da9052_gpio_get(struct gpio_chip *gc, unsigned offset) { - struct da9052_gpio *gpio = to_da9052_gpio(gc); + struct da9052_gpio *gpio = gpiochip_get_data(gc); int da9052_port_direction = 0; int ret; @@ -105,7 +100,7 @@ static int da9052_gpio_get(struct gpio_chip *gc, unsigned offset) static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { - struct da9052_gpio *gpio = to_da9052_gpio(gc); + struct da9052_gpio *gpio = gpiochip_get_data(gc); int ret; if (da9052_gpio_port_odd(offset)) { @@ -131,7 +126,7 @@ static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) static int da9052_gpio_direction_input(struct gpio_chip *gc, unsigned offset) { - struct da9052_gpio *gpio = to_da9052_gpio(gc); + struct da9052_gpio *gpio = gpiochip_get_data(gc); unsigned char register_value; int ret; @@ -157,7 +152,7 @@ static int da9052_gpio_direction_input(struct gpio_chip *gc, unsigned offset) static int da9052_gpio_direction_output(struct gpio_chip *gc, unsigned offset, int value) { - struct da9052_gpio *gpio = to_da9052_gpio(gc); + struct da9052_gpio *gpio = gpiochip_get_data(gc); unsigned char register_value; int ret; @@ -182,7 +177,7 @@ static int da9052_gpio_direction_output(struct gpio_chip *gc, static int da9052_gpio_to_irq(struct gpio_chip *gc, u32 offset) { - struct da9052_gpio *gpio = to_da9052_gpio(gc); + struct da9052_gpio *gpio = gpiochip_get_data(gc); struct da9052 *da9052 = gpio->da9052; int irq; @@ -222,7 +217,7 @@ static int da9052_gpio_probe(struct platform_device *pdev) if (pdata && pdata->gpio_base) gpio->gp.base = pdata->gpio_base; - ret = gpiochip_add(&gpio->gp); + ret = gpiochip_add_data(&gpio->gp, gpio); if (ret < 0) { dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); return ret;