Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1396358

[PATCH v2] gpio: sch: Fix Oops on module load on Asus Eee PC 1201

Path csiph.com!news.freedyn.net!aioe.org!bofh.it!news.nic.it!robomod
From Colin Pitrat <colin.pitrat@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v2] gpio: sch: Fix Oops on module load on Asus Eee PC 1201
Date Sat, 07 May 2016 21:50:01 +0200
Message-ID <rwgoF-7MA-5@gated-at.bofh.it> (permalink)
X-Original-To linus.walleij@linaro.org, gnurou@gmail.com
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=AIRr6XTeSGMXSZQZipO2dRUDf0zDe9NgOz55vxbGWmg=; b=rR+v4VLk62GWG4berAT/igE2QrGHX2mbvAUBiEYvGYUYE9Lt/LcjeGLRRTU3lS0tRg b8JfEH5NmAnG9A5QIfreCqB76gjhuiRTwqmDzGbkppy7+3pOC6DEzjPey9IiuIH8eFqH J4MYb4pG9lDh5nS7jlaOd04FGSYPrq6r2pkDK1jf9cbu/rxVCRs8z0uwRsxpXAMqiuwP gElzSQ9jGbi2N6NIKlnfRAN8/8lx/wsMhRRl5qz3ehftaikRZpECbHW+Som07bbCDjsD WxSfySGFbiiOu+NQmOTmk4uugzlZUPiGs/eYSOGnLzOadmfn6Gge/g1jr0wk7EV75kgP Bc9A==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=AIRr6XTeSGMXSZQZipO2dRUDf0zDe9NgOz55vxbGWmg=; b=G1c/7x5caFyBzMRnqmiMK4eqK16Ubam2hMttWwSUrNH5vXiQEU/LS06OswdowrgUD+ R1rl/pTDhdBLvsOtNmttPfESjTAd9wAJ8SL7GuPcUdweOnA67XFm0MiYfdBf3JyR+qlk QMi7mcOfkNF7WfwwZVC0db9ArL3AdStSEAqfcF/Bi/GLeeWHW0K8t48QPHVTtVeRvZgA AGrLbNym08C96nahYx1Ruy+BtKxLrwX4g9Q+ZLSgOp7Xcf1OwFk/3Kf4NkgV1BQJhArr Bos3Gp2zI25EDyKlUquR/cV3UJCezSUIQxy3BkU9two4hhQ33L9DxJZzOt8J8AKPngbQ KCDA==
X-Gm-Message-State AOPr4FUJp2R4a7zoYGU1RU9A9QtNWai2j9xpGjShwliBZ2JVHd1tH13LLqh5TnUJBc4d/g==
X-Received by 10.194.58.195 with SMTP id t3mr24711477wjq.97.1462650098023; Sat, 07 May 2016 12:41:38 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.6.0 (2016-04-01)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 79
Organization linux.* mail to news gateway
X-Original-Cc rebecca.swee.fun.chang@intel.com, mika.westerberg@linux.intel.com, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Sat, 7 May 2016 20:41:30 +0100
X-Original-Message-ID <20160507194123.GA1192@pitrat4.localdomain>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1396358

Show key headers only | View raw


This fixes the issue descirbe in bug 117531. 
It's a regression introduced in linux 4.5 that causes a Oops at load of
gpio_sch and prevents powering off the computer.

The patch consist in reverting commit 737c8fccf1c5b2aae3c6d9a66dce17e35fc39b71 
(a.k.a 'gpio: sch: use gpiochip data pointer') that causes this regression.
However, although it does work for me, I'm not sure of the impact of reverting
only this part of the patch.

Contrary to previous patch sent that reverted two changes, this one only
reverts the source of the issue, that is the replacement of to_sch_gpio macro
by gpiochip_get_data.

Signed-off-by: Colin Pitrat <colin.pitrat@gmail.com>

---
 drivers/gpio/gpio-sch.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
index e85e753..a8a333ad 100644
--- a/drivers/gpio/gpio-sch.c
+++ b/drivers/gpio/gpio-sch.c
@@ -41,6 +41,8 @@ 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)
 {
@@ -63,7 +65,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 = gpiochip_get_data(gc);
+	struct sch_gpio *sch = to_sch_gpio(gc);
 	unsigned short offset, bit;
 	u8 reg_val;
 
@@ -78,7 +80,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 = gpiochip_get_data(gc);
+	struct sch_gpio *sch = to_sch_gpio(gc);
 	unsigned short offset, bit;
 	u8 reg_val;
 
@@ -95,7 +97,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 = gpiochip_get_data(gc);
+	struct sch_gpio *sch = to_sch_gpio(gc);
 
 	spin_lock(&sch->lock);
 	sch_gpio_reg_set(gc, gpio_num, GIO, 1);
@@ -110,7 +112,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 = gpiochip_get_data(gc);
+	struct sch_gpio *sch = to_sch_gpio(gc);
 
 	spin_lock(&sch->lock);
 	sch_gpio_reg_set(gc, gpio_num, GLV, val);
@@ -120,7 +122,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 = gpiochip_get_data(gc);
+	struct sch_gpio *sch = to_sch_gpio(gc);
 
 	spin_lock(&sch->lock);
 	sch_gpio_reg_set(gc, gpio_num, GIO, 0);
-- 
2.8.2

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v2] gpio: sch: Fix Oops on module load on Asus Eee PC 1201 Colin Pitrat <colin.pitrat@gmail.com> - 2016-05-07 21:50 +0200

csiph-web