From: Niklas Cassel <cassel@kernel.org>
To: Hans Zhang <18255117159@163.com>
Cc: lpieralisi@kernel.org, kwilczynski@kernel.org,
bhelgaas@google.com, jingoohan1@gmail.com, mani@kernel.org,
robh@kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: dwc: Simplify boolean condition returns in debugfs
Date: Fri, 13 Jun 2025 11:57:59 +0200 [thread overview]
Message-ID: <aEv2J7Or8zWgoKHy@ryzen> (raw)
In-Reply-To: <20250612161226.950937-1-18255117159@163.com>
On Fri, Jun 13, 2025 at 12:12:26AM +0800, Hans Zhang wrote:
> Replace redundant ternary conditional expressions with direct boolean
> returns in PTM visibility functions. Specifically change this pattern:
>
> return (condition) ? true : false;
>
> to the simpler:
>
> return condition;
>
> Signed-off-by: Hans Zhang <18255117159@163.com>
> ---
> .../pci/controller/dwc/pcie-designware-debugfs.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-designware-debugfs.c b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
> index c67601096c48..6f438a36f840 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-debugfs.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-debugfs.c
> @@ -814,14 +814,14 @@ static bool dw_pcie_ptm_context_update_visible(void *drvdata)
> {
> struct dw_pcie *pci = drvdata;
>
> - return (pci->mode == DW_PCIE_EP_TYPE) ? true : false;
> + return pci->mode == DW_PCIE_EP_TYPE;
> }
>
> static bool dw_pcie_ptm_context_valid_visible(void *drvdata)
> {
> struct dw_pcie *pci = drvdata;
>
> - return (pci->mode == DW_PCIE_RC_TYPE) ? true : false;
> + return pci->mode == DW_PCIE_RC_TYPE;
> }
>
> static bool dw_pcie_ptm_local_clock_visible(void *drvdata)
> @@ -834,35 +834,35 @@ static bool dw_pcie_ptm_master_clock_visible(void *drvdata)
> {
> struct dw_pcie *pci = drvdata;
>
> - return (pci->mode == DW_PCIE_EP_TYPE) ? true : false;
> + return pci->mode == DW_PCIE_EP_TYPE;
> }
>
> static bool dw_pcie_ptm_t1_visible(void *drvdata)
> {
> struct dw_pcie *pci = drvdata;
>
> - return (pci->mode == DW_PCIE_EP_TYPE) ? true : false;
> + return pci->mode == DW_PCIE_EP_TYPE;
> }
>
> static bool dw_pcie_ptm_t2_visible(void *drvdata)
> {
> struct dw_pcie *pci = drvdata;
>
> - return (pci->mode == DW_PCIE_RC_TYPE) ? true : false;
> + return pci->mode == DW_PCIE_RC_TYPE;
> }
>
> static bool dw_pcie_ptm_t3_visible(void *drvdata)
> {
> struct dw_pcie *pci = drvdata;
>
> - return (pci->mode == DW_PCIE_RC_TYPE) ? true : false;
> + return pci->mode == DW_PCIE_RC_TYPE;
> }
>
> static bool dw_pcie_ptm_t4_visible(void *drvdata)
> {
> struct dw_pcie *pci = drvdata;
>
> - return (pci->mode == DW_PCIE_EP_TYPE) ? true : false;
> + return pci->mode == DW_PCIE_EP_TYPE;
> }
>
> const struct pcie_ptm_ops dw_pcie_ptm_ops = {
>
> base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
> --
> 2.25.1
>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
next prev parent reply other threads:[~2025-06-13 9:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-12 16:12 [PATCH] PCI: dwc: Simplify boolean condition returns in debugfs Hans Zhang
2025-06-13 9:57 ` Niklas Cassel [this message]
2025-06-13 14:54 ` Frank Li
2025-06-25 21:58 ` Manivannan Sadhasivam
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=aEv2J7Or8zWgoKHy@ryzen \
--to=cassel@kernel.org \
--cc=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=jingoohan1@gmail.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
/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