On Fri, Apr 11, 2014 at 11:36:05PM +0200, Daniel Vetter wrote:
[...]
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 4dff829c2d89..dcb67c6564dd 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1286,9 +1286,12 @@ static bool i915_switcheroo_can_switch(struct pci_dev 
> *pdev)
>       struct drm_device *dev = pci_get_drvdata(pdev);
>       bool can_switch;
>  
> -     spin_lock(&dev->count_lock);
> +     /*
> +      * FIXME: open_count is protected by drm_global_mutex but that would 
> lead to
> +      * locking inversion with the driver load path. And the access here is
> +      * completely racy anyway. So don't bother with locking for now.
> +      */
>       can_switch = (dev->open_count == 0);
> -     spin_unlock(&dev->count_lock);
>       return can_switch;
>  }

Couldn't this now be shortened to:

        return (dev->open_count == 0);

? Similarily for the other drivers.

> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 9f1fb8d36b67..bd16a4c8ece4 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -1076,7 +1076,7 @@ struct drm_device {
>  
>       /** \name Usage Counters */
>       /*@{ */
> -     int open_count;                 /**< Outstanding files open */
> +     int open_count;                 /**< Outstanding files open, protected 
> by drm_global_lock. */

s/drm_global_lock/drm_global_mutex/?

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140417/836e468d/attachment.sig>

Reply via email to