From: Boojin Kim Date: Thu, 24 May 2018 01:26:25 +0000 (+0900) Subject: [COMMON] crypto: diskcipher: disable free_req X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1fe4ae09b3a1a87aa83314e1dbf7e5d2a0e7aa28;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] crypto: diskcipher: disable free_req Change-Id: Ibfa7f0def8b28f1d48330a647e87cdcfadaac339 Signed-off-by: Boojin Kim --- diff --git a/crypto/diskcipher.c b/crypto/diskcipher.c index 91a6b536bbad..a0f11e36a702 100644 --- a/crypto/diskcipher.c +++ b/crypto/diskcipher.c @@ -229,7 +229,6 @@ int crypto_diskcipher_set_crypt(struct crypto_diskcipher *tfm, void *req) int ret = 0; struct crypto_tfm *base = crypto_diskcipher_tfm(tfm); struct diskcipher_alg *cra = crypto_diskcipher_alg(base->__crt_alg); - struct diskcipher_freectrl *fctrl = &cra->freectrl; if (!cra) { pr_err("%s: doesn't exist cra", __func__); @@ -245,12 +244,14 @@ int crypto_diskcipher_set_crypt(struct crypto_diskcipher *tfm, void *req) ret = cra->crypt(base, req); - if (!list_empty(&fctrl->freelist)) { - if (!atomic_read(&fctrl->freewq_active)) { - atomic_set(&fctrl->freewq_active, 1); - schedule_delayed_work(&fctrl->freewq, 0); +#ifdef USE_FREE_REQ + if (!list_empty(&cra->freectrl.freelist)) { + if (!atomic_read(&cra->freectrl.freewq_active)) { + atomic_set(&cra->freectrl.freewq_active, 1); + schedule_delayed_work(&cra->freectrl.freewq, 0); } } +#endif out: if (ret) pr_err("%s fails ret:%d, cra:%p\n", __func__, ret, cra); @@ -309,11 +310,11 @@ static int crypto_diskcipher_init_tfm(struct crypto_tfm *base) { struct crypto_diskcipher *tfm = __crypto_diskcipher_cast(base); - tfm->req_jiffies = 0; atomic_set(&tfm->status, DISKC_ST_INIT); return 0; } +#ifdef USE_FREE_REQ static void free_workq_func(struct work_struct *work) { struct diskcipher_alg *cra = @@ -345,9 +346,11 @@ static void free_workq_func(struct work_struct *work) else atomic_set(&fctrl->freewq_active, 0); } +#endif void crypto_free_req_diskcipher(struct crypto_diskcipher *tfm) { +#ifdef USE_FREE_REQ struct crypto_tfm *base = crypto_diskcipher_tfm(tfm); struct diskcipher_alg *cra = crypto_diskcipher_alg(base->__crt_alg); struct diskcipher_freectrl *fctrl = &cra->freectrl; @@ -366,6 +369,9 @@ void crypto_free_req_diskcipher(struct crypto_diskcipher *tfm) list_move_tail(&tfm->node, &fctrl->freelist); spin_unlock_irqrestore(&fctrl->freelist_lock, flags); crypto_diskcipher_debug(DISKC_API_FREEREQ, 0); +#else + crypto_free_diskcipher(tfm); +#endif } unsigned int crypto_diskcipher_extsize(struct crypto_alg *alg) @@ -424,6 +430,8 @@ void crypto_free_diskcipher(struct crypto_diskcipher *tfm) int crypto_register_diskcipher(struct diskcipher_alg *alg) { struct crypto_alg *base = &alg->base; + +#ifdef USE_FREE_REQ struct diskcipher_freectrl *fctrl = &alg->freectrl; INIT_LIST_HEAD(&fctrl->freelist); @@ -431,6 +439,7 @@ int crypto_register_diskcipher(struct diskcipher_alg *alg) spin_lock_init(&fctrl->freelist_lock); if (!fctrl->max_io_ms) fctrl->max_io_ms = DISKCIPHER_MAX_IO_MS; +#endif base->cra_type = &crypto_diskcipher_type; base->cra_flags = CRYPTO_ALG_TYPE_DISKCIPHER; return crypto_register_alg(base); diff --git a/drivers/crypto/exynos-diskcipher.c b/drivers/crypto/exynos-diskcipher.c index f4d6e0de65f0..5f40fa96f171 100644 --- a/drivers/crypto/exynos-diskcipher.c +++ b/drivers/crypto/exynos-diskcipher.c @@ -133,7 +133,9 @@ static int exynos_fmp_probe(struct platform_device *pdev) alg->clearkey = fmp_clearkey; alg->crypt = fmp_crypt; alg->clear = fmp_clear; +#ifdef USE_FREE_REQ alg->freectrl.max_io_ms = 3000; +#endif #ifndef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS alg->do_crypt = fmp_do_test_crypt; #endif diff --git a/include/crypto/diskcipher.h b/include/crypto/diskcipher.h index 6a98c7ffb8cf..3b2c46c39794 100644 --- a/include/crypto/diskcipher.h +++ b/include/crypto/diskcipher.h @@ -18,9 +18,11 @@ struct diskcipher_alg; struct crypto_diskcipher { u32 algo; unsigned int ivsize; +#ifdef USE_FREE_REQ /* for crypto_free_req_diskcipher */ unsigned long req_jiffies; struct list_head node; +#endif atomic_t status; struct crypto_tfm base; }; @@ -48,7 +50,7 @@ struct diskcipher_test_request { * And pass the crypto information to disk host device via bio. * Crypt operation executes on inline crypto on disk host device. */ - +#ifdef USE_FREE_REQ struct diskcipher_freectrl { spinlock_t freelist_lock; struct list_head freelist; @@ -56,6 +58,7 @@ struct diskcipher_freectrl { atomic_t freewq_active; u32 max_io_ms; }; +#endif struct diskcipher_alg { int (*setkey)(struct crypto_tfm *tfm, const char *key, u32 keylen, @@ -67,8 +70,10 @@ struct diskcipher_alg { int (*do_crypt)(struct crypto_tfm *tfm, struct diskcipher_test_request *req); #endif - struct crypto_alg base; +#ifdef USE_FREE_REQ struct diskcipher_freectrl freectrl; +#endif + struct crypto_alg base; }; static inline unsigned int crypto_diskcipher_ivsize(struct crypto_diskcipher *tfm)