From patchwork Wed Dec 9 13:48:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58124 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp679762lbb; Wed, 9 Dec 2015 05:48:32 -0800 (PST) X-Received: by 10.98.74.9 with SMTP id x9mr12961262pfa.139.1449668912539; Wed, 09 Dec 2015 05:48:32 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s90si12866349pfi.45.2015.12.09.05.48.32; Wed, 09 Dec 2015 05:48:32 -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 S1754710AbbLINsb (ORCPT + 4 others); Wed, 9 Dec 2015 08:48:31 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:35266 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753092AbbLINsa (ORCPT ); Wed, 9 Dec 2015 08:48:30 -0500 Received: by lfdl133 with SMTP id l133so34436011lfd.2 for ; Wed, 09 Dec 2015 05:48:29 -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=SyP06unzbrsQIJ6c/vZgwiDEt9NpDzleRQTMGd9LlPA=; b=TFety2BbAR7HpnSMU2EVnH8SkWQMQxwnGx1Wev3gxdaj3Sq6YH/+a89q2gyOcv4MbD KatC9JisC2CDsk2fsiRHDHrhuAGv/Pc7dvB/83gc5p0H3wO/gMPr7LZKAv23ObUpdp6R XRnr0vn8oVtuvRVwNQNr+2yIwk5jHX8E7aYx5CeytuK+Gnus0TQW+vhtPiX9UZFrpAsX 8NPH2O8VRLLMnGVNQ3IDo3UZqB/269EJfDII0kONtIzTVtwU2cuJAIYJY/9yVBfGvq18 I412lBEfiFKu+y0i5X43RGiBzhQQx7TlN63OOdqbWKtgevKZsIdBgYRhy0MiYgZGHDv8 VHew== 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=SyP06unzbrsQIJ6c/vZgwiDEt9NpDzleRQTMGd9LlPA=; b=V/VREG9Nmd8CaBRla5AntK2V+uOhAhahchwEiUJ/+r67KExv/H9SoOuNHySeuX1M5B jjdXATkj7cw6ZIXPkcCpw19nGuj+WD5ORdxRlwcRd08IiKbbL29TfArIt3uLzbDXda7s YsyLIHV2e8lorpmVFCb6lqV5oSvb2lEtfV30Vq7JFkhdevBPdHna0UZF7+7hrRkMvmV1 Ib35lj3qn4ksGbdAncawTIkpEZzaOgsiJziXNCPWk41xdtsek+3osfsZZl0/tDR6MEYP DDeZOdQvkMi65f5QhH3hELl7/lzPIiKB8Fjy7KCaEGMgq/Hn0hUEGvxjlIcWinwa8AZh 9zCg== X-Gm-Message-State: ALoCoQks7JPsw9owe8v0egSWM0QAp4geM5MhBdSyMdmWSHuBgt1oqtdlfMxr4zqeJxaaKmw33eRrBQRBJ4bprkkw333Kn5FH+w== X-Received: by 10.25.150.204 with SMTP id y195mr2310853lfd.66.1449668909494; Wed, 09 Dec 2015 05:48:29 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id qp7sm1451076lbc.24.2015.12.09.05.48.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:48:19 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Lee Jones Cc: Linus Walleij Subject: [PATCH 168/182] mfd: ucb1x00: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:48:17 +0100 Message-Id: <1449668897-6498-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: Lee Jones Signed-off-by: Linus Walleij --- Lee please ACK this so I can take it through the GPIO tree. --- drivers/mfd/ucb1x00-core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 Acked-by: Lee Jones diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index a6ec7cc0fac6..84d0757b8c5d 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include static DEFINE_MUTEX(ucb1x00_mutex); static LIST_HEAD(ucb1x00_drivers); @@ -109,7 +109,7 @@ unsigned int ucb1x00_io_read(struct ucb1x00 *ucb) static void ucb1x00_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); + struct ucb1x00 *ucb = gpiochip_get_data(chip); unsigned long flags; spin_lock_irqsave(&ucb->io_lock, flags); @@ -126,7 +126,7 @@ static void ucb1x00_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int ucb1x00_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); + struct ucb1x00 *ucb = gpiochip_get_data(chip); unsigned val; ucb1x00_enable(ucb); @@ -138,7 +138,7 @@ static int ucb1x00_gpio_get(struct gpio_chip *chip, unsigned offset) static int ucb1x00_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); + struct ucb1x00 *ucb = gpiochip_get_data(chip); unsigned long flags; spin_lock_irqsave(&ucb->io_lock, flags); @@ -154,7 +154,7 @@ static int ucb1x00_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int ucb1x00_gpio_direction_output(struct gpio_chip *chip, unsigned offset , int value) { - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); + struct ucb1x00 *ucb = gpiochip_get_data(chip); unsigned long flags; unsigned old, mask = 1 << offset; @@ -181,7 +181,7 @@ static int ucb1x00_gpio_direction_output(struct gpio_chip *chip, unsigned offset static int ucb1x00_to_irq(struct gpio_chip *chip, unsigned offset) { - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); + struct ucb1x00 *ucb = gpiochip_get_data(chip); return ucb->irq_base > 0 ? ucb->irq_base + offset : -ENXIO; } @@ -579,7 +579,7 @@ static int ucb1x00_probe(struct mcp *mcp) ucb->gpio.direction_input = ucb1x00_gpio_direction_input; ucb->gpio.direction_output = ucb1x00_gpio_direction_output; ucb->gpio.to_irq = ucb1x00_to_irq; - ret = gpiochip_add(&ucb->gpio); + ret = gpiochip_add_data(&ucb->gpio, ucb); if (ret) goto err_gpio_add; } else