Skip to content

Commit dc4b6de

Browse files
hfreudeheicarst
authored andcommitted
s390/ap: rename and clarify ap state machine related stuff
There is a state machine held for each ap queue device. The states and functions related to this where somethimes noted with _sm_ somethimes without. This patch clarifies and renames all the ap queue state machine related functions, enums and defines to have a _sm_ in the name. There is no functional change coming with this patch - it's only beautifying code. Signed-off-by: Harald Freudenberger <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 7e202ac commit dc4b6de

File tree

3 files changed

+138
-138
lines changed

3 files changed

+138
-138
lines changed

drivers/s390/crypto/ap_bus.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -342,21 +342,21 @@ static int ap_query_queue(ap_qid_t qid, int *queue_depth, int *device_type,
342342
}
343343
}
344344

345-
void ap_wait(enum ap_wait wait)
345+
void ap_wait(enum ap_sm_wait wait)
346346
{
347347
ktime_t hr_time;
348348

349349
switch (wait) {
350-
case AP_WAIT_AGAIN:
351-
case AP_WAIT_INTERRUPT:
350+
case AP_SM_WAIT_AGAIN:
351+
case AP_SM_WAIT_INTERRUPT:
352352
if (ap_using_interrupts())
353353
break;
354354
if (ap_poll_kthread) {
355355
wake_up(&ap_poll_wait);
356356
break;
357357
}
358358
fallthrough;
359-
case AP_WAIT_TIMEOUT:
359+
case AP_SM_WAIT_TIMEOUT:
360360
spin_lock_bh(&ap_poll_timer_lock);
361361
if (!hrtimer_is_queued(&ap_poll_timer)) {
362362
hr_time = poll_timeout;
@@ -365,7 +365,7 @@ void ap_wait(enum ap_wait wait)
365365
}
366366
spin_unlock_bh(&ap_poll_timer_lock);
367367
break;
368-
case AP_WAIT_NONE:
368+
case AP_SM_WAIT_NONE:
369369
default:
370370
break;
371371
}
@@ -382,7 +382,7 @@ void ap_request_timeout(struct timer_list *t)
382382
struct ap_queue *aq = from_timer(aq, t, timeout);
383383

384384
spin_lock_bh(&aq->lock);
385-
ap_wait(ap_sm_event(aq, AP_EVENT_TIMEOUT));
385+
ap_wait(ap_sm_event(aq, AP_SM_EVENT_TIMEOUT));
386386
spin_unlock_bh(&aq->lock);
387387
}
388388

@@ -418,7 +418,7 @@ static void ap_tasklet_fn(unsigned long dummy)
418418
{
419419
int bkt;
420420
struct ap_queue *aq;
421-
enum ap_wait wait = AP_WAIT_NONE;
421+
enum ap_sm_wait wait = AP_SM_WAIT_NONE;
422422

423423
/* Reset the indicator if interrupts are used. Thus new interrupts can
424424
* be received. Doing it in the beginning of the tasklet is therefor
@@ -430,7 +430,7 @@ static void ap_tasklet_fn(unsigned long dummy)
430430
spin_lock_bh(&ap_queues_lock);
431431
hash_for_each(ap_queues, bkt, aq, hnode) {
432432
spin_lock_bh(&aq->lock);
433-
wait = min(wait, ap_sm_event_loop(aq, AP_EVENT_POLL));
433+
wait = min(wait, ap_sm_event_loop(aq, AP_SM_EVENT_POLL));
434434
spin_unlock_bh(&aq->lock);
435435
}
436436
spin_unlock_bh(&ap_queues_lock);
@@ -1370,7 +1370,7 @@ static void _ap_scan_bus_adapter(int id)
13701370
borked = 1;
13711371
else {
13721372
spin_lock_bh(&aq->lock);
1373-
borked = aq->state == AP_STATE_BORKED;
1373+
borked = aq->sm_state == AP_SM_STATE_BORKED;
13741374
spin_unlock_bh(&aq->lock);
13751375
}
13761376
if (borked) {

drivers/s390/crypto/ap_bus.h

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -83,39 +83,39 @@ static inline int ap_test_bit(unsigned int *ptr, unsigned int nr)
8383
#define AP_INTR_ENABLED 1 /* AP interrupt enabled */
8484

8585
/*
86-
* AP device states
86+
* AP queue state machine states
8787
*/
88-
enum ap_state {
89-
AP_STATE_RESET_START,
90-
AP_STATE_RESET_WAIT,
91-
AP_STATE_SETIRQ_WAIT,
92-
AP_STATE_IDLE,
93-
AP_STATE_WORKING,
94-
AP_STATE_QUEUE_FULL,
95-
AP_STATE_REMOVE, /* about to be removed from driver */
96-
AP_STATE_UNBOUND, /* momentary not bound to a driver */
97-
AP_STATE_BORKED, /* broken */
98-
NR_AP_STATES
88+
enum ap_sm_state {
89+
AP_SM_STATE_RESET_START,
90+
AP_SM_STATE_RESET_WAIT,
91+
AP_SM_STATE_SETIRQ_WAIT,
92+
AP_SM_STATE_IDLE,
93+
AP_SM_STATE_WORKING,
94+
AP_SM_STATE_QUEUE_FULL,
95+
AP_SM_STATE_REMOVE, /* about to be removed from driver */
96+
AP_SM_STATE_UNBOUND, /* momentary not bound to a driver */
97+
AP_SM_STATE_BORKED, /* broken */
98+
NR_AP_SM_STATES
9999
};
100100

101101
/*
102-
* AP device events
102+
* AP queue state machine events
103103
*/
104-
enum ap_event {
105-
AP_EVENT_POLL,
106-
AP_EVENT_TIMEOUT,
107-
NR_AP_EVENTS
104+
enum ap_sm_event {
105+
AP_SM_EVENT_POLL,
106+
AP_SM_EVENT_TIMEOUT,
107+
NR_AP_SM_EVENTS
108108
};
109109

110110
/*
111-
* AP wait behaviour
111+
* AP queue state wait behaviour
112112
*/
113-
enum ap_wait {
114-
AP_WAIT_AGAIN, /* retry immediately */
115-
AP_WAIT_TIMEOUT, /* wait for timeout */
116-
AP_WAIT_INTERRUPT, /* wait for thin interrupt (if available) */
117-
AP_WAIT_NONE, /* no wait */
118-
NR_AP_WAIT
113+
enum ap_sm_wait {
114+
AP_SM_WAIT_AGAIN, /* retry immediately */
115+
AP_SM_WAIT_TIMEOUT, /* wait for timeout */
116+
AP_SM_WAIT_INTERRUPT, /* wait for thin interrupt (if available) */
117+
AP_SM_WAIT_NONE, /* no wait */
118+
NR_AP_SM_WAIT
119119
};
120120

121121
struct ap_device;
@@ -172,7 +172,7 @@ struct ap_queue {
172172
ap_qid_t qid; /* AP queue id. */
173173
int interrupt; /* indicate if interrupts are enabled */
174174
int queue_count; /* # messages currently on AP queue. */
175-
enum ap_state state; /* State of the AP device. */
175+
enum ap_sm_state sm_state; /* ap queue state machine state */
176176
int pendingq_count; /* # requests on pendingq list. */
177177
int requestq_count; /* # requests on requestq list. */
178178
u64 total_request_count; /* # requests ever for this AP device.*/
@@ -185,7 +185,7 @@ struct ap_queue {
185185

186186
#define to_ap_queue(x) container_of((x), struct ap_queue, ap_dev.device)
187187

188-
typedef enum ap_wait (ap_func_t)(struct ap_queue *queue);
188+
typedef enum ap_sm_wait (ap_func_t)(struct ap_queue *queue);
189189

190190
struct ap_message {
191191
struct list_head list; /* Request queueing. */
@@ -231,15 +231,15 @@ static inline void ap_release_message(struct ap_message *ap_msg)
231231
int ap_send(ap_qid_t, unsigned long long, void *, size_t);
232232
int ap_recv(ap_qid_t, unsigned long long *, void *, size_t);
233233

234-
enum ap_wait ap_sm_event(struct ap_queue *aq, enum ap_event event);
235-
enum ap_wait ap_sm_event_loop(struct ap_queue *aq, enum ap_event event);
234+
enum ap_sm_wait ap_sm_event(struct ap_queue *aq, enum ap_sm_event event);
235+
enum ap_sm_wait ap_sm_event_loop(struct ap_queue *aq, enum ap_sm_event event);
236236

237237
void ap_queue_message(struct ap_queue *aq, struct ap_message *ap_msg);
238238
void ap_cancel_message(struct ap_queue *aq, struct ap_message *ap_msg);
239239
void ap_flush_queue(struct ap_queue *aq);
240240

241241
void *ap_airq_ptr(void);
242-
void ap_wait(enum ap_wait wait);
242+
void ap_wait(enum ap_sm_wait wait);
243243
void ap_request_timeout(struct timer_list *t);
244244
void ap_bus_force_rescan(void);
245245

0 commit comments

Comments
 (0)