Re: [PATCH] iuu_phoenix new driver proposal for review and comments

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Am Mittwoch 18 Juli 2007 schrieb eczema:
> +       if ((set == 0) && priv->TIOSTATUS == TIOCM_RTS) {
> +               dbg("%s TIOCMSET RESET called !!!", __FUNCTION__);
> +               priv->TIOSTATUS = 0;
> +               if (iuu_reset(port, 0x0C))
> +                       return -EIO;
> +               current->state = TASK_INTERRUPTIBLE;
> +               schedule_timeout(1 + 500 * HZ / 1000);

If you are really interrupted, you'll break the time requirements.

+static int iuu_tiocmget(struct usb_serial_port *port, struct file *file)
+{
+       u8 *st;
+       st = kmalloc(sizeof(u8), GFP_KERNEL);
+       iuu_status(port, st);

kmalloc() can fail.

+       if (st[0] & IUU_FULLCARD_IN) {
+               dbg("%s  card present ! value returned %i ", __FUNCTION__,
+                   TIOCM_CD);
+               kfree(st);
+               return 0;
+       } else {
+               kfree(st);
+               return TIOCM_CD;
+       }

You might unify the cleanup

+iuu_ioctl(struct usb_serial_port *port, struct file *file, unsigned int cmd,
+         unsigned long arg)
+{
+
+       int mask;
+
+       dbg("%s (%d) cmd = 0x%04x", __FUNCTION__, port->number, cmd);
+
+       get_user(mask, (unsigned long *)arg);

This can fail

+       case TCFLSH:
+               return (-1);

Meaning what?

+       if (priv->write_busy)
+               return -1;

What for if you don't ever read write_busy?

+       tty->low_latency = 1;

Should be done in probe()

+       dbg("%s -  port %d", __FUNCTION__, port->number);
+       usb_clear_halt(serial->dev, port->write_urb->pipe);
+       usb_clear_halt(serial->dev, port->read_urb->pipe);

Is this really needed?


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.