net: stmmac: replace msleep with mdelay between spinlock and spinunlock
authorroger <roger.chen@rock-chips.com>
Fri, 8 Apr 2016 03:46:14 +0000 (11:46 +0800)
committerroger <roger.chen@rock-chips.com>
Fri, 8 Apr 2016 03:46:14 +0000 (11:46 +0800)
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] [<ffffffc0000883b0>] dump_backtrace+0x0/0x104
[   50.988979] [<ffffffc0000884c8>] show_stack+0x14/0x1c
[   50.989440] [<ffffffc0003033f8>] dump_stack+0x90/0xb0
[   50.989899] [<ffffffc0000bb4d4>] __schedule_bug+0x44/0x5c
[   50.990388] [<ffffffc000949d00>] __schedule+0x90/0x6d8
[   50.990851] [<ffffffc00094a44c>] schedule+0x90/0xb0
[   50.991295] [<ffffffc00094cdbc>] schedule_timeout+0x1f0/0x254
[   50.991812] [<ffffffc00094ce90>] schedule_timeout_uninterruptible+0x20/0x28
[   50.992437] [<ffffffc0000ef2ac>] msleep+0x18/0x24
[   50.992870] [<ffffffc0004b2fc0>] stmmac_mdio_reset+0x120/0x194
[   50.993397] [<ffffffc0004b1c40>] stmmac_resume+0x118/0x134
[   50.993893] [<ffffffc0004b64bc>] stmmac_pltfr_resume+0x30/0x3c
[   50.994421] [<ffffffc00045b44c>] platform_pm_resume+0x2c/0x54
[   50.994943] [<ffffffc000465350>] dpm_run_callback+0xa8/0x1e0
[   50.995452] [<ffffffc000465fd4>] device_resume+0x158/0x190
[   50.995945] [<ffffffc000466178>] dpm_resume+0x16c/0x364
[   50.996417] [<ffffffc000466384>] dpm_resume_end+0x14/0x28
[   50.996905] [<ffffffc0000d8bfc>] suspend_devices_and_enter+0x114/0x2f4
[   50.997489] [<ffffffc0000d93c8>] pm_suspend+0x5ec/0x658
[   50.997960] [<ffffffc0000d7748>] state_store+0x50/0x88
[   50.998427] [<ffffffc000305594>] kobj_attr_store+0x18/0x28
[   50.998926] [<ffffffc0001ec038>] sysfs_kf_write+0x44/0x4c
[   50.999414] [<ffffffc0001eb3f4>] kernfs_fop_write+0x110/0x16c
[   50.999935] [<ffffffc00018d208>] __vfs_write+0x28/0xd0
[   51.000400] [<ffffffc00018d464>] vfs_write+0xb0/0x180
[   51.000858] [<ffffffc00018d600>] SyS_write+0x48/0x84
[   51.001311] [<ffffffc0000844b0>] 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 <roger.chen@rock-chips.com>
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c

index bba670c42e3749483bf2218ad2da6b3b4c8d0587..13af780ca8fc8c423b8dcf0c46c434f38e3d656a 100644 (file)
@@ -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