aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/kobil_sct.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/kobil_sct.c')
-rw-r--r--drivers/usb/serial/kobil_sct.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index 78458c807eac..693f00da7c03 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -183,11 +183,11 @@ static int kobil_startup (struct usb_serial *serial)
183 for (i = 0; i < altsetting->desc.bNumEndpoints; i++) { 183 for (i = 0; i < altsetting->desc.bNumEndpoints; i++) {
184 endpoint = &altsetting->endpoint[i]; 184 endpoint = &altsetting->endpoint[i];
185 if (usb_endpoint_is_int_out(&endpoint->desc)) { 185 if (usb_endpoint_is_int_out(&endpoint->desc)) {
186 dbg("%s Found interrupt out endpoint. Address: %d", __FUNCTION__, endpoint->desc.bEndpointAddress); 186 dbg("%s Found interrupt out endpoint. Address: %d", __func__, endpoint->desc.bEndpointAddress);
187 priv->write_int_endpoint_address = endpoint->desc.bEndpointAddress; 187 priv->write_int_endpoint_address = endpoint->desc.bEndpointAddress;
188 } 188 }
189 if (usb_endpoint_is_int_in(&endpoint->desc)) { 189 if (usb_endpoint_is_int_in(&endpoint->desc)) {
190 dbg("%s Found interrupt in endpoint. Address: %d", __FUNCTION__, endpoint->desc.bEndpointAddress); 190 dbg("%s Found interrupt in endpoint. Address: %d", __func__, endpoint->desc.bEndpointAddress);
191 priv->read_int_endpoint_address = endpoint->desc.bEndpointAddress; 191 priv->read_int_endpoint_address = endpoint->desc.bEndpointAddress;
192 } 192 }
193 } 193 }
@@ -198,7 +198,7 @@ static int kobil_startup (struct usb_serial *serial)
198static void kobil_shutdown (struct usb_serial *serial) 198static void kobil_shutdown (struct usb_serial *serial)
199{ 199{
200 int i; 200 int i;
201 dbg("%s - port %d", __FUNCTION__, serial->port[0]->number); 201 dbg("%s - port %d", __func__, serial->port[0]->number);
202 202
203 for (i=0; i < serial->num_ports; ++i) { 203 for (i=0; i < serial->num_ports; ++i) {
204 while (serial->port[i]->open_count > 0) { 204 while (serial->port[i]->open_count > 0) {
@@ -218,7 +218,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
218 int transfer_buffer_length = 8; 218 int transfer_buffer_length = 8;
219 int write_urb_transfer_buffer_length = 8; 219 int write_urb_transfer_buffer_length = 8;
220 220
221 dbg("%s - port %d", __FUNCTION__, port->number); 221 dbg("%s - port %d", __func__, port->number);
222 priv = usb_get_serial_port_data(port); 222 priv = usb_get_serial_port_data(port);
223 223
224 // someone sets the dev to 0 if the close method has been called 224 // someone sets the dev to 0 if the close method has been called
@@ -245,10 +245,10 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
245 245
246 // allocate write_urb 246 // allocate write_urb
247 if (!port->write_urb) { 247 if (!port->write_urb) {
248 dbg("%s - port %d Allocating port->write_urb", __FUNCTION__, port->number); 248 dbg("%s - port %d Allocating port->write_urb", __func__, port->number);
249 port->write_urb = usb_alloc_urb(0, GFP_KERNEL); 249 port->write_urb = usb_alloc_urb(0, GFP_KERNEL);
250 if (!port->write_urb) { 250 if (!port->write_urb) {
251 dbg("%s - port %d usb_alloc_urb failed", __FUNCTION__, port->number); 251 dbg("%s - port %d usb_alloc_urb failed", __func__, port->number);
252 kfree(transfer_buffer); 252 kfree(transfer_buffer);
253 return -ENOMEM; 253 return -ENOMEM;
254 } 254 }
@@ -274,7 +274,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
274 transfer_buffer_length, 274 transfer_buffer_length,
275 KOBIL_TIMEOUT 275 KOBIL_TIMEOUT
276 ); 276 );
277 dbg("%s - port %d Send get_HW_version URB returns: %i", __FUNCTION__, port->number, result); 277 dbg("%s - port %d Send get_HW_version URB returns: %i", __func__, port->number, result);
278 dbg("Harware version: %i.%i.%i", transfer_buffer[0], transfer_buffer[1], transfer_buffer[2] ); 278 dbg("Harware version: %i.%i.%i", transfer_buffer[0], transfer_buffer[1], transfer_buffer[2] );
279 279
280 // get firmware version 280 // get firmware version
@@ -288,7 +288,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
288 transfer_buffer_length, 288 transfer_buffer_length,
289 KOBIL_TIMEOUT 289 KOBIL_TIMEOUT
290 ); 290 );
291 dbg("%s - port %d Send get_FW_version URB returns: %i", __FUNCTION__, port->number, result); 291 dbg("%s - port %d Send get_FW_version URB returns: %i", __func__, port->number, result);
292 dbg("Firmware version: %i.%i.%i", transfer_buffer[0], transfer_buffer[1], transfer_buffer[2] ); 292 dbg("Firmware version: %i.%i.%i", transfer_buffer[0], transfer_buffer[1], transfer_buffer[2] );
293 293
294 if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { 294 if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
@@ -303,7 +303,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
303 0, 303 0,
304 KOBIL_TIMEOUT 304 KOBIL_TIMEOUT
305 ); 305 );
306 dbg("%s - port %d Send set_baudrate URB returns: %i", __FUNCTION__, port->number, result); 306 dbg("%s - port %d Send set_baudrate URB returns: %i", __func__, port->number, result);
307 307
308 // reset all queues 308 // reset all queues
309 result = usb_control_msg( port->serial->dev, 309 result = usb_control_msg( port->serial->dev,
@@ -316,13 +316,13 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
316 0, 316 0,
317 KOBIL_TIMEOUT 317 KOBIL_TIMEOUT
318 ); 318 );
319 dbg("%s - port %d Send reset_all_queues URB returns: %i", __FUNCTION__, port->number, result); 319 dbg("%s - port %d Send reset_all_queues URB returns: %i", __func__, port->number, result);
320 } 320 }
321 if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID || priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || 321 if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID || priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
322 priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) { 322 priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
323 // start reading (Adapter B 'cause PNP string) 323 // start reading (Adapter B 'cause PNP string)
324 result = usb_submit_urb( port->interrupt_in_urb, GFP_ATOMIC ); 324 result = usb_submit_urb( port->interrupt_in_urb, GFP_ATOMIC );
325 dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result); 325 dbg("%s - port %d Send read URB returns: %i", __func__, port->number, result);
326 } 326 }
327 327
328 kfree(transfer_buffer); 328 kfree(transfer_buffer);
@@ -332,7 +332,7 @@ static int kobil_open (struct usb_serial_port *port, struct file *filp)
332 332
333static void kobil_close (struct usb_serial_port *port, struct file *filp) 333static void kobil_close (struct usb_serial_port *port, struct file *filp)
334{ 334{
335 dbg("%s - port %d", __FUNCTION__, port->number); 335 dbg("%s - port %d", __func__, port->number);
336 336
337 if (port->write_urb) { 337 if (port->write_urb) {
338 usb_kill_urb(port->write_urb); 338 usb_kill_urb(port->write_urb);
@@ -352,11 +352,11 @@ static void kobil_read_int_callback(struct urb *urb)
352 int status = urb->status; 352 int status = urb->status;
353// char *dbg_data; 353// char *dbg_data;
354 354
355 dbg("%s - port %d", __FUNCTION__, port->number); 355 dbg("%s - port %d", __func__, port->number);
356 356
357 if (status) { 357 if (status) {
358 dbg("%s - port %d Read int status not zero: %d", 358 dbg("%s - port %d Read int status not zero: %d",
359 __FUNCTION__, port->number, status); 359 __func__, port->number, status);
360 return; 360 return;
361 } 361 }
362 362
@@ -386,7 +386,7 @@ static void kobil_read_int_callback(struct urb *urb)
386 port->interrupt_in_urb->dev = port->serial->dev; 386 port->interrupt_in_urb->dev = port->serial->dev;
387 387
388 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 388 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
389 dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result); 389 dbg("%s - port %d Send read URB returns: %i", __func__, port->number, result);
390} 390}
391 391
392 392
@@ -404,21 +404,21 @@ static int kobil_write (struct usb_serial_port *port,
404 struct kobil_private * priv; 404 struct kobil_private * priv;
405 405
406 if (count == 0) { 406 if (count == 0) {
407 dbg("%s - port %d write request of 0 bytes", __FUNCTION__, port->number); 407 dbg("%s - port %d write request of 0 bytes", __func__, port->number);
408 return 0; 408 return 0;
409 } 409 }
410 410
411 priv = usb_get_serial_port_data(port); 411 priv = usb_get_serial_port_data(port);
412 412
413 if (count > (KOBIL_BUF_LENGTH - priv->filled)) { 413 if (count > (KOBIL_BUF_LENGTH - priv->filled)) {
414 dbg("%s - port %d Error: write request bigger than buffer size", __FUNCTION__, port->number); 414 dbg("%s - port %d Error: write request bigger than buffer size", __func__, port->number);
415 return -ENOMEM; 415 return -ENOMEM;
416 } 416 }
417 417
418 // Copy data to buffer 418 // Copy data to buffer
419 memcpy (priv->buf + priv->filled, buf, count); 419 memcpy (priv->buf + priv->filled, buf, count);
420 420
421 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, priv->buf + priv->filled); 421 usb_serial_debug_data(debug, &port->dev, __func__, count, priv->buf + priv->filled);
422 422
423 priv->filled = priv->filled + count; 423 priv->filled = priv->filled + count;
424 424
@@ -450,7 +450,7 @@ static int kobil_write (struct usb_serial_port *port,
450 450
451 priv->cur_pos = priv->cur_pos + length; 451 priv->cur_pos = priv->cur_pos + length;
452 result = usb_submit_urb( port->write_urb, GFP_NOIO ); 452 result = usb_submit_urb( port->write_urb, GFP_NOIO );
453 dbg("%s - port %d Send write URB returns: %i", __FUNCTION__, port->number, result); 453 dbg("%s - port %d Send write URB returns: %i", __func__, port->number, result);
454 todo = priv->filled - priv->cur_pos; 454 todo = priv->filled - priv->cur_pos;
455 455
456 if (todo > 0) { 456 if (todo > 0) {
@@ -471,7 +471,7 @@ static int kobil_write (struct usb_serial_port *port,
471 port->interrupt_in_urb->dev = port->serial->dev; 471 port->interrupt_in_urb->dev = port->serial->dev;
472 472
473 result = usb_submit_urb( port->interrupt_in_urb, GFP_NOIO ); 473 result = usb_submit_urb( port->interrupt_in_urb, GFP_NOIO );
474 dbg("%s - port %d Send read URB returns: %i", __FUNCTION__, port->number, result); 474 dbg("%s - port %d Send read URB returns: %i", __func__, port->number, result);
475 } 475 }
476 } 476 }
477 return count; 477 return count;
@@ -480,7 +480,7 @@ static int kobil_write (struct usb_serial_port *port,
480 480
481static int kobil_write_room (struct usb_serial_port *port) 481static int kobil_write_room (struct usb_serial_port *port)
482{ 482{
483 //dbg("%s - port %d", __FUNCTION__, port->number); 483 //dbg("%s - port %d", __func__, port->number);
484 return 8; 484 return 8;
485} 485}
486 486
@@ -515,7 +515,7 @@ static int kobil_tiocmget(struct usb_serial_port *port, struct file *file)
515 KOBIL_TIMEOUT); 515 KOBIL_TIMEOUT);
516 516
517 dbg("%s - port %d Send get_status_line_state URB returns: %i. Statusline: %02x", 517 dbg("%s - port %d Send get_status_line_state URB returns: %i. Statusline: %02x",
518 __FUNCTION__, port->number, result, transfer_buffer[0]); 518 __func__, port->number, result, transfer_buffer[0]);
519 519
520 result = 0; 520 result = 0;
521 if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0) 521 if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0)
@@ -558,9 +558,9 @@ static int kobil_tiocmset(struct usb_serial_port *port, struct file *file,
558 558
559 if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) { 559 if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) {
560 if (dtr != 0) 560 if (dtr != 0)
561 dbg("%s - port %d Setting DTR", __FUNCTION__, port->number); 561 dbg("%s - port %d Setting DTR", __func__, port->number);
562 else 562 else
563 dbg("%s - port %d Clearing DTR", __FUNCTION__, port->number); 563 dbg("%s - port %d Clearing DTR", __func__, port->number);
564 result = usb_control_msg( port->serial->dev, 564 result = usb_control_msg( port->serial->dev,
565 usb_rcvctrlpipe(port->serial->dev, 0 ), 565 usb_rcvctrlpipe(port->serial->dev, 0 ),
566 SUSBCRequest_SetStatusLinesOrQueues, 566 SUSBCRequest_SetStatusLinesOrQueues,
@@ -572,9 +572,9 @@ static int kobil_tiocmset(struct usb_serial_port *port, struct file *file,
572 KOBIL_TIMEOUT); 572 KOBIL_TIMEOUT);
573 } else { 573 } else {
574 if (rts != 0) 574 if (rts != 0)
575 dbg("%s - port %d Setting RTS", __FUNCTION__, port->number); 575 dbg("%s - port %d Setting RTS", __func__, port->number);
576 else 576 else
577 dbg("%s - port %d Clearing RTS", __FUNCTION__, port->number); 577 dbg("%s - port %d Clearing RTS", __func__, port->number);
578 result = usb_control_msg( port->serial->dev, 578 result = usb_control_msg( port->serial->dev,
579 usb_rcvctrlpipe(port->serial->dev, 0 ), 579 usb_rcvctrlpipe(port->serial->dev, 0 ),
580 SUSBCRequest_SetStatusLinesOrQueues, 580 SUSBCRequest_SetStatusLinesOrQueues,
@@ -585,7 +585,7 @@ static int kobil_tiocmset(struct usb_serial_port *port, struct file *file,
585 0, 585 0,
586 KOBIL_TIMEOUT); 586 KOBIL_TIMEOUT);
587 } 587 }
588 dbg("%s - port %d Send set_status_line URB returns: %i", __FUNCTION__, port->number, result); 588 dbg("%s - port %d Send set_status_line URB returns: %i", __func__, port->number, result);
589 kfree(transfer_buffer); 589 kfree(transfer_buffer);
590 return (result < 0) ? result : 0; 590 return (result < 0) ? result : 0;
591} 591}
@@ -678,7 +678,7 @@ static int kobil_ioctl(struct usb_serial_port *port, struct file * file, unsigne
678 KOBIL_TIMEOUT 678 KOBIL_TIMEOUT
679 ); 679 );
680 680
681 dbg("%s - port %d Send reset_all_queues (FLUSH) URB returns: %i", __FUNCTION__, port->number, result); 681 dbg("%s - port %d Send reset_all_queues (FLUSH) URB returns: %i", __func__, port->number, result);
682 kfree(transfer_buffer); 682 kfree(transfer_buffer);
683 return (result < 0) ? -EFAULT : 0; 683 return (result < 0) ? -EFAULT : 0;
684 default: 684 default: