From patchwork Wed Dec 9 13:19:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58000 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp663029lbb; Wed, 9 Dec 2015 05:19:09 -0800 (PST) X-Received: by 10.66.164.234 with SMTP id yt10mr7781450pab.11.1449667149455; Wed, 09 Dec 2015 05:19:09 -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.19.09; Wed, 09 Dec 2015 05:19:09 -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 S1754087AbbLINTI (ORCPT + 4 others); Wed, 9 Dec 2015 08:19:08 -0500 Received: from mail-lb0-f181.google.com ([209.85.217.181]:33034 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbbLINTI (ORCPT ); Wed, 9 Dec 2015 08:19:08 -0500 Received: by lbbkw15 with SMTP id kw15so29817595lbb.0 for ; Wed, 09 Dec 2015 05:19:06 -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=JgF3lBx+Jv617Knn2d2aLIy0TPopsFcmKSsXaDdd6A8=; b=mKesm6/C4X1kjqjsMEHr1ElG7RLOxKz0tl9ZcnfFF67n4Da+4uHtIhOPx1O4MlzHqg yJxmDA76Bqenk//zzgNbcbzylKhBuPfdP/fvTtlq6u41agxHmI0bsphe4gmtA18FGZqZ cEbqfJsp3qGM7/3/eeLEpOU9DdtA25Eu429Sg3PNxRKlwp/CEX3+L9OGN7rdMPKGp9Ma u1BuUChPvW1S96OINjyZ4QxRB87AIhBzna313ZL1FoVl6GePryqFl1DJUGMZBAbHCRYX nzcxGa8kxrrrZ83DNNCYedZrgArd5uUcCqxfQ3kJ+jTc0h2ZNaGHZzkBCOh0O3H0djjr uSVQ== 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=JgF3lBx+Jv617Knn2d2aLIy0TPopsFcmKSsXaDdd6A8=; b=U9dkPy9eqaH1o1rjOHYLFSX9YRJUnV5YAaMOYBzN1qfwi0P3vAIRZ52yKFWyZ/Zhfd 0if5PFMlQOY74bCsHWbnWljjJn1v6iH6KFd07pf3tT/qQTjMfoFzS5HYCY9pRkaGR9jS 4HRvfnTKrJBB8T+MH0eov345VFMcATSSGx3nA/1ScRSEgrVpOe1/FVjSFnjIqGJY6wDW Pfu7fkUOClRsVYhdoIv8sgq/0vKtjLRxIUklcFfJYxVYy34ea4yVV7I2n2rTyLMvSnUe ESCMqdYnC4OwD5SXODtcjGn527a6PhuejKpvv6y70vpGOy8daM9ksPIwK+gBAxpi04AX 0ZoQ== X-Gm-Message-State: ALoCoQmsOGZWG4lb/z7Ty8PmsXKLxTGZDa8JfiAlHqf3FxxSCPmNDFiFYDvfFupqZKX+AAOLtkBtPXXyUGMCpB4f5hp4tezzgg== X-Received: by 10.112.99.199 with SMTP id es7mr2345973lbb.25.1449667145999; Wed, 09 Dec 2015 05:19:05 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x13sm1421016lfd.7.2015.12.09.05.19.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:19:05 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , David Daney Subject: [PATCH 045/182] gpio: octeon: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:19:02 +0100 Message-Id: <1449667142-31883-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: David Daney Signed-off-by: Linus Walleij --- drivers/gpio/gpio-octeon.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 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-octeon.c b/drivers/gpio/gpio-octeon.c index afbb2417dfbc..7665ebcd0c1d 100644 --- a/drivers/gpio/gpio-octeon.c +++ b/drivers/gpio/gpio-octeon.c @@ -41,7 +41,7 @@ struct octeon_gpio { static int octeon_gpio_dir_in(struct gpio_chip *chip, unsigned offset) { - struct octeon_gpio *gpio = container_of(chip, struct octeon_gpio, chip); + struct octeon_gpio *gpio = gpiochip_get_data(chip); cvmx_write_csr(gpio->register_base + bit_cfg_reg(offset), 0); return 0; @@ -49,7 +49,7 @@ static int octeon_gpio_dir_in(struct gpio_chip *chip, unsigned offset) static void octeon_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct octeon_gpio *gpio = container_of(chip, struct octeon_gpio, chip); + struct octeon_gpio *gpio = gpiochip_get_data(chip); u64 mask = 1ull << offset; u64 reg = gpio->register_base + (value ? TX_SET : TX_CLEAR); cvmx_write_csr(reg, mask); @@ -58,7 +58,7 @@ static void octeon_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int octeon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int value) { - struct octeon_gpio *gpio = container_of(chip, struct octeon_gpio, chip); + struct octeon_gpio *gpio = gpiochip_get_data(chip); union cvmx_gpio_bit_cfgx cfgx; octeon_gpio_set(chip, offset, value); @@ -72,7 +72,7 @@ static int octeon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, static int octeon_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct octeon_gpio *gpio = container_of(chip, struct octeon_gpio, chip); + struct octeon_gpio *gpio = gpiochip_get_data(chip); u64 read_bits = cvmx_read_csr(gpio->register_base + RX_DAT); return ((1ull << offset) & read_bits) != 0; @@ -117,7 +117,7 @@ static int octeon_gpio_probe(struct platform_device *pdev) chip->get = octeon_gpio_get; chip->direction_output = octeon_gpio_dir_out; chip->set = octeon_gpio_set; - err = gpiochip_add(chip); + err = gpiochip_add_data(chip, gpio); if (err) goto out;