Patch "gpio: sch: Fix Oops on module load on Asus Eee PC 1201" has been added to the 4.6-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
gpio: sch: Fix Oops on module load on Asus Eee PC 1201
to the 4.6-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
gpio-sch-fix-oops-on-module-load-on-asus-eee-pc-1201.patch
and it can be found in the queue-4.6 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
87041a58d3b19455d39baed2a5e5bb43b58fb915Mon Sep 17 00:00:00 2001
From: Colin Pitrat <[email protected]>
Date: Sat, 18 Jun 2016 19:05:04 +0100
Subject: gpio: sch: Fix Oops on module load on Asus Eee PC 1201
From: Colin Pitrat <[email protected]>
commit 87041a58d3b19455d39baed2a5e5bb43b58fb915 upstream.
This fixes the issue descirbe in bug 117531
(https://bugzilla.kernel.org/show_bug.cgi?id=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 issue is that sch_gpio_reg_set is called in sch_gpio_probe before gpio_chip data is initialized with the pointer to the sch_gpio struct. As sch_gpio_reg_set calls gpiochip_get_data, it returns NULL which causes the Oops.
The patch follows Mika's advice (https://lkml.org/lkml/2016/5/9/61) and consists in modifying sch_gpio_reg_get and sch_gpio_reg_set to take a sch_gpio struct directly instead of a gpio_chip, which avoids the call to gpiochip_get_data.
Thanks Mika for your patience with me :-)
--- drivers/gpio/gpio-sch.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/gpio/gpio-sch.c +10 -11
@@ -61,9 +61,8 @@ static unsigned sch_gpio_bit(struct sch_return gpio %8 ; } -static int sch_gpio_reg_get (struct gpio_chip *gc,unsigned gpio,unsigned reg) +static int sch_gpio_reg_get (struct sch_gpio *sch,unsigned gpio,unsigned reg) { -struct sch_gpio *sch =gpiochip_get_data (gc);unsigned short offset, bit;u8 reg_val;
@@ -75,10 +74,9 @@ static int sch_gpio_reg_get(struct gpio_return reg_val; } -static void sch_gpio_reg_set (struct gpio_chip *gc,unsigned gpio,unsigned reg, +static void sch_gpio_reg_set (struct sch_gpio *sch,unsigned gpio,unsigned reg,int val) { -struct sch_gpio *sch =gpiochip_get_data (gc);unsigned short offset, bit;u8 reg_val;
@@ -98,14 +96,15 @@ static int sch_gpio_direction_in(structstruct sch_gpio *sch =gpiochip_get_data (gc);spin_lock (&sch->lock); -sch_gpio_reg_set (gc, gpio_num,GIO ,1 ); +sch_gpio_reg_set (sch, gpio_num,GIO ,1 );spin_unlock (&sch->lock);return 0 ; }static int sch_gpio_get (struct gpio_chip *gc,unsigned gpio_num) { -return sch_gpio_reg_get (gc, gpio_num,GLV ); +struct sch_gpio *sch =gpiochip_get_data (gc); +return sch_gpio_reg_get (sch, gpio_num,GLV ); }static void sch_gpio_set (struct gpio_chip *gc,unsigned gpio_num,int val)
@@ -113,7 +112,7 @@ static void sch_gpio_set(struct gpio_chistruct sch_gpio *sch =gpiochip_get_data (gc);spin_lock (&sch->lock); -sch_gpio_reg_set (gc, gpio_num,GLV , val); +sch_gpio_reg_set (sch, gpio_num,GLV , val);spin_unlock (&sch->lock); }
@@ -123,7 +122,7 @@ static int sch_gpio_direction_out(structstruct sch_gpio *sch =gpiochip_get_data (gc);spin_lock (&sch->lock); -sch_gpio_reg_set (gc, gpio_num,GIO ,0 ); +sch_gpio_reg_set (sch, gpio_num,GIO ,0 );spin_unlock (&sch->lock);/*
@@ -182,13 +181,13 @@ static int sch_gpio_probe(struct platfor* GPIO7 is configured by the CMC as SLPIOVR * Enable GPIO[9:8] core powered gpios explicitly */ -sch_gpio_reg_set (&sch->chip,8 ,GEN ,1 ); -sch_gpio_reg_set (&sch->chip,9 ,GEN ,1 ); +sch_gpio_reg_set (sch,8 ,GEN ,1 ); +sch_gpio_reg_set (sch,9 ,GEN ,1 );/* * SUS_GPIO[2:0] enabled by default * Enable SUS_GPIO3 resume powered gpio explicitly */ -sch_gpio_reg_set (&sch->chip,13 ,GEN ,1 ); +sch_gpio_reg_set (sch,13 ,GEN ,1 );break ;case PCI_DEVICE_ID_INTEL_ITC_LPC :
Patches currently in stable-queue which might be from [email protected] are
queue-4.6/gpio-sch-fix-oops-on-module-load-on-asus-eee-pc-1201.patch