Browse files

switcheroo: update to new client ops introduced in 3.5

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
  • Loading branch information...
1 parent 6c7da8e commit fe68d7d36bb614bf6da97940f0cafcc29d99da09 @awilliam committed Aug 5, 2012
Showing with 23 additions and 2 deletions.
  1. +12 −1 asus-switcheroo.c
  2. +11 −1 byo-switcheroo.c
View
13 asus-switcheroo.c
@@ -306,6 +306,14 @@ static bool asus_switcheroo_dsm_detect(void)
return false;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+struct vga_switcheroo_client_ops asus_switcheroo_ops = {
+ .set_gpu_state = asus_switcheroo_set_state,
+ .reprobe = NULL,
+ .can_switch = asus_switcheroo_can_switch,
+};
+#endif
+
static int __init asus_switcheroo_init(void)
{
if (!asus_switcheroo_dsm_detect())
@@ -314,7 +322,10 @@ static int __init asus_switcheroo_init(void)
vga_switcheroo_register_handler(&asus_dsm_handler);
if (dummy_client)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+ vga_switcheroo_register_client(discrete_dev,
+ &asus_switcheroo_ops);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
vga_switcheroo_register_client(discrete_dev,
asus_switcheroo_set_state, NULL,
asus_switcheroo_can_switch);
View
12 byo-switcheroo.c
@@ -328,6 +328,14 @@ static bool dummy_switcheroo_can_switch(struct pci_dev *pdev)
return !dummy_client_switched;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+struct vga_switcheroo_client_ops byo_switcheroo_ops = {
+ .set_gpu_state = dummy_switcheroo_set_state,
+ .reprobe = NULL,
+ .can_switch = dummy_switcheroo_can_switch,
+};
+#endif
+
static int __init byo_switcheroo_init(void)
{
struct pci_dev *pdev = NULL;
@@ -365,7 +373,9 @@ static int __init byo_switcheroo_init(void)
printk(KERN_INFO "BYO-switcheroo handler registered\n");
if (dummy_client) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)
+ vga_switcheroo_register_client(dis_dev, &byo_switcheroo_ops);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
ret = vga_switcheroo_register_client(dis_dev,
dummy_switcheroo_set_state, NULL,
dummy_switcheroo_can_switch);

0 comments on commit fe68d7d

Please sign in to comment.