Commit 485f2fb1 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Jason Gunthorpe

RDMA/rtrs-srv: Clean up the code in __rtrs_srv_change_state

No need to use double switch to check the change of state everywhere,
let's change them to "if" to reduce size.

Link: https://lore.kernel.org/r/20210528113018.52290-5-jinpu.wang@ionos.comSigned-off-by: default avatarGuoqing Jiang <guoqing.jiang@ionos.com>
Reviewed-by: default avatarMd Haris Iqbal <haris.iqbal@ionos.com>
Signed-off-by: default avatarGioh Kim <gi-oh.kim@ionos.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 6564b110
......@@ -77,32 +77,17 @@ static bool __rtrs_srv_change_state(struct rtrs_srv_sess *sess,
old_state = sess->state;
switch (new_state) {
case RTRS_SRV_CONNECTED:
switch (old_state) {
case RTRS_SRV_CONNECTING:
if (old_state == RTRS_SRV_CONNECTING)
changed = true;
fallthrough;
default:
break;
}
break;
case RTRS_SRV_CLOSING:
switch (old_state) {
case RTRS_SRV_CONNECTING:
case RTRS_SRV_CONNECTED:
if (old_state == RTRS_SRV_CONNECTING ||
old_state == RTRS_SRV_CONNECTED)
changed = true;
fallthrough;
default:
break;
}
break;
case RTRS_SRV_CLOSED:
switch (old_state) {
case RTRS_SRV_CLOSING:
if (old_state == RTRS_SRV_CLOSING)
changed = true;
fallthrough;
default:
break;
}
break;
default:
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment