From patchwork Wed Mar 30 08:48:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 64645 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2467413lbc; Wed, 30 Mar 2016 01:48:48 -0700 (PDT) X-Received: by 10.67.3.67 with SMTP id bu3mr10961413pad.39.1459327728118; Wed, 30 Mar 2016 01:48:48 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dx1si4992598pab.85.2016.03.30.01.48.47; Wed, 30 Mar 2016 01:48:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758832AbcC3Isd (ORCPT + 29 others); Wed, 30 Mar 2016 04:48:33 -0400 Received: from mail-lb0-f177.google.com ([209.85.217.177]:34067 "EHLO mail-lb0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753503AbcC3Is1 (ORCPT ); Wed, 30 Mar 2016 04:48:27 -0400 Received: by mail-lb0-f177.google.com with SMTP id vo2so27082575lbb.1 for ; Wed, 30 Mar 2016 01:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6ZDfrLNyTpXn1ipeJGTA9fhSUYqRW1l1RP+NFsKkywg=; b=Zmo90N4x8anGUCoPmqaKYs+8rrbXLe+4H22V6ats/q4WJcKQydil63aPOGRkgG8QTa W1aZ9nHZfwMJ2vrvwY5qnQU7rHJE2Ut0GB4tz32lCmcPBU2v8WtDR9XwnPzcx1dvhxiV x9zB7bLMPCq/xDVY+Uvn3J38QQu4z7ibpfC1c= 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:in-reply-to :references; bh=6ZDfrLNyTpXn1ipeJGTA9fhSUYqRW1l1RP+NFsKkywg=; b=PsjHUqbvDPnWAzT4AnGwhLyzl1bfBB5NK2Ly0WNGadliimQT2cl/KsolB5k1vftJO0 vVfqQpUg+AAlmfO/9NAI3J4VMiTskxWgDqPEJr0ddgxPTC87MeZfrgcnBVAsrDSZXpBp o9ICqZtEvOits+GK+hUTdn/steit+G2owNIUVOamjJh+GVzAQ22ZEB0Lokun/HMRaRLl +Kv56LvyL0EY3fsMsFnymZhRA5pm4O6DAobX3rAB3ccjj6kKKHxb77abhaeQ8vFnzxHO 5uh7WRZQqp15lqjL/rXqpy6kM71gD3T5bDAcZcQQSTURZAssKL0zuW6RyWgEWex4UmJg fzUg== X-Gm-Message-State: AD7BkJJQqNzc+VIA5MZceXZP/z8N2eq1t1L2V6XgD6cUNplyXc8yiXIgCS8cXVT1qHCWmwO1 X-Received: by 10.112.125.9 with SMTP id mm9mr2710823lbb.113.1459327705321; Wed, 30 Mar 2016 01:48:25 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l10sm421542lfb.35.2016.03.30.01.48.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2016 01:48:24 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones , linux-kernel@vger.kernel.org Cc: Linus Walleij , Paul Parsons Subject: [PATCH 1/9] mfd: asic3: Use gpiochip data pointer Date: Wed, 30 Mar 2016 10:48:01 +0200 Message-Id: <1459327689-12786-2-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1459327689-12786-1-git-send-email-linus.walleij@linaro.org> References: <1459327689-12786-1-git-send-email-linus.walleij@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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: Paul Parsons Acked-by: Lee Jones Signed-off-by: Linus Walleij --- drivers/mfd/asic3.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.4.3 diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 4dca6bc61f5b..0413c8159551 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c @@ -446,7 +446,7 @@ static int asic3_gpio_direction(struct gpio_chip *chip, unsigned long flags; struct asic3 *asic; - asic = container_of(chip, struct asic3, gpio); + asic = gpiochip_get_data(chip); gpio_base = ASIC3_GPIO_TO_BASE(offset); if (gpio_base > ASIC3_GPIO_D_BASE) { @@ -492,7 +492,7 @@ static int asic3_gpio_get(struct gpio_chip *chip, u32 mask = ASIC3_GPIO_TO_MASK(offset); struct asic3 *asic; - asic = container_of(chip, struct asic3, gpio); + asic = gpiochip_get_data(chip); gpio_base = ASIC3_GPIO_TO_BASE(offset); if (gpio_base > ASIC3_GPIO_D_BASE) { @@ -513,7 +513,7 @@ static void asic3_gpio_set(struct gpio_chip *chip, unsigned long flags; struct asic3 *asic; - asic = container_of(chip, struct asic3, gpio); + asic = gpiochip_get_data(chip); gpio_base = ASIC3_GPIO_TO_BASE(offset); if (gpio_base > ASIC3_GPIO_D_BASE) { @@ -540,7 +540,7 @@ static void asic3_gpio_set(struct gpio_chip *chip, static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) { - struct asic3 *asic = container_of(chip, struct asic3, gpio); + struct asic3 *asic = gpiochip_get_data(chip); return asic->irq_base + offset; } @@ -595,7 +595,7 @@ static __init int asic3_gpio_probe(struct platform_device *pdev, alt_reg[i]); } - return gpiochip_add(&asic->gpio); + return gpiochip_add_data(&asic->gpio, asic); } static int asic3_gpio_remove(struct platform_device *pdev)