[PATCH 6/8] coresight: Move all sysfs code to sysfs file

Suzuki K Poulose suzuki.poulose at arm.com
Tue Jan 9 02:22:15 PST 2024


On 12/12/2023 15:54, James Clark wrote:
> At the moment the core file contains both sysfs functionality and
> core functionality, while the Perf mode is in a separate file in
> coresight-etm-perf.c
> 
> Many of the functions have ambiguous names like
> coresight_enable_source() which actually only work in relation to the
> sysfs mode. To avoid further confusion, move everything that isn't core
> functionality into the sysfs file and append  _sysfs to the ambiguous
> functions.
> 
> Signed-off-by: James Clark <james.clark at arm.com>

The changes look good to me. One minor comment below.

...

> +struct device_type coresight_dev_type[] = {
> +	{
> +		.name = "sink",
> +		.groups = coresight_sink_groups,
> +	},
> +	{
> +		.name = "link",
> +	},
> +	{
> +		.name = "linksink",
> +		.groups = coresight_sink_groups,
> +	},
> +	{
> +		.name = "source",
> +		.groups = coresight_source_groups,
> +	},
> +	{
> +		.name = "helper",
> +	}
> +};
> +/* Ensure the enum matches the names and groups */
> +static_assert(ARRAY_SIZE(coresight_dev_type) == CORESIGHT_DEV_TYPE_MAX);

As a general cleanup, while you are at it, could we please replace this 
with explicit member initialisers as a follow up patch ?

i.e.,

struct device_typ coresight_dev_type[CORESIGHT_DEV_TYPE_MAX] = {
	[CORESIGHT_DEV_TYPE_SINK] = {
			.name = "sink",
			.groups = coresight_sink_groups,
	},
	[CORESIGHT_DEV_TYPE_LINK] =
...

}

Thanks
Suzuki



More information about the linux-arm-kernel mailing list