summaryrefslogtreecommitdiff
path: root/drivers/hwtracing/intel_th/core.c
diff options
context:
space:
mode:
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>2016-03-04 19:42:48 +0200
committerAlexander Shishkin <alexander.shishkin@linux.intel.com>2016-04-08 16:11:56 +0300
commitb5edbf1ea3ad044b185be7015cffabba9c442660 (patch)
tree8b49f20d96bef096649200656e4838a90ce09c3e /drivers/hwtracing/intel_th/core.c
parent6575cbd67172bbcbfbb50ddd854d2b90c9f4e358 (diff)
intel_th: Allow subdevice drivers to bring in own attribute groups
Some subdevices (MSU, PTI) need to register their own driver-specific attribute groups. Provide a way for those to pass their attribute groups to the core driver in their driver structure so that the core can take care of creating and removing them. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Reviewed-by: Laurent Fert <laurent.fert@intel.com>
Diffstat (limited to 'drivers/hwtracing/intel_th/core.c')
-rw-r--r--drivers/hwtracing/intel_th/core.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index 4272f2ce5f6e..db0691929a60 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -71,6 +71,15 @@ static int intel_th_probe(struct device *dev)
if (ret)
return ret;
+ if (thdrv->attr_group) {
+ ret = sysfs_create_group(&thdev->dev.kobj, thdrv->attr_group);
+ if (ret) {
+ thdrv->remove(thdev);
+
+ return ret;
+ }
+ }
+
if (thdev->type == INTEL_TH_OUTPUT &&
!intel_th_output_assigned(thdev))
ret = hubdrv->assign(hub, thdev);
@@ -91,6 +100,9 @@ static int intel_th_remove(struct device *dev)
return err;
}
+ if (thdrv->attr_group)
+ sysfs_remove_group(&thdev->dev.kobj, thdrv->attr_group);
+
thdrv->remove(thdev);
if (intel_th_output_assigned(thdev)) {