* [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy
@ 2016-08-30 13:53 Axel Lin
2016-08-30 13:54 ` [RESEND AGAIN][PATCH 2/2] phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops Axel Lin
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Axel Lin @ 2016-08-30 13:53 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: Pramod Kumar, Andrew Lunn, Jon Mason, linux-kernel, Axel Lin
By setting phy_set_drvdata(phy, mdiodev), struct ns2_pci_phy can be
removed.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-and-tested-by: Jon Mason <jon.mason@broadcom.com>
---
This was sent on http://www.spinics.net/lists/netdev/msg383513.html
Resent on https://lkml.org/lkml/2016/8/12/658
drivers/phy/phy-bcm-ns2-pcie.c | 25 +++++--------------------
1 file changed, 5 insertions(+), 20 deletions(-)
diff --git a/drivers/phy/phy-bcm-ns2-pcie.c b/drivers/phy/phy-bcm-ns2-pcie.c
index 9513f7a..ee61772 100644
--- a/drivers/phy/phy-bcm-ns2-pcie.c
+++ b/drivers/phy/phy-bcm-ns2-pcie.c
@@ -18,11 +18,6 @@
#include <linux/phy.h>
#include <linux/phy/phy.h>
-struct ns2_pci_phy {
- struct mdio_device *mdiodev;
- struct phy *phy;
-};
-
#define BLK_ADDR_REG_OFFSET 0x1f
#define PLL_AFE1_100MHZ_BLK 0x2100
#define PLL_CLK_AMP_OFFSET 0x03
@@ -30,17 +25,17 @@ struct ns2_pci_phy {
static int ns2_pci_phy_init(struct phy *p)
{
- struct ns2_pci_phy *phy = phy_get_drvdata(p);
+ struct mdio_device *mdiodev = phy_get_drvdata(p);
int rc;
/* select the AFE 100MHz block page */
- rc = mdiobus_write(phy->mdiodev->bus, phy->mdiodev->addr,
+ rc = mdiobus_write(mdiodev->bus, mdiodev->addr,
BLK_ADDR_REG_OFFSET, PLL_AFE1_100MHZ_BLK);
if (rc)
goto err;
/* set the 100 MHz reference clock amplitude to 2.05 v */
- rc = mdiobus_write(phy->mdiodev->bus, phy->mdiodev->addr,
+ rc = mdiobus_write(mdiodev->bus, mdiodev->addr,
PLL_CLK_AMP_OFFSET, PLL_CLK_AMP_2P05V);
if (rc)
goto err;
@@ -48,7 +43,7 @@ static int ns2_pci_phy_init(struct phy *p)
return 0;
err:
- dev_err(&phy->mdiodev->dev, "Error %d writing to phy\n", rc);
+ dev_err(&mdiodev->dev, "Error %d writing to phy\n", rc);
return rc;
}
@@ -60,7 +55,6 @@ static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
{
struct device *dev = &mdiodev->dev;
struct phy_provider *provider;
- struct ns2_pci_phy *p;
struct phy *phy;
phy = devm_phy_create(dev, dev->of_node, &ns2_pci_phy_ops);
@@ -69,16 +63,7 @@ static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
return PTR_ERR(phy);
}
- p = devm_kmalloc(dev, sizeof(struct ns2_pci_phy),
- GFP_KERNEL);
- if (!p)
- return -ENOMEM;
-
- p->mdiodev = mdiodev;
- dev_set_drvdata(dev, p);
-
- p->phy = phy;
- phy_set_drvdata(phy, p);
+ phy_set_drvdata(phy, mdiodev);
provider = devm_of_phy_provider_register(&phy->dev,
of_phy_simple_xlate);
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RESEND AGAIN][PATCH 2/2] phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops
2016-08-30 13:53 [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy Axel Lin
@ 2016-08-30 13:54 ` Axel Lin
2016-08-30 14:25 ` Pramod Kumar
2016-09-02 12:16 ` Kishon Vijay Abraham I
2016-08-30 14:05 ` [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy Kishon Vijay Abraham I
2016-08-30 14:25 ` Pramod Kumar
2 siblings, 2 replies; 7+ messages in thread
From: Axel Lin @ 2016-08-30 13:54 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: Pramod Kumar, Andrew Lunn, Jon Mason, linux-kernel, Axel Lin
Add missing .owner field in ns2_pci_phy_ops, which is used for refcounting.
While at it, also makes ns2_pci_phy_ops const as it's never get modified.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-and-tested-by: Jon Mason <jon.mason@broadcom.com>
---
This was sent on http://www.spinics.net/lists/netdev/msg383514.html
Resent on https://lkml.org/lkml/2016/8/12/659
drivers/phy/phy-bcm-ns2-pcie.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/phy-bcm-ns2-pcie.c b/drivers/phy/phy-bcm-ns2-pcie.c
index ee61772..4c7d11d 100644
--- a/drivers/phy/phy-bcm-ns2-pcie.c
+++ b/drivers/phy/phy-bcm-ns2-pcie.c
@@ -47,8 +47,9 @@ err:
return rc;
}
-static struct phy_ops ns2_pci_phy_ops = {
+static const struct phy_ops ns2_pci_phy_ops = {
.init = ns2_pci_phy_init,
+ .owner = THIS_MODULE,
};
static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy
2016-08-30 13:53 [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy Axel Lin
2016-08-30 13:54 ` [RESEND AGAIN][PATCH 2/2] phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops Axel Lin
@ 2016-08-30 14:05 ` Kishon Vijay Abraham I
2016-08-30 14:11 ` Axel Lin
2016-08-30 14:25 ` Pramod Kumar
2 siblings, 1 reply; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2016-08-30 14:05 UTC (permalink / raw)
To: Axel Lin; +Cc: Pramod Kumar, Andrew Lunn, Jon Mason, linux-kernel
On Tuesday 30 August 2016 07:23 PM, Axel Lin wrote:
> By setting phy_set_drvdata(phy, mdiodev), struct ns2_pci_phy can be
> removed.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> Reviewed-and-tested-by: Jon Mason <jon.mason@broadcom.com>
> ---
> This was sent on http://www.spinics.net/lists/netdev/msg383513.html
> Resent on https://lkml.org/lkml/2016/8/12/658
Will merge this once I start queuing for 4.9. Will start doing it this week.
-Kishon
> drivers/phy/phy-bcm-ns2-pcie.c | 25 +++++--------------------
> 1 file changed, 5 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/phy/phy-bcm-ns2-pcie.c b/drivers/phy/phy-bcm-ns2-pcie.c
> index 9513f7a..ee61772 100644
> --- a/drivers/phy/phy-bcm-ns2-pcie.c
> +++ b/drivers/phy/phy-bcm-ns2-pcie.c
> @@ -18,11 +18,6 @@
> #include <linux/phy.h>
> #include <linux/phy/phy.h>
>
> -struct ns2_pci_phy {
> - struct mdio_device *mdiodev;
> - struct phy *phy;
> -};
> -
> #define BLK_ADDR_REG_OFFSET 0x1f
> #define PLL_AFE1_100MHZ_BLK 0x2100
> #define PLL_CLK_AMP_OFFSET 0x03
> @@ -30,17 +25,17 @@ struct ns2_pci_phy {
>
> static int ns2_pci_phy_init(struct phy *p)
> {
> - struct ns2_pci_phy *phy = phy_get_drvdata(p);
> + struct mdio_device *mdiodev = phy_get_drvdata(p);
> int rc;
>
> /* select the AFE 100MHz block page */
> - rc = mdiobus_write(phy->mdiodev->bus, phy->mdiodev->addr,
> + rc = mdiobus_write(mdiodev->bus, mdiodev->addr,
> BLK_ADDR_REG_OFFSET, PLL_AFE1_100MHZ_BLK);
> if (rc)
> goto err;
>
> /* set the 100 MHz reference clock amplitude to 2.05 v */
> - rc = mdiobus_write(phy->mdiodev->bus, phy->mdiodev->addr,
> + rc = mdiobus_write(mdiodev->bus, mdiodev->addr,
> PLL_CLK_AMP_OFFSET, PLL_CLK_AMP_2P05V);
> if (rc)
> goto err;
> @@ -48,7 +43,7 @@ static int ns2_pci_phy_init(struct phy *p)
> return 0;
>
> err:
> - dev_err(&phy->mdiodev->dev, "Error %d writing to phy\n", rc);
> + dev_err(&mdiodev->dev, "Error %d writing to phy\n", rc);
> return rc;
> }
>
> @@ -60,7 +55,6 @@ static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
> {
> struct device *dev = &mdiodev->dev;
> struct phy_provider *provider;
> - struct ns2_pci_phy *p;
> struct phy *phy;
>
> phy = devm_phy_create(dev, dev->of_node, &ns2_pci_phy_ops);
> @@ -69,16 +63,7 @@ static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
> return PTR_ERR(phy);
> }
>
> - p = devm_kmalloc(dev, sizeof(struct ns2_pci_phy),
> - GFP_KERNEL);
> - if (!p)
> - return -ENOMEM;
> -
> - p->mdiodev = mdiodev;
> - dev_set_drvdata(dev, p);
> -
> - p->phy = phy;
> - phy_set_drvdata(phy, p);
> + phy_set_drvdata(phy, mdiodev);
>
> provider = devm_of_phy_provider_register(&phy->dev,
> of_phy_simple_xlate);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy
2016-08-30 14:05 ` [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy Kishon Vijay Abraham I
@ 2016-08-30 14:11 ` Axel Lin
0 siblings, 0 replies; 7+ messages in thread
From: Axel Lin @ 2016-08-30 14:11 UTC (permalink / raw)
To: Kishon Vijay Abraham I; +Cc: Pramod Kumar, Andrew Lunn, Jon Mason, linux-kernel
2016-08-30 22:05 GMT+08:00 Kishon Vijay Abraham I <kishon@ti.com>:
>
>
> On Tuesday 30 August 2016 07:23 PM, Axel Lin wrote:
>> By setting phy_set_drvdata(phy, mdiodev), struct ns2_pci_phy can be
>> removed.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>> Reviewed-and-tested-by: Jon Mason <jon.mason@broadcom.com>
>> ---
>> This was sent on http://www.spinics.net/lists/netdev/msg383513.html
>> Resent on https://lkml.org/lkml/2016/8/12/658
>
> Will merge this once I start queuing for 4.9. Will start doing it this week.
I think the second patch is a fix for v4.8.
I had a hard time to understand how you collect patches.
For the past record, I had to resend patches even after a couple weeks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy
2016-08-30 13:53 [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy Axel Lin
2016-08-30 13:54 ` [RESEND AGAIN][PATCH 2/2] phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops Axel Lin
2016-08-30 14:05 ` [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy Kishon Vijay Abraham I
@ 2016-08-30 14:25 ` Pramod Kumar
2 siblings, 0 replies; 7+ messages in thread
From: Pramod Kumar @ 2016-08-30 14:25 UTC (permalink / raw)
To: Axel Lin, Kishon Vijay Abraham I; +Cc: Andrew Lunn, Jon Mason, linux-kernel
> -----Original Message-----
> From: Axel Lin [mailto:axel.lin@ingics.com]
> Sent: 30 August 2016 19:24
> To: Kishon Vijay Abraham I
> Cc: Pramod Kumar; Andrew Lunn; Jon Mason; linux-kernel@vger.kernel.org;
> Axel Lin
> Subject: [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct
> ns2_pci_phy
>
> By setting phy_set_drvdata(phy, mdiodev), struct ns2_pci_phy can be
removed.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> Reviewed-and-tested-by: Jon Mason <jon.mason@broadcom.com>
> ---
> This was sent on http://www.spinics.net/lists/netdev/msg383513.html
> Resent on https://lkml.org/lkml/2016/8/12/658
> drivers/phy/phy-bcm-ns2-pcie.c | 25 +++++--------------------
> 1 file changed, 5 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/phy/phy-bcm-ns2-pcie.c
b/drivers/phy/phy-bcm-ns2-pcie.c
> index 9513f7a..ee61772 100644
> --- a/drivers/phy/phy-bcm-ns2-pcie.c
> +++ b/drivers/phy/phy-bcm-ns2-pcie.c
> @@ -18,11 +18,6 @@
> #include <linux/phy.h>
> #include <linux/phy/phy.h>
>
> -struct ns2_pci_phy {
> - struct mdio_device *mdiodev;
> - struct phy *phy;
> -};
> -
> #define BLK_ADDR_REG_OFFSET 0x1f
> #define PLL_AFE1_100MHZ_BLK 0x2100
> #define PLL_CLK_AMP_OFFSET 0x03
> @@ -30,17 +25,17 @@ struct ns2_pci_phy {
>
> static int ns2_pci_phy_init(struct phy *p) {
> - struct ns2_pci_phy *phy = phy_get_drvdata(p);
> + struct mdio_device *mdiodev = phy_get_drvdata(p);
> int rc;
>
> /* select the AFE 100MHz block page */
> - rc = mdiobus_write(phy->mdiodev->bus, phy->mdiodev->addr,
> + rc = mdiobus_write(mdiodev->bus, mdiodev->addr,
> BLK_ADDR_REG_OFFSET, PLL_AFE1_100MHZ_BLK);
> if (rc)
> goto err;
>
> /* set the 100 MHz reference clock amplitude to 2.05 v */
> - rc = mdiobus_write(phy->mdiodev->bus, phy->mdiodev->addr,
> + rc = mdiobus_write(mdiodev->bus, mdiodev->addr,
> PLL_CLK_AMP_OFFSET, PLL_CLK_AMP_2P05V);
> if (rc)
> goto err;
> @@ -48,7 +43,7 @@ static int ns2_pci_phy_init(struct phy *p)
> return 0;
>
> err:
> - dev_err(&phy->mdiodev->dev, "Error %d writing to phy\n", rc);
> + dev_err(&mdiodev->dev, "Error %d writing to phy\n", rc);
> return rc;
> }
>
> @@ -60,7 +55,6 @@ static int ns2_pci_phy_probe(struct mdio_device
> *mdiodev) {
> struct device *dev = &mdiodev->dev;
> struct phy_provider *provider;
> - struct ns2_pci_phy *p;
> struct phy *phy;
>
> phy = devm_phy_create(dev, dev->of_node, &ns2_pci_phy_ops); @@ -
> 69,16 +63,7 @@ static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
> return PTR_ERR(phy);
> }
>
> - p = devm_kmalloc(dev, sizeof(struct ns2_pci_phy),
> - GFP_KERNEL);
> - if (!p)
> - return -ENOMEM;
> -
> - p->mdiodev = mdiodev;
> - dev_set_drvdata(dev, p);
> -
> - p->phy = phy;
> - phy_set_drvdata(phy, p);
> + phy_set_drvdata(phy, mdiodev);
>
> provider = devm_of_phy_provider_register(&phy->dev,
> of_phy_simple_xlate);
> --
Looks fine to me.
Reviewed-by: Pramod Kumar <pramodku@broadcom.com>
> 2.5.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [RESEND AGAIN][PATCH 2/2] phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops
2016-08-30 13:54 ` [RESEND AGAIN][PATCH 2/2] phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops Axel Lin
@ 2016-08-30 14:25 ` Pramod Kumar
2016-09-02 12:16 ` Kishon Vijay Abraham I
1 sibling, 0 replies; 7+ messages in thread
From: Pramod Kumar @ 2016-08-30 14:25 UTC (permalink / raw)
To: Axel Lin, Kishon Vijay Abraham I; +Cc: Andrew Lunn, Jon Mason, linux-kernel
> -----Original Message-----
> From: Axel Lin [mailto:axel.lin@ingics.com]
> Sent: 30 August 2016 19:24
> To: Kishon Vijay Abraham I
> Cc: Pramod Kumar; Andrew Lunn; Jon Mason; linux-kernel@vger.kernel.org;
> Axel Lin
> Subject: [RESEND AGAIN][PATCH 2/2] phy: bcm-ns2-pcie: Set missing .owner
> field in ns2_pci_phy_ops
>
> Add missing .owner field in ns2_pci_phy_ops, which is used for
refcounting.
> While at it, also makes ns2_pci_phy_ops const as it's never get
modified.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> Reviewed-and-tested-by: Jon Mason <jon.mason@broadcom.com>
> ---
> This was sent on http://www.spinics.net/lists/netdev/msg383514.html
> Resent on https://lkml.org/lkml/2016/8/12/659
> drivers/phy/phy-bcm-ns2-pcie.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/phy-bcm-ns2-pcie.c
b/drivers/phy/phy-bcm-ns2-pcie.c
> index ee61772..4c7d11d 100644
> --- a/drivers/phy/phy-bcm-ns2-pcie.c
> +++ b/drivers/phy/phy-bcm-ns2-pcie.c
> @@ -47,8 +47,9 @@ err:
> return rc;
> }
>
> -static struct phy_ops ns2_pci_phy_ops = {
> +static const struct phy_ops ns2_pci_phy_ops = {
> .init = ns2_pci_phy_init,
> + .owner = THIS_MODULE,
> };
>
> static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
> --
Looks fine to me.
Reviewed-by: Pramod Kumar <pramodku@broadcom.com>
> 2.5.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RESEND AGAIN][PATCH 2/2] phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops
2016-08-30 13:54 ` [RESEND AGAIN][PATCH 2/2] phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops Axel Lin
2016-08-30 14:25 ` Pramod Kumar
@ 2016-09-02 12:16 ` Kishon Vijay Abraham I
1 sibling, 0 replies; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2016-09-02 12:16 UTC (permalink / raw)
To: Axel Lin; +Cc: Pramod Kumar, Andrew Lunn, Jon Mason, linux-kernel
On Tuesday 30 August 2016 07:24 PM, Axel Lin wrote:
> Add missing .owner field in ns2_pci_phy_ops, which is used for refcounting.
> While at it, also makes ns2_pci_phy_ops const as it's never get modified.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> Reviewed-and-tested-by: Jon Mason <jon.mason@broadcom.com>
merged, thanks
-Kishon
> ---
> This was sent on http://www.spinics.net/lists/netdev/msg383514.html
> Resent on https://lkml.org/lkml/2016/8/12/659
> drivers/phy/phy-bcm-ns2-pcie.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/phy-bcm-ns2-pcie.c b/drivers/phy/phy-bcm-ns2-pcie.c
> index ee61772..4c7d11d 100644
> --- a/drivers/phy/phy-bcm-ns2-pcie.c
> +++ b/drivers/phy/phy-bcm-ns2-pcie.c
> @@ -47,8 +47,9 @@ err:
> return rc;
> }
>
> -static struct phy_ops ns2_pci_phy_ops = {
> +static const struct phy_ops ns2_pci_phy_ops = {
> .init = ns2_pci_phy_init,
> + .owner = THIS_MODULE,
> };
>
> static int ns2_pci_phy_probe(struct mdio_device *mdiodev)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-09-02 12:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-30 13:53 [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy Axel Lin
2016-08-30 13:54 ` [RESEND AGAIN][PATCH 2/2] phy: bcm-ns2-pcie: Set missing .owner field in ns2_pci_phy_ops Axel Lin
2016-08-30 14:25 ` Pramod Kumar
2016-09-02 12:16 ` Kishon Vijay Abraham I
2016-08-30 14:05 ` [RESEND AGAIN][PATCH 1/2] phy: bcm-ns2-pcie: Get rid of struct ns2_pci_phy Kishon Vijay Abraham I
2016-08-30 14:11 ` Axel Lin
2016-08-30 14:25 ` Pramod Kumar
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.