diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-19 02:40:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 14:53:43 -0400 |
commit | ba25f9dcc4ea6e30839fcab5a5516f2176d5bfed (patch) | |
tree | 3123c03b25dd5c0cd24b6ab4fc16731217838157 /drivers/char/drm | |
parent | 9a2e70572e94e21e7ec4186702d045415422bda0 (diff) |
Use helpers to obtain task pid in printks
The task_struct->pid member is going to be deprecated, so start
using the helpers (task_pid_nr/task_pid_vnr/task_pid_nr_ns) in
the kernel.
The first thing to start with is the pid, printed to dmesg - in
this case we may safely use task_pid_nr(). Besides, printks produce
more (much more) than a half of all the explicit pid usage.
[akpm@linux-foundation.org: git-drm went and changed lots of stuff]
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/drm')
-rw-r--r-- | drivers/char/drm/drm_bufs.c | 2 | ||||
-rw-r--r-- | drivers/char/drm/drm_drv.c | 2 | ||||
-rw-r--r-- | drivers/char/drm/drm_fops.c | 7 | ||||
-rw-r--r-- | drivers/char/drm/drm_lock.c | 6 | ||||
-rw-r--r-- | drivers/char/drm/drm_os_linux.h | 2 | ||||
-rw-r--r-- | drivers/char/drm/i810_dma.c | 2 | ||||
-rw-r--r-- | drivers/char/drm/i830_dma.c | 2 |
7 files changed, 12 insertions, 11 deletions
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c index 856774fbe025..d24a6c2c2c24 100644 --- a/drivers/char/drm/drm_bufs.c +++ b/drivers/char/drm/drm_bufs.c | |||
@@ -1456,7 +1456,7 @@ int drm_freebufs(struct drm_device *dev, void *data, | |||
1456 | buf = dma->buflist[idx]; | 1456 | buf = dma->buflist[idx]; |
1457 | if (buf->file_priv != file_priv) { | 1457 | if (buf->file_priv != file_priv) { |
1458 | DRM_ERROR("Process %d freeing buffer not owned\n", | 1458 | DRM_ERROR("Process %d freeing buffer not owned\n", |
1459 | current->pid); | 1459 | task_pid_nr(current)); |
1460 | return -EINVAL; | 1460 | return -EINVAL; |
1461 | } | 1461 | } |
1462 | drm_free_buffer(dev, buf); | 1462 | drm_free_buffer(dev, buf); |
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c index 72668b15e5ce..44a46268b02b 100644 --- a/drivers/char/drm/drm_drv.c +++ b/drivers/char/drm/drm_drv.c | |||
@@ -463,7 +463,7 @@ int drm_ioctl(struct inode *inode, struct file *filp, | |||
463 | ++file_priv->ioctl_count; | 463 | ++file_priv->ioctl_count; |
464 | 464 | ||
465 | DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", | 465 | DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", |
466 | current->pid, cmd, nr, | 466 | task_pid_nr(current), cmd, nr, |
467 | (long)old_encode_dev(file_priv->head->device), | 467 | (long)old_encode_dev(file_priv->head->device), |
468 | file_priv->authenticated); | 468 | file_priv->authenticated); |
469 | 469 | ||
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c index f383fc37190c..3992f73299cc 100644 --- a/drivers/char/drm/drm_fops.c +++ b/drivers/char/drm/drm_fops.c | |||
@@ -234,7 +234,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, | |||
234 | if (!drm_cpu_valid()) | 234 | if (!drm_cpu_valid()) |
235 | return -EINVAL; | 235 | return -EINVAL; |
236 | 236 | ||
237 | DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); | 237 | DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor); |
238 | 238 | ||
239 | priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES); | 239 | priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES); |
240 | if (!priv) | 240 | if (!priv) |
@@ -244,7 +244,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, | |||
244 | filp->private_data = priv; | 244 | filp->private_data = priv; |
245 | priv->filp = filp; | 245 | priv->filp = filp; |
246 | priv->uid = current->euid; | 246 | priv->uid = current->euid; |
247 | priv->pid = current->pid; | 247 | priv->pid = task_pid_nr(current); |
248 | priv->minor = minor; | 248 | priv->minor = minor; |
249 | priv->head = drm_heads[minor]; | 249 | priv->head = drm_heads[minor]; |
250 | priv->ioctl_count = 0; | 250 | priv->ioctl_count = 0; |
@@ -339,7 +339,8 @@ int drm_release(struct inode *inode, struct file *filp) | |||
339 | */ | 339 | */ |
340 | 340 | ||
341 | DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", | 341 | DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", |
342 | current->pid, (long)old_encode_dev(file_priv->head->device), | 342 | task_pid_nr(current), |
343 | (long)old_encode_dev(file_priv->head->device), | ||
343 | dev->open_count); | 344 | dev->open_count); |
344 | 345 | ||
345 | if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) { | 346 | if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) { |
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c index c6b73e744d67..bea2a7d5b2b2 100644 --- a/drivers/char/drm/drm_lock.c +++ b/drivers/char/drm/drm_lock.c | |||
@@ -58,12 +58,12 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
58 | 58 | ||
59 | if (lock->context == DRM_KERNEL_CONTEXT) { | 59 | if (lock->context == DRM_KERNEL_CONTEXT) { |
60 | DRM_ERROR("Process %d using kernel context %d\n", | 60 | DRM_ERROR("Process %d using kernel context %d\n", |
61 | current->pid, lock->context); | 61 | task_pid_nr(current), lock->context); |
62 | return -EINVAL; | 62 | return -EINVAL; |
63 | } | 63 | } |
64 | 64 | ||
65 | DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", | 65 | DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", |
66 | lock->context, current->pid, | 66 | lock->context, task_pid_nr(current), |
67 | dev->lock.hw_lock->lock, lock->flags); | 67 | dev->lock.hw_lock->lock, lock->flags); |
68 | 68 | ||
69 | if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)) | 69 | if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)) |
@@ -153,7 +153,7 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) | |||
153 | 153 | ||
154 | if (lock->context == DRM_KERNEL_CONTEXT) { | 154 | if (lock->context == DRM_KERNEL_CONTEXT) { |
155 | DRM_ERROR("Process %d using kernel context %d\n", | 155 | DRM_ERROR("Process %d using kernel context %d\n", |
156 | current->pid, lock->context); | 156 | task_pid_nr(current), lock->context); |
157 | return -EINVAL; | 157 | return -EINVAL; |
158 | } | 158 | } |
159 | 159 | ||
diff --git a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h index 114e54e0f61b..76e44ac94fb5 100644 --- a/drivers/char/drm/drm_os_linux.h +++ b/drivers/char/drm/drm_os_linux.h | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <linux/delay.h> | 7 | #include <linux/delay.h> |
8 | 8 | ||
9 | /** Current process ID */ | 9 | /** Current process ID */ |
10 | #define DRM_CURRENTPID current->pid | 10 | #define DRM_CURRENTPID task_pid_nr(current) |
11 | #define DRM_SUSER(p) capable(CAP_SYS_ADMIN) | 11 | #define DRM_SUSER(p) capable(CAP_SYS_ADMIN) |
12 | #define DRM_UDELAY(d) udelay(d) | 12 | #define DRM_UDELAY(d) udelay(d) |
13 | /** Read a byte from a MMIO region */ | 13 | /** Read a byte from a MMIO region */ |
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c index 8e841bdee6dc..eb381a7c5bee 100644 --- a/drivers/char/drm/i810_dma.c +++ b/drivers/char/drm/i810_dma.c | |||
@@ -1024,7 +1024,7 @@ static int i810_getbuf(struct drm_device *dev, void *data, | |||
1024 | retcode = i810_dma_get_buffer(dev, d, file_priv); | 1024 | retcode = i810_dma_get_buffer(dev, d, file_priv); |
1025 | 1025 | ||
1026 | DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n", | 1026 | DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n", |
1027 | current->pid, retcode, d->granted); | 1027 | task_pid_nr(current), retcode, d->granted); |
1028 | 1028 | ||
1029 | sarea_priv->last_dispatch = (int)hw_status[5]; | 1029 | sarea_priv->last_dispatch = (int)hw_status[5]; |
1030 | 1030 | ||
diff --git a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c index 43a1f78712d6..69a363edb0d2 100644 --- a/drivers/char/drm/i830_dma.c +++ b/drivers/char/drm/i830_dma.c | |||
@@ -1409,7 +1409,7 @@ static int i830_getbuf(struct drm_device *dev, void *data, | |||
1409 | retcode = i830_dma_get_buffer(dev, d, file_priv); | 1409 | retcode = i830_dma_get_buffer(dev, d, file_priv); |
1410 | 1410 | ||
1411 | DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n", | 1411 | DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n", |
1412 | current->pid, retcode, d->granted); | 1412 | task_pid_nr(current), retcode, d->granted); |
1413 | 1413 | ||
1414 | sarea_priv->last_dispatch = (int)hw_status[5]; | 1414 | sarea_priv->last_dispatch = (int)hw_status[5]; |
1415 | 1415 | ||