David

I am having trouble getting the reference to "drm_global_mutex" to link correctly in drm/udl. The error is

ERROR: "drm_global_mutex" [drivers/gpu/drm/udl/udl.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2

This seems to be only accessed in the common drm code. Do you have a suggestion how to get around it?

On Wed, Feb 10, 2016 at 1:35 PM, David Herrmann <dh.herrmann@gmail.com> wrote:
Hi

On Wed, Feb 10, 2016 at 9:51 PM, Haixia Shi <hshi@chromium.org> wrote:
>> This should rather be:
>>
>>         drm_release(inode, filp);
>>         mutex_lock(&drm_global_mutex);
>>         if (!dev->open_count && udl_device_is_unplugged(dev))
>>                 drm_put_dev(dev);
>>         mutex_unlock(&drm_global_mutex);
>>
>>         return 0;
>>
>> There is no reason to look at the return code of drm_release(), ever.
>
> But drm_release() does return a retcode. It would still make sense to return
> that as-is in case any existing code relies on it.

Nobody should ever return error codes from fops.release(). It is
completely bogus. You rather confuse generic user-space that calls
close(), than getting any benefit out of it.

But TBH, I don't care. Feel free to forward the return value. But
still, please change the order of the calls as I did.

Thanks
David