From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesse Barnes Subject: Re: [PATCH 1/2] drm/i915: make backlight functions take a connector v3 Date: Fri, 11 Oct 2013 14:34:35 -0700 Message-ID: <20131011143435.609795d3@jbarnes-desktop> References: <1381516314-6007-1-git-send-email-jbarnes@virtuousgeek.org> <20131011213110.GJ8303@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from oproxy13-pub.mail.unifiedlayer.com (oproxy13-pub.mail.unifiedlayer.com [69.89.16.30]) by gabe.freedesktop.org (Postfix) with SMTP id BF11DE6839 for ; Fri, 11 Oct 2013 14:34:30 -0700 (PDT) In-Reply-To: <20131011213110.GJ8303@phenom.ffwll.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Daniel Vetter Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Fri, 11 Oct 2013 23:31:10 +0200 Daniel Vetter wrote: > On Fri, Oct 11, 2013 at 11:31:53AM -0700, Jesse Barnes wrote: > > [snip] > > > static int intel_panel_get_brightness(struct backlight_device *bd) > > { > > - struct drm_device *dev = bl_get_data(bd); > > - return intel_panel_get_backlight(dev); > > + struct intel_connector *connector = bl_get_data(bd); > > + struct drm_device *dev = connector->base.dev; > > + enum pipe pipe; > > + int ret = 0; > > + > > + mutex_lock(&dev->mode_config.mutex); > > + pipe = intel_get_pipe_from_connector(connector); > > + mutex_unlock(&dev->mode_config.mutex); > > + if (pipe == INVALID_PIPE) { > > + ret = 0; > > + goto out_unlock; > > + } > > + > > + ret = intel_panel_get_backlight(connector->base.dev, pipe); > > +out_unlock: > > + mutex_unlock(&dev->mode_config.mutex); > > I see mutex_unlock(&dev->mode_config.mutex) twice here. I think you've > just volunteered yourselve for some testcases ;-) > > Ideas: > - Make sure all lvds/edp connectors are enabled and bash on all backlight > interfaces (with igt_fork it's easy to do that concurrently). > - Race the above with output changes: dpms on/off and changing the crtc > around. > - Race the above with system suspend for bonus points (can be completely > stitched together from igt helpers). Sorry can't volunteer for that now, but those sound like good tests to write. I'll fix up the patch, we don't need to make double sure the lock is unlocked do we? and test locally and re-send. -- Jesse Barnes, Intel Open Source Technology Center