2 * platform driver support
5 #include <linux/platform.h>
6 #include <linux/module.h>
7 #include <linux/errno.h>
10 void default_reboot(char * cmd
)
15 void default_halt(void)
20 int default_suspend(int state
, int flags
)
25 static struct platform_t default_platform
= {
26 .name
= "Default Platform",
28 .reboot
= default_reboot
,
30 .power_off
= default_halt
,
31 .suspend
= default_suspend
,
35 struct platform_t
* platform
= &default_platform
;
36 static spinlock_t platform_lock
= SPIN_LOCK_UNLOCKED
;
39 * set_platform_driver - set the platform driver.
40 * @pf: driver to set it to
42 * Return -EEXIST if someone else already owns it.
44 int set_platform_driver(struct platform_t
* pf
)
48 spin_lock(&platform_lock
);
49 if (platform
!= &default_platform
) {
50 spin_unlock(&platform_lock
);
54 spin_unlock(&platform_lock
);
58 void remove_platform_driver(struct platform_t
* pf
)
60 spin_lock(&platform_lock
);
62 platform
= &default_platform
;
63 spin_unlock(&platform_lock
);
66 EXPORT_SYMBOL(default_reboot
);
67 EXPORT_SYMBOL(default_halt
);
68 EXPORT_SYMBOL(default_suspend
);
70 EXPORT_SYMBOL(platform
);
71 EXPORT_SYMBOL(set_platform_driver
);
72 EXPORT_SYMBOL(remove_platform_driver
);