All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhengchao Shao <shaozhengchao@huawei.com>
To: <netdev@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
	<jhs@mojatatu.com>, <xiyou.wangcong@gmail.com>,
	<jiri@resnulli.us>, <shuah@kernel.org>, <victor@mojatatu.com>
Cc: <weiyongjun1@huawei.com>, <yuehaibing@huawei.com>,
	<shaozhengchao@huawei.com>
Subject: [PATCH -next, v3 06/10] net: hinic: simplify code logic
Date: Wed, 21 Sep 2022 20:33:54 +0800	[thread overview]
Message-ID: <20220921123358.63442-7-shaozhengchao@huawei.com> (raw)
In-Reply-To: <20220921123358.63442-1-shaozhengchao@huawei.com>

simplify code logic in hinic_ndo_set_vf_trust() and
hinic_ndo_set_vf_spoofchk().

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 drivers/net/ethernet/huawei/hinic/hinic_sriov.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
index a8f71a69ddcc..00a66e6e3060 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
@@ -820,7 +820,7 @@ int hinic_ndo_set_vf_trust(struct net_device *netdev, int vf, bool setting)
 
 	cur_trust = nic_io->vf_infos[vf].trust;
 	/* same request, so just return success */
-	if ((setting && cur_trust) || (!setting && !cur_trust))
+	if (setting == cur_trust)
 		return 0;
 
 	err = hinic_set_vf_trust(adapter->hwdev, vf, setting);
@@ -940,7 +940,7 @@ int hinic_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting)
 	cur_spoofchk = nic_dev->hwdev->func_to_io.vf_infos[vf].spoofchk;
 
 	/* same request, so just return success */
-	if ((setting && cur_spoofchk) || (!setting && !cur_spoofchk))
+	if (setting == cur_spoofchk)
 		return 0;
 
 	err = hinic_set_vf_spoofchk(sriov_info->hwdev,
-- 
2.17.1


  parent reply	other threads:[~2022-09-21 12:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 12:33 [PATCH -next, v3 00/10] cleanup in Huawei hinic driver Zhengchao Shao
2022-09-21 12:33 ` [PATCH -next, v3 01/10] net: hinic: modify kernel doc comments Zhengchao Shao
2022-09-21 12:33 ` [PATCH -next, v3 02/10] net: hinic: change type of function to be static Zhengchao Shao
2022-09-21 12:33 ` [PATCH -next, v3 03/10] net: hinic: remove unused functions Zhengchao Shao
2022-09-21 12:33 ` [PATCH -next, v3 04/10] net: hinic: remove unused macro Zhengchao Shao
2022-09-21 12:33 ` [PATCH -next, v3 05/10] net: hinic: remove duplicate macro definition Zhengchao Shao
2022-09-21 12:33 ` Zhengchao Shao [this message]
2022-09-21 12:33 ` [PATCH -next, v3 07/10] net: hinic: change hinic_deinit_vf_hw() to void Zhengchao Shao
2022-09-21 12:33 ` [PATCH -next, v3 08/10] net: hinic: remove unused enumerated value Zhengchao Shao
2022-09-21 12:33 ` [PATCH -next, v3 09/10] net: hinic: replace magic numbers with macro Zhengchao Shao
2022-09-21 12:33 ` [PATCH -next, v3 10/10] net: hinic: remove the unused input parameter prod_idx in sq_prepare_ctrl() Zhengchao Shao
2022-09-23  1:10 ` [PATCH -next, v3 00/10] cleanup in Huawei hinic driver patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220921123358.63442-7-shaozhengchao@huawei.com \
    --to=shaozhengchao@huawei.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=victor@mojatatu.com \
    --cc=weiyongjun1@huawei.com \
    --cc=xiyou.wangcong@gmail.com \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.