From patchwork Wed Mar 30 08:48:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 64647 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2467486lbc; Wed, 30 Mar 2016 01:49:01 -0700 (PDT) X-Received: by 10.98.34.200 with SMTP id p69mr11019915pfj.114.1459327740927; Wed, 30 Mar 2016 01:49:00 -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.00; Wed, 30 Mar 2016 01:49:00 -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 S1758885AbcC3Isq (ORCPT + 29 others); Wed, 30 Mar 2016 04:48:46 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:36142 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758809AbcC3Isn (ORCPT ); Wed, 30 Mar 2016 04:48:43 -0400 Received: by mail-lf0-f53.google.com with SMTP id e133so30681424lfe.3 for ; Wed, 30 Mar 2016 01:48:43 -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=UrF7E/i4JVt6aqj4IOaJI2DaLZ63NpuPaQpiJ1Cq1Gs=; b=UM22/Fv7pmt5VskJYlcr7DhgRH/3vwfrPN901/iFQSH+HRuYyk072rcWgcLvmuGfpa RcpJFhtCQ+1FhqpjDS2Si7ktdZrK/B7acvjsJ6IDWqk6yTaFqWdZlFOeF/45gYbxrgCi rP26wrt1i77yfpZAh1bjNeJs9Cpr+uT4FwYLc= 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=UrF7E/i4JVt6aqj4IOaJI2DaLZ63NpuPaQpiJ1Cq1Gs=; b=BTTs/Bsxj0YzwfGHfN+tBWYYdx8v2bNV8osROGuT6HqgYeAdJKb1OOqxF/O90MAY7m ue1B0azpV4RpJBmsN2m4HoX4+SQU5SeO0f86pqqFa6DVPQUu+5YolB+S/vom3uv7HafZ 9uGX4Bx8qQ245d9Hy8kpCTkXgX/DPlutlRB0LpULSi1CSNiAcJ2fNaGQk5EhOc0Rpsqe gBhUZi2zicUY1TAQocu2OaKKPLRoFF5BfHcyym/BJId/T0U+FOoYf+8a2ekxzFjssFFa NtasfL4RW3e/q81H8rABCn4HBMzltkz4GquArYtzIGbf0jpfHswUzUxg81mbk2dEpBRA BWjg== X-Gm-Message-State: AD7BkJIxTPD86pnubiwNec3CV6457ccfY5eqX25qvo6tVyWdQljkVb2tF03p0ZYp8KiMrWR2 X-Received: by 10.25.87.137 with SMTP id l131mr2723452lfb.65.1459327722259; Wed, 30 Mar 2016 01:48:42 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l10sm421542lfb.35.2016.03.30.01.48.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2016 01:48:41 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones , linux-kernel@vger.kernel.org Cc: Linus Walleij , Dmitry Baryshkov Subject: [PATCH 6/9] mfd: tc6393xb: Use gpiochip data pointer Date: Wed, 30 Mar 2016 10:48:06 +0200 Message-Id: <1459327689-12786-7-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: Dmitry Baryshkov Acked-by: Lee Jones Signed-off-by: Linus Walleij --- drivers/mfd/tc6393xb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.4.3 diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index 1ecbfa40d1b3..d42d322ac7ca 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #define SCR_REVID 0x08 /* b Revision ID */ @@ -434,7 +434,7 @@ static struct mfd_cell tc6393xb_cells[] = { static int tc6393xb_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); + struct tc6393xb *tc6393xb = gpiochip_get_data(chip); /* XXX: does dsr also represent inputs? */ return !!(tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)) @@ -444,7 +444,7 @@ static int tc6393xb_gpio_get(struct gpio_chip *chip, static void __tc6393xb_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); + struct tc6393xb *tc6393xb = gpiochip_get_data(chip); u8 dsr; dsr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)); @@ -459,7 +459,7 @@ static void __tc6393xb_gpio_set(struct gpio_chip *chip, static void tc6393xb_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); + struct tc6393xb *tc6393xb = gpiochip_get_data(chip); unsigned long flags; spin_lock_irqsave(&tc6393xb->lock, flags); @@ -472,7 +472,7 @@ static void tc6393xb_gpio_set(struct gpio_chip *chip, static int tc6393xb_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { - struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); + struct tc6393xb *tc6393xb = gpiochip_get_data(chip); unsigned long flags; u8 doecr; @@ -490,7 +490,7 @@ static int tc6393xb_gpio_direction_input(struct gpio_chip *chip, static int tc6393xb_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) { - struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); + struct tc6393xb *tc6393xb = gpiochip_get_data(chip); unsigned long flags; u8 doecr; @@ -517,7 +517,7 @@ static int tc6393xb_register_gpio(struct tc6393xb *tc6393xb, int gpio_base) tc6393xb->gpio.direction_input = tc6393xb_gpio_direction_input; tc6393xb->gpio.direction_output = tc6393xb_gpio_direction_output; - return gpiochip_add(&tc6393xb->gpio); + return gpiochip_add_data(&tc6393xb->gpio, tc6393xb); } /*--------------------------------------------------------------------------*/