[ Sasha's backport helper bot ] Hi, The upstream commit SHA1 provided is correct: 1da11f822042eb6ef4b6064dc048f157a7852529 WARNING: Author mismatch between patch and upstream commit: Backport author: Xiangyu Chen <xiangyu.chen@xxxxxxxxxxxxxxxxx> Commit author: Marco Pagani <marpagan@xxxxxxxxxx> Status in newer kernel trees: 6.12.y | Present (exact SHA1) 6.11.y | Present (exact SHA1) 6.6.y | Present (different SHA1: d7c4081c54a1) 6.1.y | Not found Note: The patch differs from the upstream commit: --- --- - 2024-11-25 10:03:24.580903183 -0500 +++ /tmp/tmp.dgudhG3mc3 2024-11-25 10:03:24.569117471 -0500 @@ -1,3 +1,5 @@ +[ Upstream commit 1da11f822042eb6ef4b6064dc048f157a7852529 ] + The current implementation of the fpga bridge assumes that the low-level module registers a driver for the parent device and uses its owner pointer to take the module's refcount. This approach is problematic since it can @@ -27,6 +29,8 @@ Acked-by: Xu Yilun <yilun.xu@xxxxxxxxx> Link: https://lore.kernel.org/r/20240322171839.233864-1-marpagan@xxxxxxxxxx Signed-off-by: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx> +Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> +Signed-off-by: Xiangyu Chen <xiangyu.chen@xxxxxxxxxxxxx> --- Documentation/driver-api/fpga/fpga-bridge.rst | 7 ++- drivers/fpga/fpga-bridge.c | 57 ++++++++++--------- @@ -34,7 +38,7 @@ 3 files changed, 43 insertions(+), 31 deletions(-) diff --git a/Documentation/driver-api/fpga/fpga-bridge.rst b/Documentation/driver-api/fpga/fpga-bridge.rst -index 6042085340953..833f68fb07008 100644 +index 604208534095..833f68fb0700 100644 --- a/Documentation/driver-api/fpga/fpga-bridge.rst +++ b/Documentation/driver-api/fpga/fpga-bridge.rst @@ -6,9 +6,12 @@ API to implement a new FPGA bridge @@ -61,7 +65,7 @@ .. kernel-doc:: drivers/fpga/fpga-bridge.c :functions: fpga_bridge_unregister diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c -index 79c473b3c7c3d..8ef395b49bf8a 100644 +index 833ce13ff6f8..698d6cbf782a 100644 --- a/drivers/fpga/fpga-bridge.c +++ b/drivers/fpga/fpga-bridge.c @@ -55,33 +55,26 @@ int fpga_bridge_disable(struct fpga_bridge *bridge) @@ -106,7 +110,7 @@ } /** -@@ -98,13 +91,18 @@ static struct fpga_bridge *__fpga_bridge_get(struct device *dev, +@@ -97,13 +90,18 @@ static struct fpga_bridge *__fpga_bridge_get(struct device *dev, struct fpga_bridge *of_fpga_bridge_get(struct device_node *np, struct fpga_image_info *info) { @@ -114,9 +118,9 @@ + struct fpga_bridge *bridge; + struct device *bridge_dev; -- dev = class_find_device_by_of_node(&fpga_bridge_class, np); +- dev = class_find_device_by_of_node(fpga_bridge_class, np); - if (!dev) -+ bridge_dev = class_find_device_by_of_node(&fpga_bridge_class, np); ++ bridge_dev = class_find_device_by_of_node(fpga_bridge_class, np); + if (!bridge_dev) return ERR_PTR(-ENODEV); @@ -129,15 +133,15 @@ } EXPORT_SYMBOL_GPL(of_fpga_bridge_get); -@@ -125,6 +123,7 @@ static int fpga_bridge_dev_match(struct device *dev, const void *data) +@@ -124,6 +122,7 @@ static int fpga_bridge_dev_match(struct device *dev, const void *data) struct fpga_bridge *fpga_bridge_get(struct device *dev, struct fpga_image_info *info) { + struct fpga_bridge *bridge; struct device *bridge_dev; - bridge_dev = class_find_device(&fpga_bridge_class, NULL, dev, -@@ -132,7 +131,11 @@ struct fpga_bridge *fpga_bridge_get(struct device *dev, + bridge_dev = class_find_device(fpga_bridge_class, NULL, dev, +@@ -131,7 +130,11 @@ struct fpga_bridge *fpga_bridge_get(struct device *dev, if (!bridge_dev) return ERR_PTR(-ENODEV); @@ -150,7 +154,7 @@ } EXPORT_SYMBOL_GPL(fpga_bridge_get); -@@ -146,7 +149,7 @@ void fpga_bridge_put(struct fpga_bridge *bridge) +@@ -145,7 +148,7 @@ void fpga_bridge_put(struct fpga_bridge *bridge) dev_dbg(&bridge->dev, "put\n"); bridge->info = NULL; @@ -159,7 +163,7 @@ mutex_unlock(&bridge->mutex); put_device(&bridge->dev); } -@@ -316,18 +319,19 @@ static struct attribute *fpga_bridge_attrs[] = { +@@ -312,18 +315,19 @@ static struct attribute *fpga_bridge_attrs[] = { ATTRIBUTE_GROUPS(fpga_bridge); /** @@ -183,7 +187,7 @@ { struct fpga_bridge *bridge; int id, ret; -@@ -357,6 +361,7 @@ fpga_bridge_register(struct device *parent, const char *name, +@@ -353,6 +357,7 @@ fpga_bridge_register(struct device *parent, const char *name, bridge->name = name; bridge->br_ops = br_ops; @@ -191,7 +195,7 @@ bridge->priv = priv; bridge->dev.groups = br_ops->groups; -@@ -386,7 +391,7 @@ fpga_bridge_register(struct device *parent, const char *name, +@@ -382,7 +387,7 @@ fpga_bridge_register(struct device *parent, const char *name, return ERR_PTR(ret); } @@ -201,7 +205,7 @@ /** * fpga_bridge_unregister - unregister an FPGA bridge diff --git a/include/linux/fpga/fpga-bridge.h b/include/linux/fpga/fpga-bridge.h -index 223da48a6d18b..94c4edd047e54 100644 +index 223da48a6d18..94c4edd047e5 100644 --- a/include/linux/fpga/fpga-bridge.h +++ b/include/linux/fpga/fpga-bridge.h @@ -45,6 +45,7 @@ struct fpga_bridge_info { @@ -236,3 +240,6 @@ void fpga_bridge_unregister(struct fpga_bridge *br); #endif /* _LINUX_FPGA_BRIDGE_H */ +-- +2.43.0 + --- Results of testing on various branches: | Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.1.y | Success | Success |