mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-20 17:30:09 +01:00
BSD: simplify drm_ioctl() after other refactoring.
This commit is contained in:
parent
4cdd871e90
commit
a9ee144eab
1 changed files with 6 additions and 15 deletions
|
|
@ -821,14 +821,7 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
||||||
int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
|
int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
|
||||||
DRM_STRUCTPROC *p)
|
DRM_STRUCTPROC *p)
|
||||||
{
|
{
|
||||||
#ifdef __FreeBSD__
|
drm_device_t *dev = drm_get_device_from_kdev(kdev);
|
||||||
drm_device_t *dev = kdev->si_drv1;
|
|
||||||
#elif defined(__NetBSD__)
|
|
||||||
drm_device_t *dev = device_lookup(&drm_cd, minor(kdev));
|
|
||||||
#else
|
|
||||||
drm_device_t *dev = device_lookup(&drm_cd,
|
|
||||||
minor(kdev)))->dv_cfdata->cf_driver->cd_devs[minor(kdev)];
|
|
||||||
#endif
|
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
drm_ioctl_desc_t *ioctl;
|
drm_ioctl_desc_t *ioctl;
|
||||||
int (*func)(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int (*func)(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
||||||
|
|
@ -915,15 +908,13 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
|
||||||
((ioctl->flags & DRM_MASTER) && !file_priv->master))
|
((ioctl->flags & DRM_MASTER) && !file_priv->master))
|
||||||
return EACCES;
|
return EACCES;
|
||||||
|
|
||||||
if (is_driver_ioctl)
|
|
||||||
DRM_LOCK();
|
|
||||||
retcode = func(dev, data, file_priv);
|
|
||||||
if (is_driver_ioctl) {
|
if (is_driver_ioctl) {
|
||||||
|
DRM_LOCK();
|
||||||
|
/* shared code returns -errno */
|
||||||
|
retcode = -func(dev, data, file_priv);
|
||||||
DRM_UNLOCK();
|
DRM_UNLOCK();
|
||||||
/* Driver ioctls in shared code follow the linux convention of
|
} else {
|
||||||
* returning -errno instead of errno.
|
retcode = func(dev, data, file_priv);
|
||||||
*/
|
|
||||||
retcode = -retcode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retcode != 0)
|
if (retcode != 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue