From patchwork Wed Dec 9 13:29:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58041 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp668753lbb; Wed, 9 Dec 2015 05:29:12 -0800 (PST) X-Received: by 10.66.120.200 with SMTP id le8mr7891509pab.61.1449667752743; Wed, 09 Dec 2015 05:29:12 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ny6si12718088pab.215.2015.12.09.05.29.12; Wed, 09 Dec 2015 05:29:12 -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 S1754074AbbLIN3M (ORCPT + 4 others); Wed, 9 Dec 2015 08:29:12 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:35932 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751617AbbLIN3L (ORCPT ); Wed, 9 Dec 2015 08:29:11 -0500 Received: by lfs39 with SMTP id 39so34385915lfs.3 for ; Wed, 09 Dec 2015 05:29:10 -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=MVqPUi56tb47rbNhdtnyjOXfnywRrlbpbPHnJGjg004=; b=HuJTKNKSAWztGyFYQUjI7C7QVjOrCiyNOqVTyOiQyVVoapqzky/D4ivsT7INsymKR2 xhs5bT842hFpj/B2eTTHmoRxuKCSsFsg8EEEOydmZ1KIE8xwoMW+9A56SwVE3YjEmaG3 O24zM6WvJaTljITlCyyj3C6WRgCRDtV/uGLvHeq8ER81RsWFl+8pGnJrtsMMiDuEqiPa zk3VYCVnOEInOxf9Xuqv4l21J4yb3UMpagsgY5C3mNg51sLnyGB6DRVseS8+UryBJISE NrXSP6GaL8SSJOjeCTyliMgUrCzttOJtt0iwuQjLaZsOndDDxMLLG+svi9tOcQT8VYQJ 0IVw== 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=MVqPUi56tb47rbNhdtnyjOXfnywRrlbpbPHnJGjg004=; b=kcitWpguv4DosdDP42iP9OWk+eg13EmOCABds8Tx7kBvgoXoQ+AL8PbMipJlXUnFaM ZVSjjnfWFxfZyU9MeL5zq9raldbnjbI5W326ThUSYWTTw1MIKGNUjWSqQd6lQ0um3jEN HXwFe9iifF0QeM9J7OpFo1cNLjGkzrPCqdyAvXelj2IlaUWlrZ6l3DEOIp89n375MD/D R1mpmu0x3gwb5g859iSSppIZhr4BirGfA358ADEFmQwoQyoYu/MhPKQ5GTfYdnJf+HsP +131xgoxYPC0GA9Yipa8LIPDBw/WWdoKj6Wt/ANST0zbiFMlNwTtfBDK8Izl6yH/tPpb KzFw== X-Gm-Message-State: ALoCoQk7UZ29hVPSfWb6yRTvQBbYJ/vg8t1nLvmoYZvk0WAQhWuS7uuqz7iqmQc+QAKSTLzVKfnpHQKy56vAQdzZaeNPK9HzNA== X-Received: by 10.25.22.165 with SMTP id 37mr1923826lfw.60.1449667750129; Wed, 09 Dec 2015 05:29:10 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id mt2sm1415762lbc.9.2015.12.09.05.29.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:29:09 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Fabian Vogt Subject: [PATCH 085/182] gpio: zevio: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:29:07 +0100 Message-Id: <1449667747-1522-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: Fabian Vogt Signed-off-by: Linus Walleij --- drivers/gpio/gpio-zevio.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 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-zevio.c b/drivers/gpio/gpio-zevio.c index 65b61dcc6268..cda6d922be98 100644 --- a/drivers/gpio/gpio-zevio.c +++ b/drivers/gpio/gpio-zevio.c @@ -52,9 +52,6 @@ #define ZEVIO_GPIO_INPUT 0x18 #define ZEVIO_GPIO_INT_STICKY 0x20 -#define to_zevio_gpio(chip) container_of(to_of_mm_gpio_chip(chip), \ - struct zevio_gpio, chip) - /* Bit number of GPIO in its section */ #define ZEVIO_GPIO_BIT(gpio) (gpio&7) @@ -80,7 +77,7 @@ static inline void zevio_gpio_port_set(struct zevio_gpio *c, unsigned pin, /* Functions for struct gpio_chip */ static int zevio_gpio_get(struct gpio_chip *chip, unsigned pin) { - struct zevio_gpio *controller = to_zevio_gpio(chip); + struct zevio_gpio *controller = gpiochip_get_data(chip); u32 val, dir; spin_lock(&controller->lock); @@ -96,7 +93,7 @@ static int zevio_gpio_get(struct gpio_chip *chip, unsigned pin) static void zevio_gpio_set(struct gpio_chip *chip, unsigned pin, int value) { - struct zevio_gpio *controller = to_zevio_gpio(chip); + struct zevio_gpio *controller = gpiochip_get_data(chip); u32 val; spin_lock(&controller->lock); @@ -112,7 +109,7 @@ static void zevio_gpio_set(struct gpio_chip *chip, unsigned pin, int value) static int zevio_gpio_direction_input(struct gpio_chip *chip, unsigned pin) { - struct zevio_gpio *controller = to_zevio_gpio(chip); + struct zevio_gpio *controller = gpiochip_get_data(chip); u32 val; spin_lock(&controller->lock); @@ -129,7 +126,7 @@ static int zevio_gpio_direction_input(struct gpio_chip *chip, unsigned pin) static int zevio_gpio_direction_output(struct gpio_chip *chip, unsigned pin, int value) { - struct zevio_gpio *controller = to_zevio_gpio(chip); + struct zevio_gpio *controller = gpiochip_get_data(chip); u32 val; spin_lock(&controller->lock); @@ -187,7 +184,9 @@ static int zevio_gpio_probe(struct platform_device *pdev) controller->chip.gc = zevio_gpio_chip; controller->chip.gc.parent = &pdev->dev; - status = of_mm_gpiochip_add(pdev->dev.of_node, &(controller->chip)); + status = of_mm_gpiochip_add_data(pdev->dev.of_node, + &(controller->chip), + controller); if (status) { dev_err(&pdev->dev, "failed to add gpiochip: %d\n", status); return status;