From patchwork Wed Dec 9 13:26:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58028 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp667502lbb; Wed, 9 Dec 2015 05:26:59 -0800 (PST) X-Received: by 10.98.0.137 with SMTP id 131mr12905225pfa.137.1449667619792; Wed, 09 Dec 2015 05:26:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wp3si12717417pab.160.2015.12.09.05.26.59; Wed, 09 Dec 2015 05:26:59 -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 S1754083AbbLIN07 (ORCPT + 4 others); Wed, 9 Dec 2015 08:26:59 -0500 Received: from mail-lf0-f51.google.com ([209.85.215.51]:36822 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753942AbbLIN06 (ORCPT ); Wed, 9 Dec 2015 08:26:58 -0500 Received: by lfs39 with SMTP id 39so34344137lfs.3 for ; Wed, 09 Dec 2015 05:26:57 -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=vC/TnskvNtwKmdoaY3bMsA5dkwW25w4oBebVEGBoNC4=; b=oAmYbAmaae7wWDyoPXFs1I0OAk2POcNLuvIBGGE+6MhV0YcX3HCwsb5nIL30DkgxNZ ccm37ZfKxwiwGpUEtYPB34Gja2Q77t6baszTJScG9I8xKLdsmnPbOc99Ry87dTx4jQxU IYImn7BmIEBH0eLZk8YJC3Rf4S/6D3wiLnhZubBXUooBCbARWW67MIpXsyf4fZAbdrog zM2PrRnVsZN9YRiflui62KgrXKlCyJIKDelSEr+ZGuNUJZg87Y5n/xxYsjvPU11fgzZ8 hqaPYCKWOFxfKZZCESO0RL5V/NNWEcYqGrkqSuiGrLkgxQ5pul5f6QjuyTxCr78JrsCW ZDNg== 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=vC/TnskvNtwKmdoaY3bMsA5dkwW25w4oBebVEGBoNC4=; b=bmnIbLZkC5hBNLbQ5/2H4Uj5rqG4It1tuZde/w22T+VNhXApvC3K1JqDkZnIAgLALB NZ97nzNzDou0afAhL5z+vdbL3ttya6Spm1VRImbg7nqqnnCivN4HwRJ3seMEdmcWTIjP oVFefYD7DwHB7+tFDY8qLFZgbf5afrKaxY6/l2lWchveor9Jzd++GpSKNItMCEsLK+J9 yVhpvkvj7vIBXbOa7WP7syAOdSBeMhQT+tYLUQcLD6LQiLqyBkEyGpn1f43/Yr3xUe2F 5b825FTWNNd/CsYDnFfl5I5C4sBf7TLNi0waoIr6XWViu8Dg/9u2QdyP1vX93pIw4Czx najA== X-Gm-Message-State: ALoCoQlAyDaGapynO1k6bIeYhmSz3Xqrnyf2bmlfswSrmFDFje2tfOU1z0uOVTdUDewON8qm/oJfjPOeOlxkz22KyeFtEuGOEw== X-Received: by 10.25.205.146 with SMTP id d140mr2240487lfg.17.1449667617069; Wed, 09 Dec 2015 05:26:57 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t82sm1438307lfe.14.2015.12.09.05.26.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:26:56 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Roger Quadros , Tony Lindgren Subject: [PATCH 072/182] gpio: twl4030: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:26:53 +0100 Message-Id: <1449667613-812-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: Roger Quadros Cc: Tony Lindgren Signed-off-by: Linus Walleij --- drivers/gpio/gpio-twl4030.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 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-twl4030.c b/drivers/gpio/gpio-twl4030.c index 14f40bf64e34..26d7f852b76a 100644 --- a/drivers/gpio/gpio-twl4030.c +++ b/drivers/gpio/gpio-twl4030.c @@ -76,11 +76,6 @@ struct gpio_twl4030_priv { /*----------------------------------------------------------------------*/ -static inline struct gpio_twl4030_priv *to_gpio_twl4030(struct gpio_chip *chip) -{ - return container_of(chip, struct gpio_twl4030_priv, gpio_chip); -} - /* * To configure TWL4030 GPIO module registers */ @@ -205,7 +200,7 @@ static int twl4030_get_gpio_datain(int gpio) static int twl_request(struct gpio_chip *chip, unsigned offset) { - struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip); + struct gpio_twl4030_priv *priv = gpiochip_get_data(chip); int status = 0; mutex_lock(&priv->mutex); @@ -273,7 +268,7 @@ done: static void twl_free(struct gpio_chip *chip, unsigned offset) { - struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip); + struct gpio_twl4030_priv *priv = gpiochip_get_data(chip); mutex_lock(&priv->mutex); if (offset >= TWL4030_GPIO_MAX) { @@ -293,7 +288,7 @@ out: static int twl_direction_in(struct gpio_chip *chip, unsigned offset) { - struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip); + struct gpio_twl4030_priv *priv = gpiochip_get_data(chip); int ret; mutex_lock(&priv->mutex); @@ -312,7 +307,7 @@ static int twl_direction_in(struct gpio_chip *chip, unsigned offset) static int twl_get(struct gpio_chip *chip, unsigned offset) { - struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip); + struct gpio_twl4030_priv *priv = gpiochip_get_data(chip); int ret; int status = 0; @@ -335,7 +330,7 @@ out: static void twl_set(struct gpio_chip *chip, unsigned offset, int value) { - struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip); + struct gpio_twl4030_priv *priv = gpiochip_get_data(chip); mutex_lock(&priv->mutex); if (offset < TWL4030_GPIO_MAX) @@ -353,7 +348,7 @@ static void twl_set(struct gpio_chip *chip, unsigned offset, int value) static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value) { - struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip); + struct gpio_twl4030_priv *priv = gpiochip_get_data(chip); int ret = 0; mutex_lock(&priv->mutex); @@ -379,7 +374,7 @@ static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value) static int twl_to_irq(struct gpio_chip *chip, unsigned offset) { - struct gpio_twl4030_priv *priv = to_gpio_twl4030(chip); + struct gpio_twl4030_priv *priv = gpiochip_get_data(chip); return (priv->irq_base && (offset < TWL4030_GPIO_MAX)) ? (priv->irq_base + offset) @@ -544,7 +539,7 @@ no_irqs: if (pdata->use_leds) priv->gpio_chip.ngpio += 2; - ret = gpiochip_add(&priv->gpio_chip); + ret = gpiochip_add_data(&priv->gpio_chip, priv); if (ret < 0) { dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret); priv->gpio_chip.ngpio = 0;