]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: sun8i-ce - add a new function for dumping task descriptors
authorOvidiu Panait <ovidiu.panait.oss@gmail.com>
Tue, 2 Sep 2025 13:21:29 +0000 (16:21 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 13 Sep 2025 04:11:05 +0000 (12:11 +0800)
In order to remove code duplication, factor out task descriptor dumping to
a new function sun8i_ce_dump_task_descriptors().

Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c

index ba30859e749c4b5627da8a18e24840fea083f07a..b7093fbb8e9d9ff6aa6b2241d6f0d2a8f9e4cabc 100644 (file)
@@ -169,6 +169,12 @@ static const struct ce_variant ce_r40_variant = {
        .trng = CE_ID_NOTSUPP,
 };
 
+static void sun8i_ce_dump_task_descriptors(struct sun8i_ce_flow *chan)
+{
+       print_hex_dump(KERN_INFO, "TASK: ", DUMP_PREFIX_NONE, 16, 4,
+                      chan->tl, sizeof(struct ce_task), false);
+}
+
 /*
  * sun8i_ce_get_engine_number() get the next channel slot
  * This is a simple round-robin way of getting the next channel
@@ -183,7 +189,6 @@ int sun8i_ce_run_task(struct sun8i_ce_dev *ce, int flow, const char *name)
 {
        u32 v;
        int err = 0;
-       struct ce_task *cet = ce->chanlist[flow].tl;
 
 #ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG
        ce->chanlist[flow].stat_req++;
@@ -225,9 +230,8 @@ int sun8i_ce_run_task(struct sun8i_ce_dev *ce, int flow, const char *name)
                /* Sadly, the error bit is not per flow */
                if (v) {
                        dev_err(ce->dev, "CE ERROR: %x for flow %x\n", v, flow);
+                       sun8i_ce_dump_task_descriptors(&ce->chanlist[flow]);
                        err = -EFAULT;
-                       print_hex_dump(KERN_INFO, "TASK: ", DUMP_PREFIX_NONE, 16, 4,
-                                      cet, sizeof(struct ce_task), false);
                }
                if (v & CE_ERR_ALGO_NOTSUP)
                        dev_err(ce->dev, "CE ERROR: algorithm not supported\n");
@@ -244,9 +248,8 @@ int sun8i_ce_run_task(struct sun8i_ce_dev *ce, int flow, const char *name)
                v &= 0xF;
                if (v) {
                        dev_err(ce->dev, "CE ERROR: %x for flow %x\n", v, flow);
+                       sun8i_ce_dump_task_descriptors(&ce->chanlist[flow]);
                        err = -EFAULT;
-                       print_hex_dump(KERN_INFO, "TASK: ", DUMP_PREFIX_NONE, 16, 4,
-                                      cet, sizeof(struct ce_task), false);
                }
                if (v & CE_ERR_ALGO_NOTSUP)
                        dev_err(ce->dev, "CE ERROR: algorithm not supported\n");
@@ -260,9 +263,8 @@ int sun8i_ce_run_task(struct sun8i_ce_dev *ce, int flow, const char *name)
                v &= 0xFF;
                if (v) {
                        dev_err(ce->dev, "CE ERROR: %x for flow %x\n", v, flow);
+                       sun8i_ce_dump_task_descriptors(&ce->chanlist[flow]);
                        err = -EFAULT;
-                       print_hex_dump(KERN_INFO, "TASK: ", DUMP_PREFIX_NONE, 16, 4,
-                                      cet, sizeof(struct ce_task), false);
                }
                if (v & CE_ERR_ALGO_NOTSUP)
                        dev_err(ce->dev, "CE ERROR: algorithm not supported\n");