vga_switcheroo: Don't require handler init callback
authorSeth Forshee <seth.forshee@canonical.com>
Fri, 17 Aug 2012 16:17:02 +0000 (11:17 -0500)
committerMatthew Garrett <mjg@redhat.com>
Fri, 17 Aug 2012 21:34:41 +0000 (17:34 -0400)
This callback is a no-op in nouveau, and the upcoming apple-gmux
switcheroo support won't require it either. Rather than forcing drivers
to stub it out, just make it optional and remove the callback from
nouveau.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
drivers/gpu/drm/nouveau/nouveau_acpi.c
drivers/gpu/vga/vga_switcheroo.c

index fc841e87b343a6aa71cc05bb7f4ae94e7399fafc..26ebffebe7107db7accfecc619b282ba0b271252 100644 (file)
@@ -211,11 +211,6 @@ static int nouveau_dsm_power_state(enum vga_switcheroo_client_id id,
        return nouveau_dsm_set_discrete_state(nouveau_dsm_priv.dhandle, state);
 }
 
-static int nouveau_dsm_init(void)
-{
-       return 0;
-}
-
 static int nouveau_dsm_get_client_id(struct pci_dev *pdev)
 {
        /* easy option one - intel vendor ID means Integrated */
@@ -232,7 +227,6 @@ static int nouveau_dsm_get_client_id(struct pci_dev *pdev)
 static struct vga_switcheroo_handler nouveau_dsm_handler = {
        .switchto = nouveau_dsm_switchto,
        .power_state = nouveau_dsm_power_state,
-       .init = nouveau_dsm_init,
        .get_client_id = nouveau_dsm_get_client_id,
 };
 
index e10ba3755dfa1cf46fd2e9c2cdc13656bc959a35..e25cf31faab2b10a027d3f3c860887214ba431d1 100644 (file)
@@ -83,7 +83,8 @@ static void vga_switcheroo_enable(void)
        struct vga_switcheroo_client *client;
 
        /* call the handler to init */
-       vgasr_priv.handler->init();
+       if (vgasr_priv.handler->init)
+               vgasr_priv.handler->init();
 
        list_for_each_entry(client, &vgasr_priv.clients, list) {
                if (client->id != -1)