Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/4] PCI: qcom: Cleanups
@ 2016-10-12 13:59 Bjorn Helgaas
  2016-10-12 14:00 ` [PATCH v2 1/4] PCI: qcom: Remove unused platform data Bjorn Helgaas
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2016-10-12 13:59 UTC (permalink / raw)
  To: Stanimir Varbanov; +Cc: linux-arm-msm, linux-pci

  - Remove platform drvdata because it appears unused (we called
    platform_set_drvdata() but not platform_get_drvdata()).

  - Remove redundant struct members.

Nothing here should change the behavior of the driver.

Changes from v1:
  I dropped the following patch because it was a lot of churn for
  questionable benefit:
    PCI: qcom: Name private struct pointer "qcom" consistently

---

Bjorn Helgaas (4):
      PCI: qcom: Remove unused platform data
      PCI: qcom: Remove redundant struct qcom_pcie.dbi
      PCI: qcom: Remove redundant struct qcom_pcie.dev
      PCI: qcom: Reorder struct qcom_pcie


 drivers/pci/host/pcie-qcom.c |   30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

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

* [PATCH v2 1/4] PCI: qcom: Remove unused platform data
  2016-10-12 13:59 [PATCH v2 0/4] PCI: qcom: Cleanups Bjorn Helgaas
@ 2016-10-12 14:00 ` Bjorn Helgaas
  2016-10-12 14:00 ` [PATCH v2 2/4] PCI: qcom: Remove redundant struct qcom_pcie.dbi Bjorn Helgaas
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2016-10-12 14:00 UTC (permalink / raw)
  To: Stanimir Varbanov; +Cc: linux-arm-msm, linux-pci

The qcom driver never uses the platform drvdata pointer, so don't bother
setting it.  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pcie-qcom.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/pci/host/pcie-qcom.c b/drivers/pci/host/pcie-qcom.c
index 5ec2d44..51bb0a9 100644
--- a/drivers/pci/host/pcie-qcom.c
+++ b/drivers/pci/host/pcie-qcom.c
@@ -569,8 +569,6 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	platform_set_drvdata(pdev, pcie);
-
 	return 0;
 }
 


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

* [PATCH v2 2/4] PCI: qcom: Remove redundant struct qcom_pcie.dbi
  2016-10-12 13:59 [PATCH v2 0/4] PCI: qcom: Cleanups Bjorn Helgaas
  2016-10-12 14:00 ` [PATCH v2 1/4] PCI: qcom: Remove unused platform data Bjorn Helgaas
@ 2016-10-12 14:00 ` Bjorn Helgaas
  2016-10-12 14:00 ` [PATCH v2 3/4] PCI: qcom: Remove redundant struct qcom_pcie.dev Bjorn Helgaas
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2016-10-12 14:00 UTC (permalink / raw)
  To: Stanimir Varbanov; +Cc: linux-arm-msm, linux-pci

Remove the struct qcom_pcie.dbi member, which is a duplicate of the generic
pp.dbi_base member.  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pcie-qcom.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/host/pcie-qcom.c b/drivers/pci/host/pcie-qcom.c
index 51bb0a9..b8586e4 100644
--- a/drivers/pci/host/pcie-qcom.c
+++ b/drivers/pci/host/pcie-qcom.c
@@ -90,7 +90,6 @@ struct qcom_pcie {
 	struct device *dev;
 	union qcom_pcie_resources res;
 	void __iomem *parf;
-	void __iomem *dbi;
 	void __iomem *elbi;
 	struct phy *phy;
 	struct gpio_desc *reset;
@@ -426,7 +425,7 @@ err_res:
 static int qcom_pcie_link_up(struct pcie_port *pp)
 {
 	struct qcom_pcie *pcie = to_qcom_pcie(pp);
-	u16 val = readw(pcie->dbi + PCIE20_CAP + PCI_EXP_LNKSTA);
+	u16 val = readw(pcie->pp.dbi_base + PCIE20_CAP + PCI_EXP_LNKSTA);
 
 	return !!(val & PCI_EXP_LNKSTA_DLLLA);
 }
@@ -509,6 +508,7 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 	if (!pcie)
 		return -ENOMEM;
 
+	pp = &pcie->pp;
 	pcie->ops = (struct qcom_pcie_ops *)of_device_get_match_data(dev);
 	pcie->dev = dev;
 
@@ -522,9 +522,9 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 		return PTR_ERR(pcie->parf);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
-	pcie->dbi = devm_ioremap_resource(dev, res);
-	if (IS_ERR(pcie->dbi))
-		return PTR_ERR(pcie->dbi);
+	pp->dbi_base = devm_ioremap_resource(dev, res);
+	if (IS_ERR(pp->dbi_base))
+		return PTR_ERR(pp->dbi_base);
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi");
 	pcie->elbi = devm_ioremap_resource(dev, res);
@@ -539,9 +539,7 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	pp = &pcie->pp;
 	pp->dev = dev;
-	pp->dbi_base = pcie->dbi;
 	pp->root_bus_nr = -1;
 	pp->ops = &qcom_pcie_dw_ops;
 


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

* [PATCH v2 3/4] PCI: qcom: Remove redundant struct qcom_pcie.dev
  2016-10-12 13:59 [PATCH v2 0/4] PCI: qcom: Cleanups Bjorn Helgaas
  2016-10-12 14:00 ` [PATCH v2 1/4] PCI: qcom: Remove unused platform data Bjorn Helgaas
  2016-10-12 14:00 ` [PATCH v2 2/4] PCI: qcom: Remove redundant struct qcom_pcie.dbi Bjorn Helgaas
@ 2016-10-12 14:00 ` Bjorn Helgaas
  2016-10-12 14:00 ` [PATCH v2 4/4] PCI: qcom: Reorder struct qcom_pcie Bjorn Helgaas
  2016-10-12 16:06 ` [PATCH v2 0/4] PCI: qcom: Cleanups Bjorn Helgaas
  4 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2016-10-12 14:00 UTC (permalink / raw)
  To: Stanimir Varbanov; +Cc: linux-arm-msm, linux-pci

Remove the struct qcom_pcie.dev member, which is a duplicate of the generic
pp.dev member.  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pcie-qcom.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/host/pcie-qcom.c b/drivers/pci/host/pcie-qcom.c
index b8586e4..6f6cbb1 100644
--- a/drivers/pci/host/pcie-qcom.c
+++ b/drivers/pci/host/pcie-qcom.c
@@ -87,7 +87,6 @@ struct qcom_pcie_ops {
 
 struct qcom_pcie {
 	struct pcie_port pp;
-	struct device *dev;
 	union qcom_pcie_resources res;
 	void __iomem *parf;
 	void __iomem *elbi;
@@ -135,7 +134,7 @@ static int qcom_pcie_establish_link(struct qcom_pcie *pcie)
 static int qcom_pcie_get_resources_v0(struct qcom_pcie *pcie)
 {
 	struct qcom_pcie_resources_v0 *res = &pcie->res.v0;
-	struct device *dev = pcie->dev;
+	struct device *dev = pcie->pp.dev;
 
 	res->vdda = devm_regulator_get(dev, "vdda");
 	if (IS_ERR(res->vdda))
@@ -187,7 +186,7 @@ static int qcom_pcie_get_resources_v0(struct qcom_pcie *pcie)
 static int qcom_pcie_get_resources_v1(struct qcom_pcie *pcie)
 {
 	struct qcom_pcie_resources_v1 *res = &pcie->res.v1;
-	struct device *dev = pcie->dev;
+	struct device *dev = pcie->pp.dev;
 
 	res->vdda = devm_regulator_get(dev, "vdda");
 	if (IS_ERR(res->vdda))
@@ -236,7 +235,7 @@ static void qcom_pcie_deinit_v0(struct qcom_pcie *pcie)
 static int qcom_pcie_init_v0(struct qcom_pcie *pcie)
 {
 	struct qcom_pcie_resources_v0 *res = &pcie->res.v0;
-	struct device *dev = pcie->dev;
+	struct device *dev = pcie->pp.dev;
 	u32 val;
 	int ret;
 
@@ -358,7 +357,7 @@ static void qcom_pcie_deinit_v1(struct qcom_pcie *pcie)
 static int qcom_pcie_init_v1(struct qcom_pcie *pcie)
 {
 	struct qcom_pcie_resources_v1 *res = &pcie->res.v1;
-	struct device *dev = pcie->dev;
+	struct device *dev = pcie->pp.dev;
 	int ret;
 
 	ret = reset_control_deassert(res->core);
@@ -510,7 +509,6 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 
 	pp = &pcie->pp;
 	pcie->ops = (struct qcom_pcie_ops *)of_device_get_match_data(dev);
-	pcie->dev = dev;
 
 	pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_LOW);
 	if (IS_ERR(pcie->reset))


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

* [PATCH v2 4/4] PCI: qcom: Reorder struct qcom_pcie
  2016-10-12 13:59 [PATCH v2 0/4] PCI: qcom: Cleanups Bjorn Helgaas
                   ` (2 preceding siblings ...)
  2016-10-12 14:00 ` [PATCH v2 3/4] PCI: qcom: Remove redundant struct qcom_pcie.dev Bjorn Helgaas
@ 2016-10-12 14:00 ` Bjorn Helgaas
  2016-10-12 16:06 ` [PATCH v2 0/4] PCI: qcom: Cleanups Bjorn Helgaas
  4 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2016-10-12 14:00 UTC (permalink / raw)
  To: Stanimir Varbanov; +Cc: linux-arm-msm, linux-pci

Reorder struct qcom_pcie to put generic fields first.  No functional change
intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/host/pcie-qcom.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-qcom.c b/drivers/pci/host/pcie-qcom.c
index 6f6cbb1..ef0a84c 100644
--- a/drivers/pci/host/pcie-qcom.c
+++ b/drivers/pci/host/pcie-qcom.c
@@ -86,10 +86,10 @@ struct qcom_pcie_ops {
 };
 
 struct qcom_pcie {
-	struct pcie_port pp;
+	struct pcie_port pp;			/* pp.dbi_base is DT dbi */
+	void __iomem *parf;			/* DT parf */
+	void __iomem *elbi;			/* DT elbi */
 	union qcom_pcie_resources res;
-	void __iomem *parf;
-	void __iomem *elbi;
 	struct phy *phy;
 	struct gpio_desc *reset;
 	struct qcom_pcie_ops *ops;


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

* Re: [PATCH v2 0/4] PCI: qcom: Cleanups
  2016-10-12 13:59 [PATCH v2 0/4] PCI: qcom: Cleanups Bjorn Helgaas
                   ` (3 preceding siblings ...)
  2016-10-12 14:00 ` [PATCH v2 4/4] PCI: qcom: Reorder struct qcom_pcie Bjorn Helgaas
@ 2016-10-12 16:06 ` Bjorn Helgaas
  2016-10-13  8:31   ` Stanimir Varbanov
  4 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2016-10-12 16:06 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Stanimir Varbanov, linux-arm-msm, linux-pci

On Wed, Oct 12, 2016 at 08:59:54AM -0500, Bjorn Helgaas wrote:
>   - Remove platform drvdata because it appears unused (we called
>     platform_set_drvdata() but not platform_get_drvdata()).
> 
>   - Remove redundant struct members.
> 
> Nothing here should change the behavior of the driver.
> 
> Changes from v1:
>   I dropped the following patch because it was a lot of churn for
>   questionable benefit:
>     PCI: qcom: Name private struct pointer "qcom" consistently
> 
> ---
> 
> Bjorn Helgaas (4):
>       PCI: qcom: Remove unused platform data
>       PCI: qcom: Remove redundant struct qcom_pcie.dbi
>       PCI: qcom: Remove redundant struct qcom_pcie.dev
>       PCI: qcom: Reorder struct qcom_pcie
> 
> 
>  drivers/pci/host/pcie-qcom.c |   30 ++++++++++++------------------
>  1 file changed, 12 insertions(+), 18 deletions(-)

I applied these to pci/host-qcom for v4.9.  I hope to ask Linus to
pull them tomorrow, so if you see any issues, let me know soon.

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

* Re: [PATCH v2 0/4] PCI: qcom: Cleanups
  2016-10-12 16:06 ` [PATCH v2 0/4] PCI: qcom: Cleanups Bjorn Helgaas
@ 2016-10-13  8:31   ` Stanimir Varbanov
  0 siblings, 0 replies; 7+ messages in thread
From: Stanimir Varbanov @ 2016-10-13  8:31 UTC (permalink / raw)
  To: Bjorn Helgaas, Bjorn Helgaas; +Cc: linux-arm-msm, linux-pci

Hi Bjorn,

On 10/12/2016 07:06 PM, Bjorn Helgaas wrote:
> On Wed, Oct 12, 2016 at 08:59:54AM -0500, Bjorn Helgaas wrote:
>>   - Remove platform drvdata because it appears unused (we called
>>     platform_set_drvdata() but not platform_get_drvdata()).
>>
>>   - Remove redundant struct members.
>>
>> Nothing here should change the behavior of the driver.
>>
>> Changes from v1:
>>   I dropped the following patch because it was a lot of churn for
>>   questionable benefit:
>>     PCI: qcom: Name private struct pointer "qcom" consistently
>>
>> ---
>>
>> Bjorn Helgaas (4):
>>       PCI: qcom: Remove unused platform data
>>       PCI: qcom: Remove redundant struct qcom_pcie.dbi
>>       PCI: qcom: Remove redundant struct qcom_pcie.dev
>>       PCI: qcom: Reorder struct qcom_pcie
>>
>>
>>  drivers/pci/host/pcie-qcom.c |   30 ++++++++++++------------------
>>  1 file changed, 12 insertions(+), 18 deletions(-)
> 
> I applied these to pci/host-qcom for v4.9.  I hope to ask Linus to
> pull them tomorrow, so if you see any issues, let me know soon.

Thanks for the clean up!

Reviewed-by: Stanimir Varbanov <svarbanov@mm-sol.com>

regards,
Stan

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

end of thread, other threads:[~2016-10-13  8:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 13:59 [PATCH v2 0/4] PCI: qcom: Cleanups Bjorn Helgaas
2016-10-12 14:00 ` [PATCH v2 1/4] PCI: qcom: Remove unused platform data Bjorn Helgaas
2016-10-12 14:00 ` [PATCH v2 2/4] PCI: qcom: Remove redundant struct qcom_pcie.dbi Bjorn Helgaas
2016-10-12 14:00 ` [PATCH v2 3/4] PCI: qcom: Remove redundant struct qcom_pcie.dev Bjorn Helgaas
2016-10-12 14:00 ` [PATCH v2 4/4] PCI: qcom: Reorder struct qcom_pcie Bjorn Helgaas
2016-10-12 16:06 ` [PATCH v2 0/4] PCI: qcom: Cleanups Bjorn Helgaas
2016-10-13  8:31   ` Stanimir Varbanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox