*   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
 #include <linux/module.h>
        /* First of all we get the time stamp... */
        pps_get_ts(&ts);
 
-       pr_info("PPS event at %lu\n", jiffies);
+       dev_info(pps->dev, "PPS event at %lu\n", jiffies);
 
        pps_event(pps, &ts, PPS_CAPTUREASSERT, NULL);
 
        pps = pps_register_source(&pps_ktimer_info,
                                PPS_CAPTUREASSERT | PPS_OFFSETASSERT);
        if (pps == NULL) {
-               printk(KERN_ERR "cannot register ktimer source\n");
+               pr_err("cannot register PPS source\n");
                return -ENOMEM;
        }
 
 
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
 #include <linux/module.h>
 
        /* Sanity checks */
        if ((info->mode & default_params) != default_params) {
-               printk(KERN_ERR "pps: %s: unsupported default parameters\n",
+               pr_err("%s: unsupported default parameters\n",
                                        info->name);
                err = -EINVAL;
                goto pps_register_source_exit;
        }
        if ((info->mode & (PPS_ECHOASSERT | PPS_ECHOCLEAR)) != 0 &&
                        info->echo == NULL) {
-               printk(KERN_ERR "pps: %s: echo function is not defined\n",
+               pr_err("%s: echo function is not defined\n",
                                        info->name);
                err = -EINVAL;
                goto pps_register_source_exit;
        }
        if ((info->mode & (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)) == 0) {
-               printk(KERN_ERR "pps: %s: unspecified time format\n",
+               pr_err("%s: unspecified time format\n",
                                        info->name);
                err = -EINVAL;
                goto pps_register_source_exit;
        if (id >= PPS_MAX_SOURCES) {
                spin_unlock_irq(&pps_idr_lock);
 
-               printk(KERN_ERR "pps: %s: too many PPS sources in the system\n",
+               pr_err("%s: too many PPS sources in the system\n",
                                        info->name);
                err = -EBUSY;
                goto free_idr;
        /* Create the char device */
        err = pps_register_cdev(pps);
        if (err < 0) {
-               printk(KERN_ERR "pps: %s: unable to create char device\n",
+               pr_err("%s: unable to create char device\n",
                                        info->name);
                goto free_idr;
        }
 
-       pr_info("new PPS source %s at ID %d\n", info->name, id);
+       dev_info(pps->dev, "new PPS source %s\n", info->name);
 
        return pps;
 
        kfree(pps);
 
 pps_register_source_exit:
-       printk(KERN_ERR "pps: %s: unable to register source\n", info->name);
+       pr_err("%s: unable to register source\n", info->name);
 
        return NULL;
 }
 
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
 #include <linux/module.h>
 
        switch (cmd) {
        case PPS_GETPARAMS:
-               pr_debug("PPS_GETPARAMS: source %d\n", pps->id);
+               dev_dbg(pps->dev, "PPS_GETPARAMS\n");
 
                spin_lock_irq(&pps->lock);
 
                break;
 
        case PPS_SETPARAMS:
-               pr_debug("PPS_SETPARAMS: source %d\n", pps->id);
+               dev_dbg(pps->dev, "PPS_SETPARAMS\n");
 
                /* Check the capabilities */
                if (!capable(CAP_SYS_TIME))
                if (err)
                        return -EFAULT;
                if (!(params.mode & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR))) {
-                       pr_debug("capture mode unspecified (%x)\n",
+                       dev_dbg(pps->dev, "capture mode unspecified (%x)\n",
                                                                params.mode);
                        return -EINVAL;
                }
 
                /* Check for supported capabilities */
                if ((params.mode & ~pps->info.mode) != 0) {
-                       pr_debug("unsupported capabilities (%x)\n",
+                       dev_dbg(pps->dev, "unsupported capabilities (%x)\n",
                                                                params.mode);
                        return -EINVAL;
                }
                /* Restore the read only parameters */
                if ((params.mode & (PPS_TSFMT_TSPEC | PPS_TSFMT_NTPFP)) == 0) {
                        /* section 3.3 of RFC 2783 interpreted */
-                       pr_debug("time format unspecified (%x)\n",
+                       dev_dbg(pps->dev, "time format unspecified (%x)\n",
                                                                params.mode);
                        pps->params.mode |= PPS_TSFMT_TSPEC;
                }
                break;
 
        case PPS_GETCAP:
-               pr_debug("PPS_GETCAP: source %d\n", pps->id);
+               dev_dbg(pps->dev, "PPS_GETCAP\n");
 
                err = put_user(pps->info.mode, iuarg);
                if (err)
                struct pps_fdata fdata;
                unsigned int ev;
 
-               pr_debug("PPS_FETCH: source %d\n", pps->id);
+               dev_dbg(pps->dev, "PPS_FETCH\n");
 
                err = copy_from_user(&fdata, uarg, sizeof(struct pps_fdata));
                if (err)
                else {
                        unsigned long ticks;
 
-                       pr_debug("timeout %lld.%09d\n",
+                       dev_dbg(pps->dev, "timeout %lld.%09d\n",
                                        (long long) fdata.timeout.sec,
                                        fdata.timeout.nsec);
                        ticks = fdata.timeout.sec * HZ;
 
                /* Check for pending signals */
                if (err == -ERESTARTSYS) {
-                       pr_debug("pending signal caught\n");
+                       dev_dbg(pps->dev, "pending signal caught\n");
                        return -EINTR;
                }
 
 
        err = cdev_add(&pps->cdev, devt, 1);
        if (err) {
-               printk(KERN_ERR "pps: %s: failed to add char device %d:%d\n",
+               pr_err("%s: failed to add char device %d:%d\n",
                                pps->info.name, MAJOR(pps_devt), pps->id);
                return err;
        }
 
        pps_class = class_create(THIS_MODULE, "pps");
        if (!pps_class) {
-               printk(KERN_ERR "pps: failed to allocate class\n");
+               pr_err("failed to allocate class\n");
                return -ENOMEM;
        }
        pps_class->dev_attrs = pps_attrs;
 
        err = alloc_chrdev_region(&pps_devt, 0, PPS_MAX_SOURCES, "pps");
        if (err < 0) {
-               printk(KERN_ERR "pps: failed to allocate char device region\n");
+               pr_err("failed to allocate char device region\n");
                goto remove_class;
        }