From patchwork Wed Dec 9 13:48:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58122 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp679555lbb; Wed, 9 Dec 2015 05:48:07 -0800 (PST) X-Received: by 10.98.74.9 with SMTP id x9mr12958797pfa.139.1449668887657; Wed, 09 Dec 2015 05:48:07 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s90si12866349pfi.45.2015.12.09.05.48.07; Wed, 09 Dec 2015 05:48:07 -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 S1754325AbbLINsH (ORCPT + 4 others); Wed, 9 Dec 2015 08:48:07 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:36026 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753083AbbLINsF (ORCPT ); Wed, 9 Dec 2015 08:48:05 -0500 Received: by lfs39 with SMTP id 39so34757095lfs.3 for ; Wed, 09 Dec 2015 05:48:04 -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=SoAHI6CKb/I91dVBSlXyYFlis9CSeSHTIVwAfn4rpRQ=; b=RxSjND+Oh9eL1k+WjTvEAcu6h+l5aNSUc+L8E1Pn8h/V9cHEOgxC0Yp9aYY1iM+laR Bn+JyPdPmrnp/FZCmb5PhSKceVUPzedfX3b7zQQIiudf08s8FatbRVb0jVW4NfwNo6bi Nc3GgLx4I7BsjUhest/PtwEru8+KYQHOPNk8GhRPZpWo2k6XbSjBZPdK4jwxjyT43j1w XcEjMcquX1SzLWu0nayQ27TDRzAWFKvde2UaTc3eYjKgD/86iHKsU+DZMw6JswRdS82f qIzC4i194Lx5FRIr8v88dQJPfPjG4dtGrDKcAtYq8NYG5KiTkD1p7Az2mQ36x+odVM7z s7EA== 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=SoAHI6CKb/I91dVBSlXyYFlis9CSeSHTIVwAfn4rpRQ=; b=i2BYKvuRhWcd+uZma/H684az+UZFq1tXHH/RGPvbDTio6s6/5EhJ+Sr/j7NJDQ2Vxb m0kEfpLtbnx4bdSwG/s5jJp4duQosLI0LzvPwdhJHrtPdVNZOtDD2KTsxmbb6a2MdXQT nIz5JT6/o2fhmIPpp2ZPrutss8+AroyR2xyxzmW1zvH8IBaP9vX6yMpdYplHuup0j4qF feO3UGFTkRqG3ctcc0mbngTWxEHBZuy59K44JVuokQqbPLdXyPTIm9Ib/n/Z1KuXUrAX YwYECCBPJRmn+jh52ThRp+2ZcLvfIX4WLBVsU9s5KMKRQLhbGc7O15fBu6zBqWriwR14 CKMQ== X-Gm-Message-State: ALoCoQncWZkDjDT3fy105VJtRcYRQ4zGwovrCFBrcGw1Wd4sAU7oyGP3mEsZhaFGxMSEy1/qn8cOIOuqfDvDVYBOYFnvmH7tEA== X-Received: by 10.25.85.78 with SMTP id j75mr2259689lfb.46.1449668884049; Wed, 09 Dec 2015 05:48:04 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id ki2sm1420221lbc.15.2015.12.09.05.48.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:48:03 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Lee Jones Cc: Linus Walleij , Dmitry Baryshkov Subject: [PATCH 166/182] mfd: tc6393xb: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:48:00 +0100 Message-Id: <1449668880-6404-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: Lee Jones Cc: Dmitry Baryshkov Signed-off-by: Linus Walleij --- Lee please ACK this so I can take it through the GPIO tree. --- drivers/mfd/tc6393xb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 Acked-by: Lee Jones diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index 8c84a513016b..a5253f9a5089 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); } /*--------------------------------------------------------------------------*/