From patchwork Wed Mar 30 08:48:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 64648 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2467491lbc; Wed, 30 Mar 2016 01:49:02 -0700 (PDT) X-Received: by 10.66.220.66 with SMTP id pu2mr11054836pac.115.1459327741555; Wed, 30 Mar 2016 01:49:01 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 75si4979240pfs.118.2016.03.30.01.49.01; Wed, 30 Mar 2016 01:49:01 -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 S1758918AbcC3Isx (ORCPT + 29 others); Wed, 30 Mar 2016 04:48:53 -0400 Received: from mail-lb0-f173.google.com ([209.85.217.173]:34260 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758886AbcC3Iss (ORCPT ); Wed, 30 Mar 2016 04:48:48 -0400 Received: by mail-lb0-f173.google.com with SMTP id vo2so27087963lbb.1 for ; Wed, 30 Mar 2016 01:48:47 -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=7HFBI7v0HKVMbjf+ckqhk97+4fgjuHfRiUl9bQgyv84=; b=PBO0yoajIdSEP1lLojDWDSmqCVxYIi9e7nsCmDK0y/l5kkUAPsa5iQIZDXPLNthKat e2iZja9hpUXx82R1+Vze8206bVgGa33886jbwMs5ovifkXsvnQ3efIVJ4el/b+WpcYoK G5If8JnZZh++1S5WnW64/9yVF7gX221qU4Zzw= 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=7HFBI7v0HKVMbjf+ckqhk97+4fgjuHfRiUl9bQgyv84=; b=kJi/HChVgNi6DKPyLpij0KipiRbL1NAzCeHHWftHbArfUOFk4XJPImMRR4HSiHVcYk RwzZCtyKrZT/Nwgi4Whw43x5dPJ5TBaDOkjNjlLLcBtqOT4ZV8qwePmekDVahNUatAsS KxTc48MI73hZhYYNRAOIKUQcYryyvGMqrBYCW2EuwJkHUG+DaV+Px2DVz7IuHqNkvFYr 8PV+F+glh/0LrRY9yx5q5HuWcaihZ9D9TSqVikBVY2Ap1s3B8aEpIgwsxWrAlY7CFyDL 5nB75gcAbjA2Ewt7ql25uFbvEiyfHZcEdIFygDkVCfl5OiVkMY4/rCYQpY4Ob/efAmHo 8gug== X-Gm-Message-State: AD7BkJKbksi3ujirNaK01HDdxOTJTfhk7JOmsSDVe0Lc6XIYj7uL+uqge0UbbxkPTHeEH68k X-Received: by 10.112.167.37 with SMTP id zl5mr3355813lbb.60.1459327726332; Wed, 30 Mar 2016 01:48:46 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l10sm421542lfb.35.2016.03.30.01.48.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2016 01:48:45 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones , linux-kernel@vger.kernel.org Cc: Linus Walleij Subject: [PATCH 8/9] mfd: ucb1x00: Use gpiochip data pointer Date: Wed, 30 Mar 2016 10:48:08 +0200 Message-Id: <1459327689-12786-9-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(). Acked-by: Lee Jones Signed-off-by: Linus Walleij --- drivers/mfd/ucb1x00-core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.4.3 diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index bcafe1ecd71c..9ab9ec47ea75 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include static DEFINE_MUTEX(ucb1x00_mutex); static LIST_HEAD(ucb1x00_drivers); @@ -109,7 +109,7 @@ unsigned int ucb1x00_io_read(struct ucb1x00 *ucb) static void ucb1x00_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); + struct ucb1x00 *ucb = gpiochip_get_data(chip); unsigned long flags; spin_lock_irqsave(&ucb->io_lock, flags); @@ -126,7 +126,7 @@ static void ucb1x00_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int ucb1x00_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); + struct ucb1x00 *ucb = gpiochip_get_data(chip); unsigned val; ucb1x00_enable(ucb); @@ -138,7 +138,7 @@ static int ucb1x00_gpio_get(struct gpio_chip *chip, unsigned offset) static int ucb1x00_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); + struct ucb1x00 *ucb = gpiochip_get_data(chip); unsigned long flags; spin_lock_irqsave(&ucb->io_lock, flags); @@ -154,7 +154,7 @@ static int ucb1x00_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int ucb1x00_gpio_direction_output(struct gpio_chip *chip, unsigned offset , int value) { - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); + struct ucb1x00 *ucb = gpiochip_get_data(chip); unsigned long flags; unsigned old, mask = 1 << offset; @@ -181,7 +181,7 @@ static int ucb1x00_gpio_direction_output(struct gpio_chip *chip, unsigned offset static int ucb1x00_to_irq(struct gpio_chip *chip, unsigned offset) { - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); + struct ucb1x00 *ucb = gpiochip_get_data(chip); return ucb->irq_base > 0 ? ucb->irq_base + offset : -ENXIO; } @@ -579,7 +579,7 @@ static int ucb1x00_probe(struct mcp *mcp) ucb->gpio.direction_input = ucb1x00_gpio_direction_input; ucb->gpio.direction_output = ucb1x00_gpio_direction_output; ucb->gpio.to_irq = ucb1x00_to_irq; - ret = gpiochip_add(&ucb->gpio); + ret = gpiochip_add_data(&ucb->gpio, ucb); if (ret) goto err_gpio_add; } else