cp210x.c (f26788da3b342099d2b02d99ba1cb7f154d6ef7b) cp210x.c (2db6c7698bbb37128959d3a207fc46e3f45bef3c)
1/*
2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver
3 *
4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.

--- 358 unchanged lines hidden (view full) ---

367 else if (baud <= 1474560) baud = 1228800;
368 else if (baud <= 2457600) baud = 1843200;
369 else baud = 3686400;
370 return baud;
371}
372
373static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)
374{
1/*
2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver
3 *
4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.

--- 358 unchanged lines hidden (view full) ---

367 else if (baud <= 1474560) baud = 1228800;
368 else if (baud <= 2457600) baud = 1843200;
369 else baud = 3686400;
370 return baud;
371}
372
373static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)
374{
375 struct usb_serial *serial = port->serial;
376 int result;
377
378 dbg("%s - port %d", __func__, port->number);
379
380 if (cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_ENABLE)) {
381 dev_err(&port->dev, "%s - Unable to enable UART\n",
382 __func__);
383 return -EPROTO;
384 }
385
375 int result;
376
377 dbg("%s - port %d", __func__, port->number);
378
379 if (cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_ENABLE)) {
380 dev_err(&port->dev, "%s - Unable to enable UART\n",
381 __func__);
382 return -EPROTO;
383 }
384
386 /* Start reading from the device */
387 usb_fill_bulk_urb(port->read_urb, serial->dev,
388 usb_rcvbulkpipe(serial->dev,
389 port->bulk_in_endpointAddress),
390 port->read_urb->transfer_buffer,
391 port->read_urb->transfer_buffer_length,
392 serial->type->read_bulk_callback,
393 port);
394 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
395 if (result) {
396 dev_err(&port->dev, "%s - failed resubmitting read urb, "
397 "error %d\n", __func__, result);
385 result = usb_serial_generic_submit_read_urb(port, GFP_KERNEL);
386 if (result)
398 return result;
387 return result;
399 }
400
401 /* Configure the termios structure */
402 cp210x_get_termios(tty, port);
403 return 0;
404}
405
406static void cp210x_cleanup(struct usb_serial_port *port)
407{

--- 448 unchanged lines hidden ---
388
389 /* Configure the termios structure */
390 cp210x_get_termios(tty, port);
391 return 0;
392}
393
394static void cp210x_cleanup(struct usb_serial_port *port)
395{

--- 448 unchanged lines hidden ---