virtio-crypto: change code style
authorzhenwei pi <pizhenwei@bytedance.com>
Fri, 6 May 2022 13:16:23 +0000 (21:16 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 31 May 2022 16:45:08 +0000 (12:45 -0400)
commit6fd763d155860eb7ea3a93c8b3bf926940ffa3fb
tree6ef4923b9c484e366e799030431440425328e086
parent7e415282b41bf0d15c6e0fe268f822d9b083f2f7
virtio-crypto: change code style

Use temporary variable to make code easy to read and maintain.
/* Pad cipher's parameters */
        vcrypto->ctrl.u.sym_create_session.op_type =
                cpu_to_le32(VIRTIO_CRYPTO_SYM_OP_CIPHER);
        vcrypto->ctrl.u.sym_create_session.u.cipher.para.algo =
                vcrypto->ctrl.header.algo;
        vcrypto->ctrl.u.sym_create_session.u.cipher.para.keylen =
                cpu_to_le32(keylen);
        vcrypto->ctrl.u.sym_create_session.u.cipher.para.op =
                cpu_to_le32(op);
-->
sym_create_session = &ctrl->u.sym_create_session;
sym_create_session->op_type = cpu_to_le32(VIRTIO_CRYPTO_SYM_OP_CIPHER);
sym_create_session->u.cipher.para.algo = ctrl->header.algo;
sym_create_session->u.cipher.para.keylen = cpu_to_le32(keylen);
sym_create_session->u.cipher.para.op = cpu_to_le32(op);

The new style shows more obviously:
- the variable we want to operate.
- an assignment statement in a single line.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20220506131627.180784-2-pizhenwei@bytedance.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/crypto/virtio/virtio_crypto_akcipher_algs.c
drivers/crypto/virtio/virtio_crypto_skcipher_algs.c