Merge back earlier cpufreq fixes for v4.4.
[firefly-linux-kernel-4.4.55.git] / drivers / vfio / platform / vfio_platform_private.h
index c563940e0f6b8aa2a88052595d60601a7443cbda..42816dd280cb98ac4e27fabced74c2d9aa1df3d7 100644 (file)
@@ -57,6 +57,9 @@ struct vfio_platform_device {
        int                             refcnt;
        struct mutex                    igate;
        struct module                   *parent_module;
+       const char                      *compat;
+       struct module                   *reset_module;
+       struct device                   *device;
 
        /*
         * These fields should be filled by the bus specific binder
@@ -80,12 +83,6 @@ struct vfio_platform_reset_node {
        vfio_platform_reset_fn_t reset;
 };
 
-struct vfio_platform_reset_combo {
-       const char *compat;
-       const char *reset_function_name;
-       const char *module_name;
-};
-
 extern int vfio_platform_probe_common(struct vfio_platform_device *vdev,
                                      struct device *dev);
 extern struct vfio_platform_device *vfio_platform_remove_common
@@ -110,4 +107,18 @@ static struct vfio_platform_reset_node __reset ## _node = {        \
 };                                                             \
 __vfio_platform_register_reset(&__reset ## _node)
 
+#define module_vfio_reset_handler(compat, reset)               \
+MODULE_ALIAS("vfio-reset:" compat);                            \
+static int __init reset ## _module_init(void)                  \
+{                                                              \
+       vfio_platform_register_reset(compat, reset);            \
+       return 0;                                               \
+};                                                             \
+static void __exit reset ## _module_exit(void)                 \
+{                                                              \
+       vfio_platform_unregister_reset(compat, reset);          \
+};                                                             \
+module_init(reset ## _module_init);                            \
+module_exit(reset ## _module_exit)
+
 #endif /* VFIO_PLATFORM_PRIVATE_H */