vga_switcheroo: Set active attribute to false for audio clients
authorLukas Wunner <lukas@wunner.de>
Thu, 27 Aug 2015 14:43:43 +0000 (16:43 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 24 Sep 2015 18:14:25 +0000 (20:14 +0200)
The active attribute in struct vga_switcheroo_client denotes whether
the outputs are currently switched to this client. The attribute is
only meaningful for vga clients. It is never used for audio clients.

The function vga_switcheroo_register_audio_client() misuses this
attribute to store whether the audio device is fully initialized.
Most likely there was a misunderstanding about the meaning of
"active" when this was added.

Comment from Takashi's review:

"Not really.  The full initialization of audio was meant that the audio
is active indeed.  Admittedly, though, the active flag for each audio
client doesn't play any role because the audio always follows the gfx
state changes, and the value passed there doesn't reflect the actual
state due to the later change.  So, I agree with the removal of the
flag itself -- or let the audio active flag following the
corresponding gfx flag.  The latter will make the proc output more
consistent while the former is certainly more reduction of code."

Set the active attribute to false for audio clients. Remove the
active parameter from vga_switcheroo_register_audio_client() and
its sole caller, hda_intel.c:register_vga_switcheroo().

vga_switcheroo_register_audio_client() was introduced by 3e9e63dbd374
("vga_switcheroo: Add the support for audio clients"). Its use in
hda_intel.c was introduced by a82d51ed24bb ("ALSA: hda - Support
VGA-switcheroo").

v1.1: The changes above imply that in find_active_client() the call
to client_is_vga() is now superfluous. Drop it.

Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
[danvet: Add Takashi's clarification to the commit message.]
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/vga/vga_switcheroo.c
include/linux/vga_switcheroo.h
sound/pci/hda/hda_intel.c

index 67a57090175def77d3f4488a3a791cd999d679ef..86c03b53e7bfe2f2a04abab67623f5817eb6733c 100644 (file)
@@ -288,7 +288,6 @@ EXPORT_SYMBOL(vga_switcheroo_register_client);
  * @pdev: client pci device
  * @ops: client callbacks
  * @id: client identifier, see enum vga_switcheroo_client_id
- * @active: whether the audio device is fully initialized
  *
  * Register audio client (audio device on a GPU). The power state of the
  * client is assumed to be ON.
@@ -297,9 +296,9 @@ EXPORT_SYMBOL(vga_switcheroo_register_client);
  */
 int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
                                         const struct vga_switcheroo_client_ops *ops,
-                                        int id, bool active)
+                                        int id)
 {
-       return register_client(pdev, ops, id | ID_BIT_AUDIO, active, false);
+       return register_client(pdev, ops, id | ID_BIT_AUDIO, false, false);
 }
 EXPORT_SYMBOL(vga_switcheroo_register_audio_client);
 
@@ -331,7 +330,7 @@ find_active_client(struct list_head *head)
        struct vga_switcheroo_client *client;
 
        list_for_each_entry(client, head, list)
-               if (client->active && client_is_vga(client))
+               if (client->active)
                        return client;
        return NULL;
 }
index fe90bfc3b510d13a2163c3625ad4297fa820b911..37649919771754cb2a953a3793a600aa9e16612b 100644 (file)
@@ -128,7 +128,7 @@ int vga_switcheroo_register_client(struct pci_dev *dev,
                                   bool driver_power_control);
 int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
                                         const struct vga_switcheroo_client_ops *ops,
-                                        int id, bool active);
+                                        int id);
 
 void vga_switcheroo_client_fb_set(struct pci_dev *dev,
                                  struct fb_info *info);
@@ -154,7 +154,7 @@ static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_i
 static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; }
 static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
        const struct vga_switcheroo_client_ops *ops,
-       int id, bool active) { return 0; }
+       int id) { return 0; }
 static inline void vga_switcheroo_unregister_handler(void) {}
 static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
 static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; }
index c38c68f579381d657786945baa3ab99b3ccae787..e819013959d97d82606da618fa26354f119c682f 100644 (file)
@@ -1143,8 +1143,7 @@ static int register_vga_switcheroo(struct azx *chip)
         * is there any machine with two switchable HDMI audio controllers?
         */
        err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops,
-                                                   VGA_SWITCHEROO_DIS,
-                                                   hda->probe_continued);
+                                                  VGA_SWITCHEROO_DIS);
        if (err < 0)
                return err;
        hda->vga_switcheroo_registered = 1;