• zhenwei pi's avatar
    virtio-crypto: change code style · 6fd763d1
    zhenwei pi authored
    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: default avatarGonglei <arei.gonglei@huawei.com>
    Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
    Message-Id: <20220506131627.180784-2-pizhenwei@bytedance.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    6fd763d1
virtio_crypto_akcipher_algs.c 16.8 KB