From patchwork Wed Dec 9 13:30:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58047 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp669566lbb; Wed, 9 Dec 2015 05:30:39 -0800 (PST) X-Received: by 10.98.70.138 with SMTP id o10mr12953204pfi.17.1449667839142; Wed, 09 Dec 2015 05:30:39 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si12813275pfa.51.2015.12.09.05.30.38; Wed, 09 Dec 2015 05:30:39 -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 S1754381AbbLINaf (ORCPT + 4 others); Wed, 9 Dec 2015 08:30:35 -0500 Received: from mail-lb0-f171.google.com ([209.85.217.171]:33324 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754356AbbLINad (ORCPT ); Wed, 9 Dec 2015 08:30:33 -0500 Received: by lbbkw15 with SMTP id kw15so30010582lbb.0 for ; Wed, 09 Dec 2015 05:30:32 -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=fFOCLO19mapVqlaicJo/hf5JNAT6TQfwXb5sgyYsieg=; b=ofPG9wj9Aqn+YhZY+YqinO71Q2nKGm1lCOh/vFcOo+UyPCOWy9EhPnzNyCTcZm12Fz O+rnCR3PbS+C8nDi+WX2yFWNEYv3YdhvgAWADplBOgHkj7OVGcjU5FkB+vHnp/NHHktv MEvUhX4/nDB/ZrhSzEUbKr8/ov3Tb3I6L8ogBwHZGnqnFsgrEjwohUX6zxGa0r4qltrg R3rEjqQFCIMY/7c3tDvxvsbgXmJ9Sb0pyqCQNZHUwcx49nbsky/XZd/0mbUNRkG0HqeH Rk8H92op+5aQt0kxGGLrByG9PPSVjONM7L5PkWcTeOJ2SC52qIx+yfBNayjndfI+sPu/ LKEQ== 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=fFOCLO19mapVqlaicJo/hf5JNAT6TQfwXb5sgyYsieg=; b=AUj+nKEF6XFBoV60iOSEirCq3KnI2xQHvyG2dNnaGecZzv7ZYuk2VdpccioJKDzOnz zXVuy+82sEGq25kJqOJ97UserYuVrFBd2rPdfnpJ/nvQLYlGVvQqRzZN1dClkYlWrPL6 5dxzAgEkaE6GkQmp6GVI6xFba7XuVXZV3iodQ8SQ/fVy1NbRm8J51gpX83tvIz92G6uH 4MCDPpY306RPSAxgBZWUPdAg8VFEROR9bMeWf0f6mYq2WNB4su1r/E3kc7AqtaQbYoPt BomEWHtAjx59hiq63YzE2NYofZHzph9yUlkPbcquUfdwxEU/NrIsdHoGIevz2GM7Fsv1 6Mvg== X-Gm-Message-State: ALoCoQmJKtgXArhLsG4Ywuu+c7T1iOb8eS0ipLW2603Uxhtc6EtYFc8BSePwl2hkKppXMi1y1H2BbwBX874QY5Ge957QDwLxfA== X-Received: by 10.112.199.194 with SMTP id jm2mr1928332lbc.109.1449667831869; Wed, 09 Dec 2015 05:30:31 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id s63sm1425448lfd.31.2015.12.09.05.30.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:30:31 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Mika Westerberg , Heikki Krogerus Subject: [PATCH 091/182] pinctrl: baytrail: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:30:28 +0100 Message-Id: <1449667828-1881-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: Mika Westerberg Cc: Heikki Krogerus Signed-off-by: Linus Walleij --- drivers/pinctrl/intel/pinctrl-baytrail.c | 32 +++++++++++++++----------------- 1 file changed, 15 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/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index bb92f8ae6b33..9d2fcc869f30 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -147,12 +147,10 @@ struct byt_gpio { struct byt_gpio_pin_context *saved_context; }; -#define to_byt_gpio(c) container_of(c, struct byt_gpio, chip) - static void __iomem *byt_gpio_reg(struct gpio_chip *chip, unsigned offset, int reg) { - struct byt_gpio *vg = to_byt_gpio(chip); + struct byt_gpio *vg = gpiochip_get_data(chip); u32 reg_offset; if (reg == BYT_INT_STAT_REG) @@ -193,7 +191,7 @@ static u32 byt_get_gpio_mux(struct byt_gpio *vg, unsigned offset) static int byt_gpio_request(struct gpio_chip *chip, unsigned offset) { - struct byt_gpio *vg = to_byt_gpio(chip); + struct byt_gpio *vg = gpiochip_get_data(chip); void __iomem *reg = byt_gpio_reg(chip, offset, BYT_CONF0_REG); u32 value, gpio_mux; unsigned long flags; @@ -229,7 +227,7 @@ static int byt_gpio_request(struct gpio_chip *chip, unsigned offset) static void byt_gpio_free(struct gpio_chip *chip, unsigned offset) { - struct byt_gpio *vg = to_byt_gpio(chip); + struct byt_gpio *vg = gpiochip_get_data(chip); byt_gpio_clear_triggering(vg, offset); pm_runtime_put(&vg->pdev->dev); @@ -237,7 +235,7 @@ static void byt_gpio_free(struct gpio_chip *chip, unsigned offset) static int byt_irq_type(struct irq_data *d, unsigned type) { - struct byt_gpio *vg = to_byt_gpio(irq_data_get_irq_chip_data(d)); + struct byt_gpio *vg = gpiochip_get_data(irq_data_get_irq_chip_data(d)); u32 offset = irqd_to_hwirq(d); u32 value; unsigned long flags; @@ -273,7 +271,7 @@ static int byt_irq_type(struct irq_data *d, unsigned type) static int byt_gpio_get(struct gpio_chip *chip, unsigned offset) { void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG); - struct byt_gpio *vg = to_byt_gpio(chip); + struct byt_gpio *vg = gpiochip_get_data(chip); unsigned long flags; u32 val; @@ -286,7 +284,7 @@ static int byt_gpio_get(struct gpio_chip *chip, unsigned offset) static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct byt_gpio *vg = to_byt_gpio(chip); + struct byt_gpio *vg = gpiochip_get_data(chip); void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG); unsigned long flags; u32 old_val; @@ -305,7 +303,7 @@ static void byt_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { - struct byt_gpio *vg = to_byt_gpio(chip); + struct byt_gpio *vg = gpiochip_get_data(chip); void __iomem *reg = byt_gpio_reg(chip, offset, BYT_VAL_REG); unsigned long flags; u32 value; @@ -324,7 +322,7 @@ static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int byt_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int value) { - struct byt_gpio *vg = to_byt_gpio(chip); + struct byt_gpio *vg = gpiochip_get_data(chip); void __iomem *conf_reg = byt_gpio_reg(chip, gpio, BYT_CONF0_REG); void __iomem *reg = byt_gpio_reg(chip, gpio, BYT_VAL_REG); unsigned long flags; @@ -356,7 +354,7 @@ static int byt_gpio_direction_output(struct gpio_chip *chip, static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) { - struct byt_gpio *vg = to_byt_gpio(chip); + struct byt_gpio *vg = gpiochip_get_data(chip); int i; u32 conf0, val, offs; @@ -428,7 +426,7 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) static void byt_gpio_irq_handler(struct irq_desc *desc) { struct irq_data *data = irq_desc_get_irq_data(desc); - struct byt_gpio *vg = to_byt_gpio(irq_desc_get_handler_data(desc)); + struct byt_gpio *vg = gpiochip_get_data(irq_desc_get_handler_data(desc)); struct irq_chip *chip = irq_data_get_irq_chip(data); u32 base, pin; void __iomem *reg; @@ -450,7 +448,7 @@ static void byt_gpio_irq_handler(struct irq_desc *desc) static void byt_irq_ack(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct byt_gpio *vg = to_byt_gpio(gc); + struct byt_gpio *vg = gpiochip_get_data(gc); unsigned offset = irqd_to_hwirq(d); void __iomem *reg; @@ -463,7 +461,7 @@ static void byt_irq_ack(struct irq_data *d) static void byt_irq_unmask(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct byt_gpio *vg = to_byt_gpio(gc); + struct byt_gpio *vg = gpiochip_get_data(gc); unsigned offset = irqd_to_hwirq(d); unsigned long flags; void __iomem *reg; @@ -498,7 +496,7 @@ static void byt_irq_unmask(struct irq_data *d) static void byt_irq_mask(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct byt_gpio *vg = to_byt_gpio(gc); + struct byt_gpio *vg = gpiochip_get_data(gc); byt_gpio_clear_triggering(vg, irqd_to_hwirq(d)); } @@ -605,7 +603,7 @@ static int byt_gpio_probe(struct platform_device *pdev) sizeof(*vg->saved_context), GFP_KERNEL); #endif - ret = gpiochip_add(gc); + ret = gpiochip_add_data(gc, vg); if (ret) { dev_err(&pdev->dev, "failed adding byt-gpio chip\n"); return ret;