Re: [PATCH] USB: add USB serial ssu100 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Donnerstag, 29. Juli 2010, 17:05:41 schrieb Bill Pemberton:
> +static int ssu100_ioctl(struct tty_struct *tty, struct file *file,
> +                   unsigned int cmd, unsigned long arg)
> +{
> +       struct usb_serial_port *port = tty->driver_data;
> +       struct ssu100_port_private *priv = usb_get_serial_port_data(port);
> +
> +       dbg("%s cmd 0x%04x", __func__, cmd);
> +
> +       switch (cmd) {
> +       case TIOCGSERIAL:
> +               return get_serial_info(port,
> +                                      (struct serial_struct __user *) arg);
> +
> +       case TIOCMIWAIT:
> +               while (priv != NULL) {
> +                       u8 prevMSR = priv->shadowMSR & SERIAL_MSR_MASK;
> +                       interruptible_sleep_on(&priv->delta_msr_wait);

This won't fly

1. you have no guarantee that the packet that would wake you up hasn't arrived
by the time you go to sleep. Use a proper wait_event_ macro
2. you need to handle disconnection

	Regards
		Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux