[PARPORT] [PATCH] [TRIVIAL] {2.4.19, 2.5.31}/drivers/char/lp.c

From: Lucas Correia Villa Real (lucasvr@terra.com.br)
Date: Sun Aug 25 2002 - 13:46:26 EDT

  • Next message: Moritz Barsnick: "[PARPORT] [NOTE] [TRIVIAL] (Was: Re: [PARPORT] [PATCH] [TRIVIAL] {2.4.19, 2.5.31}/drivers/char/lp.c)"

    Avoid +/- operations with 0 and explicit some debug information as KERN_INFO or
    KERN_ERR. Follows patch for both 2.4.19 and 2.5.31

    Lucas C. Villa Real

    --- linux-2.4.19/drivers/char/lp.c.orig 2002-08-21 01:28:52.000000000 -0300
    +++ linux-2.4.19/drivers/char/lp.c 2002-08-21 01:30:40.000000000 -0300
    @@ -335,7 +335,7 @@
            do {
                    /* Write the data. */
                    written = parport_write (port, kbuf, copy_size);
    - if (written >= 0) {
    + if (written > 0) {
                            copy_size -= written;
                            count -= written;
                            buf += written;
    @@ -843,7 +843,7 @@
                        port->probe_info[0].class != PARPORT_CLASS_PRINTER)
                            return;
                    if (lp_count == LP_NO) {
    - printk("lp: ignoring parallel port (max. %d)\n",LP_NO);
    + printk(KERN_INFO "lp: ignoring parallel port (max. %d)\n",LP_NO);
                            return;
                    }
                    if (!lp_register(lp_count, port))
    @@ -907,14 +907,14 @@
            }

            if (devfs_register_chrdev (LP_MAJOR, "lp", &lp_fops)) {
    - printk ("lp: unable to get major %d\n", LP_MAJOR);
    + printk (KERN_ERR "lp: unable to get major %d\n", LP_MAJOR);
                    return -EIO;
            }

            devfs_handle = devfs_mk_dir (NULL, "printers", NULL);

            if (parport_register_driver (&lp_driver)) {
    - printk ("lp: unable to register with parport\n");
    + printk (KERN_ERR "lp: unable to register with parport\n");
                    return -EIO;
            }

    --- linux-2.5.31/drivers/char/lp.c.orig 2002-08-21 01:39:36.000000000 -0300
    +++ linux-2.5.31/drivers/char/lp.c 2002-08-21 01:36:51.000000000 -0300
    @@ -335,7 +335,7 @@
            do {
                    /* Write the data. */
                    written = parport_write (port, kbuf, copy_size);
    - if (written >= 0) {
    + if (written > 0) {
                            copy_size -= written;
                            count -= written;
                            buf += written;
    @@ -840,7 +840,7 @@
                        port->probe_info[0].class != PARPORT_CLASS_PRINTER)
                            return;
                    if (lp_count == LP_NO) {
    - printk("lp: ignoring parallel port (max. %d)\n",LP_NO);
    + printk(KERN_INFO "lp: ignoring parallel port (max. %d)\n",LP_NO);
                            return;
                    }
                    if (!lp_register(lp_count, port))
    @@ -904,14 +904,14 @@
            }

            if (register_chrdev (LP_MAJOR, "lp", &lp_fops)) {
    - printk ("lp: unable to get major %d\n", LP_MAJOR);
    + printk (KERN_ERR "lp: unable to get major %d\n", LP_MAJOR);
                    return -EIO;
            }

            devfs_handle = devfs_mk_dir (NULL, "printers", NULL);

            if (parport_register_driver (&lp_driver)) {
    - printk ("lp: unable to register with parport\n");
    + printk (KERN_ERR "lp: unable to register with parport\n");
                    return -EIO;
            }

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Sun Aug 25 2002 - 13:45:36 EDT