diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-18 23:40:40 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-19 11:53:43 -0700 |
commit | ba25f9dcc4ea6e30839fcab5a5516f2176d5bfed (patch) | |
tree | 3123c03b25dd5c0cd24b6ab4fc16731217838157 /drivers | |
parent | 9a2e70572e94e21e7ec4186702d045415422bda0 (diff) | |
download | op-kernel-dev-ba25f9dcc4ea6e30839fcab5a5516f2176d5bfed.zip op-kernel-dev-ba25f9dcc4ea6e30839fcab5a5516f2176d5bfed.tar.gz |
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')
-rw-r--r-- | drivers/block/nbd.c | 2 | ||||
-rw-r--r-- | drivers/cdrom/cdrom.c | 2 | ||||
-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 | ||||
-rw-r--r-- | drivers/hid/hidraw.c | 4 | ||||
-rw-r--r-- | drivers/md/md.c | 2 | ||||
-rw-r--r-- | drivers/media/video/zoran_driver.c | 4 | ||||
-rw-r--r-- | drivers/mtd/ubi/wl.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_ioctl.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_discover.c | 8 | ||||
-rw-r--r-- | drivers/usb/core/devio.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 2 |
19 files changed, 31 insertions, 30 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index cb136a9..ac4a0cb 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -188,7 +188,7 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size, if (signal_pending(current)) { siginfo_t info; printk(KERN_WARNING "nbd (pid %d: %s) got signal %d\n", - current->pid, current->comm, + task_pid_nr(current), current->comm, dequeue_signal_lock(current, ¤t->blocked, &info)); result = -EINTR; sock_shutdown(lo, !send); diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index d70745c..af05610 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -1107,7 +1107,7 @@ int open_for_data(struct cdrom_device_info * cdi) is the default case! */ cdinfo(CD_OPEN, "bummer. wrong media type.\n"); cdinfo(CD_WARNING, "pid %d must open device O_NONBLOCK!\n", - (unsigned int)current->pid); + (unsigned int)task_pid_nr(current)); ret=-EMEDIUMTYPE; goto clean_up_and_return; } diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c index 856774f..d24a6c2 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, buf = dma->buflist[idx]; if (buf->file_priv != file_priv) { DRM_ERROR("Process %d freeing buffer not owned\n", - current->pid); + task_pid_nr(current)); return -EINVAL; } drm_free_buffer(dev, buf); diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c index 72668b1..44a4626 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, ++file_priv->ioctl_count; DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", - current->pid, cmd, nr, + task_pid_nr(current), cmd, nr, (long)old_encode_dev(file_priv->head->device), file_priv->authenticated); diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c index f383fc3..3992f732 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, if (!drm_cpu_valid()) return -EINVAL; - DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); + DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor); priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES); if (!priv) @@ -244,7 +244,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, filp->private_data = priv; priv->filp = filp; priv->uid = current->euid; - priv->pid = current->pid; + priv->pid = task_pid_nr(current); priv->minor = minor; priv->head = drm_heads[minor]; priv->ioctl_count = 0; @@ -339,7 +339,8 @@ int drm_release(struct inode *inode, struct file *filp) */ DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", - current->pid, (long)old_encode_dev(file_priv->head->device), + task_pid_nr(current), + (long)old_encode_dev(file_priv->head->device), dev->open_count); 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 c6b73e7..bea2a7d 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) if (lock->context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock->context); + task_pid_nr(current), lock->context); return -EINVAL; } DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", - lock->context, current->pid, + lock->context, task_pid_nr(current), dev->lock.hw_lock->lock, lock->flags); 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) if (lock->context == DRM_KERNEL_CONTEXT) { DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock->context); + task_pid_nr(current), lock->context); return -EINVAL; } diff --git a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h index 114e54e..76e44ac 100644 --- a/drivers/char/drm/drm_os_linux.h +++ b/drivers/char/drm/drm_os_linux.h @@ -7,7 +7,7 @@ #include <linux/delay.h> /** Current process ID */ -#define DRM_CURRENTPID current->pid +#define DRM_CURRENTPID task_pid_nr(current) #define DRM_SUSER(p) capable(CAP_SYS_ADMIN) #define DRM_UDELAY(d) udelay(d) /** Read a byte from a MMIO region */ diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c index 8e841bd..eb381a7 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, retcode = i810_dma_get_buffer(dev, d, file_priv); DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n", - current->pid, retcode, d->granted); + task_pid_nr(current), retcode, d->granted); sarea_priv->last_dispatch = (int)hw_status[5]; diff --git a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c index 43a1f78..69a363e 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, retcode = i830_dma_get_buffer(dev, d, file_priv); DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n", - current->pid, retcode, d->granted); + task_pid_nr(current), retcode, d->granted); sarea_priv->last_dispatch = (int)hw_status[5]; diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 85a2328..a6e1c9b 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) line = tty->index; sx_dprintk(SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, " - "np=%d)\n", current->pid, line, tty, + "np=%d)\n", task_pid_nr(current), line, tty, current->signal->tty, sx_nports); if ((line < 0) || (line >= SX_NPORTS) || (line >= sx_nports)) diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index e405449..13a5357 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -3530,7 +3530,7 @@ void __do_SAK(struct tty_struct *tty) do_each_pid_task(session, PIDTYPE_SID, p) { printk(KERN_NOTICE "SAK: killed process %d" " (%s): task_session_nr(p)==tty->session\n", - p->pid, p->comm); + task_pid_nr(p), p->comm); send_sig(SIGKILL, p, 1); } while_each_pid_task(session, PIDTYPE_SID, p); /* Now kill any processes that happen to have the @@ -3540,7 +3540,7 @@ void __do_SAK(struct tty_struct *tty) if (p->signal->tty == tty) { printk(KERN_NOTICE "SAK: killed process %d" " (%s): task_session_nr(p)==tty->session\n", - p->pid, p->comm); + task_pid_nr(p), p->comm); send_sig(SIGKILL, p, 1); continue; } @@ -3560,7 +3560,7 @@ void __do_SAK(struct tty_struct *tty) filp->private_data == tty) { printk(KERN_NOTICE "SAK: killed process %d" " (%s): fd#%d opened to the tty\n", - p->pid, p->comm, i); + task_pid_nr(p), p->comm, i); force_sig(SIGKILL, p); break; } diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index a702e2f..1ca6f46 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -113,13 +113,13 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t if (count > HID_MIN_BUFFER_SIZE) { printk(KERN_WARNING "hidraw: pid %d passed too large report\n", - current->pid); + task_pid_nr(current)); return -EINVAL; } if (count < 2) { printk(KERN_WARNING "hidraw: pid %d passed too short report\n", - current->pid); + task_pid_nr(current)); return -EINVAL; } diff --git a/drivers/md/md.c b/drivers/md/md.c index c059ae6..808cd95 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4717,7 +4717,7 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev, void md_unregister_thread(mdk_thread_t *thread) { - dprintk("interrupting MD-thread pid %d\n", thread->tsk->pid); + dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk)); kthread_stop(thread->tsk); kfree(thread); diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 1c14fa2..419e5af 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c @@ -1285,7 +1285,7 @@ zoran_open (struct inode *inode, } dprintk(1, KERN_INFO "%s: zoran_open(%s, pid=[%d]), users(-)=%d\n", - ZR_DEVNAME(zr), current->comm, current->pid, zr->user); + ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user); /* now, create the open()-specific file_ops struct */ fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL); @@ -1358,7 +1358,7 @@ zoran_close (struct inode *inode, struct zoran *zr = fh->zr; dprintk(1, KERN_INFO "%s: zoran_close(%s, pid=[%d]), users(+)=%d\n", - ZR_DEVNAME(zr), current->comm, current->pid, zr->user); + ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user); /* kernel locks (fs/device.c), so don't do that ourselves * (prevents deadlocks) */ diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index a4f1bf3..6330c8c 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -1309,7 +1309,7 @@ static int ubi_thread(void *u) struct ubi_device *ubi = u; ubi_msg("background thread \"%s\" started, PID %d", - ubi->bgt_name, current->pid); + ubi->bgt_name, task_pid_nr(current)); set_freezable(); for (;;) { diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c index 40f516d..d8f5efc 100644 --- a/drivers/net/wireless/hostap/hostap_ioctl.c +++ b/drivers/net/wireless/hostap/hostap_ioctl.c @@ -2920,7 +2920,7 @@ static int prism2_ioctl_priv_monitor(struct net_device *dev, int *i) printk(KERN_DEBUG "%s: process %d (%s) used deprecated iwpriv monitor " "- update software to use iwconfig mode monitor\n", - dev->name, current->pid, current->comm); + dev->name, task_pid_nr(current), current->comm); /* Backward compatibility code - this can be removed at some point */ diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index 7ef0afc..5f3a0d7 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c @@ -285,7 +285,7 @@ static void sas_discover_domain(struct work_struct *work) dev = port->port_dev; SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id, - current->pid); + task_pid_nr(current)); switch (dev->dev_type) { case SAS_END_DEV: @@ -320,7 +320,7 @@ static void sas_discover_domain(struct work_struct *work) } SAS_DPRINTK("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id, - current->pid, error); + task_pid_nr(current), error); } static void sas_revalidate_domain(struct work_struct *work) @@ -334,12 +334,12 @@ static void sas_revalidate_domain(struct work_struct *work) &port->disc.pending); SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id, - current->pid); + task_pid_nr(current)); if (port->port_dev) res = sas_ex_revalidate_domain(port->port_dev); SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n", - port->id, current->pid, res); + port->id, task_pid_nr(current), res); } /* ---------- Events ---------- */ diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index f013b40..1f4f6d0 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -460,7 +460,7 @@ static int checkintf(struct dev_state *ps, unsigned int ifnum) return 0; /* if not yet claimed, claim it for the driver */ dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n", - current->pid, current->comm, ifnum); + task_pid_nr(current), current->comm, ifnum); return claimintf(ps, ifnum); } diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 73726c5..1d174dc 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c @@ -4006,7 +4006,7 @@ static int __init fsg_bind(struct usb_gadget *gadget) DBG(fsg, "removable=%d, stall=%d, buflen=%u\n", mod_data.removable, mod_data.can_stall, mod_data.buflen); - DBG(fsg, "I/O thread pid: %d\n", fsg->thread_task->pid); + DBG(fsg, "I/O thread pid: %d\n", task_pid_nr(fsg->thread_task)); set_bit(REGISTERED, &fsg->atomic_bitflags); |