From patchwork Wed Dec 9 13:22:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58015 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp665431lbb; Wed, 9 Dec 2015 05:23:10 -0800 (PST) X-Received: by 10.98.73.10 with SMTP id w10mr12887189pfa.164.1449667389897; Wed, 09 Dec 2015 05:23:09 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e66si12740587pfb.179.2015.12.09.05.23.09; Wed, 09 Dec 2015 05:23: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 S1752952AbbLINXA (ORCPT + 4 others); Wed, 9 Dec 2015 08:23:00 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:32770 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753156AbbLINW6 (ORCPT ); Wed, 9 Dec 2015 08:22:58 -0500 Received: by lbbkw15 with SMTP id kw15so29881423lbb.0 for ; Wed, 09 Dec 2015 05:22:56 -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=2LKmyTejd4iHdUY8dC5znpccAOFW3SR5QVyUWXYmHwo=; b=tAF3tXNU5kWU5nAhDpcLRMKKf36AzP/Q6xuhtdITlyp7ZIfjt+zO1ey99SK+15AIS7 b9MTFLawE0R6UJRJXfE9AopCXxLHgh0G3Ei2vrqPKL1dNxXq1e8aQ4RMRjvhlG45AWP8 8T74wpxWQQIqYKRdLLwFw3H8RqRJvA5J2XDLH+NL9auKFsihCKeyI2vixudrmVBEFTt1 Z1kzh00pMh8B4w9ZZHFDWzxrvktW7+VHiPgO8jBvFyTzz/+XEaTic7IJdhkK9PEiI0lR JNAS/pXaO2sXLCwv/S69cvKWde5BNTAZcFbDRoFId1ju+YdkBFoar/ddPq85sIphq8qe 1iQQ== 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=2LKmyTejd4iHdUY8dC5znpccAOFW3SR5QVyUWXYmHwo=; b=gRUlVseK9A1fyjGm7f7CyUbbAToY/EPnZAFcgrh4KAJ+Rwp/nMHIHZAFZHVr2pX/4E qvITDMbpmrMMLGqpJLqvz2EM9vti31z245oQnb+8vysw63Dd80iGL6SWk7ninGDD1H5W BntvUjsGZy2DMz/svJr5Hd7jCDeNmKmnv4cDGTLAhtyljwmCHY+HrCBXwTvqux6isCUQ nJ06ozX6sqSgZqbWLLU4vrRGxT4GR20nrKv/m9sYSc9GLap7hM8hsy5YCDrFJQ/vC+tR ABQ/VQ9RpBTpgooKCfUfJRI8yPpbJMzrYDk/wk1Iq5Z4XT4rnYqMAZfY7hSkY8rMHc9a J8/A== X-Gm-Message-State: ALoCoQlBV9/CfA3/2cVZ+C/JtW5ZD8RkrdB9SHWQmlmt8nRP20S88cKiCk1lbkiz5yhg/J5ykztM0stTqpBrZ3/oS+coHOP8zA== X-Received: by 10.112.200.229 with SMTP id jv5mr2494952lbc.23.1449667376297; Wed, 09 Dec 2015 05:22:56 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a2sm1421219lbp.37.2015.12.09.05.22.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:22:55 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Alessandro Rubini Subject: [PATCH 060/182] gpio: sta2x11: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:22:53 +0100 Message-Id: <1449667373-32623-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: Alessandro Rubini Signed-off-by: Linus Walleij --- drivers/gpio/gpio-sta2x11.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-sta2x11.c b/drivers/gpio/gpio-sta2x11.c index 55e47828ddfc..b09ab7562709 100644 --- a/drivers/gpio/gpio-sta2x11.c +++ b/drivers/gpio/gpio-sta2x11.c @@ -74,7 +74,7 @@ static inline u32 __bit(int nr) static void gsta_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) { - struct gsta_gpio *chip = container_of(gpio, struct gsta_gpio, gpio); + struct gsta_gpio *chip = gpiochip_get_data(gpio); struct gsta_regs __iomem *regs = __regs(chip, nr); u32 bit = __bit(nr); @@ -86,7 +86,7 @@ static void gsta_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) static int gsta_gpio_get(struct gpio_chip *gpio, unsigned nr) { - struct gsta_gpio *chip = container_of(gpio, struct gsta_gpio, gpio); + struct gsta_gpio *chip = gpiochip_get_data(gpio); struct gsta_regs __iomem *regs = __regs(chip, nr); u32 bit = __bit(nr); @@ -96,7 +96,7 @@ static int gsta_gpio_get(struct gpio_chip *gpio, unsigned nr) static int gsta_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, int val) { - struct gsta_gpio *chip = container_of(gpio, struct gsta_gpio, gpio); + struct gsta_gpio *chip = gpiochip_get_data(gpio); struct gsta_regs __iomem *regs = __regs(chip, nr); u32 bit = __bit(nr); @@ -111,7 +111,7 @@ static int gsta_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, static int gsta_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) { - struct gsta_gpio *chip = container_of(gpio, struct gsta_gpio, gpio); + struct gsta_gpio *chip = gpiochip_get_data(gpio); struct gsta_regs __iomem *regs = __regs(chip, nr); u32 bit = __bit(nr); @@ -121,7 +121,7 @@ static int gsta_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) static int gsta_gpio_to_irq(struct gpio_chip *gpio, unsigned offset) { - struct gsta_gpio *chip = container_of(gpio, struct gsta_gpio, gpio); + struct gsta_gpio *chip = gpiochip_get_data(gpio); return chip->irq_base + offset; } @@ -409,7 +409,7 @@ static int gsta_probe(struct platform_device *dev) goto err_free_descs; } - err = gpiochip_add(&chip->gpio); + err = gpiochip_add_data(&chip->gpio, chip); if (err < 0) { dev_err(&dev->dev, "sta2x11 gpio: Can't register (%i)\n", -err);