From patchwork Wed Dec 9 13:47:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58120 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp679398lbb; Wed, 9 Dec 2015 05:47:51 -0800 (PST) X-Received: by 10.66.65.203 with SMTP id z11mr8030559pas.152.1449668871424; Wed, 09 Dec 2015 05:47:51 -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.47.51; Wed, 09 Dec 2015 05:47:51 -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 S1754086AbbLINru (ORCPT + 4 others); Wed, 9 Dec 2015 08:47:50 -0500 Received: from mail-lf0-f46.google.com ([209.85.215.46]:35887 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753083AbbLINru (ORCPT ); Wed, 9 Dec 2015 08:47:50 -0500 Received: by lfs39 with SMTP id 39so34752165lfs.3 for ; Wed, 09 Dec 2015 05:47:49 -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=i30jNNAvEMvfdk81YDkOE6QZSwof0LJadsaWd9+xmrE=; b=xusWJM745HFtkaj0GIXWfvldISCDADrys7R8Cy0FAetnhbo1A4aqBE/u2IxIQgkXaK opQf6pmt7uNdIQU5gj7uQHGBaA91hK0Gs5sRix4tgXPVoQlqqEifvLkqdsdBYMFmmUjB jmnBJGs+L5KV913Mt7JwtfDV9AuSUKwCfTtOSS3z7sWfLmj21DnoMkYjlwYixHDbUJVk IzS4yYpnk3aYNhNEvnij7bpIZm0VTSaD1HB7USJzUmvrkY9E1BiGXKlkZZCWrKHGOS4K jGW/nuNbgLGkAOK0EVsRMyFhdyBKvOp0IubyckB2KvBrrbBdP4Ib5qOB/my4dC+mNlTe c97Q== 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=i30jNNAvEMvfdk81YDkOE6QZSwof0LJadsaWd9+xmrE=; b=c7SpQTaFVh8oIkqJY/SiVB3mIDTP5oRXRTh/MTukZBiCw3atKTCPVHba0AbRja33hw bESKUNnUVRZFE1s2YGQF1c6UcTcfqEtAwMglSps2KrM667NbtmD2mfVsChCChW8CgRbB ENHS90KiPDZ+q52Hy4B4oxl4Ppf5DC8DG+lgwctWRl1D2SiGH8iomQmMU7VWWPxJovbo YMndSIOYjfhvq9SrbJRn6nrD5vC8wZSOmC46M5gpWfLWyNRK6RdcAZhTYyOhm0h1WS8t zGAJyupPglW7r/6nNiIAppF9Ml77HURQ5kuwf0nC7+zTE9EQ11aPMwlTsq3MkHaxenK9 Bn7g== X-Gm-Message-State: ALoCoQkHgBcbMRFLbKfPmI/SHwFDI28nh2HocyXB4F8pquCPQcIIkVrybu5InKatNi/pMtEwm/ujbZisq8MX7hWKH/KimZLU5w== X-Received: by 10.25.24.67 with SMTP id o64mr2241545lfi.135.1449668868975; Wed, 09 Dec 2015 05:47:48 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id q8sm1447717lbr.1.2015.12.09.05.47.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:47:48 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Lee Jones Cc: Linus Walleij Subject: [PATCH 164/182] mfd: htc-i2cpld: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:47:45 +0100 Message-Id: <1449668865-6307-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 Signed-off-by: Linus Walleij --- Lee please ACK this so I can take it through the GPIO tree. --- drivers/mfd/htc-i2cpld.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 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/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c index bd6b96d07ab8..3f9eee5f8fb9 100644 --- a/drivers/mfd/htc-i2cpld.c +++ b/drivers/mfd/htc-i2cpld.c @@ -227,8 +227,7 @@ static irqreturn_t htcpld_handler(int irq, void *dev) static void htcpld_chip_set(struct gpio_chip *chip, unsigned offset, int val) { struct i2c_client *client; - struct htcpld_chip *chip_data = - container_of(chip, struct htcpld_chip, chip_out); + struct htcpld_chip *chip_data = gpiochip_get_data(chip); unsigned long flags; client = chip_data->client; @@ -257,14 +256,12 @@ static void htcpld_chip_set_ni(struct work_struct *work) static int htcpld_chip_get(struct gpio_chip *chip, unsigned offset) { - struct htcpld_chip *chip_data; + struct htcpld_chip *chip_data = gpiochip_get_data(chip); u8 cache; if (!strncmp(chip->label, "htcpld-out", 10)) { - chip_data = container_of(chip, struct htcpld_chip, chip_out); cache = chip_data->cache_out; } else if (!strncmp(chip->label, "htcpld-in", 9)) { - chip_data = container_of(chip, struct htcpld_chip, chip_in); cache = chip_data->cache_in; } else return -EINVAL; @@ -291,9 +288,7 @@ static int htcpld_direction_input(struct gpio_chip *chip, static int htcpld_chip_to_irq(struct gpio_chip *chip, unsigned offset) { - struct htcpld_chip *chip_data; - - chip_data = container_of(chip, struct htcpld_chip, chip_in); + struct htcpld_chip *chip_data = gpiochip_get_data(chip); if (offset < chip_data->nirqs) return chip_data->irq_start + offset; @@ -451,14 +446,14 @@ static int htcpld_register_chip_gpio( gpio_chip->ngpio = plat_chip_data->num_gpios; /* Add the GPIO chips */ - ret = gpiochip_add(&(chip->chip_out)); + ret = gpiochip_add_data(&(chip->chip_out), chip); if (ret) { dev_warn(dev, "Unable to register output GPIOs for 0x%x: %d\n", plat_chip_data->addr, ret); return ret; } - ret = gpiochip_add(&(chip->chip_in)); + ret = gpiochip_add_data(&(chip->chip_in), chip); if (ret) { dev_warn(dev, "Unable to register input GPIOs for 0x%x: %d\n", plat_chip_data->addr, ret);