From patchwork Wed Dec 9 13:18:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57994 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp662544lbb; Wed, 9 Dec 2015 05:18:20 -0800 (PST) X-Received: by 10.66.155.197 with SMTP id vy5mr7781810pab.109.1449667100673; Wed, 09 Dec 2015 05:18:20 -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.18.18; Wed, 09 Dec 2015 05:18:20 -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 S1753998AbbLINSS (ORCPT + 4 others); Wed, 9 Dec 2015 08:18:18 -0500 Received: from mail-lf0-f53.google.com ([209.85.215.53]:36223 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751531AbbLINSR (ORCPT ); Wed, 9 Dec 2015 08:18:17 -0500 Received: by lfs39 with SMTP id 39so34174633lfs.3 for ; Wed, 09 Dec 2015 05:18:16 -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=/GH8+HUG6/ODw36nnnXjJ5G7cET8yKp0oa15ROjJ5jc=; b=xWuB/tTVgJtuc/k7KIt5S1rdgrDBXS4yMcQn2L3hjNYkFZZG3tMtjvD5eU7CPvwUDu NXvJCKpayCC4sEqVoil0h03vBP+gmKcc9gWHb8FpYzLAg7Mdol7EsxnnHdwSdEMBYG5F GEQ/omvvGfLQYmloB254dcQjy6c1KOr46XuPXdHjQO2c2nNoPAEi6enPkpWsr04Pd2hY n1JMdZToJZFfqvdXFOYKAgl6SFDW71V/wBwF0TL3EcB8UzsbfheFvVsnmJ3iJjD8oNcx Wh7eaDHicW9MMYpK6TpJRO+DAr5dIFD8AF6MtAydK7Lc36ZOSYVn7R3QCIP99qdrO8yd dChA== 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=/GH8+HUG6/ODw36nnnXjJ5G7cET8yKp0oa15ROjJ5jc=; b=GTbIhz/LaErd2w0O1udVv7aR0H0x8qi67phG9p1FVVGVpSQ14MMVL9RSiIuQdnKxNR rXfHPI1RxWC42qiVdQW6n3j+EEisvDLgA8bAIRity2DXh7ZmDCLznOXYR9us7QFHRcr0 oCSa4fWX43I6tf/8HcTuH1NhmihN90dOFrL9p37xKyAS7JcMQX6VvM38t6gFd5k8j9wc 9s1cjYrN6uOUzPxzaJNtMH75XIEZMHcqFJkDN3NQWJ8I7120tC0A+Px0k5E7o3q+Pqjy 0nD8HOrKpN7t4XA/HDmAxV0XtjYg6/d60CC8gz2DJPgfrm+fXRYP6dNEQoQF+G2YsC+R 13lg== X-Gm-Message-State: ALoCoQlHY0vL8gFCak/J4lwe2O8rB1mdz+7MZNWHgZ2PsjY7aRotHX3B6U6wvcmdV+/FkKGtDHd1ujGU1gJGpZewNSzVFqMs9Q== X-Received: by 10.25.145.76 with SMTP id t73mr1809099lfd.121.1449667096250; Wed, 09 Dec 2015 05:18:16 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id mt2sm1408254lbc.9.2015.12.09.05.18.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:18:15 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Feng Tang , Tomoya MORINAGA Subject: [PATCH 039/182] gpio: ml-ioh: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:18:11 +0100 Message-Id: <1449667091-31599-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: Feng Tang Cc: Tomoya MORINAGA Signed-off-by: Linus Walleij --- drivers/gpio/gpio-ml-ioh.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c index 5536108aa9db..91aa40c2287f 100644 --- a/drivers/gpio/gpio-ml-ioh.c +++ b/drivers/gpio/gpio-ml-ioh.c @@ -106,7 +106,7 @@ static const int num_ports[] = {6, 12, 16, 16, 15, 16, 16, 12}; static void ioh_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) { u32 reg_val; - struct ioh_gpio *chip = container_of(gpio, struct ioh_gpio, gpio); + struct ioh_gpio *chip = gpiochip_get_data(gpio); unsigned long flags; spin_lock_irqsave(&chip->spinlock, flags); @@ -122,7 +122,7 @@ static void ioh_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) static int ioh_gpio_get(struct gpio_chip *gpio, unsigned nr) { - struct ioh_gpio *chip = container_of(gpio, struct ioh_gpio, gpio); + struct ioh_gpio *chip = gpiochip_get_data(gpio); return ioread32(&chip->reg->regs[chip->ch].pi) & (1 << nr); } @@ -130,7 +130,7 @@ static int ioh_gpio_get(struct gpio_chip *gpio, unsigned nr) static int ioh_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, int val) { - struct ioh_gpio *chip = container_of(gpio, struct ioh_gpio, gpio); + struct ioh_gpio *chip = gpiochip_get_data(gpio); u32 pm; u32 reg_val; unsigned long flags; @@ -155,7 +155,7 @@ static int ioh_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, static int ioh_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) { - struct ioh_gpio *chip = container_of(gpio, struct ioh_gpio, gpio); + struct ioh_gpio *chip = gpiochip_get_data(gpio); u32 pm; unsigned long flags; @@ -225,7 +225,7 @@ static void ioh_gpio_restore_reg_conf(struct ioh_gpio *chip) static int ioh_gpio_to_irq(struct gpio_chip *gpio, unsigned offset) { - struct ioh_gpio *chip = container_of(gpio, struct ioh_gpio, gpio); + struct ioh_gpio *chip = gpiochip_get_data(gpio); return chip->irq_base + offset; } @@ -450,7 +450,7 @@ static int ioh_gpio_probe(struct pci_dev *pdev, chip->ch = i; spin_lock_init(&chip->spinlock); ioh_gpio_setup(chip, num_ports[i]); - ret = gpiochip_add(&chip->gpio); + ret = gpiochip_add_data(&chip->gpio, chip); if (ret) { dev_err(&pdev->dev, "IOH gpio: Failed to register GPIO\n"); goto err_gpiochip_add;