Re: [PATCH v4 01/13] coresight: Fix loss of connection info when a module is unloaded

From: Suzuki K Poulose
Date: Tue Apr 04 2023 - 10:11:51 EST


On 04/04/2023 14:53, James Clark wrote:
child_fwnode should be a read only property based on the DT. If it's

minor nit: Not restricted to DT. This also covers the ACPI.

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.

Reproducible on Juno with the following steps:

# load all coresight modules.
$ cd /sys/bus/coresight/devices/
$ echo 1 > tmc_etr0/enable_sink
$ echo 1 > etm0/enable_source
# Works fine ^

$ echo 0 > etm0/enable_source
$ rmmod coresight-funnel
$ modprobe coresight-funnel
$ echo 1 > etm0/enable_source
-bash: echo: write error: Invalid argument

Fixes: 37ea1ffddffa ("coresight: Use fwnode handle instead of device names")
Fixes: 2af89ebacf29 ("coresight: Clear the connection field properly")
Signed-off-by: James Clark <james.clark@xxxxxxx>

Looks good to me.

Tested-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>