Subject: Re: [PATCH] coresight: trbe: Hide enable_sink sysfs file

From: Leo Yan <[email-masked]>
Date: Wed, 13 May 2026 10:54:39 +0100

On Wed, May 13, 2026 at 10:33:40AM +0100, James Clark wrote:

[...]

> > > +static umode_t coresight_attr_is_visible(struct kobject *kobj,
> > > +					 struct attribute *attr, int n)
> > >   {
> > >   	struct device *dev = kobj_to_dev(kobj);
> > > +	struct coresight_device *csdev = to_coresight_device(dev);
> > >   	if (attr == &dev_attr_label.attr) {
> > >   		if (fwnode_property_present(dev_fwnode(dev), "label"))
> > >   			return attr->mode;
> > >   		else
> > >   			return 0;
> > > +	} else if (attr == &dev_attr_enable_sink.attr ||
> > > +		   attr == &dev_attr_enable_source.attr) {
> > > +		if (csdev->no_sysfs_mode)
> > > +			return 0;
> > > +		else
> > > +			return attr->mode;
> > 
> > I'd prefer no_sysfs_mode to work as a general flag rather than being
> > limited to sink/source devices only. Otherwise, LGTM.
> 
> Which other files would you hide though? These are the only two that I could
> think of.
> 
> I wouldn't hide all sysfs files for 'no_sysfs_mode' as there are read only
> things that aren't strictly related to sysfs mode.

In coresight-sysfs.c, there are two kinds of attributes: the label and
the sink/source enable knobs.

The label is already handled separately. So we can hide the rest
attributes when no_sysfs_mode is set?

Thanks,
Leo