Skip to content

Commit fe262d5

Browse files
gregkhrafaeljw
authored andcommitted
cpufreq: use default_groups in kobj_type
There are currently 2 ways to create a set of sysfs files for a kobj_type, through the default_attrs field, and the default_groups field. Move the cpufreq code to use default_groups field which has been the preferred way since aa30f47 ("kobject: Add support for default attribute groups to kobj_type") so that we can soon get rid of the obsolete default_attrs field. Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent dfeeedc commit fe262d5

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

drivers/cpufreq/cpufreq.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ cpufreq_freq_attr_rw(scaling_max_freq);
924924
cpufreq_freq_attr_rw(scaling_governor);
925925
cpufreq_freq_attr_rw(scaling_setspeed);
926926

927-
static struct attribute *default_attrs[] = {
927+
static struct attribute *cpufreq_attrs[] = {
928928
&cpuinfo_min_freq.attr,
929929
&cpuinfo_max_freq.attr,
930930
&cpuinfo_transition_latency.attr,
@@ -938,6 +938,7 @@ static struct attribute *default_attrs[] = {
938938
&scaling_setspeed.attr,
939939
NULL
940940
};
941+
ATTRIBUTE_GROUPS(cpufreq);
941942

942943
#define to_policy(k) container_of(k, struct cpufreq_policy, kobj)
943944
#define to_attr(a) container_of(a, struct freq_attr, attr)
@@ -1000,7 +1001,7 @@ static const struct sysfs_ops sysfs_ops = {
10001001

10011002
static struct kobj_type ktype_cpufreq = {
10021003
.sysfs_ops = &sysfs_ops,
1003-
.default_attrs = default_attrs,
1004+
.default_groups = cpufreq_groups,
10041005
.release = cpufreq_sysfs_release,
10051006
};
10061007

drivers/cpufreq/cpufreq_conservative.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ gov_attr_rw(ignore_nice_load);
257257
gov_attr_rw(down_threshold);
258258
gov_attr_rw(freq_step);
259259

260-
static struct attribute *cs_attributes[] = {
260+
static struct attribute *cs_attrs[] = {
261261
&sampling_rate.attr,
262262
&sampling_down_factor.attr,
263263
&up_threshold.attr,
@@ -266,6 +266,7 @@ static struct attribute *cs_attributes[] = {
266266
&freq_step.attr,
267267
NULL
268268
};
269+
ATTRIBUTE_GROUPS(cs);
269270

270271
/************************** sysfs end ************************/
271272

@@ -315,7 +316,7 @@ static void cs_start(struct cpufreq_policy *policy)
315316

316317
static struct dbs_governor cs_governor = {
317318
.gov = CPUFREQ_DBS_GOVERNOR_INITIALIZER("conservative"),
318-
.kobj_type = { .default_attrs = cs_attributes },
319+
.kobj_type = { .default_groups = cs_groups },
319320
.gov_dbs_update = cs_dbs_update,
320321
.alloc = cs_alloc,
321322
.free = cs_free,

drivers/cpufreq/cpufreq_ondemand.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ gov_attr_rw(sampling_down_factor);
328328
gov_attr_rw(ignore_nice_load);
329329
gov_attr_rw(powersave_bias);
330330

331-
static struct attribute *od_attributes[] = {
331+
static struct attribute *od_attrs[] = {
332332
&sampling_rate.attr,
333333
&up_threshold.attr,
334334
&sampling_down_factor.attr,
@@ -337,6 +337,7 @@ static struct attribute *od_attributes[] = {
337337
&io_is_busy.attr,
338338
NULL
339339
};
340+
ATTRIBUTE_GROUPS(od);
340341

341342
/************************** sysfs end ************************/
342343

@@ -401,7 +402,7 @@ static struct od_ops od_ops = {
401402

402403
static struct dbs_governor od_dbs_gov = {
403404
.gov = CPUFREQ_DBS_GOVERNOR_INITIALIZER("ondemand"),
404-
.kobj_type = { .default_attrs = od_attributes },
405+
.kobj_type = { .default_groups = od_groups },
405406
.gov_dbs_update = od_dbs_update,
406407
.alloc = od_alloc,
407408
.free = od_free,

0 commit comments

Comments
 (0)