[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-11 Thread Daniel Vetter
On Wed, Feb 10, 2016 at 02:02:46PM -0800, Stéphane Marchesin wrote: > On Wed, Feb 10, 2016 at 1:54 PM, David Herrmann > wrote: > > Hi > > > > On Wed, Feb 10, 2016 at 10:46 PM, Stéphane Marchesin > > wrote: > >> On Wed, Feb 10, 2016 at 1:38 PM, David Herrmann > >> wrote: > >>> Hi > >>> > >>>

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread David Herrmann
Hi On Wed, Feb 10, 2016 at 11:02 PM, Stéphane Marchesin wrote: > On Wed, Feb 10, 2016 at 1:54 PM, David Herrmann > wrote: If a device is unplugged, you should consider all your resources to be destroyed. There is no reason to release them manually. User-space *must* be able to

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread David Herrmann
Hi On Wed, Feb 10, 2016 at 10:46 PM, Stéphane Marchesin wrote: > On Wed, Feb 10, 2016 at 1:38 PM, David Herrmann > wrote: >> Hi >> >> On Wed, Feb 10, 2016 at 9:39 PM, Haixia Shi wrote: >>> + if (udl_device_is_unplugged(dev) && + nr !=

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread David Herrmann
Hi On Wed, Feb 10, 2016 at 10:38 PM, Haixia Shi wrote: > 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: ***

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread David Herrmann
Hi On Wed, Feb 10, 2016 at 9:39 PM, Haixia Shi wrote: > >> + if (udl_device_is_unplugged(dev) && >> + nr != DRM_IOCTL_NR(DRM_IOCTL_MODE_SETCRTC) && >> + nr != DRM_IOCTL_NR(DRM_IOCTL_MODE_RMFB) && >> + nr !=

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread David Herrmann
Hi On Wed, Feb 10, 2016 at 9:51 PM, Haixia Shi wrote: >> This should rather be: >> >> drm_release(inode, filp); >> mutex_lock(_global_mutex); >> if (!dev->open_count && udl_device_is_unplugged(dev)) >> drm_put_dev(dev); >>

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread David Herrmann
Hi On Wed, Feb 10, 2016 at 10:00 PM, Haixia Shi wrote: > Also note that it is not currently feasible for UDL code to access > drm_global_mutex. Then change this. > Please also refer to the similar comments ("FIXME: open_count is protected > by drm_global_mutex but that would lead to locking

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread Stéphane Marchesin
On Wed, Feb 10, 2016 at 1:54 PM, David Herrmann wrote: > Hi > > On Wed, Feb 10, 2016 at 10:46 PM, Stéphane Marchesin > wrote: >> On Wed, Feb 10, 2016 at 1:38 PM, David Herrmann >> wrote: >>> Hi >>> >>> On Wed, Feb 10, 2016 at 9:39 PM, Haixia Shi wrote: > + if

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread Stéphane Marchesin
On Wed, Feb 10, 2016 at 1:38 PM, David Herrmann wrote: > Hi > > On Wed, Feb 10, 2016 at 9:39 PM, Haixia Shi wrote: >> >>> + if (udl_device_is_unplugged(dev) && >>> + nr != DRM_IOCTL_NR(DRM_IOCTL_MODE_SETCRTC) && >>> + nr != DRM_IOCTL_NR(DRM_IOCTL_MODE_RMFB) &&

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread Haixia Shi
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.

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread David Herrmann
Hi On Tue, Feb 9, 2016 at 10:05 PM, Haixia Shi wrote: > Remove the general drm_device_is_unplugged() checks, and move the unplugged > flag handling logic into drm/udl. In general we want to keep driver-specific > logic out of common drm code. > > Signed-off-by: Haixia Shi > Reviewed-by:

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread Haixia Shi
Also note that it is not currently feasible for UDL code to access drm_global_mutex. Please also refer to the similar comments ("FIXME: open_count is protected by drm_global_mutex but that would lead to locking inversion with the driver load path.") in nouveau, i915 and amdgpu. On Wed, Feb 10,

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread Haixia Shi
> This should rather be: > > drm_release(inode, filp); > mutex_lock(_global_mutex); > if (!dev->open_count && udl_device_is_unplugged(dev)) > drm_put_dev(dev); > mutex_unlock(_global_mutex); > > return 0; > > There is no reason to look at the

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread Haixia Shi
> + if (udl_device_is_unplugged(dev) && > + nr != DRM_IOCTL_NR(DRM_IOCTL_MODE_SETCRTC) && > + nr != DRM_IOCTL_NR(DRM_IOCTL_MODE_RMFB) && > + nr != DRM_IOCTL_NR(DRM_IOCTL_MODE_DESTROY_DUMB)) > + return -ENODEV; > >Why? > >Just do: > >

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-10 Thread Daniel Vetter
On Tue, Feb 09, 2016 at 01:05:43PM -0800, Haixia Shi wrote: > Remove the general drm_device_is_unplugged() checks, and move the unplugged > flag handling logic into drm/udl. In general we want to keep driver-specific > logic out of common drm code. > > Signed-off-by: Haixia Shi > Reviewed-by:

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-09 Thread David Herrmann
Hi On Tue, Feb 9, 2016 at 9:45 PM, Haixia Shi wrote: > Regarding the following comment: > >> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c >> index 1ea8790..b4332d4 100644 >> --- a/drivers/gpu/drm/drm_fops.c >> +++ b/drivers/gpu/drm/drm_fops.c >> @@ -497,8 +497,6 @@ int

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-09 Thread David Herrmann
Hi On Fri, Feb 5, 2016 at 10:57 PM, Haixia Shi wrote: > Remove the general drm_device_is_unplugged() checks, and move the unplugged > flag handling logic into drm/udl. In general we want to keep driver-specific > logic out of common drm code. I like the idea of moving this hack into udl.

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-09 Thread Haixia Shi
Remove the general drm_device_is_unplugged() checks, and move the unplugged flag handling logic into drm/udl. In general we want to keep driver-specific logic out of common drm code. Signed-off-by: Haixia Shi Reviewed-by: Stéphane Marchesin --- drivers/gpu/drm/drm_drv.c | 6

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-09 Thread Haixia Shi
Regarding the following comment: > diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c > index 1ea8790..b4332d4 100644 > --- a/drivers/gpu/drm/drm_fops.c > +++ b/drivers/gpu/drm/drm_fops.c > @@ -497,8 +497,6 @@ int drm_release(struct inode *inode, struct file *filp) > >

[PATCH 2/2] drm: make unplugged flag specific to udl driver

2016-02-05 Thread Haixia Shi
Remove the general drm_device_is_unplugged() checks, and move the unplugged flag handling logic into drm/udl. In general we want to keep driver-specific logic out of common drm code. Signed-off-by: Haixia Shi Reviewed-by: Stéphane Marchesin --- drivers/gpu/drm/drm_drv.c | 6 --