From patchwork Wed Dec 9 13:45:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58112 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp678026lbb; Wed, 9 Dec 2015 05:45:17 -0800 (PST) X-Received: by 10.67.14.104 with SMTP id ff8mr8003519pad.92.1449668716906; Wed, 09 Dec 2015 05:45:16 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lo5si12815265pab.188.2015.12.09.05.45.16; Wed, 09 Dec 2015 05:45:16 -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 S1754324AbbLINpQ (ORCPT + 4 others); Wed, 9 Dec 2015 08:45:16 -0500 Received: from mail-lf0-f52.google.com ([209.85.215.52]:34747 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753029AbbLINpP (ORCPT ); Wed, 9 Dec 2015 08:45:15 -0500 Received: by lffu14 with SMTP id u14so34564461lff.1 for ; Wed, 09 Dec 2015 05:45:14 -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=DE1+l8OIAIB1rI2Ushtd0Na7CX/E/XCrNvjKv+kIp8Q=; b=SLeVmKlDnlNBDur+zUpzkfrfm6jcAKcTeyWhC/7SUT3Wp49Oa0jAYty4uVnxaFyKA/ +TBceyeq8RXhMv7+cjyS20vcrnJ2wvPmA0wfHF8kMLClQFNwXoogjkpoCk/IZVLgteA4 OIyANtNs1vzX08lAXwjvUu2HCVBDa6PaIyAFRcd5SYBX2YCdmtvP3oK0WnjVp39Qf3bh TdawNGwgbQNbrmpf6taVTNjLfaIW4Jmv4EDyuZahOcM200D+Ug22+sk1EIKyQJJCs28L N5eBNgntkgcdEfikqcVXGaJXVzl/9FG7++HlvdY+L9jS3ZGgxQy6c8PwiHKSecq0wbkJ PWAA== 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=DE1+l8OIAIB1rI2Ushtd0Na7CX/E/XCrNvjKv+kIp8Q=; b=J08OfgDWJM+PFAe9RK8wAwylpdK+fYRBJSHZl1hx9BFsXYrfGXcCvzAKTeLfTNco5N O1q1o6dhcDr1qvzDhl0/Oj2PT3FUucOLA5JyNt6J42oGnAKY46BKhaZVRNnuvnMrTG11 O22w3zpCKWRgBmvxOWJhLkjOOALv5BRS+AXiGYXnW8ypowexT0cXD6IlHEJnYX1sCfGg xrfGClQ+WLk30y9ZMC6HvVLFc3rlPbD+IKJXhjl2qNRmD6c5a1JuhHV69hWh+af7Iy3C PAtWbBjjcmuJFQ+lFEEudEUEOBTF8XSiWLf9mnnbu1/RcU27nUJhfjE0BL7PiZNcfBCC wbGA== X-Gm-Message-State: ALoCoQkN7Wh+rBdL0+zB9nDt6xgOIeKDOi7xAgJvUaOx7AkM2DFl4z32htdoKwixYr1GgSyJSO8yY2XiZWxpfMEtYRIBssN/mg== X-Received: by 10.25.213.145 with SMTP id m139mr2338553lfg.150.1449668714037; Wed, 09 Dec 2015 05:45:14 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id pd9sm1410846lbc.48.2015.12.09.05.45.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:45:13 -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 156/182] input: adp5589-keys: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:45:10 +0100 Message-Id: <1449668710-5785-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 --- Dmitry: please ACK this so I can take it through the GPIO tree. --- drivers/input/keyboard/adp5589-keys.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/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 4d446d5085aa..0b72345cf7b6 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -387,7 +387,7 @@ static int adp5589_write(struct i2c_client *client, u8 reg, u8 val) #ifdef CONFIG_GPIOLIB static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off) { - struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc); + struct adp5589_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = kpad->var->bank(kpad->gpiomap[off]); unsigned int bit = kpad->var->bit(kpad->gpiomap[off]); @@ -399,7 +399,7 @@ static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off) static void adp5589_gpio_set_value(struct gpio_chip *chip, unsigned off, int val) { - struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc); + struct adp5589_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = kpad->var->bank(kpad->gpiomap[off]); unsigned int bit = kpad->var->bit(kpad->gpiomap[off]); @@ -418,7 +418,7 @@ static void adp5589_gpio_set_value(struct gpio_chip *chip, static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off) { - struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc); + struct adp5589_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = kpad->var->bank(kpad->gpiomap[off]); unsigned int bit = kpad->var->bit(kpad->gpiomap[off]); int ret; @@ -438,7 +438,7 @@ static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off) static int adp5589_gpio_direction_output(struct gpio_chip *chip, unsigned off, int val) { - struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc); + struct adp5589_kpad *kpad = gpiochip_get_data(chip); unsigned int bank = kpad->var->bank(kpad->gpiomap[off]); unsigned int bit = kpad->var->bit(kpad->gpiomap[off]); int ret; @@ -525,7 +525,7 @@ static int adp5589_gpio_add(struct adp5589_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;