bcm53xx: group iProc patches into patchsets they were sent in
[openwrt/openwrt.git] / target / linux / bcm53xx / patches-4.1 / 032-PCI-iproc-Delete-unnecessary-checks-before-phy-calls.patch
1 From 93972d18bbaba6f34e21742400b6e7461edc4837 Mon Sep 17 00:00:00 2001
2 From: Markus Elfring <elfring@users.sourceforge.net>
3 Date: Sun, 28 Jun 2015 16:42:04 +0200
4 Subject: [PATCH] PCI: iproc: Delete unnecessary checks before phy calls
5
6 The functions phy_exit() and phy_power_off() test whether their argument is
7 NULL and then return immediately. Thus the test around the calls is not
8 needed.
9
10 This issue was detected by using the Coccinelle software.
11
12 [bhelgaas: also phy_init() and phy_power_on(), as Ray Jui suggested]
13 [bhelgaas: also remove tests in iproc_pcie_remove()]
14 Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
15 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
16 Reviewed-by: Ray Jui <rjui@broadcom.com>
17 ---
18 drivers/pci/host/pcie-iproc.c | 34 +++++++++++++---------------------
19 1 file changed, 13 insertions(+), 21 deletions(-)
20
21 --- a/drivers/pci/host/pcie-iproc.c
22 +++ b/drivers/pci/host/pcie-iproc.c
23 @@ -191,19 +191,16 @@ int iproc_pcie_setup(struct iproc_pcie *
24 if (!pcie || !pcie->dev || !pcie->base)
25 return -EINVAL;
26
27 - if (pcie->phy) {
28 - ret = phy_init(pcie->phy);
29 - if (ret) {
30 - dev_err(pcie->dev, "unable to initialize PCIe PHY\n");
31 - return ret;
32 - }
33 -
34 - ret = phy_power_on(pcie->phy);
35 - if (ret) {
36 - dev_err(pcie->dev, "unable to power on PCIe PHY\n");
37 - goto err_exit_phy;
38 - }
39 + ret = phy_init(pcie->phy);
40 + if (ret) {
41 + dev_err(pcie->dev, "unable to initialize PCIe PHY\n");
42 + return ret;
43 + }
44
45 + ret = phy_power_on(pcie->phy);
46 + if (ret) {
47 + dev_err(pcie->dev, "unable to power on PCIe PHY\n");
48 + goto err_exit_phy;
49 }
50
51 iproc_pcie_reset(pcie);
52 @@ -239,12 +236,9 @@ err_rm_root_bus:
53 pci_remove_root_bus(bus);
54
55 err_power_off_phy:
56 - if (pcie->phy)
57 - phy_power_off(pcie->phy);
58 + phy_power_off(pcie->phy);
59 err_exit_phy:
60 - if (pcie->phy)
61 - phy_exit(pcie->phy);
62 -
63 + phy_exit(pcie->phy);
64 return ret;
65 }
66 EXPORT_SYMBOL(iproc_pcie_setup);
67 @@ -254,10 +248,8 @@ int iproc_pcie_remove(struct iproc_pcie
68 pci_stop_root_bus(pcie->root_bus);
69 pci_remove_root_bus(pcie->root_bus);
70
71 - if (pcie->phy) {
72 - phy_power_off(pcie->phy);
73 - phy_exit(pcie->phy);
74 - }
75 + phy_power_off(pcie->phy);
76 + phy_exit(pcie->phy);
77
78 return 0;
79 }