[PATCH v3 06/13] coresight: Fix loss of connection info when a module is unloaded

James Clark james.clark at arm.com
Wed Mar 29 04:53:19 PDT 2023


child_fwnode should be a read only property based on the DT. If it's
cleared on the parent device when a child is unloaded, then when the
child is loaded again the connection won't be remade.

child_dev should be cleared instead which signifies that the connection
should be remade when the child_fwnode registers a new coresight_device.

Similarly the reference count shouldn't be decremented as long as the
parent device exists. The correct place to drop the reference is in
coresight_release_platform_data() which is already done.

Signed-off-by: James Clark <james.clark at arm.com>
---
 drivers/hwtracing/coresight/coresight-core.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index bfe1b93aca4e..12cbb68e8e1c 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1414,13 +1414,8 @@ static int coresight_remove_match(struct device *dev, void *data)
 		if (csdev->dev.fwnode == conn->dest_fwnode) {
 			iterator->orphan = true;
 			coresight_remove_links(iterator, conn);
-			/*
-			 * Drop the reference to the handle for the remote
-			 * device acquired in parsing the connections from
-			 * platform data.
-			 */
-			fwnode_handle_put(conn->dest_fwnode);
-			conn->dest_fwnode = NULL;
+
+			conn->dest_dev = NULL;
 			/* No need to continue */
 			break;
 		}
@@ -1553,7 +1548,6 @@ void coresight_release_platform_data(struct coresight_device *csdev,
 		 * is going away
 		 */
 		fwnode_handle_put(conns[i].dest_fwnode);
-		pdata->out_conns[i].dest_fwnode = NULL;
 	}
 	if (csdev)
 		coresight_remove_conns_sysfs_group(csdev);
-- 
2.34.1




More information about the linux-arm-kernel mailing list