@@ -24,7 +24,7 @@ static bool sun8i_ss_need_fallback(struct skcipher_request *areq)
2424{
2525 struct crypto_skcipher * tfm = crypto_skcipher_reqtfm (areq );
2626 struct skcipher_alg * alg = crypto_skcipher_alg (tfm );
27- struct sun8i_ss_alg_template * algt = container_of (alg , struct sun8i_ss_alg_template , alg .skcipher );
27+ struct sun8i_ss_alg_template * algt = container_of (alg , struct sun8i_ss_alg_template , alg .skcipher . base );
2828 struct scatterlist * in_sg = areq -> src ;
2929 struct scatterlist * out_sg = areq -> dst ;
3030 struct scatterlist * sg ;
@@ -93,13 +93,18 @@ static int sun8i_ss_cipher_fallback(struct skcipher_request *areq)
9393 struct sun8i_cipher_req_ctx * rctx = skcipher_request_ctx (areq );
9494 int err ;
9595
96- #ifdef CONFIG_CRYPTO_DEV_SUN8I_SS_DEBUG
97- struct skcipher_alg * alg = crypto_skcipher_alg (tfm );
98- struct sun8i_ss_alg_template * algt ;
96+ if (IS_ENABLED (CONFIG_CRYPTO_DEV_SUN8I_SS_DEBUG )) {
97+ struct skcipher_alg * alg = crypto_skcipher_alg (tfm );
98+ struct sun8i_ss_alg_template * algt __maybe_unused ;
99+
100+ algt = container_of (alg , struct sun8i_ss_alg_template ,
101+ alg .skcipher .base );
99102
100- algt = container_of ( alg , struct sun8i_ss_alg_template , alg . skcipher );
101- algt -> stat_fb ++ ;
103+ #ifdef CONFIG_CRYPTO_DEV_SUN8I_SS_DEBUG
104+ algt -> stat_fb ++ ;
102105#endif
106+ }
107+
103108 skcipher_request_set_tfm (& rctx -> fallback_req , op -> fallback_tfm );
104109 skcipher_request_set_callback (& rctx -> fallback_req , areq -> base .flags ,
105110 areq -> base .complete , areq -> base .data );
@@ -193,7 +198,7 @@ static int sun8i_ss_cipher(struct skcipher_request *areq)
193198 int nsgd = sg_nents_for_len (areq -> dst , areq -> cryptlen );
194199 int i ;
195200
196- algt = container_of (alg , struct sun8i_ss_alg_template , alg .skcipher );
201+ algt = container_of (alg , struct sun8i_ss_alg_template , alg .skcipher . base );
197202
198203 dev_dbg (ss -> dev , "%s %s %u %x IV(%p %u) key=%u\n" , __func__ ,
199204 crypto_tfm_alg_name (areq -> base .tfm ),
@@ -324,7 +329,7 @@ static int sun8i_ss_cipher(struct skcipher_request *areq)
324329 return err ;
325330}
326331
327- static int sun8i_ss_handle_cipher_request (struct crypto_engine * engine , void * areq )
332+ int sun8i_ss_handle_cipher_request (struct crypto_engine * engine , void * areq )
328333{
329334 int err ;
330335 struct skcipher_request * breq = container_of (areq , struct skcipher_request , base );
@@ -390,7 +395,7 @@ int sun8i_ss_cipher_init(struct crypto_tfm *tfm)
390395
391396 memset (op , 0 , sizeof (struct sun8i_cipher_tfm_ctx ));
392397
393- algt = container_of (alg , struct sun8i_ss_alg_template , alg .skcipher );
398+ algt = container_of (alg , struct sun8i_ss_alg_template , alg .skcipher . base );
394399 op -> ss = algt -> ss ;
395400
396401 op -> fallback_tfm = crypto_alloc_skcipher (name , 0 , CRYPTO_ALG_NEED_FALLBACK );
@@ -408,8 +413,6 @@ int sun8i_ss_cipher_init(struct crypto_tfm *tfm)
408413 crypto_tfm_alg_driver_name (crypto_skcipher_tfm (op -> fallback_tfm )),
409414 CRYPTO_MAX_ALG_NAME );
410415
411- op -> enginectx .op .do_one_request = sun8i_ss_handle_cipher_request ;
412-
413416 err = pm_runtime_resume_and_get (op -> ss -> dev );
414417 if (err < 0 ) {
415418 dev_err (op -> ss -> dev , "pm error %d\n" , err );
0 commit comments