linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: dwc: Simplify boolean condition returns in debugfs
@ 2025-06-12 16:12 Hans Zhang
  2025-06-13  9:57 ` Niklas Cassel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hans Zhang @ 2025-06-12 16:12 UTC (permalink / raw)
  To: lpieralisi, kwilczynski, bhelgaas, jingoohan1, mani
  Cc: robh, linux-pci, linux-kernel, Hans Zhang

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: dwc: Simplify boolean condition returns in debugfs
  2025-06-12 16:12 [PATCH] PCI: dwc: Simplify boolean condition returns in debugfs Hans Zhang
@ 2025-06-13  9:57 ` Niklas Cassel
  2025-06-13 14:54 ` Frank Li
  2025-06-25 21:58 ` Manivannan Sadhasivam
  2 siblings, 0 replies; 4+ messages in thread
From: Niklas Cassel @ 2025-06-13  9:57 UTC (permalink / raw)
  To: Hans Zhang
  Cc: lpieralisi, kwilczynski, bhelgaas, jingoohan1, mani, robh,
	linux-pci, linux-kernel

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: dwc: Simplify boolean condition returns in debugfs
  2025-06-12 16:12 [PATCH] PCI: dwc: Simplify boolean condition returns in debugfs Hans Zhang
  2025-06-13  9:57 ` Niklas Cassel
@ 2025-06-13 14:54 ` Frank Li
  2025-06-25 21:58 ` Manivannan Sadhasivam
  2 siblings, 0 replies; 4+ messages in thread
From: Frank Li @ 2025-06-13 14:54 UTC (permalink / raw)
  To: Hans Zhang
  Cc: lpieralisi, kwilczynski, bhelgaas, jingoohan1, mani, robh,
	linux-pci, linux-kernel

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>

Reviewed-by: Frank Li <Frank.Li@nxp.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
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: dwc: Simplify boolean condition returns in debugfs
  2025-06-12 16:12 [PATCH] PCI: dwc: Simplify boolean condition returns in debugfs Hans Zhang
  2025-06-13  9:57 ` Niklas Cassel
  2025-06-13 14:54 ` Frank Li
@ 2025-06-25 21:58 ` Manivannan Sadhasivam
  2 siblings, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2025-06-25 21:58 UTC (permalink / raw)
  To: lpieralisi, kwilczynski, bhelgaas, jingoohan1, Hans Zhang
  Cc: robh, linux-pci, linux-kernel


On Fri, 13 Jun 2025 00:12:26 +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:
> 
> [...]

Applied, thanks!

[1/1] PCI: dwc: Simplify boolean condition returns in debugfs
      commit: 032f05be51ab4a1d67d08a8083ec16dd934d255e

Best regards,
-- 
Manivannan Sadhasivam <mani@kernel.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-25 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 16:12 [PATCH] PCI: dwc: Simplify boolean condition returns in debugfs Hans Zhang
2025-06-13  9:57 ` Niklas Cassel
2025-06-13 14:54 ` Frank Li
2025-06-25 21:58 ` Manivannan Sadhasivam

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).