[PATCH v11 14/27] coresight: Move source helper disabling to coresight_disable_path()

Leo Yan leo.yan at arm.com
Wed May 6 02:33:44 PDT 2026


On Wed, May 06, 2026 at 10:05:47AM +0100, Suzuki K Poulose wrote:

[...]

> > In coresight_enable_path(), if enabling a node fails, iterate to the
> > next node (which is the last successfully enabled node) and pass it to
> > coresight_disable_path() for rollback.  If the failed node is the last
> > node on the path, no device is actually enabled, so bail out directly.

[...]

> > @@ -580,12 +567,16 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode)
> >   {
> >   	int ret = 0;
> >   	u32 type;
> > -	struct coresight_node *nd;
> > +	struct coresight_node *nd, *last;
> >   	struct coresight_device *csdev, *parent, *child;
> >   	struct coresight_device *source;
> >   	source = coresight_get_source(path);
> > -	list_for_each_entry_reverse(nd, &path->path_list, link) {
> > +
> > +	last = list_last_entry(&path->path_list, struct coresight_node, link);
> > +
> > +	nd = last;
> > +	list_for_each_entry_from_reverse(nd, &path->path_list, link) {
> >   		csdev = nd->csdev;
> >   		type = csdev->type;
> > @@ -639,6 +630,11 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode)
> >   err_disable_helpers:
> >   	coresight_disable_helpers(csdev, path);
> >   err_disable_path:
> > +	/* No device is actually enabled */
> > +	if (nd == last)
> > +		goto out;
>  +
> 
> This hunk seems to be different from the one described in the commit and
> should be a different patch if at all we need it ?

This code piece matches to "If the failed node is the last node on the
path, ... so bail out directly".

But I should have adjusted description in commit log that first
mention the last node failure case to directly bail out, otherwise,
fetch next node for rallback operation.

> Moreover, this looks unnecessary. We already do the check to see if we
> didn't enable any device. See CORESIGHT_DEVICE_TYPE_SINK case.

This is required when support range - we cannot assume sink is the last
node anymore. I can move this chunk into patch 15 for support range.

Thanks,
Leo



More information about the linux-arm-kernel mailing list