PM / devfreq: Add new device link for sysfs
As the device name has been changed to devfreq(X), but user should find devfreq driver with their parent device name, so add a new link named with parent name. Change-Id: I5077ddecbcc8db8d59cb6f16f2be5107b391677d Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
parent
0ab296d5cf
commit
32948d8b86
1 changed files with 20 additions and 0 deletions
|
|
@ -27,6 +27,9 @@
|
|||
#include <linux/hrtimer.h>
|
||||
#include <linux/of.h>
|
||||
#include "governor.h"
|
||||
#ifdef CONFIG_ARCH_ROCKCHIP
|
||||
#include "../base/base.h"
|
||||
#endif
|
||||
|
||||
static struct class *devfreq_class;
|
||||
|
||||
|
|
@ -634,6 +637,18 @@ struct devfreq *devfreq_add_device(struct device *dev,
|
|||
goto err_out;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ARCH_ROCKCHIP
|
||||
if (sysfs_create_link(&devfreq->dev.class->p->subsys.kobj,
|
||||
&devfreq->dev.kobj, dev_name(dev))) {
|
||||
dev_err(dev, "failed to create devfreq %s link\n",
|
||||
dev_name(dev));
|
||||
device_unregister(&devfreq->dev);
|
||||
mutex_unlock(&devfreq->lock);
|
||||
put_device(&devfreq->dev);
|
||||
goto err_out;
|
||||
}
|
||||
#endif
|
||||
|
||||
devfreq->trans_table =
|
||||
devm_kzalloc(&devfreq->dev,
|
||||
array3_size(sizeof(unsigned int),
|
||||
|
|
@ -699,6 +714,11 @@ int devfreq_remove_device(struct devfreq *devfreq)
|
|||
if (!devfreq)
|
||||
return -EINVAL;
|
||||
|
||||
#ifdef CONFIG_ARCH_ROCKCHIP
|
||||
sysfs_delete_link(&devfreq->dev.class->p->subsys.kobj,
|
||||
&devfreq->dev.kobj, dev_name(devfreq->dev.parent));
|
||||
#endif
|
||||
|
||||
device_unregister(&devfreq->dev);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue