From patchwork Wed Dec 9 13:33:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58071 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp671526lbb; Wed, 9 Dec 2015 05:33:43 -0800 (PST) X-Received: by 10.98.64.18 with SMTP id n18mr13108798pfa.109.1449668023612; Wed, 09 Dec 2015 05:33:43 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 81si12819810pfr.79.2015.12.09.05.33.43; Wed, 09 Dec 2015 05:33:43 -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 S1754354AbbLINdk (ORCPT + 4 others); Wed, 9 Dec 2015 08:33:40 -0500 Received: from mail-lb0-f170.google.com ([209.85.217.170]:33974 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754451AbbLINdi (ORCPT ); Wed, 9 Dec 2015 08:33:38 -0500 Received: by lbbcs9 with SMTP id cs9so29982143lbb.1 for ; Wed, 09 Dec 2015 05:33:36 -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=Xr418qcljp0GR3QgPwIr5aw5qCwZKnedDnJN2JVbHGM=; b=15hA1kFDZ/TSYAAwS+RI2PQDB9Q8lbCG4pj7rAZg/aKG7vyHGSvaRhZ4tuIAuLAJ4W LOongZ72E437lLLrsAjkyw7DXBzLfnObY85ybYJdqGWxWS6Ip6r+zByGEtiFZLdyxMH9 7uqkD29j0qGrjup9CrGG5B+6ijPlPQlcjoiaPqweyqTnZrT6j1Aa2sem94KYgHiuiHLi z7mjpAPtQ2wV8yK73E6fXZXNgH1XpNM2PtXF5JTog5lqVxsvyzgXlLtnV9TMjAbqqLo3 YlnUrQhjJmBd6EZRLwYyc4RuwZR9Jva4tD5mFbxLLmnHbZiGPrpZxA3IKdNFq+P3GMcF F6vQ== 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=Xr418qcljp0GR3QgPwIr5aw5qCwZKnedDnJN2JVbHGM=; b=H7DgKXa50H9HuB4Q7jFnVgfanGSr2IYi2kUpJTyajzQX2WjuG0NgkbIGsYnHcwbMgF 3g1unF5xwdkGagq2NdAf45PK4JgKqFX5infeIyyt54DPayEWh8UUtBFtWl3K5mkVtwrl QMwPRXigiBMg4Au64w7w6ub3aZsolCI1araQBD36JDhqBWWRwL2cvoOdkbnjlSP0u7b/ w9dTB8pcLrqxr+f5bad8j/mSk1LUVbUIHBo+x3mIluQopl8O5+cF8q0umbB6wrPdCDVx lgKho8HoyHRUroNT5affTasG/Z/MImjbt6JtQNuenshzEUXZRd3bEjN4XEQHyODFTxLS hE4w== X-Gm-Message-State: ALoCoQmxJEZFXAq1C+MueY09VYKabbUFGrg53BRf2FQr6xzFTsF9ehdEUXRXx4lG0KeVMqNzkG3ddeCVWIt+FPWUM1kxfwjfrA== X-Received: by 10.112.55.38 with SMTP id o6mr1971373lbp.38.1449668016833; Wed, 09 Dec 2015 05:33:36 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id nq2sm1420873lbb.33.2015.12.09.05.33.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:33:36 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Barry Song Subject: [PATCH 115/182] pinctrl: sirf-atlas7: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:33:33 +0100 Message-Id: <1449668013-3246-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: Barry Song Signed-off-by: Linus Walleij --- drivers/pinctrl/sirf/pinctrl-atlas7.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 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/pinctrl/sirf/pinctrl-atlas7.c b/drivers/pinctrl/sirf/pinctrl-atlas7.c index 1850dc1b3863..3a95ffdbaa72 100644 --- a/drivers/pinctrl/sirf/pinctrl-atlas7.c +++ b/drivers/pinctrl/sirf/pinctrl-atlas7.c @@ -355,11 +355,6 @@ struct atlas7_gpio_chip { struct atlas7_gpio_bank banks[0]; }; -static inline struct atlas7_gpio_chip *to_atlas7_gpio(struct gpio_chip *gc) -{ - return container_of(gc, struct atlas7_gpio_chip, chip); -} - /** * @dev: a pointer back to containing device * @virtbase: the offset to the controller in virtual memory @@ -5600,7 +5595,7 @@ static int __atlas7_gpio_to_pin(struct atlas7_gpio_chip *a7gc, u32 gpio) static void atlas7_gpio_irq_ack(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); + struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc); struct atlas7_gpio_bank *bank; void __iomem *ctrl_reg; u32 val, pin_in_bank; @@ -5638,7 +5633,7 @@ static void __atlas7_gpio_irq_mask(struct atlas7_gpio_chip *a7gc, int idx) static void atlas7_gpio_irq_mask(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); + struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc); unsigned long flags; spin_lock_irqsave(&a7gc->lock, flags); @@ -5651,7 +5646,7 @@ static void atlas7_gpio_irq_mask(struct irq_data *d) static void atlas7_gpio_irq_unmask(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); + struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc); struct atlas7_gpio_bank *bank; void __iomem *ctrl_reg; u32 val, pin_in_bank; @@ -5675,7 +5670,7 @@ static int atlas7_gpio_irq_type(struct irq_data *d, unsigned int type) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); + struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc); struct atlas7_gpio_bank *bank; void __iomem *ctrl_reg; u32 val, pin_in_bank; @@ -5744,7 +5739,7 @@ static struct irq_chip atlas7_gpio_irq_chip = { static void atlas7_gpio_handle_irq(struct irq_desc *desc) { struct gpio_chip *gc = irq_desc_get_handler_data(desc); - struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); + struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc); struct atlas7_gpio_bank *bank = NULL; u32 status, ctrl; int pin_in_bank = 0, idx; @@ -5812,7 +5807,7 @@ static void __atlas7_gpio_set_input(struct atlas7_gpio_chip *a7gc, static int atlas7_gpio_request(struct gpio_chip *chip, unsigned int gpio) { - struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); + struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); int ret; unsigned long flags; @@ -5840,7 +5835,7 @@ static int atlas7_gpio_request(struct gpio_chip *chip, static void atlas7_gpio_free(struct gpio_chip *chip, unsigned int gpio) { - struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); + struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); unsigned long flags; spin_lock_irqsave(&a7gc->lock, flags); @@ -5856,7 +5851,7 @@ static void atlas7_gpio_free(struct gpio_chip *chip, static int atlas7_gpio_direction_input(struct gpio_chip *chip, unsigned int gpio) { - struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); + struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); unsigned long flags; spin_lock_irqsave(&a7gc->lock, flags); @@ -5893,7 +5888,7 @@ static void __atlas7_gpio_set_output(struct atlas7_gpio_chip *a7gc, static int atlas7_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio, int value) { - struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); + struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); unsigned long flags; spin_lock_irqsave(&a7gc->lock, flags); @@ -5908,7 +5903,7 @@ static int atlas7_gpio_direction_output(struct gpio_chip *chip, static int atlas7_gpio_get_value(struct gpio_chip *chip, unsigned int gpio) { - struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); + struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); struct atlas7_gpio_bank *bank; u32 val, pin_in_bank; unsigned long flags; @@ -5928,7 +5923,7 @@ static int atlas7_gpio_get_value(struct gpio_chip *chip, static void atlas7_gpio_set_value(struct gpio_chip *chip, unsigned int gpio, int value) { - struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); + struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip); struct atlas7_gpio_bank *bank; void __iomem *ctrl_reg; u32 ctrl, pin_in_bank; @@ -6015,7 +6010,7 @@ static int atlas7_gpio_probe(struct platform_device *pdev) chip->parent = &pdev->dev; /* Add gpio chip to system */ - ret = gpiochip_add(chip); + ret = gpiochip_add_data(chip, a7gc); if (ret) { dev_err(&pdev->dev, "%s: error in probe function with status %d\n",