.. | .. |
---|
35 | 35 | #include <linux/debugfs.h> |
---|
36 | 36 | #include <linux/fb.h> |
---|
37 | 37 | #include <linux/fs.h> |
---|
| 38 | +#include <linux/fbcon.h> |
---|
38 | 39 | #include <linux/module.h> |
---|
39 | 40 | #include <linux/pci.h> |
---|
40 | 41 | #include <linux/pm_domain.h> |
---|
.. | .. |
---|
133 | 134 | * @delayed_switch_active: whether a delayed switch is pending |
---|
134 | 135 | * @delayed_client_id: client to which a delayed switch is pending |
---|
135 | 136 | * @debugfs_root: directory for vga_switcheroo debugfs interface |
---|
136 | | - * @switch_file: file for vga_switcheroo debugfs interface |
---|
137 | 137 | * @registered_clients: number of registered GPUs |
---|
138 | 138 | * (counting only vga clients, not audio clients) |
---|
139 | 139 | * @clients: list of registered clients |
---|
.. | .. |
---|
152 | 152 | enum vga_switcheroo_client_id delayed_client_id; |
---|
153 | 153 | |
---|
154 | 154 | struct dentry *debugfs_root; |
---|
155 | | - struct dentry *switch_file; |
---|
156 | 155 | |
---|
157 | 156 | int registered_clients; |
---|
158 | 157 | struct list_head clients; |
---|
.. | .. |
---|
168 | 167 | #define client_is_vga(c) (!client_is_audio(c)) |
---|
169 | 168 | #define client_id(c) ((c)->id & ~ID_BIT_AUDIO) |
---|
170 | 169 | |
---|
171 | | -static int vga_switcheroo_debugfs_init(struct vgasr_priv *priv); |
---|
| 170 | +static void vga_switcheroo_debugfs_init(struct vgasr_priv *priv); |
---|
172 | 171 | static void vga_switcheroo_debugfs_fini(struct vgasr_priv *priv); |
---|
173 | 172 | |
---|
174 | 173 | /* only one switcheroo per system */ |
---|
.. | .. |
---|
736 | 735 | if (!active->driver_power_control) |
---|
737 | 736 | set_audio_state(active->id, VGA_SWITCHEROO_OFF); |
---|
738 | 737 | |
---|
739 | | - if (new_client->fb_info) { |
---|
740 | | - struct fb_event event; |
---|
741 | | - |
---|
742 | | - console_lock(); |
---|
743 | | - event.info = new_client->fb_info; |
---|
744 | | - fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event); |
---|
745 | | - console_unlock(); |
---|
746 | | - } |
---|
| 738 | + if (new_client->fb_info) |
---|
| 739 | + fbcon_remap_all(new_client->fb_info); |
---|
747 | 740 | |
---|
748 | 741 | mutex_lock(&vgasr_priv.mux_hw_lock); |
---|
749 | 742 | ret = vgasr_priv.handler->switchto(new_client->id); |
---|
.. | .. |
---|
914 | 907 | |
---|
915 | 908 | static void vga_switcheroo_debugfs_fini(struct vgasr_priv *priv) |
---|
916 | 909 | { |
---|
917 | | - debugfs_remove(priv->switch_file); |
---|
918 | | - priv->switch_file = NULL; |
---|
919 | | - |
---|
920 | | - debugfs_remove(priv->debugfs_root); |
---|
| 910 | + debugfs_remove_recursive(priv->debugfs_root); |
---|
921 | 911 | priv->debugfs_root = NULL; |
---|
922 | 912 | } |
---|
923 | 913 | |
---|
924 | | -static int vga_switcheroo_debugfs_init(struct vgasr_priv *priv) |
---|
| 914 | +static void vga_switcheroo_debugfs_init(struct vgasr_priv *priv) |
---|
925 | 915 | { |
---|
926 | | - static const char mp[] = "/sys/kernel/debug"; |
---|
927 | | - |
---|
928 | 916 | /* already initialised */ |
---|
929 | 917 | if (priv->debugfs_root) |
---|
930 | | - return 0; |
---|
| 918 | + return; |
---|
| 919 | + |
---|
931 | 920 | priv->debugfs_root = debugfs_create_dir("vgaswitcheroo", NULL); |
---|
932 | 921 | |
---|
933 | | - if (!priv->debugfs_root) { |
---|
934 | | - pr_err("Cannot create %s/vgaswitcheroo\n", mp); |
---|
935 | | - goto fail; |
---|
936 | | - } |
---|
937 | | - |
---|
938 | | - priv->switch_file = debugfs_create_file("switch", 0644, |
---|
939 | | - priv->debugfs_root, NULL, |
---|
940 | | - &vga_switcheroo_debugfs_fops); |
---|
941 | | - if (!priv->switch_file) { |
---|
942 | | - pr_err("cannot create %s/vgaswitcheroo/switch\n", mp); |
---|
943 | | - goto fail; |
---|
944 | | - } |
---|
945 | | - return 0; |
---|
946 | | -fail: |
---|
947 | | - vga_switcheroo_debugfs_fini(priv); |
---|
948 | | - return -1; |
---|
| 922 | + debugfs_create_file("switch", 0644, priv->debugfs_root, NULL, |
---|
| 923 | + &vga_switcheroo_debugfs_fops); |
---|
949 | 924 | } |
---|
950 | 925 | |
---|
951 | 926 | /** |
---|