From patchwork Wed Dec 9 13:27: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: 554550 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 8AF49140313 for ; Thu, 10 Dec 2015 00:27:07 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro-org.20150623.gappssmtp.com header.i=@linaro-org.20150623.gappssmtp.com header.b=O8XDAErt; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754148AbbLIN1H (ORCPT ); Wed, 9 Dec 2015 08:27:07 -0500 Received: from mail-lf0-f49.google.com ([209.85.215.49]:34848 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753942AbbLIN1F (ORCPT ); Wed, 9 Dec 2015 08:27:05 -0500 Received: by lfdl133 with SMTP id l133so34016818lfd.2 for ; Wed, 09 Dec 2015 05:27:03 -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=VnwyWshR/UlhViaeudAn/+WxKoJP8BFwsNkTDKz/pv4=; b=O8XDAErteq7YKrmSKfVGiGtbvAjloc6Sinh7HdzDPhVqk/8bicriB+0B3MAcS0xbSE gCIV2W8T0BBnNdop9K/vhwIqHHdMu9l2CUH/GO0Ad5/rARTgWQGd7THhb0+5Q6870vSh IMuUSVHwVIc0kWdUm+1whrhYtJBYNdTDPkNfY89GS7BNo79pBDEcvIDSPA8LmZW5vo44 KDdxOifoViCeaWgL/5oPzxhlx0wJbHgVBniiyzEYiaRUpDFNKSgF+q9aoaJ1Otc/Anqk H17TsWqClFLmKHm+9BulNLcO4TWj27/HeFhL3uk2GANvyfY42N0ES+XW3HjAmJ97NGQE aF6Q== 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=VnwyWshR/UlhViaeudAn/+WxKoJP8BFwsNkTDKz/pv4=; b=VTguYzorBrri2AGBeC1XuqHbThubLHYzvzMrHXT8FbmVjcSRA3P7ubN1Fqi8iNe9xg yOG+P7FaGKLsDO7LqAZnCm+dNSakFoGz7TNfwzJJqhBXWe6bHfUeHB/AbBl71r1gL23Z SSMbeNcahnI09NBR3uvJlW187bmW6TlqXuATjcQ6dVnc0qnV5VLX0LObN27QP3PgBuGB S3NLGvt2nBb5jSORpqPltf57FvT3MBapDVkUDYdmPQPQKB5qZ+QlekbLv4s9r/xnTJuE hcIZqQDVS6wz5O8qU28XstthC2bucVCntiKvWZ1b87Wna940q1hqrxM7d4DsythPR98M WKVg== X-Gm-Message-State: ALoCoQl+Fm+iOVK9dp1tmZJ5/JnjEgJJygkHDLjpXHa+RHMddQX8TcAyscxO0YoHWvQp0yZrNbrbE+1+rBc0JtcUmnJlWogckg== X-Received: by 10.25.24.193 with SMTP id 62mr2314031lfy.84.1449667623870; Wed, 09 Dec 2015 05:27:03 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id rm5sm1404227lbb.20.2015.12.09.05.27.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:27:03 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , James Hogan Subject: [PATCH 073/182] gpio: tz1090-pdc: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:27:00 +0100 Message-Id: <1449667620-870-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: James Hogan Signed-off-by: Linus Walleij --- drivers/gpio/gpio-tz1090-pdc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-tz1090-pdc.c b/drivers/gpio/gpio-tz1090-pdc.c index a974397164b2..c182342297ac 100644 --- a/drivers/gpio/gpio-tz1090-pdc.c +++ b/drivers/gpio/gpio-tz1090-pdc.c @@ -49,7 +49,6 @@ struct tz1090_pdc_gpio { void __iomem *reg; int irq[GPIO_PDC_NIRQ]; }; -#define to_pdc(c) container_of(c, struct tz1090_pdc_gpio, chip) /* Register accesses into the PDC MMIO area */ @@ -70,7 +69,7 @@ static inline unsigned int pdc_read(struct tz1090_pdc_gpio *priv, static int tz1090_pdc_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_pdc_gpio *priv = to_pdc(chip); + struct tz1090_pdc_gpio *priv = gpiochip_get_data(chip); u32 value; int lstat; @@ -87,7 +86,7 @@ static int tz1090_pdc_gpio_direction_output(struct gpio_chip *chip, unsigned int offset, int output_value) { - struct tz1090_pdc_gpio *priv = to_pdc(chip); + struct tz1090_pdc_gpio *priv = gpiochip_get_data(chip); u32 value; int lstat; @@ -112,14 +111,14 @@ static int tz1090_pdc_gpio_direction_output(struct gpio_chip *chip, static int tz1090_pdc_gpio_get(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_pdc_gpio *priv = to_pdc(chip); + struct tz1090_pdc_gpio *priv = gpiochip_get_data(chip); return pdc_read(priv, REG_SOC_GPIO_STATUS) & BIT(offset); } static void tz1090_pdc_gpio_set(struct gpio_chip *chip, unsigned int offset, int output_value) { - struct tz1090_pdc_gpio *priv = to_pdc(chip); + struct tz1090_pdc_gpio *priv = gpiochip_get_data(chip); u32 value; int lstat; @@ -139,7 +138,7 @@ static void tz1090_pdc_gpio_set(struct gpio_chip *chip, unsigned int offset, static int tz1090_pdc_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_pdc_gpio *priv = to_pdc(chip); + struct tz1090_pdc_gpio *priv = gpiochip_get_data(chip); unsigned int syswake = offset - GPIO_PDC_IRQ_FIRST; int irq; @@ -207,7 +206,7 @@ static int tz1090_pdc_gpio_probe(struct platform_device *pdev) priv->irq[i] = irq_of_parse_and_map(np, i); /* Add the GPIO bank */ - gpiochip_add(&priv->chip); + gpiochip_add_data(&priv->chip, priv); return 0; }