@@ -155,6 +155,10 @@ static void at91_pm_suspend(suspend_state_t state)
flush_cache_all();
outer_disable();
+ /* Copy the pm suspend handler to SRAM */
+ at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn,
+ &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
+
at91_suspend_sram_fn(at91_pmc_base, at91_ramc_base[0],
at91_ramc_base[1], pm_data);
@@ -305,10 +309,6 @@ static void __init at91_pm_sram_init(void)
pr_warn("SRAM: Could not map\n");
return;
}
-
- /* Copy the pm suspend handler to SRAM */
- at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn,
- &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
}
static void __init at91_pm_init(void)
-------------------------8<-----------------------------------
Or using memcpy() instead of fncpy() also fixes the problem:
-------------------------8<-----------------------------------
@@ -307,8 +307,8 @@ static void __init at91_pm_sram_init(void)
}
/* Copy the pm suspend handler to SRAM */
- at91_suspend_sram_fn = fncpy(at91_suspend_sram_fn,
- &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz);
+ memcpy(at91_suspend_sram_fn, at91_pm_suspend_in_sram,
+ at91_pm_suspend_in_sram_sz);
}
static void __init at91_pm_init(void)