Skip to content

Commit

Permalink
stm class: Support devices with multiple instances
Browse files Browse the repository at this point in the history
By convention, the name of the stm policy directory in configfs consists of
the device name to which it applies and the actual policy name, separated
by a dot. Now, some devices already have dots in their names that separate
name of the actual device from its instance identifier. Such devices will
result in two (or more, who can tell) dots in the policy directory name.

Existing policy code, however, will treat the first dot as the one that
separates device name from policy name, therefore failing the above case.

This patch makes the last dot in the directory name be the separator, thus
prohibiting dots from being used in policy names.

Suggested-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Alexander Shishkin authored and Greg Kroah-Hartman committed Feb 20, 2016
1 parent f8560a9 commit 59be422
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/hwtracing/stm/policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,11 @@ stp_policies_make(struct config_group *group, const char *name)

/*
* node must look like <device_name>.<policy_name>, where
* <device_name> is the name of an existing stm device and
* <policy_name> is an arbitrary string
* <device_name> is the name of an existing stm device; may
* contain dots;
* <policy_name> is an arbitrary string; may not contain dots
*/
p = strchr(devname, '.');
p = strrchr(devname, '.');
if (!p) {
kfree(devname);
return ERR_PTR(-EINVAL);
Expand Down

0 comments on commit 59be422

Please sign in to comment.