@@ -2249,18 +2249,17 @@ int cpuhp_smt_enable(void)
2249
2249
#endif
2250
2250
2251
2251
#if defined(CONFIG_SYSFS ) && defined(CONFIG_HOTPLUG_CPU )
2252
- static ssize_t show_cpuhp_state (struct device * dev ,
2253
- struct device_attribute * attr , char * buf )
2252
+ static ssize_t state_show (struct device * dev ,
2253
+ struct device_attribute * attr , char * buf )
2254
2254
{
2255
2255
struct cpuhp_cpu_state * st = per_cpu_ptr (& cpuhp_state , dev -> id );
2256
2256
2257
2257
return sprintf (buf , "%d\n" , st -> state );
2258
2258
}
2259
- static DEVICE_ATTR (state , 0444 , show_cpuhp_state , NULL );
2259
+ static DEVICE_ATTR_RO (state );
2260
2260
2261
- static ssize_t write_cpuhp_target (struct device * dev ,
2262
- struct device_attribute * attr ,
2263
- const char * buf , size_t count )
2261
+ static ssize_t target_store (struct device * dev , struct device_attribute * attr ,
2262
+ const char * buf , size_t count )
2264
2263
{
2265
2264
struct cpuhp_cpu_state * st = per_cpu_ptr (& cpuhp_state , dev -> id );
2266
2265
struct cpuhp_step * sp ;
@@ -2298,19 +2297,17 @@ static ssize_t write_cpuhp_target(struct device *dev,
2298
2297
return ret ? ret : count ;
2299
2298
}
2300
2299
2301
- static ssize_t show_cpuhp_target (struct device * dev ,
2302
- struct device_attribute * attr , char * buf )
2300
+ static ssize_t target_show (struct device * dev ,
2301
+ struct device_attribute * attr , char * buf )
2303
2302
{
2304
2303
struct cpuhp_cpu_state * st = per_cpu_ptr (& cpuhp_state , dev -> id );
2305
2304
2306
2305
return sprintf (buf , "%d\n" , st -> target );
2307
2306
}
2308
- static DEVICE_ATTR (target , 0644 , show_cpuhp_target , write_cpuhp_target );
2309
-
2307
+ static DEVICE_ATTR_RW (target );
2310
2308
2311
- static ssize_t write_cpuhp_fail (struct device * dev ,
2312
- struct device_attribute * attr ,
2313
- const char * buf , size_t count )
2309
+ static ssize_t fail_store (struct device * dev , struct device_attribute * attr ,
2310
+ const char * buf , size_t count )
2314
2311
{
2315
2312
struct cpuhp_cpu_state * st = per_cpu_ptr (& cpuhp_state , dev -> id );
2316
2313
struct cpuhp_step * sp ;
@@ -2359,15 +2356,15 @@ static ssize_t write_cpuhp_fail(struct device *dev,
2359
2356
return count ;
2360
2357
}
2361
2358
2362
- static ssize_t show_cpuhp_fail (struct device * dev ,
2363
- struct device_attribute * attr , char * buf )
2359
+ static ssize_t fail_show (struct device * dev ,
2360
+ struct device_attribute * attr , char * buf )
2364
2361
{
2365
2362
struct cpuhp_cpu_state * st = per_cpu_ptr (& cpuhp_state , dev -> id );
2366
2363
2367
2364
return sprintf (buf , "%d\n" , st -> fail );
2368
2365
}
2369
2366
2370
- static DEVICE_ATTR (fail , 0644 , show_cpuhp_fail , write_cpuhp_fail );
2367
+ static DEVICE_ATTR_RW (fail );
2371
2368
2372
2369
static struct attribute * cpuhp_cpu_attrs [] = {
2373
2370
& dev_attr_state .attr ,
@@ -2382,7 +2379,7 @@ static const struct attribute_group cpuhp_cpu_attr_group = {
2382
2379
NULL
2383
2380
};
2384
2381
2385
- static ssize_t show_cpuhp_states (struct device * dev ,
2382
+ static ssize_t states_show (struct device * dev ,
2386
2383
struct device_attribute * attr , char * buf )
2387
2384
{
2388
2385
ssize_t cur , res = 0 ;
@@ -2401,7 +2398,7 @@ static ssize_t show_cpuhp_states(struct device *dev,
2401
2398
mutex_unlock (& cpuhp_state_mutex );
2402
2399
return res ;
2403
2400
}
2404
- static DEVICE_ATTR (states , 0444 , show_cpuhp_states , NULL );
2401
+ static DEVICE_ATTR_RO (states );
2405
2402
2406
2403
static struct attribute * cpuhp_cpu_root_attrs [] = {
2407
2404
& dev_attr_states .attr ,
@@ -2474,28 +2471,27 @@ static const char *smt_states[] = {
2474
2471
[CPU_SMT_NOT_IMPLEMENTED ] = "notimplemented" ,
2475
2472
};
2476
2473
2477
- static ssize_t
2478
- show_smt_control ( struct device * dev , struct device_attribute * attr , char * buf )
2474
+ static ssize_t control_show ( struct device * dev ,
2475
+ struct device_attribute * attr , char * buf )
2479
2476
{
2480
2477
const char * state = smt_states [cpu_smt_control ];
2481
2478
2482
2479
return snprintf (buf , PAGE_SIZE - 2 , "%s\n" , state );
2483
2480
}
2484
2481
2485
- static ssize_t
2486
- store_smt_control (struct device * dev , struct device_attribute * attr ,
2487
- const char * buf , size_t count )
2482
+ static ssize_t control_store (struct device * dev , struct device_attribute * attr ,
2483
+ const char * buf , size_t count )
2488
2484
{
2489
2485
return __store_smt_control (dev , attr , buf , count );
2490
2486
}
2491
- static DEVICE_ATTR (control , 0644 , show_smt_control , store_smt_control );
2487
+ static DEVICE_ATTR_RW (control );
2492
2488
2493
- static ssize_t
2494
- show_smt_active ( struct device * dev , struct device_attribute * attr , char * buf )
2489
+ static ssize_t active_show ( struct device * dev ,
2490
+ struct device_attribute * attr , char * buf )
2495
2491
{
2496
2492
return snprintf (buf , PAGE_SIZE - 2 , "%d\n" , sched_smt_active ());
2497
2493
}
2498
- static DEVICE_ATTR (active , 0444 , show_smt_active , NULL );
2494
+ static DEVICE_ATTR_RO (active );
2499
2495
2500
2496
static struct attribute * cpuhp_smt_attrs [] = {
2501
2497
& dev_attr_control .attr ,
0 commit comments