Message ID | 20230426052153epcms2p27d64a865f15bfd452d564f77d63605db@epcms2p2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp16559vqo; Tue, 25 Apr 2023 22:29:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7SCOJp+ttBYWZvhiL7Nt4vGbNrsp5aQlA+E+rar9scnv+Z2lW3Xqih1pLkdBLEh0Fkgp8F X-Received: by 2002:a05:6a21:3010:b0:f6:c920:7870 with SMTP id yd16-20020a056a21301000b000f6c9207870mr1664351pzb.59.1682486945871; Tue, 25 Apr 2023 22:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682486945; cv=none; d=google.com; s=arc-20160816; b=K5bmEWFmN00hiqvrv89bCTf5t1slewXbb5TQ7fszN2voUl92x2K08wvkWmoMIX+Ja/ vh+NZiXhUF+oXjXuQMHbfPxe3HlMDgtHggqRpzP0HwAJUhFXexaRnkoNT22hSBCW+nqR ODjkmTaFLFO5NEUiORRN4NVMvXlrqLksu75qDk5FICrQPuDaAGdaD2TI6/XxQj0to2nv p57qh5CSZvnZy389SUS/HaaqDyc6plaXrfDLw36Tm+EW6P3mNEzH00rGS5jU4jl5abVB xGublFxLEPTLF2yw29HxkVThpo0/Q2hAbSn0dKj7LlzR9pfWQlnIh3zO9tL7fFqnOZm1 zP+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:date:message-id:to:from:sender:reply-to :subject:mime-version:dkim-signature:dkim-filter; bh=Mablksv+xusZx3eIKvm1G4NKxdL629bEN5mQIqNAqMI=; b=duMOS/xVIv9CqWkfjU8XB2/x8qtSAt9M+6L/6Ov3LjYsciSQPjEDVcmOh/lkTScEU5 xkKaxob/W/raY/FaEhTGTps9rsAaDUtU3/KFibgC4XvBd5QoU+eG9EhPyPP+WqAqqC51 dbwwJ535XL1nBdIr2r/2E4msE55AKOf1tCm5KrNCTgXvdB6IZnKiAvI2XMUtVHp7eQ98 4UDz5NYjvFGiL8ZDVt3l08NLlbN4cEIrGfFV2BZDq1a1ImY43uOFI+QhyVmh01klOsAw +GodVEKvS0zegYOk6h3ywoP+0ZjgKoxgkzftF2sJPf2Y8IJaNmhvnbcxrACuILP4eXRa a1TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=aOkwRT8O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c123-20020a633581000000b00513576ea7casi15270761pga.795.2023.04.25.22.28.52; Tue, 25 Apr 2023 22:29:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=aOkwRT8O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239354AbjDZFWO (ORCPT <rfc822;zxc52fgh@gmail.com> + 99 others); Wed, 26 Apr 2023 01:22:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbjDZFWN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 26 Apr 2023 01:22:13 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66C4E2727 for <linux-kernel@vger.kernel.org>; Tue, 25 Apr 2023 22:22:07 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230426052155epoutp02986fbc4e6bb31a328578085d4d7505a4~ZZJJDm14Z2166921669epoutp02f for <linux-kernel@vger.kernel.org>; Wed, 26 Apr 2023 05:21:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230426052155epoutp02986fbc4e6bb31a328578085d4d7505a4~ZZJJDm14Z2166921669epoutp02f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1682486515; bh=Mablksv+xusZx3eIKvm1G4NKxdL629bEN5mQIqNAqMI=; h=Subject:Reply-To:From:To:Date:References:From; b=aOkwRT8O+7N/kDLvepiP0F3NTz9HlX8J32dKmkC5lUdDVXXC2hhrT86xIR2lHO7gV bGHbSjqV3SgnE2PRrxpZjypbvKmP3hSpoXw5ZpLIrYCEzmvC1hM8YkHGYH8p926l2O Hc8ZgD0o0ZhodUogmOVFXWANRe80uJDsGXlVJw9c= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230426052154epcas2p138bcce16ce6281eb794ce0d924dbef36~ZZJIQ-k480119601196epcas2p1B; Wed, 26 Apr 2023 05:21:54 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.68]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Q5nKs2mT8z4x9Q6; Wed, 26 Apr 2023 05:21:53 +0000 (GMT) X-AuditID: b6c32a48-475ff70000005998-ac-6448b4f1191a Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 17.E5.22936.1F4B8446; Wed, 26 Apr 2023 14:21:53 +0900 (KST) Mime-Version: 1.0 Subject: [PATCH] scsi: ufs: core: Simplify param_set_mcq_mode() Reply-To: keosung.park@samsung.com Sender: Keoseong Park <keosung.park@samsung.com> From: Keoseong Park <keosung.park@samsung.com> To: ALIM AKHTAR <alim.akhtar@samsung.com>, "avri.altman@wdc.com" <avri.altman@wdc.com>, "bvanassche@acm.org" <bvanassche@acm.org>, "jejb@linux.ibm.com" <jejb@linux.ibm.com>, "martin.petersen@oracle.com" <martin.petersen@oracle.com>, "stanley.chu@mediatek.com" <stanley.chu@mediatek.com>, "quic_asutoshd@quicinc.com" <quic_asutoshd@quicinc.com>, "beanhuo@micron.com" <beanhuo@micron.com>, "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> X-Priority: 3 X-Content-Kind-Code: NORMAL X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20230426052153epcms2p27d64a865f15bfd452d564f77d63605db@epcms2p2> Date: Wed, 26 Apr 2023 14:21:53 +0900 X-CMS-MailID: 20230426052153epcms2p27d64a865f15bfd452d564f77d63605db Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-CPGSPASS: Y X-CPGSPASS: Y X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAJsWRmVeSWpSXmKPExsWy7bCmhe7HLR4pBp8nCVs8mLeNzeLlz6ts FgcfdrJYTPvwk9ni5SFNi0e3nzFaLLqxjcni8q45bBbd13ewWSw//o/JYmHHXBaLpVtvMjrw eFy+4u0xYdEBRo+Wk/tZPL6v72Dz+Pj0FovHxD11Hn1bVjF6fN4k59F+oJspgDMq2yYjNTEl tUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH6GAlhbLEnFKgUE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p27d64a865f15bfd452d564f77d63605db References: <CGME20230426052153epcms2p27d64a865f15bfd452d564f77d63605db@epcms2p2> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764215432105626870?= X-GMAIL-MSGID: =?utf-8?q?1764215432105626870?= |
Series |
scsi: ufs: core: Simplify param_set_mcq_mode()
|
|
Commit Message
Keoseong Park
April 26, 2023, 5:21 a.m. UTC
This function does not require the "ret" variable because it returns
only the result of param_set_bool().
Remove unnecessary "ret" variable and simplify the code.
Signed-off-by: Keoseong Park <keosung.park@samsung.com>
---
drivers/ufs/core/ufshcd.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
Comments
Keoseong Park <keosung.park@samsung.com> 於 2023年4月26日 週三 下午1:26寫道: > > This function does not require the "ret" variable because it returns > only the result of param_set_bool(). > > Remove unnecessary "ret" variable and simplify the code. > > Signed-off-by: Keoseong Park <keosung.park@samsung.com> > --- > drivers/ufs/core/ufshcd.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
> This function does not require the "ret" variable because it returns > only the result of param_set_bool(). > > Remove unnecessary "ret" variable and simplify the code. > > Signed-off-by: Keoseong Park <keosung.park@samsung.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> > --- > drivers/ufs/core/ufshcd.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > index 9434328ba323..46c4ed478ad0 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -108,13 +108,7 @@ static bool is_mcq_supported(struct ufs_hba *hba) > > static int param_set_mcq_mode(const char *val, const struct kernel_param > *kp) > { > - int ret; > - > - ret = param_set_bool(val, kp); > - if (ret) > - return ret; > - > - return 0; > + return param_set_bool(val, kp); > } > > static const struct kernel_param_ops mcq_mode_ops = { > -- > 2.17.1
On 4/25/23 22:21, Keoseong Park wrote: > This function does not require the "ret" variable because it returns > only the result of param_set_bool(). > > Remove unnecessary "ret" variable and simplify the code. > > Signed-off-by: Keoseong Park <keosung.park@samsung.com> > --- > drivers/ufs/core/ufshcd.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > index 9434328ba323..46c4ed478ad0 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -108,13 +108,7 @@ static bool is_mcq_supported(struct ufs_hba *hba) > > static int param_set_mcq_mode(const char *val, const struct kernel_param *kp) > { > - int ret; > - > - ret = param_set_bool(val, kp); > - if (ret) > - return ret; > - > - return 0; > + return param_set_bool(val, kp); > } > > static const struct kernel_param_ops mcq_mode_ops = { Why do we even have the param_set_mcq_mode() callback? Has it been considered to remove mcq_mode_ops as in the untested patch below? Thanks, Bart. diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 7b1e7d7091ff..2b8c2613f7d7 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -98,7 +98,7 @@ /* Polling time to wait for fDeviceInit */ #define FDEVICEINIT_COMPL_TIMEOUT 1500 /* millisecs */ -/* UFSHC 4.0 compliant HC support this mode, refer param_set_mcq_mode() */ +/* UFSHC 4.0 compliant HC support this mode. */ static bool use_mcq_mode = true; static bool is_mcq_supported(struct ufs_hba *hba) @@ -106,23 +106,7 @@ static bool is_mcq_supported(struct ufs_hba *hba) return hba->mcq_sup && use_mcq_mode; } -static int param_set_mcq_mode(const char *val, const struct kernel_param *kp) -{ - int ret; - - ret = param_set_bool(val, kp); - if (ret) - return ret; - - return 0; -} - -static const struct kernel_param_ops mcq_mode_ops = { - .set = param_set_mcq_mode, - .get = param_get_bool, -}; - -module_param_cb(use_mcq_mode, &mcq_mode_ops, &use_mcq_mode, 0644); +module_param(use_mcq_mode, bool, 0644); MODULE_PARM_DESC(use_mcq_mode, "Control MCQ mode for controllers starting from UFSHCI 4.0. 1 - enable MCQ, 0 - disable MCQ. MCQ is enabled by default"); #define ufshcd_toggle_vreg(_dev, _vreg, _on) \
Hi Bart, Thank you for your review. >On 4/25/23 22:21, Keoseong Park wrote: >> This function does not require the "ret" variable because it returns >> only the result of param_set_bool(). >> >> Remove unnecessary "ret" variable and simplify the code. >> >> Signed-off-by: Keoseong Park <keosung.park@samsung.com> >> --- >> drivers/ufs/core/ufshcd.c | 8 +------- >> 1 file changed, 1 insertion(+), 7 deletions(-) >> >> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c >> index 9434328ba323..46c4ed478ad0 100644 >> --- a/drivers/ufs/core/ufshcd.c >> +++ b/drivers/ufs/core/ufshcd.c >> @@ -108,13 +108,7 @@ static bool is_mcq_supported(struct ufs_hba *hba) >> >> static int param_set_mcq_mode(const char *val, const struct kernel_param *kp) >> { >> - int ret; >> - >> - ret = param_set_bool(val, kp); >> - if (ret) >> - return ret; >> - >> - return 0; >> + return param_set_bool(val, kp); >> } >> >> static const struct kernel_param_ops mcq_mode_ops = { > >Why do we even have the param_set_mcq_mode() callback? Has it been considered >to remove mcq_mode_ops as in the untested patch below? I agree with you in that it only uses param_{set,get}_bool(). So, I'll test the patch below and send it. Best Regards, Keoseong > >Thanks, > >Bart. > >diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c >index 7b1e7d7091ff..2b8c2613f7d7 100644 >--- a/drivers/ufs/core/ufshcd.c >+++ b/drivers/ufs/core/ufshcd.c >@@ -98,7 +98,7 @@ > /* Polling time to wait for fDeviceInit */ > #define FDEVICEINIT_COMPL_TIMEOUT 1500 /* millisecs */ > >-/* UFSHC 4.0 compliant HC support this mode, refer param_set_mcq_mode() */ >+/* UFSHC 4.0 compliant HC support this mode. */ > static bool use_mcq_mode = true; > > static bool is_mcq_supported(struct ufs_hba *hba) >@@ -106,23 +106,7 @@ static bool is_mcq_supported(struct ufs_hba *hba) > return hba->mcq_sup && use_mcq_mode; > } > >-static int param_set_mcq_mode(const char *val, const struct kernel_param *kp) >-{ >- int ret; >- >- ret = param_set_bool(val, kp); >- if (ret) >- return ret; >- >- return 0; >-} >- >-static const struct kernel_param_ops mcq_mode_ops = { >- .set = param_set_mcq_mode, >- .get = param_get_bool, >-}; >- >-module_param_cb(use_mcq_mode, &mcq_mode_ops, &use_mcq_mode, 0644); >+module_param(use_mcq_mode, bool, 0644); > MODULE_PARM_DESC(use_mcq_mode, "Control MCQ mode for controllers starting from UFSHCI 4.0. 1 - enable MCQ, 0 - disable MCQ. MCQ is enabled by default"); > > #define ufshcd_toggle_vreg(_dev, _vreg, _on) \
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 9434328ba323..46c4ed478ad0 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -108,13 +108,7 @@ static bool is_mcq_supported(struct ufs_hba *hba) static int param_set_mcq_mode(const char *val, const struct kernel_param *kp) { - int ret; - - ret = param_set_bool(val, kp); - if (ret) - return ret; - - return 0; + return param_set_bool(val, kp); } static const struct kernel_param_ops mcq_mode_ops = {