[v1.1,03/15] vga_switcheroo: Set active attribute to false for audio clients
diff mbox

Message ID 159a43313e266d605850ad5ccfe204fa2c743396.1442497843.git.lukas@wunner.de
State New
Headers show

Commit Message

Lukas Wunner Aug. 27, 2015, 2:43 p.m. UTC
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.

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>
---
 drivers/gpu/vga/vga_switcheroo.c | 7 +++----
 include/linux/vga_switcheroo.h   | 4 ++--
 sound/pci/hda/hda_intel.c        | 3 +--
 3 files changed, 6 insertions(+), 8 deletions(-)

Comments

Daniel Vetter Sept. 23, 2015, 7:13 a.m. UTC | #1
On Thu, Aug 27, 2015 at 04:43:43PM +0200, Lukas Wunner wrote:
> 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.
> 
> 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>

Takashi, can you pls ack this for merging through drm-misc? Patch lgtm.
-Daniel

> ---
>  drivers/gpu/vga/vga_switcheroo.c | 7 +++----
>  include/linux/vga_switcheroo.h   | 4 ++--
>  sound/pci/hda/hda_intel.c        | 3 +--
>  3 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
> index 2e7e2f8e..563b82f 100644
> --- a/drivers/gpu/vga/vga_switcheroo.c
> +++ b/drivers/gpu/vga/vga_switcheroo.c
> @@ -290,7 +290,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.
> @@ -299,9 +298,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);
>  
> @@ -333,7 +332,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;
>  }
> diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
> index fe90bfc..3764991 100644
> --- a/include/linux/vga_switcheroo.h
> +++ b/include/linux/vga_switcheroo.h
> @@ -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; }
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index c38c68f..e819013 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -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;
> -- 
> 1.8.5.2 (Apple Git-48)
>
Takashi Iwai Sept. 24, 2015, 9:37 a.m. UTC | #2
On Thu, 27 Aug 2015 16:43:43 +0200,
Lukas Wunner wrote:
> 
> 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.

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.


thanks,

Takashi

> 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>
> ---
>  drivers/gpu/vga/vga_switcheroo.c | 7 +++----
>  include/linux/vga_switcheroo.h   | 4 ++--
>  sound/pci/hda/hda_intel.c        | 3 +--
>  3 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
> index 2e7e2f8e..563b82f 100644
> --- a/drivers/gpu/vga/vga_switcheroo.c
> +++ b/drivers/gpu/vga/vga_switcheroo.c
> @@ -290,7 +290,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.
> @@ -299,9 +298,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);
>  
> @@ -333,7 +332,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;
>  }
> diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
> index fe90bfc..3764991 100644
> --- a/include/linux/vga_switcheroo.h
> +++ b/include/linux/vga_switcheroo.h
> @@ -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; }
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index c38c68f..e819013 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -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;
> -- 
> 1.8.5.2 (Apple Git-48)
>
Takashi Iwai Sept. 24, 2015, 9:40 a.m. UTC | #3
On Wed, 23 Sep 2015 09:13:28 +0200,
Daniel Vetter wrote:
> 
> On Thu, Aug 27, 2015 at 04:43:43PM +0200, Lukas Wunner wrote:
> > 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.
> > 
> > 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>
> 
> Takashi, can you pls ack this for merging through drm-misc? Patch lgtm.

For the code change, feel free to take my ack:
  Reviewed-by: Takashi Iwai <tiwai@suse.de>

But it'd be better if the changelog can be rephrased a bit.


thanks,

Takashi

> -Daniel
> 
> > ---
> >  drivers/gpu/vga/vga_switcheroo.c | 7 +++----
> >  include/linux/vga_switcheroo.h   | 4 ++--
> >  sound/pci/hda/hda_intel.c        | 3 +--
> >  3 files changed, 6 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
> > index 2e7e2f8e..563b82f 100644
> > --- a/drivers/gpu/vga/vga_switcheroo.c
> > +++ b/drivers/gpu/vga/vga_switcheroo.c
> > @@ -290,7 +290,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.
> > @@ -299,9 +298,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);
> >  
> > @@ -333,7 +332,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;
> >  }
> > diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
> > index fe90bfc..3764991 100644
> > --- a/include/linux/vga_switcheroo.h
> > +++ b/include/linux/vga_switcheroo.h
> > @@ -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; }
> > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> > index c38c68f..e819013 100644
> > --- a/sound/pci/hda/hda_intel.c
> > +++ b/sound/pci/hda/hda_intel.c
> > @@ -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;
> > -- 
> > 1.8.5.2 (Apple Git-48)
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
>
Daniel Vetter Sept. 24, 2015, 3:13 p.m. UTC | #4
On Thu, Sep 24, 2015 at 11:40:52AM +0200, Takashi Iwai wrote:
> On Wed, 23 Sep 2015 09:13:28 +0200,
> Daniel Vetter wrote:
> > 
> > On Thu, Aug 27, 2015 at 04:43:43PM +0200, Lukas Wunner wrote:
> > > 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.
> > > 
> > > 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>
> > 
> > Takashi, can you pls ack this for merging through drm-misc? Patch lgtm.
> 
> For the code change, feel free to take my ack:
>   Reviewed-by: Takashi Iwai <tiwai@suse.de>
> 
> But it'd be better if the changelog can be rephrased a bit.

I added your clarification to the commit message and pulled in the patch.

Thanks, Daniel

> 
> 
> thanks,
> 
> Takashi
> 
> > -Daniel
> > 
> > > ---
> > >  drivers/gpu/vga/vga_switcheroo.c | 7 +++----
> > >  include/linux/vga_switcheroo.h   | 4 ++--
> > >  sound/pci/hda/hda_intel.c        | 3 +--
> > >  3 files changed, 6 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
> > > index 2e7e2f8e..563b82f 100644
> > > --- a/drivers/gpu/vga/vga_switcheroo.c
> > > +++ b/drivers/gpu/vga/vga_switcheroo.c
> > > @@ -290,7 +290,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.
> > > @@ -299,9 +298,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);
> > >  
> > > @@ -333,7 +332,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;
> > >  }
> > > diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
> > > index fe90bfc..3764991 100644
> > > --- a/include/linux/vga_switcheroo.h
> > > +++ b/include/linux/vga_switcheroo.h
> > > @@ -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; }
> > > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> > > index c38c68f..e819013 100644
> > > --- a/sound/pci/hda/hda_intel.c
> > > +++ b/sound/pci/hda/hda_intel.c
> > > @@ -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;
> > > -- 
> > > 1.8.5.2 (Apple Git-48)
> > > 
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> >
Lukas Wunner Oct. 1, 2015, 4:19 p.m. UTC | #5
Hi Daniel,

On Thu, Sep 24, 2015 at 05:13:02PM +0200, Daniel Vetter wrote:
> I added your clarification to the commit message and pulled in the patch.

As requested, here's an on-list gentle reminder that a portion of
this series hasn't been merged yet, specifically:

[PATCH 04/15] vga_switcheroo: Add missing locking
[PATCH 05/15] vga_switcheroo: Drop client power state
[PATCH 06/15] vga_switcheroo: Use enum vga_switcheroo_state instead
[PATCH 07/15] vga_switcheroo: Use VGA_SWITCHEROO_UNKNOWN_ID instead
[PATCH 08/15] vga_switcheroo: Use enum vga_switcheroo_client_id
[PATCH 10/15] ALSA: hda - Spell vga_switcheroo consistently
[PATCH 12/15] drm/nouveau: Spell vga_switcheroo consistently

In the case of patch 10, Takashi Iwai has suggested off-list that it be
merged through drm-misc and has kindly offered his
Reviewed-by: Takashi Iwai <tiwai@suse.de>

In the case of patch 12, I guess it may be merged through darktama's repo.

The patches were submitted to dri-devel September 17 and are also
available on GitHub for easier reviewing:
https://github.com/l1k/linux/commits/vga_switcheroo_docs

If anyone has comments or objections please come forward.

Thank you,

Lukas

Patch
diff mbox

diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index 2e7e2f8e..563b82f 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -290,7 +290,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.
@@ -299,9 +298,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);
 
@@ -333,7 +332,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;
 }
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index fe90bfc..3764991 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -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; }
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index c38c68f..e819013 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -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;