All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] net: mdio-mux: Misc fix
@ 2017-09-01 11:55 Corentin Labbe
  2017-09-01 11:56 ` [PATCH v2 1/5] net: mdio-mux: Fix NULL Comparison style Corentin Labbe
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Corentin Labbe @ 2017-09-01 11:55 UTC (permalink / raw)
  To: andrew, f.fainelli; +Cc: netdev, linux-kernel, Corentin Labbe

Hello

This patch series fix minor problems found when working on the
dwmac-sun8i syscon mdio-mux.

Regards

Changes since v1:
- Removed obsolete comment about of_mdio_find_bus/put_device
- removed more DRV_VERSION

Corentin Labbe (5):
  net: mdio-mux: Fix NULL Comparison style
  net: mdio-mux: Remove unnecessary 'out of memory' message
  net: mdio-mux: printing driver version is useless
  net: mdio-mux-mmioreg: Can handle 8/16/32 bits registers
  net: mdio-mux: fix unbalanced put_device

 drivers/net/phy/Kconfig    |  2 +-
 drivers/net/phy/mdio-mux.c | 19 ++++---------------
 2 files changed, 5 insertions(+), 16 deletions(-)

-- 
2.13.5

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

* [PATCH v2 1/5] net: mdio-mux: Fix NULL Comparison style
  2017-09-01 11:55 [PATCH v2 0/5] net: mdio-mux: Misc fix Corentin Labbe
@ 2017-09-01 11:56 ` Corentin Labbe
  2017-09-01 11:56 ` [PATCH v2 2/5] net: mdio-mux: Remove unnecessary 'out of memory' message Corentin Labbe
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2017-09-01 11:56 UTC (permalink / raw)
  To: andrew, f.fainelli; +Cc: netdev, linux-kernel, Corentin Labbe

This patch fix checkpatch warning about NULL Comparison style.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/phy/mdio-mux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c
index 942ceaf3fd3f..b18ad7082b88 100644
--- a/drivers/net/phy/mdio-mux.c
+++ b/drivers/net/phy/mdio-mux.c
@@ -120,7 +120,7 @@ int mdio_mux_init(struct device *dev,
 	}
 
 	pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL);
-	if (pb == NULL) {
+	if (!pb) {
 		ret_val = -ENOMEM;
 		goto err_pb_kz;
 	}
@@ -144,7 +144,7 @@ int mdio_mux_init(struct device *dev,
 		}
 
 		cb = devm_kzalloc(dev, sizeof(*cb), GFP_KERNEL);
-		if (cb == NULL) {
+		if (!cb) {
 			dev_err(dev,
 				"Error: Failed to allocate memory for child %pOF\n",
 				child_bus_node);
-- 
2.13.5

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

* [PATCH v2 2/5] net: mdio-mux: Remove unnecessary 'out of memory' message
  2017-09-01 11:55 [PATCH v2 0/5] net: mdio-mux: Misc fix Corentin Labbe
  2017-09-01 11:56 ` [PATCH v2 1/5] net: mdio-mux: Fix NULL Comparison style Corentin Labbe
@ 2017-09-01 11:56 ` Corentin Labbe
  2017-09-01 11:56 ` [PATCH v2 3/5] net: mdio-mux: printing driver version is useless Corentin Labbe
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2017-09-01 11:56 UTC (permalink / raw)
  To: andrew, f.fainelli; +Cc: netdev, linux-kernel, Corentin Labbe

This patch fix checkpatch warning about unnecessary 'out of memory'
message.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/phy/mdio-mux.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c
index b18ad7082b88..5e08e89465c5 100644
--- a/drivers/net/phy/mdio-mux.c
+++ b/drivers/net/phy/mdio-mux.c
@@ -145,9 +145,6 @@ int mdio_mux_init(struct device *dev,
 
 		cb = devm_kzalloc(dev, sizeof(*cb), GFP_KERNEL);
 		if (!cb) {
-			dev_err(dev,
-				"Error: Failed to allocate memory for child %pOF\n",
-				child_bus_node);
 			ret_val = -ENOMEM;
 			continue;
 		}
@@ -156,9 +153,6 @@ int mdio_mux_init(struct device *dev,
 
 		cb->mii_bus = mdiobus_alloc();
 		if (!cb->mii_bus) {
-			dev_err(dev,
-				"Error: Failed to allocate MDIO bus for child %pOF\n",
-				child_bus_node);
 			ret_val = -ENOMEM;
 			devm_kfree(dev, cb);
 			continue;
-- 
2.13.5

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

* [PATCH v2 3/5] net: mdio-mux: printing driver version is useless
  2017-09-01 11:55 [PATCH v2 0/5] net: mdio-mux: Misc fix Corentin Labbe
  2017-09-01 11:56 ` [PATCH v2 1/5] net: mdio-mux: Fix NULL Comparison style Corentin Labbe
  2017-09-01 11:56 ` [PATCH v2 2/5] net: mdio-mux: Remove unnecessary 'out of memory' message Corentin Labbe
@ 2017-09-01 11:56 ` Corentin Labbe
  2017-09-01 13:38   ` Andrew Lunn
  2017-09-01 11:56 ` [PATCH v2 4/5] net: mdio-mux-mmioreg: Can handle 8/16/32 bits registers Corentin Labbe
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Corentin Labbe @ 2017-09-01 11:56 UTC (permalink / raw)
  To: andrew, f.fainelli; +Cc: netdev, linux-kernel, Corentin Labbe

Remove the driver version information because this information
is not useful in an upstream kernel driver.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/phy/mdio-mux.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c
index 5e08e89465c5..282828551bdd 100644
--- a/drivers/net/phy/mdio-mux.c
+++ b/drivers/net/phy/mdio-mux.c
@@ -13,7 +13,6 @@
 #include <linux/module.h>
 #include <linux/phy.h>
 
-#define DRV_VERSION "1.0"
 #define DRV_DESCRIPTION "MDIO bus multiplexer driver"
 
 struct mdio_mux_child_bus;
@@ -179,7 +178,6 @@ int mdio_mux_init(struct device *dev,
 	}
 	if (pb->children) {
 		*mux_handle = pb;
-		dev_info(dev, "Version " DRV_VERSION "\n");
 		return 0;
 	}
 
@@ -212,6 +210,5 @@ void mdio_mux_uninit(void *mux_handle)
 EXPORT_SYMBOL_GPL(mdio_mux_uninit);
 
 MODULE_DESCRIPTION(DRV_DESCRIPTION);
-MODULE_VERSION(DRV_VERSION);
 MODULE_AUTHOR("David Daney");
 MODULE_LICENSE("GPL");
-- 
2.13.5

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

* [PATCH v2 4/5] net: mdio-mux-mmioreg: Can handle 8/16/32 bits registers
  2017-09-01 11:55 [PATCH v2 0/5] net: mdio-mux: Misc fix Corentin Labbe
                   ` (2 preceding siblings ...)
  2017-09-01 11:56 ` [PATCH v2 3/5] net: mdio-mux: printing driver version is useless Corentin Labbe
@ 2017-09-01 11:56 ` Corentin Labbe
  2017-09-01 11:56 ` [PATCH v2 5/5] net: mdio-mux: fix unbalanced put_device Corentin Labbe
  2017-09-01 17:26 ` [PATCH v2 0/5] net: mdio-mux: Misc fix David Miller
  5 siblings, 0 replies; 9+ messages in thread
From: Corentin Labbe @ 2017-09-01 11:56 UTC (permalink / raw)
  To: andrew, f.fainelli; +Cc: netdev, linux-kernel, Corentin Labbe

This patch fix an old information that mdio-mux-mmioreg can only handle
8bit registers.
This is not true anymore.

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/net/phy/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 5afe6fdcc968..a9d16a3af514 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -85,7 +85,7 @@ config MDIO_BUS_MUX_MMIOREG
 	  parent bus.  Child bus selection is under the control of one of
 	  the FPGA's registers.
 
-	  Currently, only 8-bit registers are supported.
+	  Currently, only 8/16/32 bits registers are supported.
 
 config MDIO_CAVIUM
 	tristate
-- 
2.13.5

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

* [PATCH v2 5/5] net: mdio-mux: fix unbalanced put_device
  2017-09-01 11:55 [PATCH v2 0/5] net: mdio-mux: Misc fix Corentin Labbe
                   ` (3 preceding siblings ...)
  2017-09-01 11:56 ` [PATCH v2 4/5] net: mdio-mux-mmioreg: Can handle 8/16/32 bits registers Corentin Labbe
@ 2017-09-01 11:56 ` Corentin Labbe
  2017-09-01 13:38   ` Andrew Lunn
  2017-09-01 17:26 ` [PATCH v2 0/5] net: mdio-mux: Misc fix David Miller
  5 siblings, 1 reply; 9+ messages in thread
From: Corentin Labbe @ 2017-09-01 11:56 UTC (permalink / raw)
  To: andrew, f.fainelli; +Cc: netdev, linux-kernel, Corentin Labbe

mdio_mux_uninit() call put_device (unconditionally) because of
of_mdio_find_bus() in mdio_mux_init.
But of_mdio_find_bus is only called if mux_bus is empty.
If mux_bus is set, mdio_mux_uninit will print a "refcount_t: underflow"
trace.

This patch add a get_device in the other branch of "if (mux_bus)".

Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
 drivers/net/phy/mdio-mux.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c
index 282828551bdd..6f75e9f27fed 100644
--- a/drivers/net/phy/mdio-mux.c
+++ b/drivers/net/phy/mdio-mux.c
@@ -116,6 +116,7 @@ int mdio_mux_init(struct device *dev,
 	} else {
 		parent_bus_node = NULL;
 		parent_bus = mux_bus;
+		get_device(&parent_bus->dev);
 	}
 
 	pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL);
@@ -184,9 +185,7 @@ int mdio_mux_init(struct device *dev,
 	dev_err(dev, "Error: No acceptable child buses found\n");
 	devm_kfree(dev, pb);
 err_pb_kz:
-	/* balance the reference of_mdio_find_bus() took */
-	if (!mux_bus)
-		put_device(&parent_bus->dev);
+	put_device(&parent_bus->dev);
 err_parent_bus:
 	of_node_put(parent_bus_node);
 	return ret_val;
@@ -204,7 +203,6 @@ void mdio_mux_uninit(void *mux_handle)
 		cb = cb->next;
 	}
 
-	/* balance the reference of_mdio_find_bus() in mdio_mux_init() took */
 	put_device(&pb->mii_bus->dev);
 }
 EXPORT_SYMBOL_GPL(mdio_mux_uninit);
-- 
2.13.5

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

* Re: [PATCH v2 3/5] net: mdio-mux: printing driver version is useless
  2017-09-01 11:56 ` [PATCH v2 3/5] net: mdio-mux: printing driver version is useless Corentin Labbe
@ 2017-09-01 13:38   ` Andrew Lunn
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2017-09-01 13:38 UTC (permalink / raw)
  To: Corentin Labbe; +Cc: f.fainelli, netdev, linux-kernel

On Fri, Sep 01, 2017 at 01:56:02PM +0200, Corentin Labbe wrote:
> Remove the driver version information because this information
> is not useful in an upstream kernel driver.
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH v2 5/5] net: mdio-mux: fix unbalanced put_device
  2017-09-01 11:56 ` [PATCH v2 5/5] net: mdio-mux: fix unbalanced put_device Corentin Labbe
@ 2017-09-01 13:38   ` Andrew Lunn
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2017-09-01 13:38 UTC (permalink / raw)
  To: Corentin Labbe; +Cc: f.fainelli, netdev, linux-kernel

On Fri, Sep 01, 2017 at 01:56:04PM +0200, Corentin Labbe wrote:
> mdio_mux_uninit() call put_device (unconditionally) because of
> of_mdio_find_bus() in mdio_mux_init.
> But of_mdio_find_bus is only called if mux_bus is empty.
> If mux_bus is set, mdio_mux_uninit will print a "refcount_t: underflow"
> trace.
> 
> This patch add a get_device in the other branch of "if (mux_bus)".
> 
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH v2 0/5] net: mdio-mux: Misc fix
  2017-09-01 11:55 [PATCH v2 0/5] net: mdio-mux: Misc fix Corentin Labbe
                   ` (4 preceding siblings ...)
  2017-09-01 11:56 ` [PATCH v2 5/5] net: mdio-mux: fix unbalanced put_device Corentin Labbe
@ 2017-09-01 17:26 ` David Miller
  5 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2017-09-01 17:26 UTC (permalink / raw)
  To: clabbe.montjoie; +Cc: andrew, f.fainelli, netdev, linux-kernel

From: Corentin Labbe <clabbe.montjoie@gmail.com>
Date: Fri,  1 Sep 2017 13:55:59 +0200

> This patch series fix minor problems found when working on the
> dwmac-sun8i syscon mdio-mux.
 ...
> Changes since v1:
> - Removed obsolete comment about of_mdio_find_bus/put_device
> - removed more DRV_VERSION

Series applied to net-next.

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

end of thread, other threads:[~2017-09-01 17:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-01 11:55 [PATCH v2 0/5] net: mdio-mux: Misc fix Corentin Labbe
2017-09-01 11:56 ` [PATCH v2 1/5] net: mdio-mux: Fix NULL Comparison style Corentin Labbe
2017-09-01 11:56 ` [PATCH v2 2/5] net: mdio-mux: Remove unnecessary 'out of memory' message Corentin Labbe
2017-09-01 11:56 ` [PATCH v2 3/5] net: mdio-mux: printing driver version is useless Corentin Labbe
2017-09-01 13:38   ` Andrew Lunn
2017-09-01 11:56 ` [PATCH v2 4/5] net: mdio-mux-mmioreg: Can handle 8/16/32 bits registers Corentin Labbe
2017-09-01 11:56 ` [PATCH v2 5/5] net: mdio-mux: fix unbalanced put_device Corentin Labbe
2017-09-01 13:38   ` Andrew Lunn
2017-09-01 17:26 ` [PATCH v2 0/5] net: mdio-mux: Misc fix David Miller

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.