Re: [PATCH 1/5] drm/i915: add dev_to_i915_priv helper

Daniel Vetter
2014-12-08T20:27:23Z

On Mon, Dec 08, 2014 at 06:42:05PM +0200, Imre Deak wrote:
> This will be needed by later patches, so factor it out.
>
> 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) {

btw all checks for drm_dev and dev_private are remnants from the old ums
days and can all be killed. With fire, please.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch