From 016ae63c56a9b9f928cc82001e2f755935968414 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 11 Jun 2023 23:51:40 -0400 Subject: [PATCH] Fixes for 5.4 Signed-off-by: Sasha Levin --- .../eeprom-at24-also-select-regmap.patch | 49 +++++++++++++++++ ...-i2c-adapter-in-.remove-s-error-path.patch | 53 +++++++++++++++++++ queue-5.4/series | 2 + 3 files changed, 104 insertions(+) create mode 100644 queue-5.4/eeprom-at24-also-select-regmap.patch create mode 100644 queue-5.4/i2c-sprd-delete-i2c-adapter-in-.remove-s-error-path.patch diff --git a/queue-5.4/eeprom-at24-also-select-regmap.patch b/queue-5.4/eeprom-at24-also-select-regmap.patch new file mode 100644 index 00000000000..f9a6fac3f2c --- /dev/null +++ b/queue-5.4/eeprom-at24-also-select-regmap.patch @@ -0,0 +1,49 @@ +From 24f3b85250eddc8e49ab8eb0cd35eaf31f7015df Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Jun 2023 19:54:24 -0700 +Subject: eeprom: at24: also select REGMAP + +From: Randy Dunlap + +[ Upstream commit 7f3c782b3914e510b646a77aedc3adeac2e4a63b ] + +Selecting only REGMAP_I2C can leave REGMAP unset, causing build errors, +so also select REGMAP to prevent the build errors. + +../drivers/misc/eeprom/at24.c:540:42: warning: 'struct regmap_config' declared inside parameter list will not be visible outside of this definition or declaration + 540 | struct regmap_config *regmap_config) +../drivers/misc/eeprom/at24.c: In function 'at24_make_dummy_client': +../drivers/misc/eeprom/at24.c:552:18: error: implicit declaration of function 'devm_regmap_init_i2c' [-Werror=implicit-function-declaration] + 552 | regmap = devm_regmap_init_i2c(dummy_client, regmap_config); +../drivers/misc/eeprom/at24.c:552:16: warning: assignment to 'struct regmap *' from 'int' makes pointer from integer without a cast [-Wint-conversion] + 552 | regmap = devm_regmap_init_i2c(dummy_client, regmap_config); +../drivers/misc/eeprom/at24.c: In function 'at24_probe': +../drivers/misc/eeprom/at24.c:586:16: error: variable 'regmap_config' has initializer but incomplete type + 586 | struct regmap_config regmap_config = { }; +../drivers/misc/eeprom/at24.c:586:30: error: storage size of 'regmap_config' isn't known + 586 | struct regmap_config regmap_config = { }; +../drivers/misc/eeprom/at24.c:586:30: warning: unused variable 'regmap_config' [-Wunused-variable] + +Fixes: 5c015258478e ("eeprom: at24: add basic regmap_i2c support") +Signed-off-by: Randy Dunlap +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/misc/eeprom/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/misc/eeprom/Kconfig b/drivers/misc/eeprom/Kconfig +index 0f791bfdc1f58..c92f2cdf40263 100644 +--- a/drivers/misc/eeprom/Kconfig ++++ b/drivers/misc/eeprom/Kconfig +@@ -6,6 +6,7 @@ config EEPROM_AT24 + depends on I2C && SYSFS + select NVMEM + select NVMEM_SYSFS ++ select REGMAP + select REGMAP_I2C + help + Enable this driver to get read/write support to most I2C EEPROMs +-- +2.39.2 + diff --git a/queue-5.4/i2c-sprd-delete-i2c-adapter-in-.remove-s-error-path.patch b/queue-5.4/i2c-sprd-delete-i2c-adapter-in-.remove-s-error-path.patch new file mode 100644 index 00000000000..27fee5608d2 --- /dev/null +++ b/queue-5.4/i2c-sprd-delete-i2c-adapter-in-.remove-s-error-path.patch @@ -0,0 +1,53 @@ +From 71da6ba635bf88717d982c056550c4c44a0c2ff9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Mar 2023 10:58:19 +0100 +Subject: i2c: sprd: Delete i2c adapter in .remove's error path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit ca0aa17f2db3468fd017038d23a78e17388e2f67 ] + +If pm runtime resume fails the .remove callback used to exit early. This +resulted in an error message by the driver core but the device gets +removed anyhow. This lets the registered i2c adapter stay around with an +unbound parent device. + +So only skip clk disabling if resume failed, but do delete the adapter. + +Fixes: 8b9ec0719834 ("i2c: Add Spreadtrum I2C controller driver") +Signed-off-by: Uwe Kleine-König +Reviewed-by: Andi Shyti +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-sprd.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c +index 92ba0183fd8a0..ef0dc06a3778e 100644 +--- a/drivers/i2c/busses/i2c-sprd.c ++++ b/drivers/i2c/busses/i2c-sprd.c +@@ -577,12 +577,14 @@ static int sprd_i2c_remove(struct platform_device *pdev) + struct sprd_i2c *i2c_dev = platform_get_drvdata(pdev); + int ret; + +- ret = pm_runtime_resume_and_get(i2c_dev->dev); ++ ret = pm_runtime_get_sync(i2c_dev->dev); + if (ret < 0) +- return ret; ++ dev_err(&pdev->dev, "Failed to resume device (%pe)\n", ERR_PTR(ret)); + + i2c_del_adapter(&i2c_dev->adap); +- clk_disable_unprepare(i2c_dev->clk); ++ ++ if (ret >= 0) ++ clk_disable_unprepare(i2c_dev->clk); + + pm_runtime_put_noidle(i2c_dev->dev); + pm_runtime_disable(i2c_dev->dev); +-- +2.39.2 + diff --git a/queue-5.4/series b/queue-5.4/series index 158515200ba..08d71b6e1ed 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -32,3 +32,5 @@ pinctrl-meson-axg-add-missing-gpioa_18-gpio-group.patch usb-usbfs-enforce-page-requirements-for-mmap.patch usb-usbfs-use-consistent-mmap-functions.patch bonding-gcc13-synchronize-bond_-a-t-lb_xmit-types.patch +i2c-sprd-delete-i2c-adapter-in-.remove-s-error-path.patch +eeprom-at24-also-select-regmap.patch -- 2.47.2