From patchwork Wed Dec 9 13:33:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58068 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp671263lbb; Wed, 9 Dec 2015 05:33:18 -0800 (PST) X-Received: by 10.98.68.83 with SMTP id r80mr12781530pfa.120.1449667997937; Wed, 09 Dec 2015 05:33:17 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si12782315pfa.123.2015.12.09.05.33.17; Wed, 09 Dec 2015 05:33:17 -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 S1754425AbbLINdR (ORCPT + 4 others); Wed, 9 Dec 2015 08:33:17 -0500 Received: from mail-lb0-f175.google.com ([209.85.217.175]:36635 "EHLO mail-lb0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751883AbbLINdQ (ORCPT ); Wed, 9 Dec 2015 08:33:16 -0500 Received: by lbblt2 with SMTP id lt2so30164517lbb.3 for ; Wed, 09 Dec 2015 05:33:15 -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=yDuzXQ8Mdp9Y37PL07R6NP0P2viw/BbZ472ePxQDJPE=; b=dupjg+HwlpWCimsWz3+d3ehLZ8k0vitsnQah2ozNYVn+vPNq/B2OjNKZz5AOP74N4U otYfKGqsxgIn99QqtoLt0YJdNv/vYc+3+VOu32Zw3gBUkZlxoV+6++Da06TS1UQJbmsc 1ROeg43wII/L/2oL8bhIXNGiJzb5w6IiMxrdMmB09x19MbHx684i2LfprgITpJ4flcPX 0uG+CgkKG47PqCcBUo1PoVgfBEgM1MbCj6XQLYPkYj26Mcsf7mnsv+nPZac0CNWJh34G bMDmJ+I0Eg8rz48zD9wKfG5ZD/uim152OEHfq8SZDTDtQyTGihKkJ99HbZF4qxYbzayM daSg== 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=yDuzXQ8Mdp9Y37PL07R6NP0P2viw/BbZ472ePxQDJPE=; b=HFXgq0BHM/EtwI79K7B8mFurXjJh01mCw7/AhsU5CE8mfohfJMCUKlsCV6OUREL8gj xxXGA/fV+R21u99nbT9YDj0uh931/wWk5U1N0+H8HKOcjR8ZVFNxKDKjh6NM9Yhswjlw 0vOggjnuDfMy9OwnnBT1MEa8FZr0hApHPUbrP2uMlxQU1AWJcA4uYrN5N/F/UM/O6wY8 8o8n7mSqEwVNByDQoGjPwz0+DUrW0rW8d0q9gFVRFuWqGLhyufTQ1L6Et1fChwDfCiVY ZDTLINkjVV6zekMRNicBCt3eazPHqCHJvL75SlWIGgfEgiPPTdHJreU1+yuJemwhfSBg SVgA== X-Gm-Message-State: ALoCoQm84wrFq7Cvkp/K0OBvRCmBYGjnauF8/75VNJHgOmCyrLDWX05eYsVWwDy56Ud71uVV0S6Thsxic/WEnPbStQ/dW7ttwQ== X-Received: by 10.112.173.202 with SMTP id bm10mr2024010lbc.56.1449667995366; Wed, 09 Dec 2015 05:33:15 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id f71sm1445392lfe.36.2015.12.09.05.33.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:33:14 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Tomasz Figa Subject: [PATCH 112/182] pinctrl: samsung: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:33:12 +0100 Message-Id: <1449667992-3104-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: Tomasz Figa Signed-off-by: Linus Walleij --- drivers/pinctrl/samsung/pinctrl-samsung.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 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/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index bb4db2050f19..a4fb8379f521 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -50,11 +50,6 @@ static LIST_HEAD(drvdata_list); static unsigned int pin_base; -static inline struct samsung_pin_bank *gc_to_pin_bank(struct gpio_chip *gc) -{ - return container_of(gc, struct samsung_pin_bank, gpio_chip); -} - static int samsung_get_group_count(struct pinctrl_dev *pctldev) { struct samsung_pinctrl_drv_data *pmx = pinctrl_dev_get_drvdata(pctldev); @@ -522,7 +517,7 @@ static const struct pinconf_ops samsung_pinconf_ops = { /* gpiolib gpio_set callback function */ static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { - struct samsung_pin_bank *bank = gc_to_pin_bank(gc); + struct samsung_pin_bank *bank = gpiochip_get_data(gc); const struct samsung_pin_bank_type *type = bank->type; unsigned long flags; void __iomem *reg; @@ -546,7 +541,7 @@ static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset) { void __iomem *reg; u32 data; - struct samsung_pin_bank *bank = gc_to_pin_bank(gc); + struct samsung_pin_bank *bank = gpiochip_get_data(gc); const struct samsung_pin_bank_type *type = bank->type; reg = bank->drvdata->virt_base + bank->pctl_offset; @@ -571,7 +566,7 @@ static int samsung_gpio_set_direction(struct gpio_chip *gc, u32 data, mask, shift; unsigned long flags; - bank = gc_to_pin_bank(gc); + bank = gpiochip_get_data(gc); type = bank->type; drvdata = bank->drvdata; @@ -619,7 +614,7 @@ static int samsung_gpio_direction_output(struct gpio_chip *gc, unsigned offset, */ static int samsung_gpio_to_irq(struct gpio_chip *gc, unsigned offset) { - struct samsung_pin_bank *bank = gc_to_pin_bank(gc); + struct samsung_pin_bank *bank = gpiochip_get_data(gc); unsigned int virq; if (!bank->irq_domain) @@ -918,7 +913,7 @@ static int samsung_gpiolib_register(struct platform_device *pdev, gc->of_node = bank->of_node; gc->label = bank->name; - ret = gpiochip_add(gc); + ret = gpiochip_add_data(gc, bank); if (ret) { dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n", gc->label, ret);