All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruno Thomsen <bruno.thomsen@gmail.com>
To: netdev <netdev@vger.kernel.org>
Cc: Bruno Thomsen <bruno.thomsen@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>, Fabio Estevam <festevam@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Lars Alex Pedersen <laa@kamstrup.com>,
	Bruno Thomsen <bth@kamstrup.com>
Subject: [PATCH v2 4/4 net-next] net: mdio device: use flexible sleeping in reset function
Date: Thu, 30 Jul 2020 21:57:49 +0200	[thread overview]
Message-ID: <20200730195749.4922-5-bruno.thomsen@gmail.com> (raw)
In-Reply-To: <20200730195749.4922-1-bruno.thomsen@gmail.com>

MDIO device reset assert and deassert length was created by
usleep_range() but that does not ensure optimal handling of
all the different values from device tree properties.
By switching to the new flexible sleeping helper function,
fsleep(), the correct delay function is called depending on
delay length, e.g. udelay(), usleep_range() or msleep().

Signed-off-by: Bruno Thomsen <bruno.thomsen@gmail.com>
---
 drivers/net/phy/mdio_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c
index 0f625a1b1644..0837319a52d7 100644
--- a/drivers/net/phy/mdio_device.c
+++ b/drivers/net/phy/mdio_device.c
@@ -132,7 +132,7 @@ void mdio_device_reset(struct mdio_device *mdiodev, int value)
 
 	d = value ? mdiodev->reset_assert_delay : mdiodev->reset_deassert_delay;
 	if (d)
-		usleep_range(d, d + max_t(unsigned int, d / 10, 100));
+		fsleep(d);
 }
 EXPORT_SYMBOL(mdio_device_reset);
 
-- 
2.26.2


  parent reply	other threads:[~2020-07-30 19:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 19:57 [PATCH v2 0/4 net-next] Improve MDIO Ethernet PHY reset Bruno Thomsen
2020-07-30 19:57 ` [PATCH v2 1/4 net-next] dt-bindings: net: mdio: add reset-post-delay-us property Bruno Thomsen
2020-08-02 16:46   ` Andrew Lunn
2020-08-02 20:16   ` Florian Fainelli
2020-07-30 19:57 ` [PATCH v2 2/4 net-next] net: mdiobus: use flexible sleeping for reset-delay-us Bruno Thomsen
2020-08-02 16:46   ` Andrew Lunn
2020-08-02 20:17   ` Florian Fainelli
2020-07-30 19:57 ` [PATCH v2 3/4 net-next] net: mdiobus: add reset-post-delay-us handling Bruno Thomsen
2020-08-02 16:47   ` Andrew Lunn
2020-08-02 20:18   ` Florian Fainelli
2020-07-30 19:57 ` Bruno Thomsen [this message]
2020-08-02 16:48   ` [PATCH v2 4/4 net-next] net: mdio device: use flexible sleeping in reset function Andrew Lunn
2020-08-02 20:19   ` Florian Fainelli
2020-08-03 22:01 ` [PATCH v2 0/4 net-next] Improve MDIO Ethernet PHY reset David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200730195749.4922-5-bruno.thomsen@gmail.com \
    --to=bruno.thomsen@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bth@kamstrup.com \
    --cc=f.fainelli@gmail.com \
    --cc=festevam@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=laa@kamstrup.com \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.