Re: [PATCH (net.git) 2/2] stmmac: fix error check when init ptp

2016-10-13 Thread David Miller
From: Giuseppe Cavallaro 
Date: Wed, 12 Oct 2016 15:42:04 +0200

> This patch fixes a problem when propagated the
> failure of ptp_clock_register to open function.
> 
> Signed-off-by: Giuseppe Cavallaro 

Applied.


Re: [PATCH (net.git) 2/2] stmmac: fix error check when init ptp

2016-10-13 Thread David Miller
From: Giuseppe Cavallaro 
Date: Wed, 12 Oct 2016 15:42:04 +0200

> This patch fixes a problem when propagated the
> failure of ptp_clock_register to open function.
> 
> Signed-off-by: Giuseppe Cavallaro 

Applied.


[PATCH (net.git) 2/2] stmmac: fix error check when init ptp

2016-10-12 Thread Giuseppe Cavallaro
This patch fixes a problem when propagated the
failure of ptp_clock_register to open function.

Signed-off-by: Giuseppe Cavallaro 
Cc: Alexandre TORGUE 
Cc: Rayagond Kokatanur 
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |  4 ++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c  | 10 ++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e838850..6c85b61 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1709,8 +1709,8 @@ static int stmmac_hw_setup(struct net_device *dev, bool 
init_ptp)
 
if (init_ptp) {
ret = stmmac_init_ptp(priv);
-   if (ret && ret != -EOPNOTSUPP)
-   pr_warn("%s: failed PTP initialisation\n", __func__);
+   if (ret)
+   netdev_warn(priv->dev, "PTP support cannot init.\n");
}
 
 #ifdef CONFIG_DEBUG_FS
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 6e3b829..289d527 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -186,10 +186,12 @@ int stmmac_ptp_register(struct stmmac_priv *priv)
 priv->device);
if (IS_ERR(priv->ptp_clock)) {
priv->ptp_clock = NULL;
-   pr_err("ptp_clock_register() failed on %s\n", priv->dev->name);
-   } else if (priv->ptp_clock)
-   pr_debug("Added PTP HW clock successfully on %s\n",
-priv->dev->name);
+   return PTR_ERR(priv->ptp_clock);
+   }
+
+   spin_lock_init(>ptp_lock);
+
+   netdev_dbg(priv->dev, "Added PTP HW clock successfully\n");
 
return 0;
 }
-- 
2.7.4



[PATCH (net.git) 2/2] stmmac: fix error check when init ptp

2016-10-12 Thread Giuseppe Cavallaro
This patch fixes a problem when propagated the
failure of ptp_clock_register to open function.

Signed-off-by: Giuseppe Cavallaro 
Cc: Alexandre TORGUE 
Cc: Rayagond Kokatanur 
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |  4 ++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c  | 10 ++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e838850..6c85b61 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1709,8 +1709,8 @@ static int stmmac_hw_setup(struct net_device *dev, bool 
init_ptp)
 
if (init_ptp) {
ret = stmmac_init_ptp(priv);
-   if (ret && ret != -EOPNOTSUPP)
-   pr_warn("%s: failed PTP initialisation\n", __func__);
+   if (ret)
+   netdev_warn(priv->dev, "PTP support cannot init.\n");
}
 
 #ifdef CONFIG_DEBUG_FS
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 6e3b829..289d527 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -186,10 +186,12 @@ int stmmac_ptp_register(struct stmmac_priv *priv)
 priv->device);
if (IS_ERR(priv->ptp_clock)) {
priv->ptp_clock = NULL;
-   pr_err("ptp_clock_register() failed on %s\n", priv->dev->name);
-   } else if (priv->ptp_clock)
-   pr_debug("Added PTP HW clock successfully on %s\n",
-priv->dev->name);
+   return PTR_ERR(priv->ptp_clock);
+   }
+
+   spin_lock_init(>ptp_lock);
+
+   netdev_dbg(priv->dev, "Added PTP HW clock successfully\n");
 
return 0;
 }
-- 
2.7.4