From patchwork Wed Dec 9 13:13:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57964 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp659891lbb; Wed, 9 Dec 2015 05:14:06 -0800 (PST) X-Received: by 10.98.67.68 with SMTP id q65mr12714240pfa.63.1449666845874; Wed, 09 Dec 2015 05:14:05 -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.14.05; Wed, 09 Dec 2015 05:14:05 -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 S1754083AbbLINOB (ORCPT + 4 others); Wed, 9 Dec 2015 08:14:01 -0500 Received: from mail-lf0-f53.google.com ([209.85.215.53]:34985 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754080AbbLINOA (ORCPT ); Wed, 9 Dec 2015 08:14:00 -0500 Received: by lfdl133 with SMTP id l133so33763975lfd.2 for ; Wed, 09 Dec 2015 05:13:59 -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=MLGrrIrQskm/tWqhXXURJ3acGFaCtpPThwczPMlnpiM=; b=n4xxIy3Im02zSr4MvY85fXPB+v59Netd98nk4uneoqV79jwxyshZkFWx17cKlPtXaO BvWJp7Ziu5lVxOzazxAtkrkXwofqno6yOmlN2uLoMuE6IkVkK1oEWo95ni3tKNs9B9lt en+x3+oswWOWkprQC1gGh4wF2lH3yjJZNoVLjxhrvhFfWRQ3edCoFYBs0evuJkNvDTvk 4YMHpDSaYNQBGZk2IYezGHd5MN9KGSlR9xgJkGmdupQI+dlNelHshjlexRLarNBIdOkO Xqpq1Uzx4ja0R5qC37+N1BI/eIsxiAckoJWpTeW4PkhtSi4QVQ1cZGS2UXnqOpgUiL3L TIVw== 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=MLGrrIrQskm/tWqhXXURJ3acGFaCtpPThwczPMlnpiM=; b=Bzu4vPqiVrrc6DilXvGdScPvzolmG7iEPYuW74fxXO363wmV4npfT6Pm9rtwgxfj7j Px5K3rOPYnkV9QaF3jBx+fcxuioZpNuXvKgMYfcYFaCx+hPXGuF3SgA8S4HZ8lzKpjyY wl5PrSoq5b6GUgg4+EbU5cdEEWM67JUclukQpMYb5TV0zUmlNu1W0f8hT14zeqeflOCx Lr82IqiNO7E9OrsQVOYpqO2d8OIZcZsUNuiogdBYLsdM0CziRacGJFIKVLA8VmM+1pXq faO8iYmZBNBGilpRsNVs33/AXOsWOlOUM8NnFsdhTPmHFKdAVySaFnOhLxBRyPdoPCqM ieNw== X-Gm-Message-State: ALoCoQkvl2V8RO7MigHYsxjo+LLR52mSbHnRN0GsUvGb05BGLwOzOUqE4Vf7/mTtV+O2lNC3w2FdFLRetIpyq7gJDWb0gj2jag== X-Received: by 10.25.81.17 with SMTP id f17mr1783950lfb.90.1449666839090; Wed, 09 Dec 2015 05:13:59 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id w7sm1421232lbb.14.2015.12.09.05.13.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:13:58 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij Subject: [PATCH 009/182] gpio: adp5520: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:13:52 +0100 Message-Id: <1449666832-30159-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(). Signed-off-by: Linus Walleij --- drivers/gpio/gpio-adp5520.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-adp5520.c b/drivers/gpio/gpio-adp5520.c index caff711ca5a9..4fa7ff1fec9a 100644 --- a/drivers/gpio/gpio-adp5520.c +++ b/drivers/gpio/gpio-adp5520.c @@ -27,7 +27,7 @@ static int adp5520_gpio_get_value(struct gpio_chip *chip, unsigned off) struct adp5520_gpio *dev; uint8_t reg_val; - dev = container_of(chip, struct adp5520_gpio, gpio_chip); + dev = gpiochip_get_data(chip); /* * There are dedicated registers for GPIO IN/OUT. @@ -46,7 +46,7 @@ static void adp5520_gpio_set_value(struct gpio_chip *chip, unsigned off, int val) { struct adp5520_gpio *dev; - dev = container_of(chip, struct adp5520_gpio, gpio_chip); + dev = gpiochip_get_data(chip); if (val) adp5520_set_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]); @@ -57,7 +57,7 @@ static void adp5520_gpio_set_value(struct gpio_chip *chip, static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off) { struct adp5520_gpio *dev; - dev = container_of(chip, struct adp5520_gpio, gpio_chip); + dev = gpiochip_get_data(chip); clear_bit(off, &dev->output); @@ -70,7 +70,7 @@ static int adp5520_gpio_direction_output(struct gpio_chip *chip, { struct adp5520_gpio *dev; int ret = 0; - dev = container_of(chip, struct adp5520_gpio, gpio_chip); + dev = gpiochip_get_data(chip); set_bit(off, &dev->output); @@ -153,7 +153,7 @@ static int adp5520_gpio_probe(struct platform_device *pdev) goto err; } - ret = gpiochip_add(&dev->gpio_chip); + ret = gpiochip_add_data(&dev->gpio_chip, dev); if (ret) goto err;