From patchwork Wed Dec 9 13:43:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58109 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp677293lbb; Wed, 9 Dec 2015 05:44:03 -0800 (PST) X-Received: by 10.98.86.210 with SMTP id h79mr13027034pfj.87.1449668642949; Wed, 09 Dec 2015 05:44:02 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u63si12822783pfa.181.2015.12.09.05.44.01; Wed, 09 Dec 2015 05:44:02 -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 S1754559AbbLINoA (ORCPT + 4 others); Wed, 9 Dec 2015 08:44:00 -0500 Received: from mail-lf0-f45.google.com ([209.85.215.45]:32776 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754083AbbLINoA (ORCPT ); Wed, 9 Dec 2015 08:44:00 -0500 Received: by lfaz4 with SMTP id z4so34524171lfa.0 for ; Wed, 09 Dec 2015 05:43:58 -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:mime-version:content-type :content-transfer-encoding; bh=jbBRIbJLlRbJR1PJD8RfUYavBVm9G90vmDToQ6TvcoM=; b=bDoKxpPxvnSsom48AZZd1ivjw58UP+m0vIxtaEQ55Hx2qM+lBwxtZIoZqWo/dzlq6A 0GPlBJ5+k1meN5lCr6C3q0m3pHqKR9H+etYByGg4QSxUinX9RXYFA0M8/bIFiScWomMR tOR65hddNN18i4eeXHoBOIe+nF7+VvzlncyMVSwy5Y1V38VyL8QDBetQzyVIPSjxibgX bI6f4c0BxUXl6ZcEo/ZwubMSQ27jvtFq1WRzjpYvJjxsctmvTymNR3BIRReKgMN3WXXh jsJflEtDVWc8aiAPON5bB0LfBNwOFj8CoRe5lF76lXU0FLS/TSB5tjd3BcN2x1At9yEG beNw== 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:mime-version :content-type:content-transfer-encoding; bh=jbBRIbJLlRbJR1PJD8RfUYavBVm9G90vmDToQ6TvcoM=; b=YU6SANltiAs3LMwLxrxwocGoRDhW+dF+w2xFhWY/mrrsKn3+9fWl0sdIzfx/VUqo0R t211t+LW68bW6VqB1G/I5Pyp2BrF5Unzvxh/jAn3UM/27rDcXYPoENjO6YwRQVzwOck1 Hc6sRVdB74+y9Nsm+dIjfdkT2L9+ZLTBhT2WbbE/lwOcnJID1S8lAtsNQoUfiC+kJD0E YBprq3yHLNbEfCw9Z/QzBIenZXhhSPDbHjGGDZ4vy+pz2nkj9PmdtJdxmdoIky0+HLYU /Ubp0T1Hg72ocfUO4zGY80p5Xra7dSqsCq4oxdoqI4cQ30YhmT5h7y+wpO9Wvxlit5ap QZcw== X-Gm-Message-State: ALoCoQmzK8SvZd9rcR1lXjIbi7YuVK6rVrGbnolzfo2Sizyi2ns7hv6NmzU/6nl5fkR2hdJ4UU1MMZq0m7MVWqFeM8J77+bgIQ== X-Received: by 10.25.26.210 with SMTP id a201mr1893159lfa.58.1449668638398; Wed, 09 Dec 2015 05:43:58 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j83sm1442979lfi.47.2015.12.09.05.43.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:43:57 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , zajec5@gmail.com, Hauke Mehrtens , Kalle Valo Cc: Linus Walleij , linux-wireless@vger.kernel.org Subject: [PATCH 153/182] bcma: gpio: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:43:53 +0100 Message-Id: <1449668633-5547-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 MIME-Version: 1.0 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: Rafał Miłecki Cc: Hauke Mehrtens Cc: Kalle Valo Cc: linux-wireless@vger.kernel.org Signed-off-by: Linus Walleij --- BCMA maintainers: please ACK this so I can take it through the GPIO tree. --- drivers/bcma/driver_gpio.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 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/bcma/driver_gpio.c b/drivers/bcma/driver_gpio.c index 949754427ce2..98067f757fb0 100644 --- a/drivers/bcma/driver_gpio.c +++ b/drivers/bcma/driver_gpio.c @@ -17,14 +17,9 @@ #define BCMA_GPIO_MAX_PINS 32 -static inline struct bcma_drv_cc *bcma_gpio_get_cc(struct gpio_chip *chip) -{ - return container_of(chip, struct bcma_drv_cc, gpio); -} - static int bcma_gpio_get_value(struct gpio_chip *chip, unsigned gpio) { - struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); + struct bcma_drv_cc *cc = gpiochip_get_data(chip); return !!bcma_chipco_gpio_in(cc, 1 << gpio); } @@ -32,14 +27,14 @@ static int bcma_gpio_get_value(struct gpio_chip *chip, unsigned gpio) static void bcma_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value) { - struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); + struct bcma_drv_cc *cc = gpiochip_get_data(chip); bcma_chipco_gpio_out(cc, 1 << gpio, value ? 1 << gpio : 0); } static int bcma_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) { - struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); + struct bcma_drv_cc *cc = gpiochip_get_data(chip); bcma_chipco_gpio_outen(cc, 1 << gpio, 0); return 0; @@ -48,7 +43,7 @@ static int bcma_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) static int bcma_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int value) { - struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); + struct bcma_drv_cc *cc = gpiochip_get_data(chip); bcma_chipco_gpio_outen(cc, 1 << gpio, 1 << gpio); bcma_chipco_gpio_out(cc, 1 << gpio, value ? 1 << gpio : 0); @@ -57,7 +52,7 @@ static int bcma_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, static int bcma_gpio_request(struct gpio_chip *chip, unsigned gpio) { - struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); + struct bcma_drv_cc *cc = gpiochip_get_data(chip); bcma_chipco_gpio_control(cc, 1 << gpio, 0); /* clear pulldown */ @@ -70,7 +65,7 @@ static int bcma_gpio_request(struct gpio_chip *chip, unsigned gpio) static void bcma_gpio_free(struct gpio_chip *chip, unsigned gpio) { - struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip); + struct bcma_drv_cc *cc = gpiochip_get_data(chip); /* clear pullup */ bcma_chipco_gpio_pullup(cc, 1 << gpio, 0); @@ -81,7 +76,7 @@ static void bcma_gpio_free(struct gpio_chip *chip, unsigned gpio) static void bcma_gpio_irq_unmask(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct bcma_drv_cc *cc = bcma_gpio_get_cc(gc); + struct bcma_drv_cc *cc = gpiochip_get_data(gc); int gpio = irqd_to_hwirq(d); u32 val = bcma_chipco_gpio_in(cc, BIT(gpio)); @@ -92,7 +87,7 @@ static void bcma_gpio_irq_unmask(struct irq_data *d) static void bcma_gpio_irq_mask(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct bcma_drv_cc *cc = bcma_gpio_get_cc(gc); + struct bcma_drv_cc *cc = gpiochip_get_data(gc); int gpio = irqd_to_hwirq(d); bcma_chipco_gpio_intmask(cc, BIT(gpio), 0); @@ -216,7 +211,7 @@ int bcma_gpio_init(struct bcma_drv_cc *cc) else chip->base = -1; - err = gpiochip_add(chip); + err = gpiochip_add_data(chip, cc); if (err) return err;