linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Ruan Jinjie <ruanjinjie@huawei.com>,
	Ping-Ke Shih <pkshih@realtek.com>,
	"sgoutham@marvell.com" <sgoutham@marvell.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"jesse.brandeburg@intel.com" <jesse.brandeburg@intel.com>,
	"anthony.l.nguyen@intel.com" <anthony.l.nguyen@intel.com>,
	"tariqt@nvidia.com" <tariqt@nvidia.com>,
	"s.shtylyov@omp.ru" <s.shtylyov@omp.ru>,
	"aspriel@gmail.com" <aspriel@gmail.com>,
	"franky.lin@broadcom.com" <franky.lin@broadcom.com>,
	"hante.meuleman@broadcom.com" <hante.meuleman@broadcom.com>,
	"kvalo@kernel.org" <kvalo@kernel.org>,
	"richardcochran@gmail.com" <richardcochran@gmail.com>,
	"yoshihiro.shimoda.uh@renesas.com"
	<yoshihiro.shimoda.uh@renesas.com>,
	"u.kleine-koenig@pengutronix.de" <u.kleine-koenig@pengutronix.de>,
	"mkl@pengutronix.de" <mkl@pengutronix.de>,
	"lee@kernel.org" <lee@kernel.org>,
	"set_pte_at@outlook.com" <set_pte_at@outlook.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"intel-wired-lan@lists.osuosl.org"
	<intel-wired-lan@lists.osuosl.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"brcm80211-dev-list.pdl@broadcom.com"
	<brcm80211-dev-list.pdl@broadcom.com>,
	"SHA-cyfmac-dev-list@infineon.com"
	<SHA-cyfmac-dev-list@infineon.com>
Subject: Re: [PATCH -next 1/6] net: thunderx: Remove unnecessary ternary operators
Date: Mon, 7 Aug 2023 10:34:57 -0700	[thread overview]
Message-ID: <e3985341-a0fa-0748-613d-d49b828e65c5@intel.com> (raw)
In-Reply-To: <815f4639-7a21-4438-b9dc-0b36f9b08b17@huawei.com>



On 8/6/2023 9:59 PM, Ruan Jinjie wrote:
> 
> 
> On 2023/8/7 9:39, Ping-Ke Shih wrote:
>>
>>
>>> -----Original Message-----
>>> From: Ruan Jinjie <ruanjinjie@huawei.com>
>>> Sent: Friday, August 4, 2023 11:54 AM
>>> To: sgoutham@marvell.com; davem@davemloft.net; edumazet@google.com; kuba@kernel.org; pabeni@redhat.com;
>>> jesse.brandeburg@intel.com; anthony.l.nguyen@intel.com; tariqt@nvidia.com; s.shtylyov@omp.ru;
>>> aspriel@gmail.com; franky.lin@broadcom.com; hante.meuleman@broadcom.com; kvalo@kernel.org;
>>> richardcochran@gmail.com; yoshihiro.shimoda.uh@renesas.com; ruanjinjie@huawei.com;
>>> u.kleine-koenig@pengutronix.de; mkl@pengutronix.de; lee@kernel.org; set_pte_at@outlook.com;
>>> linux-arm-kernel@lists.infradead.org; netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org;
>>> linux-rdma@vger.kernel.org; linux-renesas-soc@vger.kernel.org; linux-wireless@vger.kernel.org;
>>> brcm80211-dev-list.pdl@broadcom.com; SHA-cyfmac-dev-list@infineon.com
>>> Subject: [PATCH -next 1/6] net: thunderx: Remove unnecessary ternary operators
>>>
>>> Ther are a little ternary operators, the true or false judgement
>>> of which is unnecessary in C language semantics.
>>>
>>> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
>>> ---
>>>  drivers/net/ethernet/cavium/thunder/nic_main.c    | 2 +-
>>>  drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 2 +-
>>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c
>>> b/drivers/net/ethernet/cavium/thunder/nic_main.c
>>> index 0ec65ec634df..b7cf4ba89b7c 100644
>>> --- a/drivers/net/ethernet/cavium/thunder/nic_main.c
>>> +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
>>> @@ -174,7 +174,7 @@ static void nic_mbx_send_ready(struct nicpf *nic, int vf)
>>>                 if (mac)
>>>                         ether_addr_copy((u8 *)&mbx.nic_cfg.mac_addr, mac);
>>>         }
>>> -       mbx.nic_cfg.sqs_mode = (vf >= nic->num_vf_en) ? true : false;
>>> +       mbx.nic_cfg.sqs_mode = vf >= nic->num_vf_en;
>>>         mbx.nic_cfg.node_id = nic->node;
>>>
>>>         mbx.nic_cfg.loopback_supported = vf < nic->num_vf_en;
>>> diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
>>> b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
>>> index a317feb8decb..9e467cecc33a 100644
>>> --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
>>> +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
>>> @@ -957,7 +957,7 @@ static void bgx_poll_for_sgmii_link(struct lmac *lmac)
>>>                 goto next_poll;
>>>         }
>>>
>>> -       lmac->link_up = ((pcs_link & PCS_MRX_STATUS_LINK) != 0) ? true : false;
>>> +       lmac->link_up = (pcs_link & PCS_MRX_STATUS_LINK) != 0;
>>
>> lmac->link_up = !!(pcs_link & PCS_MRX_STATUS_LINK);
> 
> Thank you! I'll improve it sooner.
> 

I personally find "!= 0" a bit more readable than '!!' but I suppose
thats personal taste and !! is pretty common in the kernel.

Thanks,
Jake

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-08-07 17:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04  3:53 [PATCH -next 0/6] net: Remove unnecessary ternary operators Ruan Jinjie
2023-08-04  3:53 ` [PATCH -next 1/6] net: thunderx: " Ruan Jinjie
     [not found]   ` <15759f98483947999393a25b857bc4fe@realtek.com>
2023-08-07  4:59     ` Ruan Jinjie
2023-08-07 17:34       ` Jacob Keller [this message]
2023-08-04  3:53 ` [PATCH -next 2/6] ethernet/intel: " Ruan Jinjie
2023-08-07 17:35   ` Jacob Keller
2023-08-04  3:53 ` [PATCH -next 3/6] net/mlx4: Remove an unnecessary ternary operator Ruan Jinjie
     [not found]   ` <fd3e9bb40d12421caaddda7279aece7a@realtek.com>
2023-08-07  5:00     ` Ruan Jinjie
2023-08-04  3:53 ` [PATCH -next 4/6] net: ethernet: renesas: rswitch: " Ruan Jinjie
2023-08-04  3:53 ` [PATCH -next 5/6] net: fjes: " Ruan Jinjie
2023-08-04  3:53 ` [PATCH -next 6/6] brcm80211: " Ruan Jinjie
     [not found]   ` <f72991b36d6a449ea5cf476d438bcd1d@realtek.com>
2023-08-07  5:00     ` Ruan Jinjie
2023-08-04 20:17 ` [PATCH -next 0/6] net: Remove unnecessary ternary operators Jakub Kicinski

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=e3985341-a0fa-0748-613d-d49b828e65c5@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=SHA-cyfmac-dev-list@infineon.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=aspriel@gmail.com \
    --cc=brcm80211-dev-list.pdl@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=franky.lin@broadcom.com \
    --cc=hante.meuleman@broadcom.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pkshih@realtek.com \
    --cc=richardcochran@gmail.com \
    --cc=ruanjinjie@huawei.com \
    --cc=s.shtylyov@omp.ru \
    --cc=set_pte_at@outlook.com \
    --cc=sgoutham@marvell.com \
    --cc=tariqt@nvidia.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=yoshihiro.shimoda.uh@renesas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).