The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
Possible dependencies:
7a7d86d14d07 ("phy: qcom-qmp-combo: fix broken power on")
d4b81490fe44 ("phy: qcom-qmp-combo: drop start and pwrdn-ctrl abstraction")
f7075f4905e7 ("phy: qcom-qmp-combo: clean up status polling")
acfee73b635b ("phy: qcom-qmp-combo: drop power-down delay config")
d71eb7083e5e ("phy: qcom-qmp-combo: drop sc8280xp power-down delay")
2e52ddf045a0 ("phy: qcom-qmp-combo: clean up power-down handling")
9d943961912c ("phy: qcom-qmp-combo: drop redundant DP config flag")
099155615ac2 ("phy: qcom-qmp-combo: consolidate lane config")
f5d6b5d613e9 ("phy: qcom-qmp-combo: fix sc8280xp PCS_USB offset")
064bbdba4f8d ("phy: qcom-qmp-combo: drop unused legacy DT workaround")
2de8a325b108 ("phy: qcom-qmp-combo: fix memleak on probe deferral")
e5cedefa7203 ("phy: qcom-qmp-combo: shorten function prefixes")
beee6ed1d63f ("phy: qcom-qmp-combo: drop unused defines")
ac439ce88edf ("phy: qcom-qmp: drop dual-lane comments")
a2e927b0e50d ("phy: qcom-qmp-combo: Add sc8280xp USB/DP combo phys")
c0c7769cdae2 ("phy: qcom-qmp: Add SC8280XP USB3 UNI phy")
712e5dffe911 ("phy: qcom-qmp-combo: Parameterize swing and pre_emphasis tables")
d88497fb6bbd ("phy: qualcomm: phy-qcom-qmp: add support for combo USB3+DP phy on SDM845")
5fc21d1bd3d7 ("phy: qcom-qmp: split allegedly 4.20 and 5.20 TX/RX registers")
87d71378c61a ("phy: qcom-qmp: move PCIE QHP registers to separate header")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 7a7d86d14d073dfa3429c550667a8e78b99edbd4 Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan+linaro(a)kernel.org>
Date: Mon, 14 Nov 2022 09:13:44 +0100
Subject: [PATCH] phy: qcom-qmp-combo: fix broken power on
The PHY is powered on during phy-init by setting the SW_PWRDN bit in the
COM_POWER_DOWN_CTRL register and then setting the same bit in the in the
PCS_POWER_DOWN_CONTROL register that belongs to the USB part of the
PHY.
Currently, whether power on succeeds depends on probe order and having
the USB part of the PHY be initialised first. In case the DP part of the
PHY is instead initialised first, the intended power on of the USB block
results in a corrupted DP_PHY register (e.g. DP_PHY_AUX_CFG8).
Add a pointer to the USB part of the PHY to the driver data and use that
to power on the PHY also if the DP part of the PHY is initialised first.
Fixes: 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo phy")
Cc: stable(a)vger.kernel.org # 5.10
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov(a)linaro.org>
Signed-off-by: Johan Hovold <johan+linaro(a)kernel.org>
Link: https://lore.kernel.org/r/20221114081346.5116-5-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul(a)kernel.org>
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 40c25a0ead23..17707f68d482 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -932,6 +932,7 @@ struct qcom_qmp {
struct regulator_bulk_data *vregs;
struct qmp_phy **phys;
+ struct qmp_phy *usb_phy;
struct mutex phy_mutex;
int init_count;
@@ -1911,7 +1912,7 @@ static int qmp_combo_com_init(struct qmp_phy *qphy)
{
struct qcom_qmp *qmp = qphy->qmp;
const struct qmp_phy_cfg *cfg = qphy->cfg;
- void __iomem *pcs = qphy->pcs;
+ struct qmp_phy *usb_phy = qmp->usb_phy;
void __iomem *dp_com = qmp->dp_com;
int ret;
@@ -1963,7 +1964,8 @@ static int qmp_combo_com_init(struct qmp_phy *qphy)
qphy_clrbits(dp_com, QPHY_V3_DP_COM_SWI_CTRL, 0x03);
qphy_clrbits(dp_com, QPHY_V3_DP_COM_SW_RESET, SW_RESET);
- qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN);
+ qphy_setbits(usb_phy->pcs, usb_phy->cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ SW_PWRDN);
mutex_unlock(&qmp->phy_mutex);
@@ -2831,6 +2833,8 @@ static int qmp_combo_probe(struct platform_device *pdev)
goto err_node_put;
}
+ qmp->usb_phy = qmp->phys[id];
+
/*
* Register the pipe clock provided by phy.
* See function description to see details of this pipe clock.
@@ -2846,6 +2850,9 @@ static int qmp_combo_probe(struct platform_device *pdev)
id++;
}
+ if (!qmp->usb_phy)
+ return -EINVAL;
+
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
return PTR_ERR_OR_ZERO(phy_provider);
The patch below does not apply to the 6.0-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
Possible dependencies:
7a7d86d14d07 ("phy: qcom-qmp-combo: fix broken power on")
d4b81490fe44 ("phy: qcom-qmp-combo: drop start and pwrdn-ctrl abstraction")
f7075f4905e7 ("phy: qcom-qmp-combo: clean up status polling")
acfee73b635b ("phy: qcom-qmp-combo: drop power-down delay config")
d71eb7083e5e ("phy: qcom-qmp-combo: drop sc8280xp power-down delay")
2e52ddf045a0 ("phy: qcom-qmp-combo: clean up power-down handling")
9d943961912c ("phy: qcom-qmp-combo: drop redundant DP config flag")
099155615ac2 ("phy: qcom-qmp-combo: consolidate lane config")
f5d6b5d613e9 ("phy: qcom-qmp-combo: fix sc8280xp PCS_USB offset")
064bbdba4f8d ("phy: qcom-qmp-combo: drop unused legacy DT workaround")
2de8a325b108 ("phy: qcom-qmp-combo: fix memleak on probe deferral")
e5cedefa7203 ("phy: qcom-qmp-combo: shorten function prefixes")
beee6ed1d63f ("phy: qcom-qmp-combo: drop unused defines")
ac439ce88edf ("phy: qcom-qmp: drop dual-lane comments")
a2e927b0e50d ("phy: qcom-qmp-combo: Add sc8280xp USB/DP combo phys")
c0c7769cdae2 ("phy: qcom-qmp: Add SC8280XP USB3 UNI phy")
712e5dffe911 ("phy: qcom-qmp-combo: Parameterize swing and pre_emphasis tables")
d88497fb6bbd ("phy: qualcomm: phy-qcom-qmp: add support for combo USB3+DP phy on SDM845")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 7a7d86d14d073dfa3429c550667a8e78b99edbd4 Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan+linaro(a)kernel.org>
Date: Mon, 14 Nov 2022 09:13:44 +0100
Subject: [PATCH] phy: qcom-qmp-combo: fix broken power on
The PHY is powered on during phy-init by setting the SW_PWRDN bit in the
COM_POWER_DOWN_CTRL register and then setting the same bit in the in the
PCS_POWER_DOWN_CONTROL register that belongs to the USB part of the
PHY.
Currently, whether power on succeeds depends on probe order and having
the USB part of the PHY be initialised first. In case the DP part of the
PHY is instead initialised first, the intended power on of the USB block
results in a corrupted DP_PHY register (e.g. DP_PHY_AUX_CFG8).
Add a pointer to the USB part of the PHY to the driver data and use that
to power on the PHY also if the DP part of the PHY is initialised first.
Fixes: 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo phy")
Cc: stable(a)vger.kernel.org # 5.10
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov(a)linaro.org>
Signed-off-by: Johan Hovold <johan+linaro(a)kernel.org>
Link: https://lore.kernel.org/r/20221114081346.5116-5-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul(a)kernel.org>
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 40c25a0ead23..17707f68d482 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -932,6 +932,7 @@ struct qcom_qmp {
struct regulator_bulk_data *vregs;
struct qmp_phy **phys;
+ struct qmp_phy *usb_phy;
struct mutex phy_mutex;
int init_count;
@@ -1911,7 +1912,7 @@ static int qmp_combo_com_init(struct qmp_phy *qphy)
{
struct qcom_qmp *qmp = qphy->qmp;
const struct qmp_phy_cfg *cfg = qphy->cfg;
- void __iomem *pcs = qphy->pcs;
+ struct qmp_phy *usb_phy = qmp->usb_phy;
void __iomem *dp_com = qmp->dp_com;
int ret;
@@ -1963,7 +1964,8 @@ static int qmp_combo_com_init(struct qmp_phy *qphy)
qphy_clrbits(dp_com, QPHY_V3_DP_COM_SWI_CTRL, 0x03);
qphy_clrbits(dp_com, QPHY_V3_DP_COM_SW_RESET, SW_RESET);
- qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN);
+ qphy_setbits(usb_phy->pcs, usb_phy->cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ SW_PWRDN);
mutex_unlock(&qmp->phy_mutex);
@@ -2831,6 +2833,8 @@ static int qmp_combo_probe(struct platform_device *pdev)
goto err_node_put;
}
+ qmp->usb_phy = qmp->phys[id];
+
/*
* Register the pipe clock provided by phy.
* See function description to see details of this pipe clock.
@@ -2846,6 +2850,9 @@ static int qmp_combo_probe(struct platform_device *pdev)
id++;
}
+ if (!qmp->usb_phy)
+ return -EINVAL;
+
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
return PTR_ERR_OR_ZERO(phy_provider);
The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
Possible dependencies:
7a7d86d14d07 ("phy: qcom-qmp-combo: fix broken power on")
d4b81490fe44 ("phy: qcom-qmp-combo: drop start and pwrdn-ctrl abstraction")
f7075f4905e7 ("phy: qcom-qmp-combo: clean up status polling")
acfee73b635b ("phy: qcom-qmp-combo: drop power-down delay config")
d71eb7083e5e ("phy: qcom-qmp-combo: drop sc8280xp power-down delay")
2e52ddf045a0 ("phy: qcom-qmp-combo: clean up power-down handling")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 7a7d86d14d073dfa3429c550667a8e78b99edbd4 Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan+linaro(a)kernel.org>
Date: Mon, 14 Nov 2022 09:13:44 +0100
Subject: [PATCH] phy: qcom-qmp-combo: fix broken power on
The PHY is powered on during phy-init by setting the SW_PWRDN bit in the
COM_POWER_DOWN_CTRL register and then setting the same bit in the in the
PCS_POWER_DOWN_CONTROL register that belongs to the USB part of the
PHY.
Currently, whether power on succeeds depends on probe order and having
the USB part of the PHY be initialised first. In case the DP part of the
PHY is instead initialised first, the intended power on of the USB block
results in a corrupted DP_PHY register (e.g. DP_PHY_AUX_CFG8).
Add a pointer to the USB part of the PHY to the driver data and use that
to power on the PHY also if the DP part of the PHY is initialised first.
Fixes: 52e013d0bffa ("phy: qcom-qmp: Add support for DP in USB3+DP combo phy")
Cc: stable(a)vger.kernel.org # 5.10
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov(a)linaro.org>
Signed-off-by: Johan Hovold <johan+linaro(a)kernel.org>
Link: https://lore.kernel.org/r/20221114081346.5116-5-johan+linaro@kernel.org
Signed-off-by: Vinod Koul <vkoul(a)kernel.org>
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 40c25a0ead23..17707f68d482 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -932,6 +932,7 @@ struct qcom_qmp {
struct regulator_bulk_data *vregs;
struct qmp_phy **phys;
+ struct qmp_phy *usb_phy;
struct mutex phy_mutex;
int init_count;
@@ -1911,7 +1912,7 @@ static int qmp_combo_com_init(struct qmp_phy *qphy)
{
struct qcom_qmp *qmp = qphy->qmp;
const struct qmp_phy_cfg *cfg = qphy->cfg;
- void __iomem *pcs = qphy->pcs;
+ struct qmp_phy *usb_phy = qmp->usb_phy;
void __iomem *dp_com = qmp->dp_com;
int ret;
@@ -1963,7 +1964,8 @@ static int qmp_combo_com_init(struct qmp_phy *qphy)
qphy_clrbits(dp_com, QPHY_V3_DP_COM_SWI_CTRL, 0x03);
qphy_clrbits(dp_com, QPHY_V3_DP_COM_SW_RESET, SW_RESET);
- qphy_setbits(pcs, cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL], SW_PWRDN);
+ qphy_setbits(usb_phy->pcs, usb_phy->cfg->regs[QPHY_PCS_POWER_DOWN_CONTROL],
+ SW_PWRDN);
mutex_unlock(&qmp->phy_mutex);
@@ -2831,6 +2833,8 @@ static int qmp_combo_probe(struct platform_device *pdev)
goto err_node_put;
}
+ qmp->usb_phy = qmp->phys[id];
+
/*
* Register the pipe clock provided by phy.
* See function description to see details of this pipe clock.
@@ -2846,6 +2850,9 @@ static int qmp_combo_probe(struct platform_device *pdev)
id++;
}
+ if (!qmp->usb_phy)
+ return -EINVAL;
+
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
return PTR_ERR_OR_ZERO(phy_provider);
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
Possible dependencies:
27c0d217340e ("driver core: Fix bus_type.match() error handling in __driver_attach()")
eb7fbc9fb118 ("driver core: Add missing '\n' in log messages")
64c775fb4b21 ("driver core: Rename deferred_probe_timeout and make it global")
0e9f8d09d280 ("driver core: Remove driver_deferred_probe_check_state_continue()")
e2cec7d68537 ("driver core: Set deferred_probe_timeout to a longer default if CONFIG_MODULES is set")
c8c43cee29f6 ("driver core: Fix driver_deferred_probe_check_state() logic")
4c002c978b7f ("device.h: move 'struct driver' stuff out to device/driver.h")
a8ae608529ab ("device.h: move 'struct class' stuff out to device/class.h")
5aee2bf2629d ("device.h: move 'struct bus' stuff out to device/bus.h")
fc5a251d0fd7 ("driver core: Add sync_state driver/bus callback")
e2ae9bcc4aaa ("driver core: Add support for linking devices during device addition")
372a67c0c5ef ("driver core: Add fwnode_to_dev() to look up device from fwnode")
bfb3943bed67 ("Revert "driver core: Add support for linking devices during device addition"")
33cbfe544993 ("Revert "driver core: Add edit_links() callback for drivers"")
bcca686c11cd ("Revert "driver core: Add sync_state driver/bus callback"")
1f573cce48a2 ("device.h: Fix warnings for mismatched parameter names in comments")
97e2551de3f9 ("Merge tag 'dev_groups_all_drivers' into driver-core-next")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 27c0d217340e47ec995557f61423ef415afba987 Mon Sep 17 00:00:00 2001
From: "Isaac J. Manjarres" <isaacmanjarres(a)google.com>
Date: Tue, 20 Sep 2022 17:14:13 -0700
Subject: [PATCH] driver core: Fix bus_type.match() error handling in
__driver_attach()
When a driver registers with a bus, it will attempt to match with every
device on the bus through the __driver_attach() function. Currently, if
the bus_type.match() function encounters an error that is not
-EPROBE_DEFER, __driver_attach() will return a negative error code, which
causes the driver registration logic to stop trying to match with the
remaining devices on the bus.
This behavior is not correct; a failure while matching a driver to a
device does not mean that the driver won't be able to match and bind
with other devices on the bus. Update the logic in __driver_attach()
to reflect this.
Fixes: 656b8035b0ee ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()")
Cc: stable(a)vger.kernel.org
Cc: Saravana Kannan <saravanak(a)google.com>
Signed-off-by: Isaac J. Manjarres <isaacmanjarres(a)google.com>
Link: https://lore.kernel.org/r/20220921001414.4046492-1-isaacmanjarres@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 4001e22617ab..e9b2f9c25efe 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -1162,7 +1162,11 @@ static int __driver_attach(struct device *dev, void *data)
return 0;
} else if (ret < 0) {
dev_dbg(dev, "Bus failed to match device: %d\n", ret);
- return ret;
+ /*
+ * Driver could not match with device, but may match with
+ * another device on the bus.
+ */
+ return 0;
} /* ret > 0 means positive match */
if (driver_allows_async_probing(drv)) {
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
Possible dependencies:
27c0d217340e ("driver core: Fix bus_type.match() error handling in __driver_attach()")
eb7fbc9fb118 ("driver core: Add missing '\n' in log messages")
64c775fb4b21 ("driver core: Rename deferred_probe_timeout and make it global")
0e9f8d09d280 ("driver core: Remove driver_deferred_probe_check_state_continue()")
e2cec7d68537 ("driver core: Set deferred_probe_timeout to a longer default if CONFIG_MODULES is set")
c8c43cee29f6 ("driver core: Fix driver_deferred_probe_check_state() logic")
4c002c978b7f ("device.h: move 'struct driver' stuff out to device/driver.h")
a8ae608529ab ("device.h: move 'struct class' stuff out to device/class.h")
5aee2bf2629d ("device.h: move 'struct bus' stuff out to device/bus.h")
fc5a251d0fd7 ("driver core: Add sync_state driver/bus callback")
e2ae9bcc4aaa ("driver core: Add support for linking devices during device addition")
372a67c0c5ef ("driver core: Add fwnode_to_dev() to look up device from fwnode")
bfb3943bed67 ("Revert "driver core: Add support for linking devices during device addition"")
33cbfe544993 ("Revert "driver core: Add edit_links() callback for drivers"")
bcca686c11cd ("Revert "driver core: Add sync_state driver/bus callback"")
1f573cce48a2 ("device.h: Fix warnings for mismatched parameter names in comments")
97e2551de3f9 ("Merge tag 'dev_groups_all_drivers' into driver-core-next")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 27c0d217340e47ec995557f61423ef415afba987 Mon Sep 17 00:00:00 2001
From: "Isaac J. Manjarres" <isaacmanjarres(a)google.com>
Date: Tue, 20 Sep 2022 17:14:13 -0700
Subject: [PATCH] driver core: Fix bus_type.match() error handling in
__driver_attach()
When a driver registers with a bus, it will attempt to match with every
device on the bus through the __driver_attach() function. Currently, if
the bus_type.match() function encounters an error that is not
-EPROBE_DEFER, __driver_attach() will return a negative error code, which
causes the driver registration logic to stop trying to match with the
remaining devices on the bus.
This behavior is not correct; a failure while matching a driver to a
device does not mean that the driver won't be able to match and bind
with other devices on the bus. Update the logic in __driver_attach()
to reflect this.
Fixes: 656b8035b0ee ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()")
Cc: stable(a)vger.kernel.org
Cc: Saravana Kannan <saravanak(a)google.com>
Signed-off-by: Isaac J. Manjarres <isaacmanjarres(a)google.com>
Link: https://lore.kernel.org/r/20220921001414.4046492-1-isaacmanjarres@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 4001e22617ab..e9b2f9c25efe 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -1162,7 +1162,11 @@ static int __driver_attach(struct device *dev, void *data)
return 0;
} else if (ret < 0) {
dev_dbg(dev, "Bus failed to match device: %d\n", ret);
- return ret;
+ /*
+ * Driver could not match with device, but may match with
+ * another device on the bus.
+ */
+ return 0;
} /* ret > 0 means positive match */
if (driver_allows_async_probing(drv)) {
The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
Possible dependencies:
27c0d217340e ("driver core: Fix bus_type.match() error handling in __driver_attach()")
eb7fbc9fb118 ("driver core: Add missing '\n' in log messages")
64c775fb4b21 ("driver core: Rename deferred_probe_timeout and make it global")
0e9f8d09d280 ("driver core: Remove driver_deferred_probe_check_state_continue()")
e2cec7d68537 ("driver core: Set deferred_probe_timeout to a longer default if CONFIG_MODULES is set")
c8c43cee29f6 ("driver core: Fix driver_deferred_probe_check_state() logic")
4c002c978b7f ("device.h: move 'struct driver' stuff out to device/driver.h")
a8ae608529ab ("device.h: move 'struct class' stuff out to device/class.h")
5aee2bf2629d ("device.h: move 'struct bus' stuff out to device/bus.h")
fc5a251d0fd7 ("driver core: Add sync_state driver/bus callback")
e2ae9bcc4aaa ("driver core: Add support for linking devices during device addition")
372a67c0c5ef ("driver core: Add fwnode_to_dev() to look up device from fwnode")
bfb3943bed67 ("Revert "driver core: Add support for linking devices during device addition"")
33cbfe544993 ("Revert "driver core: Add edit_links() callback for drivers"")
bcca686c11cd ("Revert "driver core: Add sync_state driver/bus callback"")
1f573cce48a2 ("device.h: Fix warnings for mismatched parameter names in comments")
97e2551de3f9 ("Merge tag 'dev_groups_all_drivers' into driver-core-next")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 27c0d217340e47ec995557f61423ef415afba987 Mon Sep 17 00:00:00 2001
From: "Isaac J. Manjarres" <isaacmanjarres(a)google.com>
Date: Tue, 20 Sep 2022 17:14:13 -0700
Subject: [PATCH] driver core: Fix bus_type.match() error handling in
__driver_attach()
When a driver registers with a bus, it will attempt to match with every
device on the bus through the __driver_attach() function. Currently, if
the bus_type.match() function encounters an error that is not
-EPROBE_DEFER, __driver_attach() will return a negative error code, which
causes the driver registration logic to stop trying to match with the
remaining devices on the bus.
This behavior is not correct; a failure while matching a driver to a
device does not mean that the driver won't be able to match and bind
with other devices on the bus. Update the logic in __driver_attach()
to reflect this.
Fixes: 656b8035b0ee ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()")
Cc: stable(a)vger.kernel.org
Cc: Saravana Kannan <saravanak(a)google.com>
Signed-off-by: Isaac J. Manjarres <isaacmanjarres(a)google.com>
Link: https://lore.kernel.org/r/20220921001414.4046492-1-isaacmanjarres@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 4001e22617ab..e9b2f9c25efe 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -1162,7 +1162,11 @@ static int __driver_attach(struct device *dev, void *data)
return 0;
} else if (ret < 0) {
dev_dbg(dev, "Bus failed to match device: %d\n", ret);
- return ret;
+ /*
+ * Driver could not match with device, but may match with
+ * another device on the bus.
+ */
+ return 0;
} /* ret > 0 means positive match */
if (driver_allows_async_probing(drv)) {
The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
Possible dependencies:
27c0d217340e ("driver core: Fix bus_type.match() error handling in __driver_attach()")
eb7fbc9fb118 ("driver core: Add missing '\n' in log messages")
64c775fb4b21 ("driver core: Rename deferred_probe_timeout and make it global")
0e9f8d09d280 ("driver core: Remove driver_deferred_probe_check_state_continue()")
e2cec7d68537 ("driver core: Set deferred_probe_timeout to a longer default if CONFIG_MODULES is set")
c8c43cee29f6 ("driver core: Fix driver_deferred_probe_check_state() logic")
4c002c978b7f ("device.h: move 'struct driver' stuff out to device/driver.h")
a8ae608529ab ("device.h: move 'struct class' stuff out to device/class.h")
5aee2bf2629d ("device.h: move 'struct bus' stuff out to device/bus.h")
fc5a251d0fd7 ("driver core: Add sync_state driver/bus callback")
e2ae9bcc4aaa ("driver core: Add support for linking devices during device addition")
372a67c0c5ef ("driver core: Add fwnode_to_dev() to look up device from fwnode")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 27c0d217340e47ec995557f61423ef415afba987 Mon Sep 17 00:00:00 2001
From: "Isaac J. Manjarres" <isaacmanjarres(a)google.com>
Date: Tue, 20 Sep 2022 17:14:13 -0700
Subject: [PATCH] driver core: Fix bus_type.match() error handling in
__driver_attach()
When a driver registers with a bus, it will attempt to match with every
device on the bus through the __driver_attach() function. Currently, if
the bus_type.match() function encounters an error that is not
-EPROBE_DEFER, __driver_attach() will return a negative error code, which
causes the driver registration logic to stop trying to match with the
remaining devices on the bus.
This behavior is not correct; a failure while matching a driver to a
device does not mean that the driver won't be able to match and bind
with other devices on the bus. Update the logic in __driver_attach()
to reflect this.
Fixes: 656b8035b0ee ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()")
Cc: stable(a)vger.kernel.org
Cc: Saravana Kannan <saravanak(a)google.com>
Signed-off-by: Isaac J. Manjarres <isaacmanjarres(a)google.com>
Link: https://lore.kernel.org/r/20220921001414.4046492-1-isaacmanjarres@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 4001e22617ab..e9b2f9c25efe 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -1162,7 +1162,11 @@ static int __driver_attach(struct device *dev, void *data)
return 0;
} else if (ret < 0) {
dev_dbg(dev, "Bus failed to match device: %d\n", ret);
- return ret;
+ /*
+ * Driver could not match with device, but may match with
+ * another device on the bus.
+ */
+ return 0;
} /* ret > 0 means positive match */
if (driver_allows_async_probing(drv)) {
The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
Possible dependencies:
5c3022e4a616 ("riscv: stacktrace: Fixup ftrace_graph_ret_addr retp argument")
f766f77a74f5 ("riscv/stacktrace: Fix stack output without ra on the stack top")
877425424d6c ("riscv: remove unreachable !HAVE_FUNCTION_GRAPH_RET_ADDR_PTR code")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 5c3022e4a616d800cf5f4c3a981d7992179e44a1 Mon Sep 17 00:00:00 2001
From: Guo Ren <guoren(a)kernel.org>
Date: Wed, 9 Nov 2022 01:49:36 -0500
Subject: [PATCH] riscv: stacktrace: Fixup ftrace_graph_ret_addr retp argument
The 'retp' is a pointer to the return address on the stack, so we
must pass the current return address pointer as the 'retp'
argument to ftrace_push_return_trace(). Not parent function's
return address on the stack.
Fixes: b785ec129bd9 ("riscv/ftrace: Add HAVE_FUNCTION_GRAPH_RET_ADDR_PTR support")
Signed-off-by: Guo Ren <guoren(a)linux.alibaba.com>
Signed-off-by: Guo Ren <guoren(a)kernel.org>
Link: https://lore.kernel.org/r/20221109064937.3643993-2-guoren@kernel.org
Cc: stable(a)vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer(a)rivosinc.com>
diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
index 08d11a53f39e..bcfe9eb55f80 100644
--- a/arch/riscv/kernel/stacktrace.c
+++ b/arch/riscv/kernel/stacktrace.c
@@ -58,7 +58,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
} else {
fp = frame->fp;
pc = ftrace_graph_ret_addr(current, NULL, frame->ra,
- (unsigned long *)(fp - 8));
+ &frame->ra);
}
}
The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
Possible dependencies:
5c3022e4a616 ("riscv: stacktrace: Fixup ftrace_graph_ret_addr retp argument")
f766f77a74f5 ("riscv/stacktrace: Fix stack output without ra on the stack top")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 5c3022e4a616d800cf5f4c3a981d7992179e44a1 Mon Sep 17 00:00:00 2001
From: Guo Ren <guoren(a)kernel.org>
Date: Wed, 9 Nov 2022 01:49:36 -0500
Subject: [PATCH] riscv: stacktrace: Fixup ftrace_graph_ret_addr retp argument
The 'retp' is a pointer to the return address on the stack, so we
must pass the current return address pointer as the 'retp'
argument to ftrace_push_return_trace(). Not parent function's
return address on the stack.
Fixes: b785ec129bd9 ("riscv/ftrace: Add HAVE_FUNCTION_GRAPH_RET_ADDR_PTR support")
Signed-off-by: Guo Ren <guoren(a)linux.alibaba.com>
Signed-off-by: Guo Ren <guoren(a)kernel.org>
Link: https://lore.kernel.org/r/20221109064937.3643993-2-guoren@kernel.org
Cc: stable(a)vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer(a)rivosinc.com>
diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
index 08d11a53f39e..bcfe9eb55f80 100644
--- a/arch/riscv/kernel/stacktrace.c
+++ b/arch/riscv/kernel/stacktrace.c
@@ -58,7 +58,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
} else {
fp = frame->fp;
pc = ftrace_graph_ret_addr(current, NULL, frame->ra,
- (unsigned long *)(fp - 8));
+ &frame->ra);
}
}
The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
Possible dependencies:
5c3022e4a616 ("riscv: stacktrace: Fixup ftrace_graph_ret_addr retp argument")
f766f77a74f5 ("riscv/stacktrace: Fix stack output without ra on the stack top")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 5c3022e4a616d800cf5f4c3a981d7992179e44a1 Mon Sep 17 00:00:00 2001
From: Guo Ren <guoren(a)kernel.org>
Date: Wed, 9 Nov 2022 01:49:36 -0500
Subject: [PATCH] riscv: stacktrace: Fixup ftrace_graph_ret_addr retp argument
The 'retp' is a pointer to the return address on the stack, so we
must pass the current return address pointer as the 'retp'
argument to ftrace_push_return_trace(). Not parent function's
return address on the stack.
Fixes: b785ec129bd9 ("riscv/ftrace: Add HAVE_FUNCTION_GRAPH_RET_ADDR_PTR support")
Signed-off-by: Guo Ren <guoren(a)linux.alibaba.com>
Signed-off-by: Guo Ren <guoren(a)kernel.org>
Link: https://lore.kernel.org/r/20221109064937.3643993-2-guoren@kernel.org
Cc: stable(a)vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer(a)rivosinc.com>
diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
index 08d11a53f39e..bcfe9eb55f80 100644
--- a/arch/riscv/kernel/stacktrace.c
+++ b/arch/riscv/kernel/stacktrace.c
@@ -58,7 +58,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
} else {
fp = frame->fp;
pc = ftrace_graph_ret_addr(current, NULL, frame->ra,
- (unsigned long *)(fp - 8));
+ &frame->ra);
}
}