@@ -262,7 +262,7 @@ static struct attribute *arm_ccn_pmu_format_attrs[] = {
262
262
NULL
263
263
};
264
264
265
- static struct attribute_group arm_ccn_pmu_format_attr_group = {
265
+ static const struct attribute_group arm_ccn_pmu_format_attr_group = {
266
266
.name = "format" ,
267
267
.attrs = arm_ccn_pmu_format_attrs ,
268
268
};
@@ -451,7 +451,7 @@ static struct arm_ccn_pmu_event arm_ccn_pmu_events[] = {
451
451
static struct attribute
452
452
* arm_ccn_pmu_events_attrs [ARRAY_SIZE (arm_ccn_pmu_events ) + 1 ];
453
453
454
- static struct attribute_group arm_ccn_pmu_events_attr_group = {
454
+ static const struct attribute_group arm_ccn_pmu_events_attr_group = {
455
455
.name = "events" ,
456
456
.is_visible = arm_ccn_pmu_events_is_visible ,
457
457
.attrs = arm_ccn_pmu_events_attrs ,
@@ -548,7 +548,7 @@ static struct attribute *arm_ccn_pmu_cmp_mask_attrs[] = {
548
548
NULL
549
549
};
550
550
551
- static struct attribute_group arm_ccn_pmu_cmp_mask_attr_group = {
551
+ static const struct attribute_group arm_ccn_pmu_cmp_mask_attr_group = {
552
552
.name = "cmp_mask" ,
553
553
.attrs = arm_ccn_pmu_cmp_mask_attrs ,
554
554
};
@@ -569,7 +569,7 @@ static struct attribute *arm_ccn_pmu_cpumask_attrs[] = {
569
569
NULL ,
570
570
};
571
571
572
- static struct attribute_group arm_ccn_pmu_cpumask_attr_group = {
572
+ static const struct attribute_group arm_ccn_pmu_cpumask_attr_group = {
573
573
.attrs = arm_ccn_pmu_cpumask_attrs ,
574
574
};
575
575
@@ -1268,10 +1268,12 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn)
1268
1268
if (ccn -> dt .id == 0 ) {
1269
1269
name = "ccn" ;
1270
1270
} else {
1271
- int len = snprintf (NULL , 0 , "ccn_%d" , ccn -> dt .id );
1272
-
1273
- name = devm_kzalloc (ccn -> dev , len + 1 , GFP_KERNEL );
1274
- snprintf (name , len + 1 , "ccn_%d" , ccn -> dt .id );
1271
+ name = devm_kasprintf (ccn -> dev , GFP_KERNEL , "ccn_%d" ,
1272
+ ccn -> dt .id );
1273
+ if (!name ) {
1274
+ err = - ENOMEM ;
1275
+ goto error_choose_name ;
1276
+ }
1275
1277
}
1276
1278
1277
1279
/* Perf driver registration */
@@ -1298,7 +1300,7 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn)
1298
1300
}
1299
1301
1300
1302
/* Pick one CPU which we will use to collect data from CCN... */
1301
- cpumask_set_cpu (smp_processor_id (), & ccn -> dt .cpu );
1303
+ cpumask_set_cpu (get_cpu (), & ccn -> dt .cpu );
1302
1304
1303
1305
/* Also make sure that the overflow interrupt is handled by this CPU */
1304
1306
if (ccn -> irq ) {
@@ -1315,10 +1317,13 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn)
1315
1317
1316
1318
cpuhp_state_add_instance_nocalls (CPUHP_AP_PERF_ARM_CCN_ONLINE ,
1317
1319
& ccn -> dt .node );
1320
+ put_cpu ();
1318
1321
return 0 ;
1319
1322
1320
1323
error_pmu_register :
1321
1324
error_set_affinity :
1325
+ put_cpu ();
1326
+ error_choose_name :
1322
1327
ida_simple_remove (& arm_ccn_pmu_ida , ccn -> dt .id );
1323
1328
for (i = 0 ; i < ccn -> num_xps ; i ++ )
1324
1329
writel (0 , ccn -> xp [i ].base + CCN_XP_DT_CONTROL );
@@ -1581,8 +1586,8 @@ static int __init arm_ccn_init(void)
1581
1586
1582
1587
static void __exit arm_ccn_exit (void )
1583
1588
{
1584
- cpuhp_remove_multi_state (CPUHP_AP_PERF_ARM_CCN_ONLINE );
1585
1589
platform_driver_unregister (& arm_ccn_driver );
1590
+ cpuhp_remove_multi_state (CPUHP_AP_PERF_ARM_CCN_ONLINE );
1586
1591
}
1587
1592
1588
1593
module_init (arm_ccn_init );
0 commit comments