lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 18 Apr 2015 17:02:39 +0200 From: Michael Trimarchi <michael@...rulasolutions.com> To: Michael Trimarchi <michael@...rulasolutions.com>, Giuseppe Cavallaro <peppe.cavallaro@...com> Cc: netdev@...r.kernel.org Subject: [RFC][PATCH] net: stmmac: use msleep instead of udelay for gpio reset Reset delay values are expressed in microsecond but most of the time the delay is more then 2ms and up to 100ms. Use udelay is wrong for large sleep period. This function is not used in interrupt context according to the documentation. Signed-off-by: Michael Trimarchi <michael@...rulasolutions.com> --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index b735fa2..009a86a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -157,15 +157,15 @@ int stmmac_mdio_reset(struct mii_bus *bus) } reset_gpio = data->reset_gpio; - active_low = data->active_low; + active_low = !!data->active_low; if (!gpio_request(reset_gpio, "mdio-reset")) { - gpio_direction_output(reset_gpio, active_low ? 1 : 0); - udelay(data->delays[0]); - gpio_set_value(reset_gpio, active_low ? 0 : 1); - udelay(data->delays[1]); - gpio_set_value(reset_gpio, active_low ? 1 : 0); - udelay(data->delays[2]); + gpio_direction_output(reset_gpio, active_low); + msleep(max(1U, data->delays[0] / 1000)); + gpio_set_value(reset_gpio, !active_low); + msleep(max(1U, data->delays[1] / 1000)); + gpio_set_value(reset_gpio, active_low); + msleep(max(1U, data->delays[2] / 1000)); } } #endif -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists