Re: Regarding USB-Serial Device driver

From: Greg KH
Date: Tue Aug 31 2010 - 00:05:12 EST


On Thu, Aug 26, 2010 at 03:20:06PM +0530, raj uprade wrote:
> Hi Greg,
>
> >
> >
> > > Again, please use a more modern kernel version, and then, please show
> > the exact diff (in 'diff -u' format) that you made.
> >
> > Below is the diff -u of changes made in pl2303.c
>
> --- /home/teleset/Zip_file/linux-2.6.26/drivers/usb/serial/pl2303.c
> 2010-07-29 15:13:47.000000000 +0530
> +++ /home/teleset/Desktop/pl2303.c 2010-08-26 15:11:04.000000000 +0530
> @@ -469,12 +469,25 @@
> if (!count)
> return count;
>
> + spin_lock_irqsave(&priv->lock, flags);
> + priv->line_control |= (CONTROL_DTR | CONTROL_RTS);
> + control = priv->line_control;
> + spin_unlock_irqrestore(&priv->lock, flags);
> + set_control_lines(port->serial->dev, control);
> +
> spin_lock_irqsave(&priv->lock, flags);
> count = pl2303_buf_put(priv->buf, buf, count);
> spin_unlock_irqrestore(&priv->lock, flags);
> -
> +
> pl2303_send(port);
>
> + mdelay(5);
> + spin_lock_irqsave(&priv->lock, flags);
> + priv->line_control = 0;
> + control = priv->line_control;
> + spin_unlock_irqrestore(&priv->lock, flags);
> + set_control_lines(port->serial->dev,control);
> +
> return count;
> }

I don't even recall what you were trying to do here, sorry. Please
include more context in your emails, we get a lot of them.

Also, what function was this change made in?

I don't think such a quick line control change is going to do what you
think it does as there are delays on the device side for sending the
data out through the uart that don't sync right up with the usb host
side here. So it might be very easy to get out of order things
happening.

You need to make sure the data is really out the port before changing
any control lines. Can't you do this properly from userspace with no
kernel changes?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/