From: Sasha Levin Date: Tue, 15 Oct 2019 05:17:53 +0000 (-0400) Subject: fixes for 5.3 X-Git-Tag: v4.4.197~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4462245875b6680859e1aabb01d510393bab9a16;p=thirdparty%2Fkernel%2Fstable-queue.git fixes for 5.3 Signed-off-by: Sasha Levin --- diff --git a/queue-5.3/firmware-google-increment-vpd-key_len-properly.patch b/queue-5.3/firmware-google-increment-vpd-key_len-properly.patch new file mode 100644 index 00000000000..77e472f004d --- /dev/null +++ b/queue-5.3/firmware-google-increment-vpd-key_len-properly.patch @@ -0,0 +1,48 @@ +From 03286b481bbe839c8d825c3d93eb395b004f0745 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Sep 2019 14:45:22 -0700 +Subject: firmware: google: increment VPD key_len properly + +From: Brian Norris + +[ Upstream commit 442f1e746e8187b9deb1590176f6b0ff19686b11 ] + +Commit 4b708b7b1a2c ("firmware: google: check if size is valid when +decoding VPD data") adds length checks, but the new vpd_decode_entry() +function botched the logic -- it adds the key length twice, instead of +adding the key and value lengths separately. + +On my local system, this means vpd.c's vpd_section_create_attribs() hits +an error case after the first attribute it parses, since it's no longer +looking at the correct offset. With this patch, I'm back to seeing all +the correct attributes in /sys/firmware/vpd/... + +Fixes: 4b708b7b1a2c ("firmware: google: check if size is valid when decoding VPD data") +Cc: +Cc: Hung-Te Lin +Signed-off-by: Brian Norris +Reviewed-by: Stephen Boyd +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20190930214522.240680-1-briannorris@chromium.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/firmware/google/vpd_decode.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/firmware/google/vpd_decode.c b/drivers/firmware/google/vpd_decode.c +index dda525c0f9682..5c6f2a74f1049 100644 +--- a/drivers/firmware/google/vpd_decode.c ++++ b/drivers/firmware/google/vpd_decode.c +@@ -52,7 +52,7 @@ static int vpd_decode_entry(const u32 max_len, const u8 *input_buf, + if (max_len - consumed < *entry_len) + return VPD_FAIL; + +- consumed += decoded_len; ++ consumed += *entry_len; + *_consumed = consumed; + return VPD_OK; + } +-- +2.20.1 + diff --git a/queue-5.3/gpio-fix-getting-nonexclusive-gpiods-from-dt.patch b/queue-5.3/gpio-fix-getting-nonexclusive-gpiods-from-dt.patch new file mode 100644 index 00000000000..3fa942d1b8d --- /dev/null +++ b/queue-5.3/gpio-fix-getting-nonexclusive-gpiods-from-dt.patch @@ -0,0 +1,44 @@ +From abacc6a8128d1f00743c48fd2bde39ae08e6be87 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Oct 2019 17:53:41 +0200 +Subject: gpio: fix getting nonexclusive gpiods from DT + +From: Marco Felsch + +[ Upstream commit be7ae45cfea97e787234e00e1a9eb341acacd84e ] + +Since commit ec757001c818 ("gpio: Enable nonexclusive gpiods from DT +nodes") we are able to get GPIOD_FLAGS_BIT_NONEXCLUSIVE marked gpios. +Currently the gpiolib uses the wrong flags variable for the check. We +need to check the gpiod_flags instead of the of_gpio_flags else we +return -EBUSY for GPIOD_FLAGS_BIT_NONEXCLUSIVE marked and requested +gpiod's. + +Fixes: ec757001c818 gpio: Enable nonexclusive gpiods from DT nodes +Cc: stable@vger.kernel.org +Signed-off-by: Marco Felsch +[Bartosz: the function was moved to gpiolib-of.c so updated the patch] +Signed-off-by: Bartosz Golaszewski +[Bartosz: backported to v5.3.y] +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpiolib.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index d9074191edef4..e4203c1eb869d 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -4303,7 +4303,7 @@ struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, + transitory = flags & OF_GPIO_TRANSITORY; + + ret = gpiod_request(desc, label); +- if (ret == -EBUSY && (flags & GPIOD_FLAGS_BIT_NONEXCLUSIVE)) ++ if (ret == -EBUSY && (dflags & GPIOD_FLAGS_BIT_NONEXCLUSIVE)) + return desc; + if (ret) + return ERR_PTR(ret); +-- +2.20.1 + diff --git a/queue-5.3/gpiolib-don-t-clear-flag_is_out-when-emulating-open-.patch b/queue-5.3/gpiolib-don-t-clear-flag_is_out-when-emulating-open-.patch new file mode 100644 index 00000000000..60024bd9e00 --- /dev/null +++ b/queue-5.3/gpiolib-don-t-clear-flag_is_out-when-emulating-open-.patch @@ -0,0 +1,99 @@ +From f969607262d272458ea3e4acc2f5441886cd7ddf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 14 Oct 2019 17:54:35 +0200 +Subject: gpiolib: don't clear FLAG_IS_OUT when emulating + open-drain/open-source + +From: Bartosz Golaszewski + +[ Upstream commit e735244e2cf068f98b6384681a38993e0517a838 ] + +When emulating open-drain/open-source by not actively driving the output +lines - we're simply changing their mode to input. This is wrong as it +will then make it impossible to change the value of such line - it's now +considered to actually be in input mode. If we want to still use the +direction_input() callback for simplicity then we need to set FLAG_IS_OUT +manually in gpiod_direction_output() and not clear it in +gpio_set_open_drain_value_commit() and +gpio_set_open_source_value_commit(). + +Fixes: c663e5f56737 ("gpio: support native single-ended hardware drivers") +Cc: stable@vger.kernel.org +Reported-by: Kent Gibson +Signed-off-by: Bartosz Golaszewski +[Bartosz: backported to v5.3, v4.19] +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpiolib.c | 27 +++++++++++++++++++-------- + 1 file changed, 19 insertions(+), 8 deletions(-) + +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c +index e4203c1eb869d..74a77001b1bd7 100644 +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -2775,8 +2775,10 @@ int gpiod_direction_output(struct gpio_desc *desc, int value) + if (!ret) + goto set_output_value; + /* Emulate open drain by not actively driving the line high */ +- if (value) +- return gpiod_direction_input(desc); ++ if (value) { ++ ret = gpiod_direction_input(desc); ++ goto set_output_flag; ++ } + } + else if (test_bit(FLAG_OPEN_SOURCE, &desc->flags)) { + ret = gpio_set_config(gc, gpio_chip_hwgpio(desc), +@@ -2784,8 +2786,10 @@ int gpiod_direction_output(struct gpio_desc *desc, int value) + if (!ret) + goto set_output_value; + /* Emulate open source by not actively driving the line low */ +- if (!value) +- return gpiod_direction_input(desc); ++ if (!value) { ++ ret = gpiod_direction_input(desc); ++ goto set_output_flag; ++ } + } else { + gpio_set_config(gc, gpio_chip_hwgpio(desc), + PIN_CONFIG_DRIVE_PUSH_PULL); +@@ -2793,6 +2797,17 @@ int gpiod_direction_output(struct gpio_desc *desc, int value) + + set_output_value: + return gpiod_direction_output_raw_commit(desc, value); ++ ++set_output_flag: ++ /* ++ * When emulating open-source or open-drain functionalities by not ++ * actively driving the line (setting mode to input) we still need to ++ * set the IS_OUT flag or otherwise we won't be able to set the line ++ * value anymore. ++ */ ++ if (ret == 0) ++ set_bit(FLAG_IS_OUT, &desc->flags); ++ return ret; + } + EXPORT_SYMBOL_GPL(gpiod_direction_output); + +@@ -3153,8 +3168,6 @@ static void gpio_set_open_drain_value_commit(struct gpio_desc *desc, bool value) + + if (value) { + err = chip->direction_input(chip, offset); +- if (!err) +- clear_bit(FLAG_IS_OUT, &desc->flags); + } else { + err = chip->direction_output(chip, offset, 0); + if (!err) +@@ -3184,8 +3197,6 @@ static void gpio_set_open_source_value_commit(struct gpio_desc *desc, bool value + set_bit(FLAG_IS_OUT, &desc->flags); + } else { + err = chip->direction_input(chip, offset); +- if (!err) +- clear_bit(FLAG_IS_OUT, &desc->flags); + } + trace_gpio_direction(desc_to_gpio(desc), !value, err); + if (err < 0) +-- +2.20.1 + diff --git a/queue-5.3/iio-light-fix-vcnl4000-devicetree-hooks.patch b/queue-5.3/iio-light-fix-vcnl4000-devicetree-hooks.patch new file mode 100644 index 00000000000..3a16e6cd1fe --- /dev/null +++ b/queue-5.3/iio-light-fix-vcnl4000-devicetree-hooks.patch @@ -0,0 +1,57 @@ +From 613d129f50a170b7c76032eecc87ae1d749751bd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Sep 2019 16:56:36 +0200 +Subject: iio: light: fix vcnl4000 devicetree hooks + +From: Marco Felsch + +[ Upstream commit 1436a78c63495dd94c8d4f84a76d78d5317d481b ] + +Since commit ebd457d55911 ("iio: light: vcnl4000 add devicetree hooks") +the of_match_table is supported but the data shouldn't be a string. +Instead it shall be one of 'enum vcnl4000_device_ids'. Also the matching +logic for the vcnl4020 was wrong. Since the data retrieve mechanism is +still based on the i2c_device_id no failures did appeared till now. + +Fixes: ebd457d55911 ("iio: light: vcnl4000 add devicetree hooks") +Signed-off-by: Marco Felsch +Reviewed-by: Angus Ainslie (Purism) angus@akkea.ca +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + drivers/iio/light/vcnl4000.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c +index 51421ac325177..f522cb863e8c8 100644 +--- a/drivers/iio/light/vcnl4000.c ++++ b/drivers/iio/light/vcnl4000.c +@@ -398,19 +398,19 @@ static int vcnl4000_probe(struct i2c_client *client, + static const struct of_device_id vcnl_4000_of_match[] = { + { + .compatible = "vishay,vcnl4000", +- .data = "VCNL4000", ++ .data = (void *)VCNL4000, + }, + { + .compatible = "vishay,vcnl4010", +- .data = "VCNL4010", ++ .data = (void *)VCNL4010, + }, + { +- .compatible = "vishay,vcnl4010", +- .data = "VCNL4020", ++ .compatible = "vishay,vcnl4020", ++ .data = (void *)VCNL4010, + }, + { + .compatible = "vishay,vcnl4200", +- .data = "VCNL4200", ++ .data = (void *)VCNL4200, + }, + {}, + }; +-- +2.20.1 + diff --git a/queue-5.3/series b/queue-5.3/series index 40652ad3ae9..4b58de1bd16 100644 --- a/queue-5.3/series +++ b/queue-5.3/series @@ -78,3 +78,7 @@ mm-z3fold.c-claim-page-in-the-beginning-of-free.patch mm-page_alloc.c-fix-a-crash-in-free_pages_prepare.patch mm-vmpressure.c-fix-a-signedness-bug-in-vmpressure_register_event.patch ib-core-fix-wrong-iterating-on-ports.patch +firmware-google-increment-vpd-key_len-properly.patch +gpio-fix-getting-nonexclusive-gpiods-from-dt.patch +gpiolib-don-t-clear-flag_is_out-when-emulating-open-.patch +iio-light-fix-vcnl4000-devicetree-hooks.patch