diff mbox

[6/9] net: mvmdio: put the poll intervals in the private structure

Message ID 20170607083810.30922-7-antoine.tenart@free-electrons.com (mailing list archive)
State New, archived
Headers show

Commit Message

Antoine Tenart June 7, 2017, 8:38 a.m. UTC
Put the two poll intervals (min and max) in the driver's private
structure. This is needed to add the xmdio support later.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvmdio.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Florian Fainelli June 7, 2017, 7:25 p.m. UTC | #1
On 06/07/2017 01:38 AM, Antoine Tenart wrote:
> Put the two poll intervals (min and max) in the driver's private
> structure. This is needed to add the xmdio support later.
>
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox

Patch

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 8a71ef93a61b..3cb3dd3331d8 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -63,6 +63,9 @@  struct orion_mdio_dev {
 	int err_interrupt;
 	wait_queue_head_t smi_busy_wait;
 	struct orion_mdio_ops *ops;
+
+	unsigned int poll_interval_min;
+	unsigned int poll_interval_max;
 };
 
 struct orion_mdio_ops {
@@ -123,8 +126,8 @@  static int orion_mdio_wait_ready(struct mii_bus *bus)
 			break;
 
 	        if (dev->err_interrupt <= 0) {
-			usleep_range(MVMDIO_SMI_POLL_INTERVAL_MIN,
-				     MVMDIO_SMI_POLL_INTERVAL_MAX);
+			usleep_range(dev->poll_interval_min,
+				     dev->poll_interval_max);
 
 			if (time_is_before_jiffies(end))
 				++timedout;
@@ -279,6 +282,8 @@  static int orion_mdio_probe(struct platform_device *pdev)
 	if (!ops)
 		return -ENOMEM;
 
+	dev->poll_interval_min = MVMDIO_SMI_POLL_INTERVAL_MIN;
+	dev->poll_interval_max = MVMDIO_SMI_POLL_INTERVAL_MAX;
 	ops->is_done = orion_mdio_smi_is_done;
 	ops->is_read_valid = orion_mdio_smi_is_read_valid;
 	ops->start_read = orion_mdio_start_read_op;