diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-20 11:42:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-20 11:42:48 -0400 |
commit | 5cab3856e76f4e6dd44731cea054021105e3e02d (patch) | |
tree | 0fce18d11071276dac994765ffc35248438edab2 /drivers/gpu | |
parent | 2edbdd1266784495979576c4ab4ef294c29bad27 (diff) | |
parent | 59de2bebabc5027f93df999d59cc65df591c3e6e (diff) |
Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
agp: zero pages before sending to userspace
drm: check for minor master before allowing drop master.
drm: set/clear is_master when master changed
drm: clean dirty memory after device release
drm: count reaches -1
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/drm_stub.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_sysfs.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/via/via_dma.c | 12 |
3 files changed, 18 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index d009661781bc..ef878615c49f 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -159,6 +159,9 @@ void drm_master_put(struct drm_master **master) | |||
159 | int drm_setmaster_ioctl(struct drm_device *dev, void *data, | 159 | int drm_setmaster_ioctl(struct drm_device *dev, void *data, |
160 | struct drm_file *file_priv) | 160 | struct drm_file *file_priv) |
161 | { | 161 | { |
162 | if (file_priv->is_master) | ||
163 | return 0; | ||
164 | |||
162 | if (file_priv->minor->master && file_priv->minor->master != file_priv->master) | 165 | if (file_priv->minor->master && file_priv->minor->master != file_priv->master) |
163 | return -EINVAL; | 166 | return -EINVAL; |
164 | 167 | ||
@@ -169,6 +172,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, | |||
169 | file_priv->minor->master != file_priv->master) { | 172 | file_priv->minor->master != file_priv->master) { |
170 | mutex_lock(&dev->struct_mutex); | 173 | mutex_lock(&dev->struct_mutex); |
171 | file_priv->minor->master = drm_master_get(file_priv->master); | 174 | file_priv->minor->master = drm_master_get(file_priv->master); |
175 | file_priv->is_master = 1; | ||
172 | mutex_unlock(&dev->struct_mutex); | 176 | mutex_unlock(&dev->struct_mutex); |
173 | } | 177 | } |
174 | 178 | ||
@@ -178,10 +182,15 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, | |||
178 | int drm_dropmaster_ioctl(struct drm_device *dev, void *data, | 182 | int drm_dropmaster_ioctl(struct drm_device *dev, void *data, |
179 | struct drm_file *file_priv) | 183 | struct drm_file *file_priv) |
180 | { | 184 | { |
181 | if (!file_priv->master) | 185 | if (!file_priv->is_master) |
182 | return -EINVAL; | 186 | return -EINVAL; |
187 | |||
188 | if (!file_priv->minor->master) | ||
189 | return -EINVAL; | ||
190 | |||
183 | mutex_lock(&dev->struct_mutex); | 191 | mutex_lock(&dev->struct_mutex); |
184 | drm_master_put(&file_priv->minor->master); | 192 | drm_master_put(&file_priv->minor->master); |
193 | file_priv->is_master = 0; | ||
185 | mutex_unlock(&dev->struct_mutex); | 194 | mutex_unlock(&dev->struct_mutex); |
186 | return 0; | 195 | return 0; |
187 | } | 196 | } |
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index bc0c6849360c..022876ae34f0 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
@@ -132,6 +132,7 @@ void drm_sysfs_destroy(void) | |||
132 | */ | 132 | */ |
133 | static void drm_sysfs_device_release(struct device *dev) | 133 | static void drm_sysfs_device_release(struct device *dev) |
134 | { | 134 | { |
135 | memset(dev, 0, sizeof(struct device)); | ||
135 | return; | 136 | return; |
136 | } | 137 | } |
137 | 138 | ||
diff --git a/drivers/gpu/drm/via/via_dma.c b/drivers/gpu/drm/via/via_dma.c index 7a339dba6a69..bfb92d283260 100644 --- a/drivers/gpu/drm/via/via_dma.c +++ b/drivers/gpu/drm/via/via_dma.c | |||
@@ -481,11 +481,13 @@ static int via_wait_idle(drm_via_private_t * dev_priv) | |||
481 | { | 481 | { |
482 | int count = 10000000; | 482 | int count = 10000000; |
483 | 483 | ||
484 | while (!(VIA_READ(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && count--); | 484 | while (!(VIA_READ(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && --count) |
485 | ; | ||
485 | 486 | ||
486 | while (count-- && (VIA_READ(VIA_REG_STATUS) & | 487 | while (count && (VIA_READ(VIA_REG_STATUS) & |
487 | (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | | 488 | (VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY | |
488 | VIA_3D_ENG_BUSY))) ; | 489 | VIA_3D_ENG_BUSY))) |
490 | --count; | ||
489 | return count; | 491 | return count; |
490 | } | 492 | } |
491 | 493 | ||
@@ -705,7 +707,7 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file * | |||
705 | switch (d_siz->func) { | 707 | switch (d_siz->func) { |
706 | case VIA_CMDBUF_SPACE: | 708 | case VIA_CMDBUF_SPACE: |
707 | while (((tmp_size = via_cmdbuf_space(dev_priv)) < d_siz->size) | 709 | while (((tmp_size = via_cmdbuf_space(dev_priv)) < d_siz->size) |
708 | && count--) { | 710 | && --count) { |
709 | if (!d_siz->wait) { | 711 | if (!d_siz->wait) { |
710 | break; | 712 | break; |
711 | } | 713 | } |
@@ -717,7 +719,7 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file * | |||
717 | break; | 719 | break; |
718 | case VIA_CMDBUF_LAG: | 720 | case VIA_CMDBUF_LAG: |
719 | while (((tmp_size = via_cmdbuf_lag(dev_priv)) > d_siz->size) | 721 | while (((tmp_size = via_cmdbuf_lag(dev_priv)) > d_siz->size) |
720 | && count--) { | 722 | && --count) { |
721 | if (!d_siz->wait) { | 723 | if (!d_siz->wait) { |
722 | break; | 724 | break; |
723 | } | 725 | } |