diff options
Diffstat (limited to 'drivers/usb/serial/cyberjack.c')
-rw-r--r-- | drivers/usb/serial/cyberjack.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index cbae876cd678..5348e97b52b5 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c | |||
@@ -116,7 +116,7 @@ static int cyberjack_startup (struct usb_serial *serial) | |||
116 | struct cyberjack_private *priv; | 116 | struct cyberjack_private *priv; |
117 | int i; | 117 | int i; |
118 | 118 | ||
119 | dbg("%s", __FUNCTION__); | 119 | dbg("%s", __func__); |
120 | 120 | ||
121 | /* allocate the private data structure */ | 121 | /* allocate the private data structure */ |
122 | priv = kmalloc(sizeof(struct cyberjack_private), GFP_KERNEL); | 122 | priv = kmalloc(sizeof(struct cyberjack_private), GFP_KERNEL); |
@@ -139,7 +139,7 @@ static int cyberjack_startup (struct usb_serial *serial) | |||
139 | GFP_KERNEL); | 139 | GFP_KERNEL); |
140 | if (result) | 140 | if (result) |
141 | err(" usb_submit_urb(read int) failed"); | 141 | err(" usb_submit_urb(read int) failed"); |
142 | dbg("%s - usb_submit_urb(int urb)", __FUNCTION__); | 142 | dbg("%s - usb_submit_urb(int urb)", __func__); |
143 | } | 143 | } |
144 | 144 | ||
145 | return( 0 ); | 145 | return( 0 ); |
@@ -149,7 +149,7 @@ static void cyberjack_shutdown (struct usb_serial *serial) | |||
149 | { | 149 | { |
150 | int i; | 150 | int i; |
151 | 151 | ||
152 | dbg("%s", __FUNCTION__); | 152 | dbg("%s", __func__); |
153 | 153 | ||
154 | for (i=0; i < serial->num_ports; ++i) { | 154 | for (i=0; i < serial->num_ports; ++i) { |
155 | usb_kill_urb(serial->port[i]->interrupt_in_urb); | 155 | usb_kill_urb(serial->port[i]->interrupt_in_urb); |
@@ -165,9 +165,9 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp) | |||
165 | unsigned long flags; | 165 | unsigned long flags; |
166 | int result = 0; | 166 | int result = 0; |
167 | 167 | ||
168 | dbg("%s - port %d", __FUNCTION__, port->number); | 168 | dbg("%s - port %d", __func__, port->number); |
169 | 169 | ||
170 | dbg("%s - usb_clear_halt", __FUNCTION__ ); | 170 | dbg("%s - usb_clear_halt", __func__ ); |
171 | usb_clear_halt(port->serial->dev, port->write_urb->pipe); | 171 | usb_clear_halt(port->serial->dev, port->write_urb->pipe); |
172 | 172 | ||
173 | /* force low_latency on so that our tty_push actually forces | 173 | /* force low_latency on so that our tty_push actually forces |
@@ -188,7 +188,7 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp) | |||
188 | 188 | ||
189 | static void cyberjack_close (struct usb_serial_port *port, struct file *filp) | 189 | static void cyberjack_close (struct usb_serial_port *port, struct file *filp) |
190 | { | 190 | { |
191 | dbg("%s - port %d", __FUNCTION__, port->number); | 191 | dbg("%s - port %d", __func__, port->number); |
192 | 192 | ||
193 | if (port->serial->dev) { | 193 | if (port->serial->dev) { |
194 | /* shutdown any bulk reads that might be going on */ | 194 | /* shutdown any bulk reads that might be going on */ |
@@ -205,17 +205,17 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b | |||
205 | int result; | 205 | int result; |
206 | int wrexpected; | 206 | int wrexpected; |
207 | 207 | ||
208 | dbg("%s - port %d", __FUNCTION__, port->number); | 208 | dbg("%s - port %d", __func__, port->number); |
209 | 209 | ||
210 | if (count == 0) { | 210 | if (count == 0) { |
211 | dbg("%s - write request of 0 bytes", __FUNCTION__); | 211 | dbg("%s - write request of 0 bytes", __func__); |
212 | return (0); | 212 | return (0); |
213 | } | 213 | } |
214 | 214 | ||
215 | spin_lock_bh(&port->lock); | 215 | spin_lock_bh(&port->lock); |
216 | if (port->write_urb_busy) { | 216 | if (port->write_urb_busy) { |
217 | spin_unlock_bh(&port->lock); | 217 | spin_unlock_bh(&port->lock); |
218 | dbg("%s - already writing", __FUNCTION__); | 218 | dbg("%s - already writing", __func__); |
219 | return 0; | 219 | return 0; |
220 | } | 220 | } |
221 | port->write_urb_busy = 1; | 221 | port->write_urb_busy = 1; |
@@ -234,13 +234,13 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b | |||
234 | /* Copy data */ | 234 | /* Copy data */ |
235 | memcpy (priv->wrbuf+priv->wrfilled, buf, count); | 235 | memcpy (priv->wrbuf+priv->wrfilled, buf, count); |
236 | 236 | ||
237 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, | 237 | usb_serial_debug_data(debug, &port->dev, __func__, count, |
238 | priv->wrbuf+priv->wrfilled); | 238 | priv->wrbuf+priv->wrfilled); |
239 | priv->wrfilled += count; | 239 | priv->wrfilled += count; |
240 | 240 | ||
241 | if( priv->wrfilled >= 3 ) { | 241 | if( priv->wrfilled >= 3 ) { |
242 | wrexpected = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3; | 242 | wrexpected = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3; |
243 | dbg("%s - expected data: %d", __FUNCTION__, wrexpected); | 243 | dbg("%s - expected data: %d", __func__, wrexpected); |
244 | } else { | 244 | } else { |
245 | wrexpected = sizeof(priv->wrbuf); | 245 | wrexpected = sizeof(priv->wrbuf); |
246 | } | 246 | } |
@@ -249,7 +249,7 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b | |||
249 | /* We have enough data to begin transmission */ | 249 | /* We have enough data to begin transmission */ |
250 | int length; | 250 | int length; |
251 | 251 | ||
252 | dbg("%s - transmitting data (frame 1)", __FUNCTION__); | 252 | dbg("%s - transmitting data (frame 1)", __func__); |
253 | length = (wrexpected > port->bulk_out_size) ? port->bulk_out_size : wrexpected; | 253 | length = (wrexpected > port->bulk_out_size) ? port->bulk_out_size : wrexpected; |
254 | 254 | ||
255 | memcpy (port->write_urb->transfer_buffer, priv->wrbuf, length ); | 255 | memcpy (port->write_urb->transfer_buffer, priv->wrbuf, length ); |
@@ -267,7 +267,7 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b | |||
267 | /* send the data out the bulk port */ | 267 | /* send the data out the bulk port */ |
268 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 268 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
269 | if (result) { | 269 | if (result) { |
270 | err("%s - failed submitting write urb, error %d", __FUNCTION__, result); | 270 | err("%s - failed submitting write urb, error %d", __func__, result); |
271 | /* Throw away data. No better idea what to do with it. */ | 271 | /* Throw away data. No better idea what to do with it. */ |
272 | priv->wrfilled=0; | 272 | priv->wrfilled=0; |
273 | priv->wrsent=0; | 273 | priv->wrsent=0; |
@@ -276,11 +276,11 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b | |||
276 | return 0; | 276 | return 0; |
277 | } | 277 | } |
278 | 278 | ||
279 | dbg("%s - priv->wrsent=%d", __FUNCTION__,priv->wrsent); | 279 | dbg("%s - priv->wrsent=%d", __func__,priv->wrsent); |
280 | dbg("%s - priv->wrfilled=%d", __FUNCTION__,priv->wrfilled); | 280 | dbg("%s - priv->wrfilled=%d", __func__,priv->wrfilled); |
281 | 281 | ||
282 | if( priv->wrsent>=priv->wrfilled ) { | 282 | if( priv->wrsent>=priv->wrfilled ) { |
283 | dbg("%s - buffer cleaned", __FUNCTION__); | 283 | dbg("%s - buffer cleaned", __func__); |
284 | memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); | 284 | memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); |
285 | priv->wrfilled=0; | 285 | priv->wrfilled=0; |
286 | priv->wrsent=0; | 286 | priv->wrsent=0; |
@@ -305,13 +305,13 @@ static void cyberjack_read_int_callback( struct urb *urb ) | |||
305 | int status = urb->status; | 305 | int status = urb->status; |
306 | int result; | 306 | int result; |
307 | 307 | ||
308 | dbg("%s - port %d", __FUNCTION__, port->number); | 308 | dbg("%s - port %d", __func__, port->number); |
309 | 309 | ||
310 | /* the urb might have been killed. */ | 310 | /* the urb might have been killed. */ |
311 | if (status) | 311 | if (status) |
312 | return; | 312 | return; |
313 | 313 | ||
314 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); | 314 | usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); |
315 | 315 | ||
316 | /* React only to interrupts signaling a bulk_in transfer */ | 316 | /* React only to interrupts signaling a bulk_in transfer */ |
317 | if( (urb->actual_length==4) && (data[0]==0x01) ) { | 317 | if( (urb->actual_length==4) && (data[0]==0x01) ) { |
@@ -333,7 +333,7 @@ static void cyberjack_read_int_callback( struct urb *urb ) | |||
333 | /* "+=" is probably more fault tollerant than "=" */ | 333 | /* "+=" is probably more fault tollerant than "=" */ |
334 | priv->rdtodo += size; | 334 | priv->rdtodo += size; |
335 | 335 | ||
336 | dbg("%s - rdtodo: %d", __FUNCTION__, priv->rdtodo); | 336 | dbg("%s - rdtodo: %d", __func__, priv->rdtodo); |
337 | 337 | ||
338 | spin_unlock(&priv->lock); | 338 | spin_unlock(&priv->lock); |
339 | 339 | ||
@@ -341,8 +341,8 @@ static void cyberjack_read_int_callback( struct urb *urb ) | |||
341 | port->read_urb->dev = port->serial->dev; | 341 | port->read_urb->dev = port->serial->dev; |
342 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 342 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
343 | if( result ) | 343 | if( result ) |
344 | err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); | 344 | err("%s - failed resubmitting read urb, error %d", __func__, result); |
345 | dbg("%s - usb_submit_urb(read urb)", __FUNCTION__); | 345 | dbg("%s - usb_submit_urb(read urb)", __func__); |
346 | } | 346 | } |
347 | } | 347 | } |
348 | 348 | ||
@@ -351,7 +351,7 @@ resubmit: | |||
351 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 351 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
352 | if (result) | 352 | if (result) |
353 | err(" usb_submit_urb(read int) failed"); | 353 | err(" usb_submit_urb(read int) failed"); |
354 | dbg("%s - usb_submit_urb(int urb)", __FUNCTION__); | 354 | dbg("%s - usb_submit_urb(int urb)", __func__); |
355 | } | 355 | } |
356 | 356 | ||
357 | static void cyberjack_read_bulk_callback (struct urb *urb) | 357 | static void cyberjack_read_bulk_callback (struct urb *urb) |
@@ -364,18 +364,18 @@ static void cyberjack_read_bulk_callback (struct urb *urb) | |||
364 | int result; | 364 | int result; |
365 | int status = urb->status; | 365 | int status = urb->status; |
366 | 366 | ||
367 | dbg("%s - port %d", __FUNCTION__, port->number); | 367 | dbg("%s - port %d", __func__, port->number); |
368 | 368 | ||
369 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); | 369 | usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); |
370 | if (status) { | 370 | if (status) { |
371 | dbg("%s - nonzero read bulk status received: %d", | 371 | dbg("%s - nonzero read bulk status received: %d", |
372 | __FUNCTION__, status); | 372 | __func__, status); |
373 | return; | 373 | return; |
374 | } | 374 | } |
375 | 375 | ||
376 | tty = port->tty; | 376 | tty = port->tty; |
377 | if (!tty) { | 377 | if (!tty) { |
378 | dbg("%s - ignoring since device not open\n", __FUNCTION__); | 378 | dbg("%s - ignoring since device not open\n", __func__); |
379 | return; | 379 | return; |
380 | } | 380 | } |
381 | if (urb->actual_length) { | 381 | if (urb->actual_length) { |
@@ -394,15 +394,15 @@ static void cyberjack_read_bulk_callback (struct urb *urb) | |||
394 | 394 | ||
395 | spin_unlock(&priv->lock); | 395 | spin_unlock(&priv->lock); |
396 | 396 | ||
397 | dbg("%s - rdtodo: %d", __FUNCTION__, todo); | 397 | dbg("%s - rdtodo: %d", __func__, todo); |
398 | 398 | ||
399 | /* Continue to read if we have still urbs to do. */ | 399 | /* Continue to read if we have still urbs to do. */ |
400 | if( todo /* || (urb->actual_length==port->bulk_in_endpointAddress)*/ ) { | 400 | if( todo /* || (urb->actual_length==port->bulk_in_endpointAddress)*/ ) { |
401 | port->read_urb->dev = port->serial->dev; | 401 | port->read_urb->dev = port->serial->dev; |
402 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 402 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
403 | if (result) | 403 | if (result) |
404 | err("%s - failed resubmitting read urb, error %d", __FUNCTION__, result); | 404 | err("%s - failed resubmitting read urb, error %d", __func__, result); |
405 | dbg("%s - usb_submit_urb(read urb)", __FUNCTION__); | 405 | dbg("%s - usb_submit_urb(read urb)", __func__); |
406 | } | 406 | } |
407 | } | 407 | } |
408 | 408 | ||
@@ -412,12 +412,12 @@ static void cyberjack_write_bulk_callback (struct urb *urb) | |||
412 | struct cyberjack_private *priv = usb_get_serial_port_data(port); | 412 | struct cyberjack_private *priv = usb_get_serial_port_data(port); |
413 | int status = urb->status; | 413 | int status = urb->status; |
414 | 414 | ||
415 | dbg("%s - port %d", __FUNCTION__, port->number); | 415 | dbg("%s - port %d", __func__, port->number); |
416 | 416 | ||
417 | port->write_urb_busy = 0; | 417 | port->write_urb_busy = 0; |
418 | if (status) { | 418 | if (status) { |
419 | dbg("%s - nonzero write bulk status received: %d", | 419 | dbg("%s - nonzero write bulk status received: %d", |
420 | __FUNCTION__, status); | 420 | __func__, status); |
421 | return; | 421 | return; |
422 | } | 422 | } |
423 | 423 | ||
@@ -427,7 +427,7 @@ static void cyberjack_write_bulk_callback (struct urb *urb) | |||
427 | if( priv->wrfilled ) { | 427 | if( priv->wrfilled ) { |
428 | int length, blksize, result; | 428 | int length, blksize, result; |
429 | 429 | ||
430 | dbg("%s - transmitting data (frame n)", __FUNCTION__); | 430 | dbg("%s - transmitting data (frame n)", __func__); |
431 | 431 | ||
432 | length = ((priv->wrfilled - priv->wrsent) > port->bulk_out_size) ? | 432 | length = ((priv->wrfilled - priv->wrsent) > port->bulk_out_size) ? |
433 | port->bulk_out_size : (priv->wrfilled - priv->wrsent); | 433 | port->bulk_out_size : (priv->wrfilled - priv->wrsent); |
@@ -448,20 +448,20 @@ static void cyberjack_write_bulk_callback (struct urb *urb) | |||
448 | /* send the data out the bulk port */ | 448 | /* send the data out the bulk port */ |
449 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 449 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
450 | if (result) { | 450 | if (result) { |
451 | err("%s - failed submitting write urb, error %d", __FUNCTION__, result); | 451 | err("%s - failed submitting write urb, error %d", __func__, result); |
452 | /* Throw away data. No better idea what to do with it. */ | 452 | /* Throw away data. No better idea what to do with it. */ |
453 | priv->wrfilled=0; | 453 | priv->wrfilled=0; |
454 | priv->wrsent=0; | 454 | priv->wrsent=0; |
455 | goto exit; | 455 | goto exit; |
456 | } | 456 | } |
457 | 457 | ||
458 | dbg("%s - priv->wrsent=%d", __FUNCTION__,priv->wrsent); | 458 | dbg("%s - priv->wrsent=%d", __func__,priv->wrsent); |
459 | dbg("%s - priv->wrfilled=%d", __FUNCTION__,priv->wrfilled); | 459 | dbg("%s - priv->wrfilled=%d", __func__,priv->wrfilled); |
460 | 460 | ||
461 | blksize = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3; | 461 | blksize = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3; |
462 | 462 | ||
463 | if( (priv->wrsent>=priv->wrfilled) || (priv->wrsent>=blksize) ) { | 463 | if( (priv->wrsent>=priv->wrfilled) || (priv->wrsent>=blksize) ) { |
464 | dbg("%s - buffer cleaned", __FUNCTION__); | 464 | dbg("%s - buffer cleaned", __func__); |
465 | memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); | 465 | memset( priv->wrbuf, 0, sizeof(priv->wrbuf) ); |
466 | priv->wrfilled=0; | 466 | priv->wrfilled=0; |
467 | priv->wrsent=0; | 467 | priv->wrsent=0; |