From b664a51a074b560e92e5b22523c5cb54833e7bf2 Mon Sep 17 00:00:00 2001 From: roger Date: Fri, 8 Apr 2016 11:46:14 +0800 Subject: [PATCH] net: stmmac: replace msleep with mdelay between spinlock and spinunlock stmmac_mdio_reset() { ... msleep() ... } stmmac_resume() { ... spin_lock_irqsave() ... stmmac_mdio_reset() ... spin_unlock_irqrestore() } The code above will cause the following crash when resuming. [ 50.988242] Call trace: [ 50.988489] [] dump_backtrace+0x0/0x104 [ 50.988979] [] show_stack+0x14/0x1c [ 50.989440] [] dump_stack+0x90/0xb0 [ 50.989899] [] __schedule_bug+0x44/0x5c [ 50.990388] [] __schedule+0x90/0x6d8 [ 50.990851] [] schedule+0x90/0xb0 [ 50.991295] [] schedule_timeout+0x1f0/0x254 [ 50.991812] [] schedule_timeout_uninterruptible+0x20/0x28 [ 50.992437] [] msleep+0x18/0x24 [ 50.992870] [] stmmac_mdio_reset+0x120/0x194 [ 50.993397] [] stmmac_resume+0x118/0x134 [ 50.993893] [] stmmac_pltfr_resume+0x30/0x3c [ 50.994421] [] platform_pm_resume+0x2c/0x54 [ 50.994943] [] dpm_run_callback+0xa8/0x1e0 [ 50.995452] [] device_resume+0x158/0x190 [ 50.995945] [] dpm_resume+0x16c/0x364 [ 50.996417] [] dpm_resume_end+0x14/0x28 [ 50.996905] [] suspend_devices_and_enter+0x114/0x2f4 [ 50.997489] [] pm_suspend+0x5ec/0x658 [ 50.997960] [] state_store+0x50/0x88 [ 50.998427] [] kobj_attr_store+0x18/0x28 [ 50.998926] [] sysfs_kf_write+0x44/0x4c [ 50.999414] [] kernfs_fop_write+0x110/0x16c [ 50.999935] [] __vfs_write+0x28/0xd0 [ 51.000400] [] vfs_write+0xb0/0x180 [ 51.000858] [] SyS_write+0x48/0x84 [ 51.001311] [] el0_svc_naked+0x24/0x28 [ 51.066648] ERROR stmmaceth/eth0, debugfs create directory failed [ 51.067196] stmmac_hw_setup: failed debugFS registration Change-Id: Iee92ac9bae18a6e8fb980434c7004dd33b43b638 Signed-off-by: roger --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index bba670c42e37..13af780ca8fc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -161,15 +161,15 @@ int stmmac_mdio_reset(struct mii_bus *bus) gpio_direction_output(data->reset_gpio, data->active_low ? 1 : 0); if (data->delays[0]) - msleep(DIV_ROUND_UP(data->delays[0], 1000)); + mdelay(DIV_ROUND_UP(data->delays[0], 1000)); gpio_set_value(data->reset_gpio, data->active_low ? 0 : 1); if (data->delays[1]) - msleep(DIV_ROUND_UP(data->delays[1], 1000)); + mdelay(DIV_ROUND_UP(data->delays[1], 1000)); gpio_set_value(data->reset_gpio, data->active_low ? 1 : 0); if (data->delays[2]) - msleep(DIV_ROUND_UP(data->delays[2], 1000)); + mdelay(DIV_ROUND_UP(data->delays[2], 1000)); } #endif -- 2.34.1