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 | |
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')
-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 | ||||
-rw-r--r-- | drivers/char/sx.c | 2 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 6 |
9 files changed, 16 insertions, 15 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 | ||
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 85a23283dff5..a6e1c9ba1217 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -1467,7 +1467,7 @@ static int sx_open(struct tty_struct *tty, struct file *filp) | |||
1467 | 1467 | ||
1468 | line = tty->index; | 1468 | line = tty->index; |
1469 | sx_dprintk(SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, " | 1469 | sx_dprintk(SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, " |
1470 | "np=%d)\n", current->pid, line, tty, | 1470 | "np=%d)\n", task_pid_nr(current), line, tty, |
1471 | current->signal->tty, sx_nports); | 1471 | current->signal->tty, sx_nports); |
1472 | 1472 | ||
1473 | if ((line < 0) || (line >= SX_NPORTS) || (line >= sx_nports)) | 1473 | if ((line < 0) || (line >= SX_NPORTS) || (line >= sx_nports)) |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index e40544947135..13a53575a016 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -3530,7 +3530,7 @@ void __do_SAK(struct tty_struct *tty) | |||
3530 | do_each_pid_task(session, PIDTYPE_SID, p) { | 3530 | do_each_pid_task(session, PIDTYPE_SID, p) { |
3531 | printk(KERN_NOTICE "SAK: killed process %d" | 3531 | printk(KERN_NOTICE "SAK: killed process %d" |
3532 | " (%s): task_session_nr(p)==tty->session\n", | 3532 | " (%s): task_session_nr(p)==tty->session\n", |
3533 | p->pid, p->comm); | 3533 | task_pid_nr(p), p->comm); |
3534 | send_sig(SIGKILL, p, 1); | 3534 | send_sig(SIGKILL, p, 1); |
3535 | } while_each_pid_task(session, PIDTYPE_SID, p); | 3535 | } while_each_pid_task(session, PIDTYPE_SID, p); |
3536 | /* Now kill any processes that happen to have the | 3536 | /* Now kill any processes that happen to have the |
@@ -3540,7 +3540,7 @@ void __do_SAK(struct tty_struct *tty) | |||
3540 | if (p->signal->tty == tty) { | 3540 | if (p->signal->tty == tty) { |
3541 | printk(KERN_NOTICE "SAK: killed process %d" | 3541 | printk(KERN_NOTICE "SAK: killed process %d" |
3542 | " (%s): task_session_nr(p)==tty->session\n", | 3542 | " (%s): task_session_nr(p)==tty->session\n", |
3543 | p->pid, p->comm); | 3543 | task_pid_nr(p), p->comm); |
3544 | send_sig(SIGKILL, p, 1); | 3544 | send_sig(SIGKILL, p, 1); |
3545 | continue; | 3545 | continue; |
3546 | } | 3546 | } |
@@ -3560,7 +3560,7 @@ void __do_SAK(struct tty_struct *tty) | |||
3560 | filp->private_data == tty) { | 3560 | filp->private_data == tty) { |
3561 | printk(KERN_NOTICE "SAK: killed process %d" | 3561 | printk(KERN_NOTICE "SAK: killed process %d" |
3562 | " (%s): fd#%d opened to the tty\n", | 3562 | " (%s): fd#%d opened to the tty\n", |
3563 | p->pid, p->comm, i); | 3563 | task_pid_nr(p), p->comm, i); |
3564 | force_sig(SIGKILL, p); | 3564 | force_sig(SIGKILL, p); |
3565 | break; | 3565 | break; |
3566 | } | 3566 | } |