From patchwork Wed Dec 9 13:34:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58075 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp671835lbb; Wed, 9 Dec 2015 05:34:11 -0800 (PST) X-Received: by 10.66.160.194 with SMTP id xm2mr7867652pab.68.1449668050959; Wed, 09 Dec 2015 05:34:10 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nx14si12797123pab.69.2015.12.09.05.34.10; Wed, 09 Dec 2015 05:34:10 -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 S1754189AbbLINeI (ORCPT + 4 others); Wed, 9 Dec 2015 08:34:08 -0500 Received: from mail-lf0-f48.google.com ([209.85.215.48]:36625 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754149AbbLINeH (ORCPT ); Wed, 9 Dec 2015 08:34:07 -0500 Received: by lfs39 with SMTP id 39so34484338lfs.3 for ; Wed, 09 Dec 2015 05:34:06 -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=SUNLUpIungOGREjwBAgsucZBjihB1JALVJLVNCvSUYg=; b=1ZINFbzEauBom8OXlVtwDIkuN31CYu2VHOz6/nMtnO8W+g44hTIOucXcuXlbnKlBa4 +HRrnUzBtMwhXWRAeTewDmjq+uAHi05QuAhTFwhW6UwIYFiTrkqnbwhNY0E8QGoLGx/K ZV9j6vXwhHPgk3xC9onN/J9TdyWpmDOJE1P/2WxJ0dh23bImhzXeGo1K6clPtLHsONBl naKLzHV+qAflZ5HBceOfxXmwuyioupQ1P5neK/uG7GPtMLTDrwzTqJSPEykYJzFvzSu3 OVnOalDViroGRVcl/HjUhpriD/gyEG68xcAZTFUt1luuNBfjIXIhHBEPjhf2YmddDcXq dEsQ== 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=SUNLUpIungOGREjwBAgsucZBjihB1JALVJLVNCvSUYg=; b=DPzn82dwnKVDAASEZ6MguiyWjuu8GQ1Khn3y0mUNUMBx8eW9MYUbgi3xyi9dt3at9l s9DNieDcsZ0/xCZAfA3no6nufV6JYZqXa9Ddvecn9/m8tbtmnVvIihDHX/veN/VAVfTG YgEqcUnMG4ISzMN3UNkTg9WllJ4Uri9U20Uwc+nt7p53kvFkx7q8Nz/T06fVBZUdchY8 JO22gLsomx9eybWrRccmoDFgB7yf2F+7k429iAoCbsFB67FuOm/60pUcqreuJHDYiGH6 u89PAv2M8cV8Ra8GcpZkNRleBYCaGMhAwaMnNrIOzk1iCdmNlJSJqrar/4+i09VX07+9 5S7A== X-Gm-Message-State: ALoCoQlBY/oUfQfTKDxAekHeaob+mprPxwGRHBokmj8MsD1rz3ktkAXj+jXXSheeKfyQClQ/Pj14JeZWEFD95o3ZHzSiy43IVQ== X-Received: by 10.25.160.213 with SMTP id j204mr2410813lfe.85.1449668046555; Wed, 09 Dec 2015 05:34:06 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a2sm1428519lbp.37.2015.12.09.05.34.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:34:05 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Ludovic Desroches Subject: [PATCH 119/182] pinctrl: at91-pio4: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:34:03 +0100 Message-Id: <1449668043-3438-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: Ludovic Desroches Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-at91-pio4.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 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/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c index f1daf8580167..27540f5a1067 100644 --- a/drivers/pinctrl/pinctrl-at91-pio4.c +++ b/drivers/pinctrl/pinctrl-at91-pio4.c @@ -15,6 +15,8 @@ */ #include +#include +/* FIXME: needed for gpio_to_irq(), get rid of this */ #include #include #include @@ -290,7 +292,7 @@ static void atmel_gpio_irq_handler(struct irq_desc *desc) static int atmel_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { - struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); + struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip); struct atmel_pin *pin = atmel_pioctrl->pins[offset]; unsigned reg; @@ -305,7 +307,7 @@ static int atmel_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int atmel_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); + struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip); struct atmel_pin *pin = atmel_pioctrl->pins[offset]; unsigned reg; @@ -317,7 +319,7 @@ static int atmel_gpio_get(struct gpio_chip *chip, unsigned offset) static int atmel_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) { - struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); + struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip); struct atmel_pin *pin = atmel_pioctrl->pins[offset]; unsigned reg; @@ -336,7 +338,7 @@ static int atmel_gpio_direction_output(struct gpio_chip *chip, unsigned offset, static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val) { - struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); + struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip); struct atmel_pin *pin = atmel_pioctrl->pins[offset]; atmel_gpio_write(atmel_pioctrl, pin->bank, @@ -346,7 +348,7 @@ static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val) static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset) { - struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); + struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip); return irq_find_mapping(atmel_pioctrl->irq_domain, offset); } @@ -1037,7 +1039,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) goto pinctrl_register_error; } - ret = gpiochip_add(atmel_pioctrl->gpio_chip); + ret = gpiochip_add_data(atmel_pioctrl->gpio_chip, atmel_pioctrl); if (ret) { dev_err(dev, "failed to add gpiochip\n"); goto gpiochip_add_error;