From patchwork Wed Dec 9 13:22:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58010 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp664976lbb; Wed, 9 Dec 2015 05:22:24 -0800 (PST) X-Received: by 10.66.192.7 with SMTP id hc7mr7972436pac.48.1449667343891; Wed, 09 Dec 2015 05:22:23 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pz5si12706894pac.133.2015.12.09.05.22.23; Wed, 09 Dec 2015 05:22:23 -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 S1754299AbbLINWW (ORCPT + 4 others); Wed, 9 Dec 2015 08:22:22 -0500 Received: from mail-lf0-f48.google.com ([209.85.215.48]:36349 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754284AbbLINWU (ORCPT ); Wed, 9 Dec 2015 08:22:20 -0500 Received: by lfs39 with SMTP id 39so34253889lfs.3 for ; Wed, 09 Dec 2015 05:22:18 -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=X4Wbh+Ag/Mzg/ut6L0eP2/5Njlzq4z9PDDK4x1dQxuw=; b=oj56fW/GL5FGAOIYGsmgqPwShZ4cIL+GHkVs54XHWc+UkWUxs8lk/xG7b4WeFplRIy v1ZO44at855qHVRwv3EvDeu/aLqu1hVl89vrD5f+FyCGyKBzBA13W/CzQ9G0HD2MN+Hh 7NTLwTijAedNEbg9Y9Dr+abL6TG5pxfEc1bgoBHyyBxoRDu9xopF/ErMLZ2ya+GTV0S2 YElT4b746+ZbRMfAQmP9lt/z8UlJMXMtqLxetlkDDDiXkA1xNsx1yNz3XVUghEpbDDWP i487hLeMa9/1mTTXvIoNLPg1tkTy4k7JRgxSeDkWVsV5WE3jjJGbKbt4+Xvw5zNJ3vHZ su7Q== 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=X4Wbh+Ag/Mzg/ut6L0eP2/5Njlzq4z9PDDK4x1dQxuw=; b=mdP8AMC3esKpMldwNlZHYnCNtyw4oznVFmCHWL31MM3Fy5tli8yRcCKZEvVak/dqbZ LnGoidiHBt3z51x+7EtxUd0u11Evfbugde+5adH1qLL45VrmzOduIsHxHpTyIKI/WAoV aJ2eo24DEFqWQP0oYj33hxfwajbm45GBd+c44f4exwTeqpsiZL3Wrw7rW184xp4X0ooK zjglHBzfA6et6HkyZk0rA95q5Jl6DoaUEJxrWrnaVgH4k4K76umpINcjQEmIG2U6G7zg IHX9zkp0ARhgcJMhJ4jBOlvpjtaG/3yITsCnnI+6AKZ0Dz7ukrb32+xt+SNTvHpz8hoZ tLIQ== X-Gm-Message-State: ALoCoQk7XVRSrgKkkse82yzaZFu6lMRy3nf8tyaS7RpyB/d8Z5jIto4jTX8XPqiFsvIZ9yaCXHQ5eQdmsAf/As+paXEw3iitTg== X-Received: by 10.25.137.7 with SMTP id l7mr1793253lfd.63.1449667338715; Wed, 09 Dec 2015 05:22:18 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j189sm1434702lfg.46.2015.12.09.05.22.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:22:18 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij Subject: [PATCH 055/182] gpio: rdc321x: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:22:15 +0100 Message-Id: <1449667335-32388-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(). Signed-off-by: Linus Walleij --- drivers/gpio/gpio-rdc321x.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 diff --git a/drivers/gpio/gpio-rdc321x.c b/drivers/gpio/gpio-rdc321x.c index d729bc8a554d..96ddee3f464a 100644 --- a/drivers/gpio/gpio-rdc321x.c +++ b/drivers/gpio/gpio-rdc321x.c @@ -47,7 +47,7 @@ static int rdc_gpio_get_value(struct gpio_chip *chip, unsigned gpio) u32 value = 0; int reg; - gpch = container_of(chip, struct rdc321x_gpio, chip); + gpch = gpiochip_get_data(chip); reg = gpio < 32 ? gpch->reg1_data_base : gpch->reg2_data_base; spin_lock(&gpch->lock); @@ -65,7 +65,7 @@ static void rdc_gpio_set_value_impl(struct gpio_chip *chip, struct rdc321x_gpio *gpch; int reg = (gpio < 32) ? 0 : 1; - gpch = container_of(chip, struct rdc321x_gpio, chip); + gpch = gpiochip_get_data(chip); if (value) gpch->data_reg[reg] |= 1 << (gpio & 0x1f); @@ -83,7 +83,7 @@ static void rdc_gpio_set_value(struct gpio_chip *chip, { struct rdc321x_gpio *gpch; - gpch = container_of(chip, struct rdc321x_gpio, chip); + gpch = gpiochip_get_data(chip); spin_lock(&gpch->lock); rdc_gpio_set_value_impl(chip, gpio, value); spin_unlock(&gpch->lock); @@ -96,7 +96,7 @@ static int rdc_gpio_config(struct gpio_chip *chip, int err; u32 reg; - gpch = container_of(chip, struct rdc321x_gpio, chip); + gpch = gpiochip_get_data(chip); spin_lock(&gpch->lock); err = pci_read_config_dword(gpch->sb_pdev, gpio < 32 ? @@ -194,7 +194,7 @@ static int rdc321x_gpio_probe(struct platform_device *pdev) dev_info(&pdev->dev, "registering %d GPIOs\n", rdc321x_gpio_dev->chip.ngpio); - return gpiochip_add(&rdc321x_gpio_dev->chip); + return gpiochip_add_data(&rdc321x_gpio_dev->chip, rdc321x_gpio_dev); } static int rdc321x_gpio_remove(struct platform_device *pdev)