1 /* SPDX--License-Identifier: GPL-2.0 */
3 #ifndef __PLATFORM_EARLY__
4 #define __PLATFORM_EARLY__
6 #include <linux/types.h>
7 #include <linux/platform_device.h>
8 #include <linux/pm_runtime.h>
9 #include <linux/slab.h>
11 struct sh_early_platform_driver
{
12 const char *class_str
;
13 struct platform_driver
*pdrv
;
14 struct list_head list
;
20 #define EARLY_PLATFORM_ID_UNSET -2
21 #define EARLY_PLATFORM_ID_ERROR -3
23 extern int sh_early_platform_driver_register(struct sh_early_platform_driver
*epdrv
,
25 extern void sh_early_platform_add_devices(struct platform_device
**devs
, int num
);
27 static inline int is_sh_early_platform_device(struct platform_device
*pdev
)
29 return !pdev
->dev
.driver
;
32 extern void sh_early_platform_driver_register_all(char *class_str
);
33 extern int sh_early_platform_driver_probe(char *class_str
,
34 int nr_probe
, int user_only
);
36 #define sh_early_platform_init(class_string, platdrv) \
37 sh_early_platform_init_buffer(class_string, platdrv, NULL, 0)
40 #define sh_early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \
41 static __initdata struct sh_early_platform_driver early_driver = { \
42 .class_str = class_string, \
46 .requested_id = EARLY_PLATFORM_ID_UNSET, \
48 static int __init sh_early_platform_driver_setup_func(char *buffer) \
50 return sh_early_platform_driver_register(&early_driver, buffer); \
52 early_param(class_string, sh_early_platform_driver_setup_func)
54 #define sh_early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \
55 static inline char *sh_early_platform_driver_setup_func(void) \
57 return bufsiz ? buf : NULL; \
61 #endif /* __PLATFORM_EARLY__ */