Skip to content

Commit 99b3126

Browse files
hfreudehcahca
authored andcommitted
s390/ap: clarify AP scan bus related functions and variables
This patch tries to clarify the functions and variables around the AP scan bus job. All these variables and functions start with ap_scan_bus and are declared in one place now. No functional changes in this patch - only renaming and move of code or declarations. Signed-off-by: Harald Freudenberger <[email protected]> Reviewed-by: Holger Dengler <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 778412a commit 99b3126

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

drivers/s390/crypto/ap_bus.c

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ EXPORT_SYMBOL(ap_perms);
8484
DEFINE_MUTEX(ap_perms_mutex);
8585
EXPORT_SYMBOL(ap_perms_mutex);
8686

87-
/* # of bus scans since init */
88-
static atomic64_t ap_scan_bus_count;
89-
9087
/* # of bindings complete since init */
9188
static atomic64_t ap_bindings_complete_count = ATOMIC64_INIT(0);
9289

@@ -102,12 +99,13 @@ static struct ap_config_info *ap_qci_info_old;
10299
debug_info_t *ap_dbf_info;
103100

104101
/*
105-
* Workqueue timer for bus rescan.
102+
* AP bus rescan related things.
106103
*/
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;
109107
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);
111109

112110
/*
113111
* Tasklet & timer for AP request polling and interrupts
@@ -1020,9 +1018,9 @@ void ap_bus_force_rescan(void)
10201018
return;
10211019

10221020
/* 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);
10261024
}
10271025
EXPORT_SYMBOL(ap_bus_force_rescan);
10281026

@@ -1251,7 +1249,7 @@ static BUS_ATTR_RO(ap_interrupts);
12511249

12521250
static ssize_t config_time_show(const struct bus_type *bus, char *buf)
12531251
{
1254-
return sysfs_emit(buf, "%d\n", ap_config_time);
1252+
return sysfs_emit(buf, "%d\n", ap_scan_bus_time);
12551253
}
12561254

12571255
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,
12611259

12621260
if (sscanf(buf, "%d\n", &time) != 1 || time < 5 || time > 120)
12631261
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);
12661264
return count;
12671265
}
12681266

@@ -2181,7 +2179,7 @@ static bool ap_config_has_new_doms(void)
21812179

21822180
/**
21832181
* 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)
21852183
* @unused: Unused pointer.
21862184
*/
21872185
static void ap_scan_bus(struct work_struct *unused)
@@ -2235,14 +2233,21 @@ static void ap_scan_bus(struct work_struct *unused)
22352233

22362234
ap_check_bindings_complete();
22372235

2238-
mod_timer(&ap_config_timer, jiffies + ap_config_time * HZ);
2236+
mod_timer(&ap_scan_bus_timer, jiffies + ap_scan_bus_time * HZ);
22392237

22402238
pr_debug("<%s\n", __func__);
22412239
}
22422240

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)
22442245
{
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);
22462251
}
22472252

22482253
static int __init ap_debug_init(void)
@@ -2332,7 +2337,7 @@ static int __init ap_module_init(void)
23322337
ap_root_device->bus = &ap_bus_type;
23332338

23342339
/* 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);
23362341

23372342
/*
23382343
* Setup the high resolution poll timer.
@@ -2350,7 +2355,7 @@ static int __init ap_module_init(void)
23502355
goto out_work;
23512356
}
23522357

2353-
queue_work(system_long_wq, &ap_scan_work);
2358+
queue_work(system_long_wq, &ap_scan_bus_work);
23542359

23552360
return 0;
23562361

0 commit comments

Comments
 (0)