From patchwork Wed Mar 30 08:48:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 64649 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2467563lbc; Wed, 30 Mar 2016 01:49:14 -0700 (PDT) X-Received: by 10.98.14.2 with SMTP id w2mr11057462pfi.35.1459327754586; Wed, 30 Mar 2016 01:49:14 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a22si4978372pfj.116.2016.03.30.01.49.14; Wed, 30 Mar 2016 01:49:14 -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 S1758903AbcC3Isv (ORCPT + 29 others); Wed, 30 Mar 2016 04:48:51 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]:35680 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758869AbcC3Isq (ORCPT ); Wed, 30 Mar 2016 04:48:46 -0400 Received: by mail-lb0-f181.google.com with SMTP id bc4so27063385lbc.2 for ; Wed, 30 Mar 2016 01:48:40 -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=KKEMmOXGJq4C9t792NoFESWmA5ddcTFIePtq1Fyh2Ek=; b=e0JSO+497VbBJ4SQWB8H3HbqvtxWTWjrtQdmWqqGi6sH4ips7RLbzxtzAklOQO2rAT 4Tgr3/NidU1Zk1VC0RRbhXMjunXSWBOKbQVn2RQXicS1ZZYbvVRC4nry9xDICc58kqPy vxBNYtgnJsPyUV+f14ZHIkxaglqR7OwH/vGnE= 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=KKEMmOXGJq4C9t792NoFESWmA5ddcTFIePtq1Fyh2Ek=; b=D/mtujiFtDa2z6VrZtrgc5kWbhonqoIF5a4FC5C0SGoFMv8IzDNjerCNpYyCCPSbrI nCmTnjnXMF/rWbTmp+7AGzmezL7npJaW2CNSh4HKrdMeTkWJ9jO4spYzYb3JXMAZ04ez dKB4FVLXsvi86OpbXo9rSyxTC2RAEPInNgova3uwwy7bkqoZNAANZ6v3Brd2+z15WPjq SkWQkNyrYzeEVkBa2RFn6hs9e9rPyaRiCqEGJ0vHQDxmatMhwYOO9thF9MmBJziVCybI sccogiM6tectl8Qka/wI9yZh3nnmFi5/ZdJIUAQNOU3zT/TlQ9Uug9CVZ1m9CjKTPMMe ml9A== X-Gm-Message-State: AD7BkJIjU09TxnwQGS/XH1C8nIDBIkeLNf7efp/tXm6ZQpoGc3eDlj9okxJTMQnQ9IxMxz1N X-Received: by 10.112.163.102 with SMTP id yh6mr3163307lbb.4.1459327719486; Wed, 30 Mar 2016 01:48:39 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l10sm421542lfb.35.2016.03.30.01.48.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2016 01:48:38 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones , linux-kernel@vger.kernel.org Cc: Linus Walleij , Ben Dooks Subject: [PATCH 5/9] mfd: sm501: Use gpiochip data pointer Date: Wed, 30 Mar 2016 10:48:05 +0200 Message-Id: <1459327689-12786-6-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: Ben Dooks Acked-by: Lee Jones Signed-off-by: Linus Walleij --- drivers/mfd/sm501.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) -- 2.4.3 diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index c646784c5a7d..65cd0d2a822a 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -879,11 +879,6 @@ static int sm501_register_display(struct sm501_devdata *sm, #ifdef CONFIG_MFD_SM501_GPIO -static inline struct sm501_gpio_chip *to_sm501_gpio(struct gpio_chip *gc) -{ - return container_of(gc, struct sm501_gpio_chip, gpio); -} - static inline struct sm501_devdata *sm501_gpio_to_dev(struct sm501_gpio *gpio) { return container_of(gpio, struct sm501_devdata, gpio); @@ -892,7 +887,7 @@ static inline struct sm501_devdata *sm501_gpio_to_dev(struct sm501_gpio *gpio) static int sm501_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct sm501_gpio_chip *smgpio = to_sm501_gpio(chip); + struct sm501_gpio_chip *smgpio = gpiochip_get_data(chip); unsigned long result; result = smc501_readl(smgpio->regbase + SM501_GPIO_DATA_LOW); @@ -923,7 +918,7 @@ static void sm501_gpio_ensure_gpio(struct sm501_gpio_chip *smchip, static void sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct sm501_gpio_chip *smchip = to_sm501_gpio(chip); + struct sm501_gpio_chip *smchip = gpiochip_get_data(chip); struct sm501_gpio *smgpio = smchip->ourgpio; unsigned long bit = 1 << offset; void __iomem *regs = smchip->regbase; @@ -948,7 +943,7 @@ static void sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int sm501_gpio_input(struct gpio_chip *chip, unsigned offset) { - struct sm501_gpio_chip *smchip = to_sm501_gpio(chip); + struct sm501_gpio_chip *smchip = gpiochip_get_data(chip); struct sm501_gpio *smgpio = smchip->ourgpio; void __iomem *regs = smchip->regbase; unsigned long bit = 1 << offset; @@ -974,7 +969,7 @@ static int sm501_gpio_input(struct gpio_chip *chip, unsigned offset) static int sm501_gpio_output(struct gpio_chip *chip, unsigned offset, int value) { - struct sm501_gpio_chip *smchip = to_sm501_gpio(chip); + struct sm501_gpio_chip *smchip = gpiochip_get_data(chip); struct sm501_gpio *smgpio = smchip->ourgpio; unsigned long bit = 1 << offset; void __iomem *regs = smchip->regbase; @@ -1039,7 +1034,7 @@ static int sm501_gpio_register_chip(struct sm501_devdata *sm, gchip->base = base; chip->ourgpio = gpio; - return gpiochip_add(gchip); + return gpiochip_add_data(gchip, chip); } static int sm501_register_gpio(struct sm501_devdata *sm)