From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maarten Lankhorst Subject: Re: [RFCv3 11/14] drm: convert crtc to properties/state Date: Thu, 21 Nov 2013 15:25:40 +0100 Message-ID: <528E17E4.7060109@canonical.com> References: <1384980493-25499-1-git-send-email-robdclark@gmail.com> <1384980493-25499-12-git-send-email-robdclark@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B2A5FD7DE for ; Thu, 21 Nov 2013 06:25:41 -0800 (PST) In-Reply-To: <1384980493-25499-12-git-send-email-robdclark@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org To: Rob Clark , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org 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.