From patchwork Wed Dec 9 13:44:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 554636 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 776501402D9 for ; Thu, 10 Dec 2015 00:45: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=LAXYy971; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754541AbbLINpG (ORCPT ); Wed, 9 Dec 2015 08:45:06 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:35345 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754324AbbLINpE (ORCPT ); Wed, 9 Dec 2015 08:45:04 -0500 Received: by lbpu9 with SMTP id u9so30043807lbp.2 for ; Wed, 09 Dec 2015 05:45: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=S2vcAQV9p2QTNvtKQAE3JhLXY3GUI5frIuXxajJiDCI=; b=LAXYy971YzJtiNGGpHKE5xvIpSLEQHZycLHnKWV+t6J/8MPpEAIMau0d27FTdsdD9R 0f3t/HmnillPOsuU2+eVOn+QkK5cGB4oPPrHb/26nzBBw9ala9zbj+R5mYctMVio9bY2 auaRsqg646IYBBURww+MxdTHV/W9h07Sh7t0MJgKk0E29gNCe79V17ht0uO8EYo5RyeP 2whhpUn5aEq60XpLUmXj4PzgqgRN3dw4PZ5ZXP+4Bf+ClJOp34v3YYHLe5laMxKAxmfw 9CtCzreMN6jO9wdm+Dm2UNREtlC7NJjY1u2GtyroFhw3GPv6JcviSoN6hyXnObd3wyJz w20Q== 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=S2vcAQV9p2QTNvtKQAE3JhLXY3GUI5frIuXxajJiDCI=; b=THc/n2iFiI7+KWgBEUVply8Mwww0cvE5P6Mvvi7HZowUM9EX0oLDCfbTiPY0ZSR3Y6 +1coiyLH3c15B/J3989SorLeuxgXH2rGmGJ7fUmIxaDdc3by/ePnDytxKOFgHtTCtPvc FJs1qH+sQjSU50pvvBE+LR+wtKrIoLjH2tQl6EM7DDYXukRiTjqvX2CBVu71pffJ/9V4 snYP9ZuUaQb60qIAPQdRzL/5PUVWcS2CNiMWzQ1jXmSOrdZlbPBdllHIrElwXSmOJusX rvM6IScPxuv94dpI2HFbWuXJv8rU58/wfL7qLy3YkqGh1muKj4TNRfUrAhr55lM1rzec Y8ww== X-Gm-Message-State: ALoCoQm232V8UN1v5hRgOXNn/xQMbh6lEd/XArbL9hipnM3fN4cJgK5kSGBsZnR9DrceDLAv/2q6fdTqn1TLpdUZQRRJ10OHLA== X-Received: by 10.112.63.68 with SMTP id e4mr2439474lbs.130.1449668703452; Wed, 09 Dec 2015 05:45:03 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id b7sm1444315lbv.0.2015.12.09.05.45.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:45:02 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Michael Hennerich , Dmitry Torokhov Cc: Linus Walleij Subject: [PATCH 155/182] input: adp5588-keys: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:44:53 +0100 Message-Id: <1449668693-5734-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: Michael Hennerich Cc: Dmitry Torokhov Signed-off-by: Linus Walleij Acked-by: Michael Hennerich Acked-by: Dmitry Torokhov --- Dmitry: please ACK this so I can take it through the GPIO tree. --- drivers/input/keyboard/adp5588-keys.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 21a62d0fa764..53fe9a3fb620 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c @@ -73,7 +73,7 @@ static int adp5588_write(struct i2c_client *client, u8 reg, u8 val) #ifdef CONFIG_GPIOLIB static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off) { - struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); + struct adp5588_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); int val; @@ -93,7 +93,7 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off) static void adp5588_gpio_set_value(struct gpio_chip *chip, unsigned off, int val) { - struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); + struct adp5588_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); @@ -112,7 +112,7 @@ static void adp5588_gpio_set_value(struct gpio_chip *chip, static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off) { - struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); + struct adp5588_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); int ret; @@ -130,7 +130,7 @@ static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off) static int adp5588_gpio_direction_output(struct gpio_chip *chip, unsigned off, int val) { - struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); + struct adp5588_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); int ret; @@ -210,7 +210,7 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad) mutex_init(&kpad->gpio_lock); - error = gpiochip_add(&kpad->gc); + error = gpiochip_add_data(&kpad->gc, kpad); if (error) { dev_err(dev, "gpiochip_add failed, err: %d\n", error); return error;