All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Imre Deak <imre.deak@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>,
	intel-gfx@lists.freedesktop.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/5] drm/i915: add dev_to_i915_priv helper
Date: Mon, 8 Dec 2014 20:40:20 +0000	[thread overview]
Message-ID: <20141208204020.GQ13586@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <1418056929-7977-2-git-send-email-imre.deak@intel.com>

On Mon, Dec 08, 2014 at 06:42:05PM +0200, Imre Deak wrote:
> This will be needed by later patches, so factor it out.

The similiar function (for drm_device) is known as to_i915(), so just
call this dev_to_i915().
> 
> No functional change.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.c  | 15 ++++++---------
>  drivers/gpu/drm/i915/intel_drv.h |  8 ++++++++
>  2 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 71be3c9..32c2e33 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -923,10 +923,10 @@ i915_pci_remove(struct pci_dev *pdev)
>  
>  static int i915_pm_suspend(struct device *dev)
>  {
> -	struct pci_dev *pdev = to_pci_dev(dev);
> -	struct drm_device *drm_dev = pci_get_drvdata(pdev);
> +	struct drm_i915_private *dev_priv = dev_to_i915_priv(dev);
> +	struct drm_device *drm_dev = dev_priv->dev;
>  
> -	if (!drm_dev || !drm_dev->dev_private) {
> +	if (!drm_dev || !dev_priv) {

This test is quite nonsensical since you've dereferenced both pointers
getting to this point. If it is required, we need a new patch.

>  		dev_err(dev, "DRM not initialized, aborting suspend.\n");
>  		return -ENODEV;
>  	}
> @@ -939,8 +939,7 @@ static int i915_pm_suspend(struct device *dev)
>  
>  static int i915_pm_suspend_late(struct device *dev)
>  {
> -	struct pci_dev *pdev = to_pci_dev(dev);
> -	struct drm_device *drm_dev = pci_get_drvdata(pdev);
> +	struct drm_device *drm_dev = dev_to_i915_priv(dev)->dev;
>  
>  	/*
>  	 * We have a suspedn ordering issue with the snd-hda driver also
> @@ -959,8 +958,7 @@ static int i915_pm_suspend_late(struct device *dev)
>  
>  static int i915_pm_resume_early(struct device *dev)
>  {
> -	struct pci_dev *pdev = to_pci_dev(dev);
> -	struct drm_device *drm_dev = pci_get_drvdata(pdev);
> +	struct drm_device *drm_dev = dev_to_i915_priv(dev)->dev;
>  
>  	if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
>  		return 0;
> @@ -970,8 +968,7 @@ static int i915_pm_resume_early(struct device *dev)
>  
>  static int i915_pm_resume(struct device *dev)
>  {
> -	struct pci_dev *pdev = to_pci_dev(dev);
> -	struct drm_device *drm_dev = pci_get_drvdata(pdev);
> +	struct drm_device *drm_dev = dev_to_i915_priv(dev)->dev;
>  
>  	if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
>  		return 0;
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 61a88fa..3de7a55 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -775,6 +775,14 @@ static inline unsigned int intel_num_planes(struct intel_crtc *crtc)
>  	return INTEL_INFO(crtc->base.dev)->num_sprites[crtc->pipe] + 1;
>  }
>  
> +static inline struct drm_i915_private *dev_to_i915_priv(struct device *dev)
> +{
> +	struct pci_dev *pdev = to_pci_dev(dev);
> +	struct drm_device *drm_dev = pci_get_drvdata(pdev);
> +
> +	return drm_dev->dev_private;

I think you meant 

static inline struct drm_i915_private *dev_to_i915(struct device *dev)
{
	return to_i915(pci_get_drvdata(to_pci_dev(dev)));
}
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2014-12-08 20:40 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-08 16:42 [PATCH 0/5] sanitize hda/i915 interface using the component fw Imre Deak
2014-12-08 16:42 ` [PATCH 1/5] drm/i915: add dev_to_i915_priv helper Imre Deak
2014-12-08 18:36   ` Jani Nikula
2014-12-08 19:54     ` Imre Deak
2014-12-08 20:27   ` Daniel Vetter
2014-12-08 20:40   ` Chris Wilson [this message]
2014-12-08 21:26     ` Imre Deak
2014-12-09  9:41   ` [PATCH v2 1/5] drm/i915: add dev_to_i915 helper Imre Deak
2014-12-09 10:08     ` Daniel Vetter
2014-12-09 16:15     ` [PATCH v3 " Imre Deak
2014-12-08 16:42 ` [PATCH 2/5] drm/i915: add component support Imre Deak
2014-12-08 18:44   ` Jani Nikula
2014-12-08 20:23     ` Imre Deak
2014-12-09  9:41   ` [PATCH v2 " Imre Deak
2014-12-09 10:12     ` Daniel Vetter
2014-12-09 10:33       ` Jani Nikula
2014-12-10  9:24         ` Daniel Vetter
2014-12-09 16:15     ` [PATCH v3 " Imre Deak
2014-12-10  8:22       ` Jani Nikula
2014-12-10 13:18         ` Imre Deak
2014-12-08 16:42 ` [PATCH 3/5] ALSA: hda: pass chip to all i915 interface functions Imre Deak
2014-12-08 16:42 ` [PATCH 4/5] ALSA: hda: add component support Imre Deak
2014-12-09  9:41   ` [PATCH v2 " Imre Deak
2014-12-09 10:19     ` Daniel Vetter
2014-12-09 17:30       ` Takashi Iwai
2014-12-10  9:27         ` Daniel Vetter
2014-12-09 16:15     ` [PATCH v3 " Imre Deak
2014-12-08 16:42 ` [PATCH 5/5] drm/i915: remove unused power_well/get_cdclk_freq api Imre Deak
2014-12-08 18:46   ` Jani Nikula
2014-12-09 21:04   ` shuang.he
2014-12-08 20:14 ` [PATCH 0/5] sanitize hda/i915 interface using the component fw Daniel Vetter
2014-12-09  8:59   ` Imre Deak
2014-12-09 10:03     ` Daniel Vetter
2014-12-09 16:56       ` Imre Deak
2014-12-09 17:33         ` Takashi Iwai
2015-01-05 15:29           ` Imre Deak
2015-01-05 15:35             ` Takashi Iwai
2015-01-05 17:25               ` Imre Deak
2015-01-06 10:25                 ` Takashi Iwai
2015-01-07 19:49                   ` Imre Deak
2015-01-08 14:35                     ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141208204020.GQ13586@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.