From patchwork Wed Dec 9 13:27:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58030 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp667697lbb; Wed, 9 Dec 2015 05:27:19 -0800 (PST) X-Received: by 10.67.15.10 with SMTP id fk10mr7915631pad.103.1449667639310; Wed, 09 Dec 2015 05:27:19 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 81si12789743pfr.79.2015.12.09.05.27.19; Wed, 09 Dec 2015 05:27:19 -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 S1754324AbbLIN1P (ORCPT + 4 others); Wed, 9 Dec 2015 08:27:15 -0500 Received: from mail-lb0-f171.google.com ([209.85.217.171]:33944 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754319AbbLIN1M (ORCPT ); Wed, 9 Dec 2015 08:27:12 -0500 Received: by lbbcs9 with SMTP id cs9so29870668lbb.1 for ; Wed, 09 Dec 2015 05:27:10 -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=AuarS153zijka1G/kxjePWfh1787lUIaQfs/zi6FGlM=; b=YhBFvVD1nmNpWSdvwTaYO3kiazkb+eEMFOK3Bw51ZDrWXSXDcoM85KYTdCn4ZTzefp 5sMel+6Y+wy5MoiYrgfoGbXSEZK26pmx8tMEGV8fndxDNLtXXrxJYMhUi1NJozmWIsdA T9gXuNwy0WhoE3dIB3OfZDQ0pWZ48DfJca5r+QI3kvecfCZ39ZS9Dljel9OtysjWo4pE I8jW2inbxuM249rnc8Ohb8ArFyNBGY5Y/GF+5dOqHBDlI3kaNe2YUl3SIACA97yUmICK i2nfwG4q70Agy4ao3sXEUwIBMjmjOM7KYfn45rsO4Q9eo2kfjOAr2uV0lZXml1OnfrG2 U/Wg== 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=AuarS153zijka1G/kxjePWfh1787lUIaQfs/zi6FGlM=; b=mdDrX3fkw7SklB+hfr69dwQOmaHpMtFNb4zMuwtBB+8Dy9+P2NJI0K4Z60jggK9MPx bs1h5oKU9PoVCy1MHJsI5Wk6muqsaHY8P9YobR7k4MCbLInmjB8nhWOfHrNJLSiN4BPk R1pdy/iuXjxn/E4GzlOT2NeMuLZlxtey2VsMZ2PFL6a6I0HgJgMRHHnnYZf76fzqc048 u56B6CBevk/tg51QQycupWcXM8yBs2sstdN89BkeBedcW46fNjEcn0XU2yDqxzTgAT3A efJhV8gws8aSdTJi464iqUNbGPzD7MLR8ECM4SOlszU8Phv6Fg+yTMg9fjI4mVviMij8 at/A== X-Gm-Message-State: ALoCoQnFYpKUXWmZAP1M2L3sKBT6V6bnXJ5LGRfPjSpOo0y8JYt9ITQws0wMnwQLBsnEUDjuhj/7PGh9w4gdByA15xFa11Se6w== X-Received: by 10.112.138.10 with SMTP id qm10mr2008346lbb.139.1449667630915; Wed, 09 Dec 2015 05:27:10 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id mt2sm1414459lbc.9.2015.12.09.05.27.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:27:10 -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 074/182] gpio: tz1090: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:27:07 +0100 Message-Id: <1449667627-920-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.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 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-tz1090.c b/drivers/gpio/gpio-tz1090.c index 7858d90202f3..c2acf9b64a73 100644 --- a/drivers/gpio/gpio-tz1090.c +++ b/drivers/gpio/gpio-tz1090.c @@ -62,7 +62,6 @@ struct tz1090_gpio_bank { int irq; char label[16]; }; -#define to_bank(c) container_of(c, struct tz1090_gpio_bank, chip) /** * struct tz1090_gpio - Overall GPIO device private data @@ -187,7 +186,7 @@ static inline int tz1090_gpio_read_bit(struct tz1090_gpio_bank *bank, static int tz1090_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); tz1090_gpio_set_bit(bank, REG_GPIO_DIR, offset); return 0; @@ -196,7 +195,7 @@ static int tz1090_gpio_direction_input(struct gpio_chip *chip, static int tz1090_gpio_direction_output(struct gpio_chip *chip, unsigned int offset, int output_value) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); int lstat; __global_lock2(lstat); @@ -212,7 +211,7 @@ static int tz1090_gpio_direction_output(struct gpio_chip *chip, */ static int tz1090_gpio_get(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); return tz1090_gpio_read_bit(bank, REG_GPIO_DIN, offset); } @@ -223,14 +222,14 @@ static int tz1090_gpio_get(struct gpio_chip *chip, unsigned int offset) static void tz1090_gpio_set(struct gpio_chip *chip, unsigned int offset, int output_value) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); tz1090_gpio_mod_bit(bank, REG_GPIO_DOUT, offset, output_value); } static int tz1090_gpio_request(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); int ret; ret = pinctrl_request_gpio(chip->base + offset); @@ -245,7 +244,7 @@ static int tz1090_gpio_request(struct gpio_chip *chip, unsigned int offset) static void tz1090_gpio_free(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); pinctrl_free_gpio(chip->base + offset); @@ -254,7 +253,7 @@ static void tz1090_gpio_free(struct gpio_chip *chip, unsigned int offset) static int tz1090_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); if (!bank->domain) return -EINVAL; @@ -440,7 +439,7 @@ static int tz1090_gpio_bank_probe(struct tz1090_gpio_bank_info *info) bank->chip.ngpio = 30; /* Add the GPIO bank */ - gpiochip_add(&bank->chip); + gpiochip_add_data(&bank->chip, bank); /* Get the GPIO bank IRQ if provided */ bank->irq = irq_of_parse_and_map(np, 0);