[PATCH 1/4] gpu/vga_switcheroo: add driver control power feature. (v3)

Peter Wu lekensteyn at gmail.com
Thu Aug 1 10:54:14 PDT 2013


Hi Dave,

I don't know anything of PM domains, but there was one minor thing I wanted to 
mention, see below.

On Monday 29 July 2013 16:06:56 Dave Airlie wrote:
> From: Dave Airlie <airlied at dhcp-40-90.bne.redhat.com>
Something went wrong here I guess?

> [..]
> 
> +static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev)
> +{
> +	struct pci_dev *pdev = to_pci_dev(dev);
> +	int ret;
> +	struct vga_switcheroo_client *client, *found = NULL;
> +
> +	/* we need to check if we have to switch back on the video
> +	   device so the audio device can come back */
> +	list_for_each_entry(client, &vgasr_priv.clients, list) {
> +		if ((client->pdev->devfn & ~(0x7)) == (pdev->devfn & ~(0x7)) &&
> client_is_vga(client)) {
Less obfuscated:

    PCI_SLOT(client->pdev->devfn) == PCI_SLOT(pdev->devfn) 

> +			found = client;
> +			ret = pm_runtime_get_sync(&client->pdev->dev);
> +			if (ret) {
> +				if (ret != 1)
> +					return ret;
> +			}
> +			break;
> +		}
> +	}
> +	ret = dev->bus->pm->runtime_resume(dev);
> +	if (ret)
> +		return ret;
> +
> +	/* put the reference for the gpu */
> +	if (found)
> +		pm_runtime_put_autosuspend(&found->pdev->dev);
> +	return 0;
> +}
> [..]

Regards,
Peter


More information about the dri-devel mailing list