<div dir="ltr"><meta http-equiv="content-type" content="text/html; charset=utf-8"><pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; ">
is this a problem? before trying to submit a solution I wanted to make sure with the experts</pre><pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; ">
<br></pre><pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; ">it seems open_count isn&#39;t locked and can cause problems</pre>
<pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; "><br></pre><pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; ">
and if it is a problem, and needs to be solved, should locking be done or is it better implemented with the (as I understand standard) kref?</pre><pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; ">
<br></pre><pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; "><br></pre><pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; ">
<font class="Apple-style-span" size="3"><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://lxr.linux.no/linux+v2.6.37/drivers/gpu/drm/drm_fops.c#L121">http://lxr.linux.no/linux+v2.6.37/drivers/gpu/drm/drm_fops.c#L121</a></font></pre>
<pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; "><font class="Apple-style-span" size="3">int drm_open(struct inode *inode, struct file *filp)
{
..&lt;no lock&gt;..

        retcode = drm_open_helper(inode, filp, dev);
        if (!retcode) {
                atomic_inc(&amp;dev-&gt;counts[_DRM_STAT_OPENS]);
                if (!dev-&gt;open_count++)
                        retcode = drm_setup(dev);
        }</font></pre><pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; "><font class="Apple-style-span" size="3">..
}<br></font></pre><pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; "><font class="Apple-style-span" size="3"><br>
</font></pre><pre class="done" id="17/88/29e7845b5ab8147f8705caabf417931353e4_3/0" style="margin-left: 0px; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; "><font class="Apple-style-span" size="3">int drm_release(struct inode *inode, struct file *filp)
{
..&lt;global lock&gt;..
        if (!--dev-&gt;open_count) {
                if (atomic_read(&amp;dev-&gt;ioctl_count)) {
                        DRM_ERROR(&quot;Device busy: %d\n&quot;,
                                  atomic_read(&amp;dev-&gt;ioctl_count));
                        retcode = -EBUSY;
                } else
                        retcode = drm_lastclose(dev);
        }
        mutex_unlock(&amp;drm_global_mutex);
}</font></pre></div>