Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1267597pxb; Thu, 15 Apr 2021 19:31:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz89mlR03fPNVb5IAqOcWiSymst+QZMMxJZdZ5BTWonYN16EJgLH7+FS2y6TD2Yv0/p/JIA X-Received: by 2002:a05:6402:453:: with SMTP id p19mr586272edw.88.1618540260711; Thu, 15 Apr 2021 19:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618540260; cv=none; d=google.com; s=arc-20160816; b=jSZvHYN8+ERVqAGlhRyx3tA7FJhrAcd91iaF5cecBHh1BxbO2zXygK8oyVf6rgEO5k rcpspNKMwWK0cbYGRqFjazI0MrqV+fTw8McGSyoz1NR2zV4V2eOrwP/g5vC3uRCccGZY 0YwXjQR2TbQ1kYtAaNHQPTrS6BmAcdDDI0WK7iJckQojaD4GvfrnvjN6qhv6szpvYJF2 bFVi/b4822OwV2T2wAPXspp8Xu/1W/CposAU3Nwbshqo4Xztfr+chIC27dsyY3n7JmYw SinSYMiNQPhzyZQJVGxlzEjnbg5VNF1TysRc1+5z5SQt7riPWiL/CuzQGVjiLV2d5q4S Xrjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=R4Pfe5mI3LRuA4zCvkjpw5CdyHMeuCh9etI7+VMI1V8=; b=o6qYeyEUaRW0QZy/DN+V9kqivHetjirnSWRW+Y8G/72sJvqNHB1uFygq+zrhS+5/Q5 CWRf6+jfL9Eq+2SJkHSERT5CtjIb1ap6IRT8bbc1my7mgJFwgb20o+Sjg6D6bOoRmfw7 JS2lmAEYERSJUuRVceme2HXZarrnhRQWngEu5hgUOVGF47Os7Oe6cMj/5S1HSmydL2Xi Y11flVWHMtf3bk1Cc7wIpgQZmp9Tl9wk/79eNBgp04wBuUi5WOPzzLblTLuxmR+g31lL DHqQLYC0soCJ8zMdmAz+ANvukXzLrEgHmzuTdZIQMSMZDuZWeYOPlqnxRYB4AoR77mrY HcyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y16si4034650edd.467.2021.04.15.19.30.18; Thu, 15 Apr 2021 19:31:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234548AbhDPBG6 (ORCPT + 99 others); Thu, 15 Apr 2021 21:06:58 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:16595 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237219AbhDPBG6 (ORCPT ); Thu, 15 Apr 2021 21:06:58 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FLyf6359Cz18H8S; Fri, 16 Apr 2021 09:04:14 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.498.0; Fri, 16 Apr 2021 09:06:19 +0800 From: Tian Tao To: , , CC: , Tian Tao Subject: [PATCH v2] crypto: ccp - Make ccp_dev_suspend and ccp_dev_resume void functions Date: Fri, 16 Apr 2021 09:06:42 +0800 Message-ID: <1618535202-11397-1-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Since ccp_dev_suspend() and ccp_dev_resume() only return 0 which causes ret to equal 0 in sp_suspend and sp_resume, making the if condition impossible to use. it might be a more appropriate fix to have these be void functions and eliminate the if condition in sp_suspend() and sp_resume(). Signed-off-by: Tian Tao Cc: Herbert Xu Cc: "David S. Miller" Cc: Tom Lendacky --- v2: handle the case that didn't define CONFIG_CRYPTO_DEV_SP_CCP. --- drivers/crypto/ccp/ccp-dev.c | 12 ++++-------- drivers/crypto/ccp/sp-dev.c | 12 ++---------- drivers/crypto/ccp/sp-dev.h | 15 ++++----------- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index 0971ee6..6777582 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c @@ -548,7 +548,7 @@ bool ccp_queues_suspended(struct ccp_device *ccp) return ccp->cmd_q_count == suspended; } -int ccp_dev_suspend(struct sp_device *sp) +void ccp_dev_suspend(struct sp_device *sp) { struct ccp_device *ccp = sp->ccp_data; unsigned long flags; @@ -556,7 +556,7 @@ int ccp_dev_suspend(struct sp_device *sp) /* If there's no device there's nothing to do */ if (!ccp) - return 0; + return; spin_lock_irqsave(&ccp->cmd_lock, flags); @@ -572,11 +572,9 @@ int ccp_dev_suspend(struct sp_device *sp) while (!ccp_queues_suspended(ccp)) wait_event_interruptible(ccp->suspend_queue, ccp_queues_suspended(ccp)); - - return 0; } -int ccp_dev_resume(struct sp_device *sp) +void ccp_dev_resume(struct sp_device *sp) { struct ccp_device *ccp = sp->ccp_data; unsigned long flags; @@ -584,7 +582,7 @@ int ccp_dev_resume(struct sp_device *sp) /* If there's no device there's nothing to do */ if (!ccp) - return 0; + return; spin_lock_irqsave(&ccp->cmd_lock, flags); @@ -597,8 +595,6 @@ int ccp_dev_resume(struct sp_device *sp) } spin_unlock_irqrestore(&ccp->cmd_lock, flags); - - return 0; } int ccp_dev_init(struct sp_device *sp) diff --git a/drivers/crypto/ccp/sp-dev.c b/drivers/crypto/ccp/sp-dev.c index 6284a15..7eb3e46 100644 --- a/drivers/crypto/ccp/sp-dev.c +++ b/drivers/crypto/ccp/sp-dev.c @@ -213,12 +213,8 @@ void sp_destroy(struct sp_device *sp) int sp_suspend(struct sp_device *sp) { - int ret; - if (sp->dev_vdata->ccp_vdata) { - ret = ccp_dev_suspend(sp); - if (ret) - return ret; + ccp_dev_suspend(sp); } return 0; @@ -226,12 +222,8 @@ int sp_suspend(struct sp_device *sp) int sp_resume(struct sp_device *sp) { - int ret; - if (sp->dev_vdata->ccp_vdata) { - ret = ccp_dev_resume(sp); - if (ret) - return ret; + ccp_dev_resume(sp); } return 0; diff --git a/drivers/crypto/ccp/sp-dev.h b/drivers/crypto/ccp/sp-dev.h index 0218d06..20377e6 100644 --- a/drivers/crypto/ccp/sp-dev.h +++ b/drivers/crypto/ccp/sp-dev.h @@ -134,8 +134,8 @@ struct sp_device *sp_get_psp_master_device(void); int ccp_dev_init(struct sp_device *sp); void ccp_dev_destroy(struct sp_device *sp); -int ccp_dev_suspend(struct sp_device *sp); -int ccp_dev_resume(struct sp_device *sp); +void ccp_dev_suspend(struct sp_device *sp); +void ccp_dev_resume(struct sp_device *sp); #else /* !CONFIG_CRYPTO_DEV_SP_CCP */ @@ -144,15 +144,8 @@ static inline int ccp_dev_init(struct sp_device *sp) return 0; } static inline void ccp_dev_destroy(struct sp_device *sp) { } - -static inline int ccp_dev_suspend(struct sp_device *sp) -{ - return 0; -} -static inline int ccp_dev_resume(struct sp_device *sp) -{ - return 0; -} +static inline void ccp_dev_suspend(struct sp_device *sp) { } +static inline void ccp_dev_resume(struct sp_device *sp) { } #endif /* CONFIG_CRYPTO_DEV_SP_CCP */ #ifdef CONFIG_CRYPTO_DEV_SP_PSP -- 2.7.4