aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/empeg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/empeg.c')
-rw-r--r--drivers/usb/serial/empeg.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
index a5c8e1e17ea5..c5ec309a3cb1 100644
--- a/drivers/usb/serial/empeg.c
+++ b/drivers/usb/serial/empeg.c
@@ -118,9 +118,6 @@ static struct usb_serial_driver empeg_device = {
118 }, 118 },
119 .id_table = id_table, 119 .id_table = id_table,
120 .usb_driver = &empeg_driver, 120 .usb_driver = &empeg_driver,
121 .num_interrupt_in = 0,
122 .num_bulk_in = 1,
123 .num_bulk_out = 1,
124 .num_ports = 1, 121 .num_ports = 1,
125 .open = empeg_open, 122 .open = empeg_open,
126 .close = empeg_close, 123 .close = empeg_close,
@@ -153,7 +150,7 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp)
153 struct usb_serial *serial = port->serial; 150 struct usb_serial *serial = port->serial;
154 int result = 0; 151 int result = 0;
155 152
156 dbg("%s - port %d", __FUNCTION__, port->number); 153 dbg("%s - port %d", __func__, port->number);
157 154
158 /* Force default termio settings */ 155 /* Force default termio settings */
159 empeg_set_termios (port, NULL) ; 156 empeg_set_termios (port, NULL) ;
@@ -175,7 +172,7 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp)
175 result = usb_submit_urb(port->read_urb, GFP_KERNEL); 172 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
176 173
177 if (result) 174 if (result)
178 dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result); 175 dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __func__, result);
179 176
180 return result; 177 return result;
181} 178}
@@ -183,7 +180,7 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp)
183 180
184static void empeg_close (struct usb_serial_port *port, struct file * filp) 181static void empeg_close (struct usb_serial_port *port, struct file * filp)
185{ 182{
186 dbg("%s - port %d", __FUNCTION__, port->number); 183 dbg("%s - port %d", __func__, port->number);
187 184
188 /* shutdown our bulk read */ 185 /* shutdown our bulk read */
189 usb_kill_urb(port->read_urb); 186 usb_kill_urb(port->read_urb);
@@ -203,7 +200,7 @@ static int empeg_write (struct usb_serial_port *port, const unsigned char *buf,
203 int bytes_sent = 0; 200 int bytes_sent = 0;
204 int transfer_size; 201 int transfer_size;
205 202
206 dbg("%s - port %d", __FUNCTION__, port->number); 203 dbg("%s - port %d", __func__, port->number);
207 204
208 while (count > 0) { 205 while (count > 0) {
209 206
@@ -222,14 +219,14 @@ static int empeg_write (struct usb_serial_port *port, const unsigned char *buf,
222 spin_unlock_irqrestore (&write_urb_pool_lock, flags); 219 spin_unlock_irqrestore (&write_urb_pool_lock, flags);
223 220
224 if (urb == NULL) { 221 if (urb == NULL) {
225 dbg("%s - no more free urbs", __FUNCTION__); 222 dbg("%s - no more free urbs", __func__);
226 goto exit; 223 goto exit;
227 } 224 }
228 225
229 if (urb->transfer_buffer == NULL) { 226 if (urb->transfer_buffer == NULL) {
230 urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC); 227 urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC);
231 if (urb->transfer_buffer == NULL) { 228 if (urb->transfer_buffer == NULL) {
232 dev_err(&port->dev, "%s no more kernel memory...\n", __FUNCTION__); 229 dev_err(&port->dev, "%s no more kernel memory...\n", __func__);
233 goto exit; 230 goto exit;
234 } 231 }
235 } 232 }
@@ -238,7 +235,7 @@ static int empeg_write (struct usb_serial_port *port, const unsigned char *buf,
238 235
239 memcpy (urb->transfer_buffer, current_position, transfer_size); 236 memcpy (urb->transfer_buffer, current_position, transfer_size);
240 237
241 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, transfer_size, urb->transfer_buffer); 238 usb_serial_debug_data(debug, &port->dev, __func__, transfer_size, urb->transfer_buffer);
242 239
243 /* build up our urb */ 240 /* build up our urb */
244 usb_fill_bulk_urb ( 241 usb_fill_bulk_urb (
@@ -254,7 +251,7 @@ static int empeg_write (struct usb_serial_port *port, const unsigned char *buf,
254 /* send it down the pipe */ 251 /* send it down the pipe */
255 status = usb_submit_urb(urb, GFP_ATOMIC); 252 status = usb_submit_urb(urb, GFP_ATOMIC);
256 if (status) { 253 if (status) {
257 dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n", __FUNCTION__, status); 254 dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed with status = %d\n", __func__, status);
258 bytes_sent = status; 255 bytes_sent = status;
259 break; 256 break;
260 } 257 }
@@ -278,7 +275,7 @@ static int empeg_write_room (struct usb_serial_port *port)
278 int i; 275 int i;
279 int room = 0; 276 int room = 0;
280 277
281 dbg("%s - port %d", __FUNCTION__, port->number); 278 dbg("%s - port %d", __func__, port->number);
282 279
283 spin_lock_irqsave (&write_urb_pool_lock, flags); 280 spin_lock_irqsave (&write_urb_pool_lock, flags);
284 281
@@ -291,7 +288,7 @@ static int empeg_write_room (struct usb_serial_port *port)
291 288
292 spin_unlock_irqrestore (&write_urb_pool_lock, flags); 289 spin_unlock_irqrestore (&write_urb_pool_lock, flags);
293 290
294 dbg("%s - returns %d", __FUNCTION__, room); 291 dbg("%s - returns %d", __func__, room);
295 292
296 return (room); 293 return (room);
297 294
@@ -304,7 +301,7 @@ static int empeg_chars_in_buffer (struct usb_serial_port *port)
304 int i; 301 int i;
305 int chars = 0; 302 int chars = 0;
306 303
307 dbg("%s - port %d", __FUNCTION__, port->number); 304 dbg("%s - port %d", __func__, port->number);
308 305
309 spin_lock_irqsave (&write_urb_pool_lock, flags); 306 spin_lock_irqsave (&write_urb_pool_lock, flags);
310 307
@@ -317,7 +314,7 @@ static int empeg_chars_in_buffer (struct usb_serial_port *port)
317 314
318 spin_unlock_irqrestore (&write_urb_pool_lock, flags); 315 spin_unlock_irqrestore (&write_urb_pool_lock, flags);
319 316
320 dbg("%s - returns %d", __FUNCTION__, chars); 317 dbg("%s - returns %d", __func__, chars);
321 318
322 return (chars); 319 return (chars);
323 320
@@ -329,11 +326,11 @@ static void empeg_write_bulk_callback (struct urb *urb)
329 struct usb_serial_port *port = urb->context; 326 struct usb_serial_port *port = urb->context;
330 int status = urb->status; 327 int status = urb->status;
331 328
332 dbg("%s - port %d", __FUNCTION__, port->number); 329 dbg("%s - port %d", __func__, port->number);
333 330
334 if (status) { 331 if (status) {
335 dbg("%s - nonzero write bulk status received: %d", 332 dbg("%s - nonzero write bulk status received: %d",
336 __FUNCTION__, status); 333 __func__, status);
337 return; 334 return;
338 } 335 }
339 336
@@ -343,21 +340,21 @@ static void empeg_write_bulk_callback (struct urb *urb)
343 340
344static void empeg_read_bulk_callback (struct urb *urb) 341static void empeg_read_bulk_callback (struct urb *urb)
345{ 342{
346 struct usb_serial_port *port = (struct usb_serial_port *)urb->context; 343 struct usb_serial_port *port = urb->context;
347 struct tty_struct *tty; 344 struct tty_struct *tty;
348 unsigned char *data = urb->transfer_buffer; 345 unsigned char *data = urb->transfer_buffer;
349 int result; 346 int result;
350 int status = urb->status; 347 int status = urb->status;
351 348
352 dbg("%s - port %d", __FUNCTION__, port->number); 349 dbg("%s - port %d", __func__, port->number);
353 350
354 if (status) { 351 if (status) {
355 dbg("%s - nonzero read bulk status received: %d", 352 dbg("%s - nonzero read bulk status received: %d",
356 __FUNCTION__, status); 353 __func__, status);
357 return; 354 return;
358 } 355 }
359 356
360 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); 357 usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data);
361 358
362 tty = port->tty; 359 tty = port->tty;
363 360
@@ -382,7 +379,7 @@ static void empeg_read_bulk_callback (struct urb *urb)
382 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 379 result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
383 380
384 if (result) 381 if (result)
385 dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); 382 dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result);
386 383
387 return; 384 return;
388 385
@@ -391,7 +388,7 @@ static void empeg_read_bulk_callback (struct urb *urb)
391 388
392static void empeg_throttle (struct usb_serial_port *port) 389static void empeg_throttle (struct usb_serial_port *port)
393{ 390{
394 dbg("%s - port %d", __FUNCTION__, port->number); 391 dbg("%s - port %d", __func__, port->number);
395 usb_kill_urb(port->read_urb); 392 usb_kill_urb(port->read_urb);
396} 393}
397 394
@@ -400,14 +397,14 @@ static void empeg_unthrottle (struct usb_serial_port *port)
400{ 397{
401 int result; 398 int result;
402 399
403 dbg("%s - port %d", __FUNCTION__, port->number); 400 dbg("%s - port %d", __func__, port->number);
404 401
405 port->read_urb->dev = port->serial->dev; 402 port->read_urb->dev = port->serial->dev;
406 403
407 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 404 result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
408 405
409 if (result) 406 if (result)
410 dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result); 407 dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __func__, result);
411 408
412 return; 409 return;
413} 410}
@@ -417,14 +414,14 @@ static int empeg_startup (struct usb_serial *serial)
417{ 414{
418 int r; 415 int r;
419 416
420 dbg("%s", __FUNCTION__); 417 dbg("%s", __func__);
421 418
422 if (serial->dev->actconfig->desc.bConfigurationValue != 1) { 419 if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
423 err("active config #%d != 1 ??", 420 err("active config #%d != 1 ??",
424 serial->dev->actconfig->desc.bConfigurationValue); 421 serial->dev->actconfig->desc.bConfigurationValue);
425 return -ENODEV; 422 return -ENODEV;
426 } 423 }
427 dbg("%s - reset config", __FUNCTION__); 424 dbg("%s - reset config", __func__);
428 r = usb_reset_configuration (serial->dev); 425 r = usb_reset_configuration (serial->dev);
429 426
430 /* continue on with initialization */ 427 /* continue on with initialization */
@@ -435,13 +432,13 @@ static int empeg_startup (struct usb_serial *serial)
435 432
436static void empeg_shutdown (struct usb_serial *serial) 433static void empeg_shutdown (struct usb_serial *serial)
437{ 434{
438 dbg ("%s", __FUNCTION__); 435 dbg ("%s", __func__);
439} 436}
440 437
441 438
442static int empeg_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg) 439static int empeg_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg)
443{ 440{
444 dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); 441 dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd);
445 442
446 return -ENOIOCTLCMD; 443 return -ENOIOCTLCMD;
447} 444}
@@ -450,7 +447,7 @@ static int empeg_ioctl (struct usb_serial_port *port, struct file * file, unsign
450static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) 447static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
451{ 448{
452 struct ktermios *termios = port->tty->termios; 449 struct ktermios *termios = port->tty->termios;
453 dbg("%s - port %d", __FUNCTION__, port->number); 450 dbg("%s - port %d", __func__, port->number);
454 451
455 /* 452 /*
456 * The empeg-car player wants these particular tty settings. 453 * The empeg-car player wants these particular tty settings.
@@ -517,7 +514,7 @@ static int __init empeg_init (void)
517 urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); 514 urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
518 if (!urb->transfer_buffer) { 515 if (!urb->transfer_buffer) {
519 err("%s - out of memory for urb buffers.", 516 err("%s - out of memory for urb buffers.",
520 __FUNCTION__); 517 __func__);
521 continue; 518 continue;
522 } 519 }
523 } 520 }