From patchwork Wed Dec 9 13:19:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58004 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp663430lbb; Wed, 9 Dec 2015 05:19:47 -0800 (PST) X-Received: by 10.66.55.72 with SMTP id q8mr7859257pap.136.1449667187883; Wed, 09 Dec 2015 05:19:47 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ab3si12752480pad.20.2015.12.09.05.19.47; Wed, 09 Dec 2015 05:19:47 -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 S1754132AbbLINTp (ORCPT + 4 others); Wed, 9 Dec 2015 08:19:45 -0500 Received: from mail-lf0-f46.google.com ([209.85.215.46]:32906 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753962AbbLINTo (ORCPT ); Wed, 9 Dec 2015 08:19:44 -0500 Received: by lfaz4 with SMTP id z4so34048883lfa.0 for ; Wed, 09 Dec 2015 05:19:43 -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=932v3Y8Cc9LY+NRrwptY/t6H5axWJwtxd8wBoZxOmI8=; b=u89pYHOK42clSWPoC8a7OolLQO02ticdOpJTCefTOVpF7nsauGBV8+LBdSS+FdXPd+ 6LZjPsRCmXyqDn5YZYuHqk17SiIpA4aA0prwxynj2IU8Qk0VhKb8pgFNmQ3uscOYeGk9 5jw0PYO/6ewUjmSb+jlEzQHNlfRRIXc9tW+mouNINDBVFKwE9b3a+zEf85orySdsgbMS FxN8fmPwryNEGmpKocfQ6AZ0qM7AG7cRfsiAd/q9A+Rlr5piqALNKy+/2Suj//eGbG5e Uhzo2GfObI1D3x0EiB1SbhqRhedjPPEmuubHFqcd8C0yvgjeu4lAorzPKrvfTbEiMOWJ yHtw== 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=932v3Y8Cc9LY+NRrwptY/t6H5axWJwtxd8wBoZxOmI8=; b=XPF5tvYRph53hc1ALaz14sJ+MFPSjfuZ2d8wudCyxnrWDPsKfL1T41y1zcl7b7xCD4 WJQFwnqVeGE6f1yrMdo1Rky+RdjepaZZwkE7ras+yjC1YuxAssSY0SH3bV8NiUHEDPBL YuhqhkujaOBk4ahXv0otN55nX8iXOOQ5z6crN7FCBbVVSRbk5Ecyvgvt+CfCPxkdUOES Rs8wiRNEheQH1pWbBiMJTfcnUB5q7Pg4sP2ZD/rMcqiS0lhC90Qeen6KweyehekdB+jU JrNxKJCfpScHYbMYl3553Lank8Kb1Wi79jzkR6ZqDUPJD/Uc4/cqhVdO4RlHLFJ5OkEy 18uQ== X-Gm-Message-State: ALoCoQkQR0b6RSamZBtewzd/6YwiKqdZ1ZQoHJIn4dFvaqgcRweUNN6UpAvMWCVweKSBQGE3S4DaRU6QATR+bFm+aNvwJYQk8g== X-Received: by 10.25.136.139 with SMTP id k133mr2268172lfd.4.1449667183423; Wed, 09 Dec 2015 05:19:43 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 70sm1447297lfw.2.2015.12.09.05.19.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:19:42 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Grygorii Strashko , George Cherian , Laurent Pinchart Subject: [PATCH 049/182] gpio: pcf857x: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:19:40 +0100 Message-Id: <1449667180-32071-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: Grygorii Strashko Cc: George Cherian Cc: Laurent Pinchart Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pcf857x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 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-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index 407ca5e1aafa..ca340ed8a200 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c @@ -137,7 +137,7 @@ static int i2c_read_le16(struct i2c_client *client) static int pcf857x_input(struct gpio_chip *chip, unsigned offset) { - struct pcf857x *gpio = container_of(chip, struct pcf857x, chip); + struct pcf857x *gpio = gpiochip_get_data(chip); int status; mutex_lock(&gpio->lock); @@ -150,7 +150,7 @@ static int pcf857x_input(struct gpio_chip *chip, unsigned offset) static int pcf857x_get(struct gpio_chip *chip, unsigned offset) { - struct pcf857x *gpio = container_of(chip, struct pcf857x, chip); + struct pcf857x *gpio = gpiochip_get_data(chip); int value; value = gpio->read(gpio->client); @@ -159,7 +159,7 @@ static int pcf857x_get(struct gpio_chip *chip, unsigned offset) static int pcf857x_output(struct gpio_chip *chip, unsigned offset, int value) { - struct pcf857x *gpio = container_of(chip, struct pcf857x, chip); + struct pcf857x *gpio = gpiochip_get_data(chip); unsigned bit = 1 << offset; int status; @@ -372,7 +372,7 @@ static int pcf857x_probe(struct i2c_client *client, gpio->out = ~n_latch; gpio->status = gpio->out; - status = gpiochip_add(&gpio->chip); + status = gpiochip_add_data(&gpio->chip, gpio); if (status < 0) goto fail;