From patchwork Wed Dec 9 13:18:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57993 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp662446lbb; Wed, 9 Dec 2015 05:18:09 -0800 (PST) X-Received: by 10.98.64.136 with SMTP id f8mr12858318pfd.95.1449667089222; Wed, 09 Dec 2015 05:18: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.18.08; Wed, 09 Dec 2015 05:18: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 S1753754AbbLINSI (ORCPT + 4 others); Wed, 9 Dec 2015 08:18:08 -0500 Received: from mail-lf0-f42.google.com ([209.85.215.42]:34333 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751531AbbLINSH (ORCPT ); Wed, 9 Dec 2015 08:18:07 -0500 Received: by lffu14 with SMTP id u14so34034331lff.1 for ; Wed, 09 Dec 2015 05:18:05 -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=cVhxgyL/ouYFKVpWj9Uo+cLNlc6KsDMumgdEoRGZR74=; b=X0h7iZy6ViZ5D1APqu92gtfqi7pt+a40NDOgOL5ljPmYgpyqoiL+9uFr6gW5ZlkhLi Zo0jeQp2Vu7H1i+huAiveJa92JMtM2XFj+xWkFO8O7C2koxFXTLw+nTfl/ut0PDrg4MA DVXn0H8vQ1aeqRHfpJcSKw13gPkclNOWKN+Ol3u1UwnCyhxh1OSJVrtOgOL0LpEZNTXD 6dVSFNsv4/dDTrSrT3a9AOT/XUIaN+HP9Yc/GI4uxBeRG8tffVSZS0AjVeVCBn9cDWyC FcPuIJWsQofWcLtHXXiOLBvh/5KUFvpUw7fI1M81aGmFrL7AJkxKjaF6OspOMKC1s8+K Hmmw== 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=cVhxgyL/ouYFKVpWj9Uo+cLNlc6KsDMumgdEoRGZR74=; b=RWdd1Vixbukw1+/8od0pKepFkGFp4OJuw3XYUlS7y19vZXhzmWIMtucdLNTJHiGYww KWZGikdci/+n9thWCxq3FUutN4sNshUWqTRI5m8qmtmLS5yWGUjnh1cR5QA/IlNlXVDA o7UGSptLEQKxd39vcT/02OU00DPaV32YTZgAgwkvoE7SuQDp5gJ1X2tUYRCFnft63BM/ oMy7k3UoiR5AxyzDy0cjPP7eRQsltT4UpCJHJrKoFhV1qcwfqctmIAdsVtKOZyjRNRXB yCZ9xYHg90UJTA8JJyZrg0qDStFwhDukOADMb5cdNkEeqRdNqteVYcWw9TozbLkI+Yd3 M0zQ== X-Gm-Message-State: ALoCoQlC4nvq5AAVghpTay4u+jDJ9haGH8JzRxJUg+PJGDp28l2sqnJp/fGjrCMuZtJj36Ib99RJslJKnKBitd6D/ES2TkF6zA== X-Received: by 10.25.28.70 with SMTP id c67mr1875917lfc.95.1449667085830; Wed, 09 Dec 2015 05:18:05 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id qr6sm1384375lbb.19.2015.12.09.05.18.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:18:05 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Alexander Stein , Sonic Zhang Subject: [PATCH 038/182] gpio: mcp: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:18:01 +0100 Message-Id: <1449667081-31552-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: Alexander Stein Cc: Sonic Zhang Signed-off-by: Linus Walleij --- drivers/gpio/gpio-mcp23s08.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 diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c index 13cace0ca6f7..c767879e4dd9 100644 --- a/drivers/gpio/gpio-mcp23s08.c +++ b/drivers/gpio/gpio-mcp23s08.c @@ -269,7 +269,7 @@ static const struct mcp23s08_ops mcp23s17_ops = { static int mcp23s08_direction_input(struct gpio_chip *chip, unsigned offset) { - struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip); + struct mcp23s08 *mcp = gpiochip_get_data(chip); int status; mutex_lock(&mcp->lock); @@ -281,7 +281,7 @@ static int mcp23s08_direction_input(struct gpio_chip *chip, unsigned offset) static int mcp23s08_get(struct gpio_chip *chip, unsigned offset) { - struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip); + struct mcp23s08 *mcp = gpiochip_get_data(chip); int status; mutex_lock(&mcp->lock); @@ -312,7 +312,7 @@ static int __mcp23s08_set(struct mcp23s08 *mcp, unsigned mask, int value) static void mcp23s08_set(struct gpio_chip *chip, unsigned offset, int value) { - struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip); + struct mcp23s08 *mcp = gpiochip_get_data(chip); unsigned mask = 1 << offset; mutex_lock(&mcp->lock); @@ -323,7 +323,7 @@ static void mcp23s08_set(struct gpio_chip *chip, unsigned offset, int value) static int mcp23s08_direction_output(struct gpio_chip *chip, unsigned offset, int value) { - struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip); + struct mcp23s08 *mcp = gpiochip_get_data(chip); unsigned mask = 1 << offset; int status; @@ -377,7 +377,7 @@ static irqreturn_t mcp23s08_irq(int irq, void *data) static int mcp23s08_gpio_to_irq(struct gpio_chip *chip, unsigned offset) { - struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip); + struct mcp23s08 *mcp = gpiochip_get_data(chip); return irq_find_mapping(mcp->irq_domain, offset); } @@ -544,7 +544,7 @@ static void mcp23s08_dbg_show(struct seq_file *s, struct gpio_chip *chip) int t; unsigned mask; - mcp = container_of(chip, struct mcp23s08, chip); + mcp = gpiochip_get_data(chip); /* NOTE: we only handle one bank for now ... */ bank = '0' + ((mcp->addr >> 1) & 0x7); @@ -704,7 +704,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, goto fail; } - status = gpiochip_add(&mcp->chip); + status = gpiochip_add_data(&mcp->chip, mcp); if (status < 0) goto fail;