@@ -84,9 +84,6 @@ EXPORT_SYMBOL(ap_perms);
84
84
DEFINE_MUTEX (ap_perms_mutex );
85
85
EXPORT_SYMBOL (ap_perms_mutex );
86
86
87
- /* # of bus scans since init */
88
- static atomic64_t ap_scan_bus_count ;
89
-
90
87
/* # of bindings complete since init */
91
88
static atomic64_t ap_bindings_complete_count = ATOMIC64_INIT (0 );
92
89
@@ -102,12 +99,13 @@ static struct ap_config_info *ap_qci_info_old;
102
99
debug_info_t * ap_dbf_info ;
103
100
104
101
/*
105
- * Workqueue timer for bus rescan.
102
+ * AP bus rescan related things .
106
103
*/
107
- static struct timer_list ap_config_timer ;
108
- static int ap_config_time = AP_CONFIG_TIME ;
104
+ static atomic64_t ap_scan_bus_count ; /* counter ap_scan_bus() invocations */
105
+ static int ap_scan_bus_time = AP_CONFIG_TIME ;
106
+ static struct timer_list ap_scan_bus_timer ;
109
107
static void ap_scan_bus (struct work_struct * );
110
- static DECLARE_WORK (ap_scan_work , ap_scan_bus ) ;
108
+ static DECLARE_WORK (ap_scan_bus_work , ap_scan_bus ) ;
111
109
112
110
/*
113
111
* Tasklet & timer for AP request polling and interrupts
@@ -1020,9 +1018,9 @@ void ap_bus_force_rescan(void)
1020
1018
return ;
1021
1019
1022
1020
/* processing a asynchronous bus rescan */
1023
- del_timer (& ap_config_timer );
1024
- queue_work (system_long_wq , & ap_scan_work );
1025
- flush_work (& ap_scan_work );
1021
+ del_timer (& ap_scan_bus_timer );
1022
+ queue_work (system_long_wq , & ap_scan_bus_work );
1023
+ flush_work (& ap_scan_bus_work );
1026
1024
}
1027
1025
EXPORT_SYMBOL (ap_bus_force_rescan );
1028
1026
@@ -1251,7 +1249,7 @@ static BUS_ATTR_RO(ap_interrupts);
1251
1249
1252
1250
static ssize_t config_time_show (const struct bus_type * bus , char * buf )
1253
1251
{
1254
- return sysfs_emit (buf , "%d\n" , ap_config_time );
1252
+ return sysfs_emit (buf , "%d\n" , ap_scan_bus_time );
1255
1253
}
1256
1254
1257
1255
static ssize_t config_time_store (const struct bus_type * bus ,
@@ -1261,8 +1259,8 @@ static ssize_t config_time_store(const struct bus_type *bus,
1261
1259
1262
1260
if (sscanf (buf , "%d\n" , & time ) != 1 || time < 5 || time > 120 )
1263
1261
return - EINVAL ;
1264
- ap_config_time = time ;
1265
- mod_timer (& ap_config_timer , jiffies + ap_config_time * HZ );
1262
+ ap_scan_bus_time = time ;
1263
+ mod_timer (& ap_scan_bus_timer , jiffies + ap_scan_bus_time * HZ );
1266
1264
return count ;
1267
1265
}
1268
1266
@@ -2181,7 +2179,7 @@ static bool ap_config_has_new_doms(void)
2181
2179
2182
2180
/**
2183
2181
* ap_scan_bus(): Scan the AP bus for new devices
2184
- * Runs periodically, workqueue timer (ap_config_time )
2182
+ * Runs periodically, workqueue timer (ap_scan_bus_time )
2185
2183
* @unused: Unused pointer.
2186
2184
*/
2187
2185
static void ap_scan_bus (struct work_struct * unused )
@@ -2235,14 +2233,21 @@ static void ap_scan_bus(struct work_struct *unused)
2235
2233
2236
2234
ap_check_bindings_complete ();
2237
2235
2238
- mod_timer (& ap_config_timer , jiffies + ap_config_time * HZ );
2236
+ mod_timer (& ap_scan_bus_timer , jiffies + ap_scan_bus_time * HZ );
2239
2237
2240
2238
pr_debug ("<%s\n" , __func__ );
2241
2239
}
2242
2240
2243
- static void ap_config_timeout (struct timer_list * unused )
2241
+ /*
2242
+ * Callback for the ap_scan_bus_timer
2243
+ */
2244
+ static void ap_scan_bus_timer_callback (struct timer_list * unused )
2244
2245
{
2245
- queue_work (system_long_wq , & ap_scan_work );
2246
+ /*
2247
+ * schedule work into the system long wq which when
2248
+ * the work is finally executed, calls the AP bus scan.
2249
+ */
2250
+ queue_work (system_long_wq , & ap_scan_bus_work );
2246
2251
}
2247
2252
2248
2253
static int __init ap_debug_init (void )
@@ -2332,7 +2337,7 @@ static int __init ap_module_init(void)
2332
2337
ap_root_device -> bus = & ap_bus_type ;
2333
2338
2334
2339
/* Setup the AP bus rescan timer. */
2335
- timer_setup (& ap_config_timer , ap_config_timeout , 0 );
2340
+ timer_setup (& ap_scan_bus_timer , ap_scan_bus_timer_callback , 0 );
2336
2341
2337
2342
/*
2338
2343
* Setup the high resolution poll timer.
@@ -2350,7 +2355,7 @@ static int __init ap_module_init(void)
2350
2355
goto out_work ;
2351
2356
}
2352
2357
2353
- queue_work (system_long_wq , & ap_scan_work );
2358
+ queue_work (system_long_wq , & ap_scan_bus_work );
2354
2359
2355
2360
return 0 ;
2356
2361
0 commit comments