From patchwork Wed Dec 9 13:22:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58012 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp665136lbb; Wed, 9 Dec 2015 05:22:38 -0800 (PST) X-Received: by 10.66.172.164 with SMTP id bd4mr7845484pac.64.1449667358451; Wed, 09 Dec 2015 05:22:38 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si12714422pat.117.2015.12.09.05.22.38; Wed, 09 Dec 2015 05:22:38 -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 S1754541AbbLINWg (ORCPT + 4 others); Wed, 9 Dec 2015 08:22:36 -0500 Received: from mail-lf0-f51.google.com ([209.85.215.51]:34697 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754526AbbLINWf (ORCPT ); Wed, 9 Dec 2015 08:22:35 -0500 Received: by lffu14 with SMTP id u14so34121925lff.1 for ; Wed, 09 Dec 2015 05:22:33 -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=BsUhjICsGUkMgrYI0RLR28lT+W63dz4HbRgylCBeFuQ=; b=qAgftSFi+r8VeeMgtLJPlT8yEXakI4I+qvK16PqBIKsFM1+qI5ZC2MGCqLGsvGSAW+ min/U8hr0dt3noWXcpzDp+0TD9Pvv5l+ktZUwScQc39a1mueNrwSuH5iLYAPQ/2J7zpH AObBEqgTOQedwpcGub2IfoGVzPlVJdoOpmOYBkCEy/hhFnA0MEK0XB8H4l+JOwNvxNHb uuEKEBgazpWMriCAEhnE9RLu1a67T4aukp/z9Cs65RWwYwQtNi9eStDSyh0ATmh8NmHp G66k0P6r8/I7u97psRQj3CswwejENpdXmgjXOqZa5GYpSntogsDzUU3fkV2Qj0HU/Zdv 2ATg== 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=BsUhjICsGUkMgrYI0RLR28lT+W63dz4HbRgylCBeFuQ=; b=BZXz+0u7phrMgtCFH4K/O+LK69+MjNwRXCE64C8wShdBTKBdDDTJJOrH9gd3/ZpEsg p0CPj0+bir6fDeG+O0HTy4ZcoggCRLqO7gaux/KOm+cO19sO07fZ/pN/B+OJXDnymD8Q dnItg6uTHrgQRZQy1qz8PQnAneuhdVa9hkVGyDbOgCheyUluH5B1u0aAmm75mnEmfatO T/eaHjXTmXZQDFOpvDfFZZ3ba4xBfaKNaf/CcdE49VG4uxZ6kZZDyxRMjz2Al+DIw9nt yy3P1buVjcG6YQdty6wLN5fWr468oakxg2TN9n/9q4CMmf1GAU71dkMZ6Q/h9iODoW4k GyRw== X-Gm-Message-State: ALoCoQnsitk7cyRHRvLtiUdDlfO+ADUo+INDbKNQiQdfaCGTvrYNAKwHgcC5Ze9TcXLpv5BSWvrf7AdtseUlMSCjl5cVwIeOJw== X-Received: by 10.25.163.85 with SMTP id m82mr2250079lfe.76.1449667353644; Wed, 09 Dec 2015 05:22:33 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i13sm1435681lfe.9.2015.12.09.05.22.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:22:32 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Mika Westerberg , Chang Rebecca Swee Fun Subject: [PATCH 057/182] gpio: sch: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:22:30 +0100 Message-Id: <1449667350-32482-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: Mika Westerberg Cc: Chang Rebecca Swee Fun Signed-off-by: Linus Walleij --- drivers/gpio/gpio-sch.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 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-sch.c b/drivers/gpio/gpio-sch.c index a8a333ade9aa..5314ee4b947d 100644 --- a/drivers/gpio/gpio-sch.c +++ b/drivers/gpio/gpio-sch.c @@ -41,8 +41,6 @@ struct sch_gpio { unsigned short resume_base; }; -#define to_sch_gpio(gc) container_of(gc, struct sch_gpio, chip) - static unsigned sch_gpio_offset(struct sch_gpio *sch, unsigned gpio, unsigned reg) { @@ -65,7 +63,7 @@ static unsigned sch_gpio_bit(struct sch_gpio *sch, unsigned gpio) static int sch_gpio_reg_get(struct gpio_chip *gc, unsigned gpio, unsigned reg) { - struct sch_gpio *sch = to_sch_gpio(gc); + struct sch_gpio *sch = gpiochip_get_data(gc); unsigned short offset, bit; u8 reg_val; @@ -80,7 +78,7 @@ static int sch_gpio_reg_get(struct gpio_chip *gc, unsigned gpio, unsigned reg) static void sch_gpio_reg_set(struct gpio_chip *gc, unsigned gpio, unsigned reg, int val) { - struct sch_gpio *sch = to_sch_gpio(gc); + struct sch_gpio *sch = gpiochip_get_data(gc); unsigned short offset, bit; u8 reg_val; @@ -97,7 +95,7 @@ static void sch_gpio_reg_set(struct gpio_chip *gc, unsigned gpio, unsigned reg, static int sch_gpio_direction_in(struct gpio_chip *gc, unsigned gpio_num) { - struct sch_gpio *sch = to_sch_gpio(gc); + struct sch_gpio *sch = gpiochip_get_data(gc); spin_lock(&sch->lock); sch_gpio_reg_set(gc, gpio_num, GIO, 1); @@ -112,7 +110,7 @@ static int sch_gpio_get(struct gpio_chip *gc, unsigned gpio_num) static void sch_gpio_set(struct gpio_chip *gc, unsigned gpio_num, int val) { - struct sch_gpio *sch = to_sch_gpio(gc); + struct sch_gpio *sch = gpiochip_get_data(gc); spin_lock(&sch->lock); sch_gpio_reg_set(gc, gpio_num, GLV, val); @@ -122,7 +120,7 @@ static void sch_gpio_set(struct gpio_chip *gc, unsigned gpio_num, int val) static int sch_gpio_direction_out(struct gpio_chip *gc, unsigned gpio_num, int val) { - struct sch_gpio *sch = to_sch_gpio(gc); + struct sch_gpio *sch = gpiochip_get_data(gc); spin_lock(&sch->lock); sch_gpio_reg_set(gc, gpio_num, GIO, 0); @@ -217,7 +215,7 @@ static int sch_gpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, sch); - return gpiochip_add(&sch->chip); + return gpiochip_add_data(&sch->chip, sch); } static int sch_gpio_remove(struct platform_device *pdev)