From patchwork Wed Dec 9 13:43: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: 7808751 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6C2D59F39B for ; Wed, 9 Dec 2015 13:44:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7158620462 for ; Wed, 9 Dec 2015 13:44:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D552203DC for ; Wed, 9 Dec 2015 13:44:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754613AbbLINoB (ORCPT ); Wed, 9 Dec 2015 08:44:01 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:35837 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754148AbbLINoA (ORCPT ); Wed, 9 Dec 2015 08:44:00 -0500 Received: by lfdl133 with SMTP id l133so34346573lfd.2 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=G2nm+wzIft4/4EYj5/6Lwk76ZTylnFWRmUe2zk4b+h5cphFinZ7Am8yRAiEbNGVoJ6 A9QBX6lPDUszIxw+j0d5CBUCWh/QviHKBE3wf4VSk6aAuj6Z/eSsWHWw/z/1Br3SDKts neW4fTXMC2ySBSftAM6EfM2hWYv0dlENAYL6vMOXszBqP8Tkwd53Q0z7SoDily4cKN/L RT5SRygU1zOAHtNRG49J8/ww40c54JhMyubHmGDAn96NhKe93oUcfcogMsKLBhpuuWkg g56k56p5N9AObe9KFBt49BgZ08nLZgmNjxQ2vnl/Liq8iiGBB+KjHyv+jfAI0Xx1C6wu immg== X-Gm-Message-State: ALoCoQnjjr7kp4/1WruKFe5JrdRcMN3sqEdwczL2VjN11N7FuSMffzU4MmcfXi4yJk8pz90+jgo/trSVjucIAUJvymcwWNi91A== 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-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Hauke Mehrtens Acked-by: Rafa? Mi?ecki --- 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(-) 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;