From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maarten Lankhorst Subject: [PATCH] drm: call drm_device_set_unplugged in drm_put_dev Date: Thu, 07 Mar 2013 17:45:42 +0100 Message-ID: <5138C436.8000006@canonical.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 D32F9E6482 for ; Thu, 7 Mar 2013 08:45:44 -0800 (PST) Received: from 5ed48cef.cm-7-5c.dynamic.ziggo.nl ([94.212.140.239] helo=[192.168.1.128]) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1UDdwt-0007iT-LQ for dri-devel@lists.freedesktop.org; Thu, 07 Mar 2013 16:45:43 +0000 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: "dri-devel@lists.freedesktop.org" List-Id: dri-devel@lists.freedesktop.org This prevents the device from being reopened after drm_put_dev is called. Signed-off-by: Maarten Lankhorst driver; + drm_device_set_unplugged(dev); + drm_lastclose(dev); if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) && @@ -499,11 +501,10 @@ void drm_unplug_dev(struct drm_device *dev) mutex_lock(&drm_global_mutex); - drm_device_set_unplugged(dev); - - if (dev->open_count == 0) { + if (dev->open_count) + drm_device_set_unplugged(dev); + else drm_put_dev(dev); - } mutex_unlock(&drm_global_mutex); } EXPORT_SYMBOL(drm_unplug_dev);