mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 04:42:04 -04:00
msm: kgsl: Fix linked sysfs files
kernfs_create_link is an unexported function so we need a workaround. Luckily most of the "linked" sysfs files are our own, so we can just create new attributes with the same callback functions. We're not so lucky with the devfreq nodes but they are optional so we can omit them when we are building as a module. Change-Id: Ic0dedbad7e5f4e28a62ce57abb6451f4865d37ab Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
parent
460c0a81bb
commit
2726e792a2
4 changed files with 32 additions and 29 deletions
|
|
@ -5001,7 +5001,7 @@ void kgsl_device_platform_remove(struct kgsl_device *device)
|
|||
|
||||
kgsl_exit_page_pools();
|
||||
|
||||
kgsl_pwrctrl_uninit_sysfs(device);
|
||||
kobject_put(device->gpu_sysfs_kobj);
|
||||
|
||||
idr_destroy(&device->context_idr);
|
||||
|
||||
|
|
|
|||
|
|
@ -579,6 +579,7 @@ static inline int kgsl_copy_from_user(void *dest, void __user *src,
|
|||
return copy_from_user(dest, src, copy) ? -EFAULT : 0;
|
||||
}
|
||||
|
||||
#ifndef MODULE
|
||||
static inline void kgsl_gpu_sysfs_add_link(struct kobject *dst,
|
||||
struct kobject *src, const char *src_name,
|
||||
const char *dst_name)
|
||||
|
|
@ -594,6 +595,13 @@ static inline void kgsl_gpu_sysfs_add_link(struct kobject *dst,
|
|||
|
||||
kernfs_create_link(dst->sd, dst_name, old);
|
||||
}
|
||||
#else
|
||||
static inline void kgsl_gpu_sysfs_add_link(struct kobject *dst,
|
||||
struct kobject *src, const char *src_name,
|
||||
const char *dst_name)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline bool kgsl_is_compat_task(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1191,45 +1191,41 @@ static const struct attribute *pwrctrl_attr_list[] = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
struct sysfs_link {
|
||||
const char *src;
|
||||
const char *dst;
|
||||
};
|
||||
static DEVICE_ATTR(gpu_busy, 0200, gpu_busy_percentage_show, NULL);
|
||||
static DEVICE_ATTR(gpu_min_clock, 0644, min_clock_mhz_show,
|
||||
min_clock_mhz_store);
|
||||
static DEVICE_ATTR(gpu_max_clock, 0644, max_clock_mhz_show,
|
||||
max_clock_mhz_store);
|
||||
static DEVICE_ATTR(gpu_clock, 0200, clock_mhz_show, NULL);
|
||||
static DEVICE_ATTR(gpu_freq_table, 0200, freq_table_mhz_show, NULL);
|
||||
static DEVICE_ATTR(gpu_tmu, 0200, temp_show, NULL);
|
||||
|
||||
static struct sysfs_link link_names[] = {
|
||||
{ "gpu_model", "gpu_model",},
|
||||
{ "gpu_busy_percentage", "gpu_busy",},
|
||||
{ "min_clock_mhz", "gpu_min_clock",},
|
||||
{ "max_clock_mhz", "gpu_max_clock",},
|
||||
{ "clock_mhz", "gpu_clock",},
|
||||
{ "freq_table_mhz", "gpu_freq_table",},
|
||||
{ "temp", "gpu_tmu",},
|
||||
static const struct attribute *pwrctrl_gpu_attr_list[] = {
|
||||
&dev_attr_gpu_model.attr,
|
||||
&dev_attr_gpu_busy.attr,
|
||||
&dev_attr_gpu_min_clock.attr,
|
||||
&dev_attr_gpu_max_clock.attr,
|
||||
&dev_attr_gpu_clock.attr,
|
||||
&dev_attr_gpu_freq_table.attr,
|
||||
&dev_attr_gpu_tmu.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
int kgsl_pwrctrl_init_sysfs(struct kgsl_device *device)
|
||||
{
|
||||
int i, ret;
|
||||
int ret;
|
||||
|
||||
ret = sysfs_create_files(&device->dev->kobj, pwrctrl_attr_list);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
device->gpu_sysfs_kobj = kobject_create_and_add("gpu", kernel_kobj);
|
||||
if (IS_ERR_OR_NULL(device->gpu_sysfs_kobj))
|
||||
return (device->gpu_sysfs_kobj == NULL) ?
|
||||
-ENOMEM : PTR_ERR(device->gpu_sysfs_kobj);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(link_names); i++)
|
||||
kgsl_gpu_sysfs_add_link(device->gpu_sysfs_kobj,
|
||||
&device->dev->kobj, link_names[i].src,
|
||||
link_names[i].dst);
|
||||
if (!device->gpu_sysfs_kobj)
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void kgsl_pwrctrl_uninit_sysfs(struct kgsl_device *device)
|
||||
{
|
||||
sysfs_remove_files(&device->dev->kobj, pwrctrl_attr_list);
|
||||
return sysfs_create_files(device->gpu_sysfs_kobj,
|
||||
pwrctrl_gpu_attr_list);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -165,7 +165,6 @@ void kgsl_pwrctrl_pwrlevel_change(struct kgsl_device *device,
|
|||
void kgsl_pwrctrl_buslevel_update(struct kgsl_device *device,
|
||||
bool on);
|
||||
int kgsl_pwrctrl_init_sysfs(struct kgsl_device *device);
|
||||
void kgsl_pwrctrl_uninit_sysfs(struct kgsl_device *device);
|
||||
int kgsl_pwrctrl_change_state(struct kgsl_device *device, int state);
|
||||
int kgsl_clk_set_rate(struct kgsl_device *device,
|
||||
unsigned int pwrlevel);
|
||||
|
|
|
|||
Loading…
Reference in a new issue