All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] PCI: artpec6: Remove surplus break statement after return
@ 2021-07-01 20:44 Krzysztof Wilczyński
  2021-07-01 20:44 ` [PATCH v2 2/2] PCI: artpec6: Remove local code block from within switch statement Krzysztof Wilczyński
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Krzysztof Wilczyński @ 2021-07-01 20:44 UTC (permalink / raw)
  To: Jesper Nilsson; +Cc: Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring, linux-pci

As part of code refactoring completed in the commit a0fd361db8e5 ("PCI:
dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common
code") the function artpec6_add_pcie_ep() has been removed and the call
to the dw_pcie_ep_init() has been moved into artpec6_pcie_probe().

This change left a break statement behind that is not needed any more as
as the function artpec6_pcie_probe() return immediately after making
a call to dw_pcie_ep_init().

Thus remove this surplus break statement that became a dead code.

Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
 drivers/pci/controller/dwc/pcie-artpec6.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-artpec6.c b/drivers/pci/controller/dwc/pcie-artpec6.c
index 597c282f586c..739871bece75 100644
--- a/drivers/pci/controller/dwc/pcie-artpec6.c
+++ b/drivers/pci/controller/dwc/pcie-artpec6.c
@@ -445,7 +445,6 @@ static int artpec6_pcie_probe(struct platform_device *pdev)
 		pci->ep.ops = &pcie_ep_ops;
 
 		return dw_pcie_ep_init(&pci->ep);
-		break;
 	}
 	default:
 		dev_err(dev, "INVALID device type %d\n", artpec6_pcie->mode);
-- 
2.32.0


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

* [PATCH v2 2/2] PCI: artpec6: Remove local code block from within switch statement
  2021-07-01 20:44 [PATCH v2 1/2] PCI: artpec6: Remove surplus break statement after return Krzysztof Wilczyński
@ 2021-07-01 20:44 ` Krzysztof Wilczyński
  2021-07-01 21:00   ` Jesper Nilsson
  2021-07-01 20:59 ` [PATCH v2 1/2] PCI: artpec6: Remove surplus break statement after return Jesper Nilsson
  2021-07-23 15:14 ` Lorenzo Pieralisi
  2 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Wilczyński @ 2021-07-01 20:44 UTC (permalink / raw)
  To: Jesper Nilsson; +Cc: Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring, linux-pci

At the moment, the switch statement in the artpec6_pcie_probe() has
a local code block where the local variable "val" is defined and
immediately used by the artpec6_pcie_readl() within this local scope.

This extra code block adds brackets at the same indentation level as the
switch statement itself which can hinder readability of the code.

Thus, move the variable "val" declaration and definition at the top of
the function where other variables are already present, and remove the
extra code block from within the select statement.  This also is the
preferred style in the PCI tree.

Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
 drivers/pci/controller/dwc/pcie-artpec6.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-artpec6.c b/drivers/pci/controller/dwc/pcie-artpec6.c
index 739871bece75..c91fc1954432 100644
--- a/drivers/pci/controller/dwc/pcie-artpec6.c
+++ b/drivers/pci/controller/dwc/pcie-artpec6.c
@@ -384,6 +384,7 @@ static int artpec6_pcie_probe(struct platform_device *pdev)
 	const struct artpec_pcie_of_data *data;
 	enum artpec_pcie_variants variant;
 	enum dw_pcie_device_mode mode;
+	u32 val;
 
 	match = of_match_device(artpec6_pcie_of_match, dev);
 	if (!match)
@@ -432,9 +433,7 @@ static int artpec6_pcie_probe(struct platform_device *pdev)
 		if (ret < 0)
 			return ret;
 		break;
-	case DW_PCIE_EP_TYPE: {
-		u32 val;
-
+	case DW_PCIE_EP_TYPE:
 		if (!IS_ENABLED(CONFIG_PCIE_ARTPEC6_EP))
 			return -ENODEV;
 
@@ -445,7 +444,6 @@ static int artpec6_pcie_probe(struct platform_device *pdev)
 		pci->ep.ops = &pcie_ep_ops;
 
 		return dw_pcie_ep_init(&pci->ep);
-	}
 	default:
 		dev_err(dev, "INVALID device type %d\n", artpec6_pcie->mode);
 	}
-- 
2.32.0


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

* Re: [PATCH v2 1/2] PCI: artpec6: Remove surplus break statement after return
  2021-07-01 20:44 [PATCH v2 1/2] PCI: artpec6: Remove surplus break statement after return Krzysztof Wilczyński
  2021-07-01 20:44 ` [PATCH v2 2/2] PCI: artpec6: Remove local code block from within switch statement Krzysztof Wilczyński
@ 2021-07-01 20:59 ` Jesper Nilsson
  2021-07-23 15:14 ` Lorenzo Pieralisi
  2 siblings, 0 replies; 5+ messages in thread
From: Jesper Nilsson @ 2021-07-01 20:59 UTC (permalink / raw)
  To: Krzysztof Wilczyński
  Cc: Jesper Nilsson, Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring, linux-pci

On Thu, Jul 01, 2021 at 10:44:00PM +0200, Krzysztof Wilczyński wrote:
> As part of code refactoring completed in the commit a0fd361db8e5 ("PCI:
> dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common
> code") the function artpec6_add_pcie_ep() has been removed and the call
> to the dw_pcie_ep_init() has been moved into artpec6_pcie_probe().
> 
> This change left a break statement behind that is not needed any more as
> as the function artpec6_pcie_probe() return immediately after making
> a call to dw_pcie_ep_init().
> 
> Thus remove this surplus break statement that became a dead code.
> 
> Signed-off-by: Krzysztof Wilczyński <kw@linux.com>

Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>


/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

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

* Re: [PATCH v2 2/2] PCI: artpec6: Remove local code block from within switch statement
  2021-07-01 20:44 ` [PATCH v2 2/2] PCI: artpec6: Remove local code block from within switch statement Krzysztof Wilczyński
@ 2021-07-01 21:00   ` Jesper Nilsson
  0 siblings, 0 replies; 5+ messages in thread
From: Jesper Nilsson @ 2021-07-01 21:00 UTC (permalink / raw)
  To: Krzysztof Wilczyński
  Cc: Jesper Nilsson, Bjorn Helgaas, Lorenzo Pieralisi, Rob Herring, linux-pci

On Thu, Jul 01, 2021 at 10:44:01PM +0200, Krzysztof Wilczyński wrote:
> At the moment, the switch statement in the artpec6_pcie_probe() has
> a local code block where the local variable "val" is defined and
> immediately used by the artpec6_pcie_readl() within this local scope.
> 
> This extra code block adds brackets at the same indentation level as the
> switch statement itself which can hinder readability of the code.
> 
> Thus, move the variable "val" declaration and definition at the top of
> the function where other variables are already present, and remove the
> extra code block from within the select statement.  This also is the
> preferred style in the PCI tree.
> 
> Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
> Signed-off-by: Krzysztof Wilczyński <kw@linux.com>

Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>


/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

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

* Re: [PATCH v2 1/2] PCI: artpec6: Remove surplus break statement after return
  2021-07-01 20:44 [PATCH v2 1/2] PCI: artpec6: Remove surplus break statement after return Krzysztof Wilczyński
  2021-07-01 20:44 ` [PATCH v2 2/2] PCI: artpec6: Remove local code block from within switch statement Krzysztof Wilczyński
  2021-07-01 20:59 ` [PATCH v2 1/2] PCI: artpec6: Remove surplus break statement after return Jesper Nilsson
@ 2021-07-23 15:14 ` Lorenzo Pieralisi
  2 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Pieralisi @ 2021-07-23 15:14 UTC (permalink / raw)
  To: Krzysztof Wilczyński, Jesper Nilsson
  Cc: Lorenzo Pieralisi, Bjorn Helgaas, Rob Herring, linux-pci

On Thu, 1 Jul 2021 20:44:00 +0000, Krzysztof Wilczyński wrote:
> As part of code refactoring completed in the commit a0fd361db8e5 ("PCI:
> dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common
> code") the function artpec6_add_pcie_ep() has been removed and the call
> to the dw_pcie_ep_init() has been moved into artpec6_pcie_probe().
> 
> This change left a break statement behind that is not needed any more as
> as the function artpec6_pcie_probe() return immediately after making
> a call to dw_pcie_ep_init().
> 
> [...]

Applied to pci/dwc, thanks!

[1/2] PCI: artpec6: Remove surplus break statement after return
      https://git.kernel.org/lpieralisi/pci/c/7c665ce919
[2/2] PCI: artpec6: Remove local code block from within switch statement
      https://git.kernel.org/lpieralisi/pci/c/313b1c763c

Thanks,
Lorenzo

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

end of thread, other threads:[~2021-07-23 15:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 20:44 [PATCH v2 1/2] PCI: artpec6: Remove surplus break statement after return Krzysztof Wilczyński
2021-07-01 20:44 ` [PATCH v2 2/2] PCI: artpec6: Remove local code block from within switch statement Krzysztof Wilczyński
2021-07-01 21:00   ` Jesper Nilsson
2021-07-01 20:59 ` [PATCH v2 1/2] PCI: artpec6: Remove surplus break statement after return Jesper Nilsson
2021-07-23 15:14 ` Lorenzo Pieralisi

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.