op 20-11-13 21:48, Rob Clark schreef:
> +int drm_modeset_lock_crtc(struct drm_crtc *crtc, void *state)
> +{
> +     // ugg, this makes atomic_helper mandatory..  not really
> +     // sure yet whether I should care, or just simplify things
> +     // and require that drivers use or extend atomic_helper:
> +     struct drm_atomic_helper_state *a = state;
> +     struct ww_acquire_ctx *ww_ctx = NULL;
> +     int ret;
> +
> +     if (a) {
> +             if (a->flags & DRM_MODE_ATOMIC_NOLOCK)
> +                     return 0;
> +             ww_ctx = &a->ww_ctx;
> +     }
> +
> +     ret = ww_mutex_lock(&crtc->mutex, ww_ctx);
> +     if (a && !ret) {
> +             WARN_ON(!list_empty(&crtc->lock_head));
> +             list_add(&crtc->lock_head, &a->locked_crtcs);
> +     }
> +
> +     return ret;
> +}
> +EXPORT_SYMBOL(drm_modeset_lock_crtc);

ww_mutex_lock cannot fail if ww_ctx == NULL, so please make this inline?

static inline drm_modeset_lock_crtc(...) { if (!ctx) return ww_mutex_lock(lock, 
NULL); else return __drm_modeset_lock_crtc_state(...); } or inline the latter 
too.

Reply via email to