diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-05-15 00:13:51 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-19 14:00:53 -0400 |
commit | 0f064b52ce0f837791924b252ae59476ef26de69 (patch) | |
tree | ffcdac0703d6a9d35e99f9143540759c4588ab3c | |
parent | 936b6230530a3605e99563dfd3a6845dc0343b6e (diff) |
Staging: cpc-usb: fix up checkpatch errors in cpc-usb_drv.c
This resolves the checkpatch errors in cpc-usb_drv.c
Cc: Sebastian Haas <haas@ems-wuensche.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/cpc-usb/cpc-usb_drv.c | 188 |
1 files changed, 75 insertions, 113 deletions
diff --git a/drivers/staging/cpc-usb/cpc-usb_drv.c b/drivers/staging/cpc-usb/cpc-usb_drv.c index b8ef701a2bc5..14aca399fc4c 100644 --- a/drivers/staging/cpc-usb/cpc-usb_drv.c +++ b/drivers/staging/cpc-usb/cpc-usb_drv.c | |||
@@ -30,11 +30,6 @@ | |||
30 | 30 | ||
31 | #include <linux/version.h> | 31 | #include <linux/version.h> |
32 | 32 | ||
33 | /* usb_kill_urb has been introduced in kernel version 2.6.8 (RC2) */ | ||
34 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8)) | ||
35 | #define usb_kill_urb usb_unlink_urb | ||
36 | #endif | ||
37 | |||
38 | #ifdef CONFIG_PROC_FS | 33 | #ifdef CONFIG_PROC_FS |
39 | # include <linux/proc_fs.h> | 34 | # include <linux/proc_fs.h> |
40 | #endif | 35 | #endif |
@@ -68,11 +63,11 @@ MODULE_LICENSE("GPL v2"); | |||
68 | 63 | ||
69 | #define CPC_USB_PROC_DIR CPC_PROC_DIR "cpc-usb" | 64 | #define CPC_USB_PROC_DIR CPC_PROC_DIR "cpc-usb" |
70 | 65 | ||
71 | static struct proc_dir_entry *procDir = NULL; | 66 | static struct proc_dir_entry *procDir; |
72 | static struct proc_dir_entry *procEntry = NULL; | 67 | static struct proc_dir_entry *procEntry; |
73 | 68 | ||
74 | /* Module parameters */ | 69 | /* Module parameters */ |
75 | static int debug = 0; | 70 | static int debug; |
76 | module_param(debug, int, S_IRUGO); | 71 | module_param(debug, int, S_IRUGO); |
77 | 72 | ||
78 | /* table of devices that work with this driver */ | 73 | /* table of devices that work with this driver */ |
@@ -91,16 +86,16 @@ DECLARE_WAIT_QUEUE_HEAD(rmmodWq); | |||
91 | atomic_t useCount; | 86 | atomic_t useCount; |
92 | 87 | ||
93 | static CPC_USB_T *CPCUSB_Table[CPC_USB_CARD_CNT] = { 0 }; | 88 | static CPC_USB_T *CPCUSB_Table[CPC_USB_CARD_CNT] = { 0 }; |
94 | static unsigned int CPCUsbCnt = 0; | 89 | static unsigned int CPCUsbCnt; |
95 | 90 | ||
96 | /* prevent races between open() and disconnect() */ | 91 | /* prevent races between open() and disconnect() */ |
97 | static DECLARE_MUTEX(disconnect_sem); | 92 | static DECLARE_MUTEX(disconnect_sem); |
98 | 93 | ||
99 | /* local function prototypes */ | 94 | /* local function prototypes */ |
100 | static ssize_t cpcusb_read(struct file *file, char *buffer, size_t count, | 95 | static ssize_t cpcusb_read(struct file *file, char *buffer, size_t count, |
101 | loff_t * ppos); | 96 | loff_t *ppos); |
102 | static ssize_t cpcusb_write(struct file *file, const char *buffer, | 97 | static ssize_t cpcusb_write(struct file *file, const char *buffer, |
103 | size_t count, loff_t * ppos); | 98 | size_t count, loff_t *ppos); |
104 | static unsigned int cpcusb_poll(struct file *file, poll_table * wait); | 99 | static unsigned int cpcusb_poll(struct file *file, poll_table * wait); |
105 | static int cpcusb_open(struct inode *inode, struct file *file); | 100 | static int cpcusb_open(struct inode *inode, struct file *file); |
106 | static int cpcusb_release(struct inode *inode, struct file *file); | 101 | static int cpcusb_release(struct inode *inode, struct file *file); |
@@ -109,23 +104,11 @@ static int cpcusb_probe(struct usb_interface *interface, | |||
109 | const struct usb_device_id *id); | 104 | const struct usb_device_id *id); |
110 | static void cpcusb_disconnect(struct usb_interface *interface); | 105 | static void cpcusb_disconnect(struct usb_interface *interface); |
111 | 106 | ||
112 | static void cpcusb_read_bulk_callback(struct urb *urb | 107 | static void cpcusb_read_bulk_callback(struct urb *urb); |
113 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) | 108 | static void cpcusb_write_bulk_callback(struct urb *urb); |
114 | , struct pt_regs *regs | 109 | static void cpcusb_read_interrupt_callback(struct urb *urb); |
115 | #endif | ||
116 | ); | ||
117 | static void cpcusb_write_bulk_callback(struct urb *urb | ||
118 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) | ||
119 | , struct pt_regs *regs | ||
120 | #endif | ||
121 | ); | ||
122 | static void cpcusb_read_interrupt_callback(struct urb *urb | ||
123 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) | ||
124 | , struct pt_regs *regs | ||
125 | #endif | ||
126 | ); | ||
127 | 110 | ||
128 | static int cpcusb_setup_intrep(CPC_USB_T * card); | 111 | static int cpcusb_setup_intrep(CPC_USB_T *card); |
129 | 112 | ||
130 | static struct file_operations cpcusb_fops = { | 113 | static struct file_operations cpcusb_fops = { |
131 | /* | 114 | /* |
@@ -153,19 +136,11 @@ static struct file_operations cpcusb_fops = { | |||
153 | static struct usb_class_driver cpcusb_class = { | 136 | static struct usb_class_driver cpcusb_class = { |
154 | .name = "usb/cpc_usb%d", | 137 | .name = "usb/cpc_usb%d", |
155 | .fops = &cpcusb_fops, | 138 | .fops = &cpcusb_fops, |
156 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)) | ||
157 | .mode = | ||
158 | S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | | ||
159 | S_IWOTH, | ||
160 | #endif | ||
161 | .minor_base = CPC_USB_BASE_MNR, | 139 | .minor_base = CPC_USB_BASE_MNR, |
162 | }; | 140 | }; |
163 | 141 | ||
164 | /* usb specific object needed to register this driver with the usb subsystem */ | 142 | /* usb specific object needed to register this driver with the usb subsystem */ |
165 | static struct usb_driver cpcusb_driver = { | 143 | static struct usb_driver cpcusb_driver = { |
166 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,14)) | ||
167 | .owner = THIS_MODULE, | ||
168 | #endif | ||
169 | .name = "cpc-usb", | 144 | .name = "cpc-usb", |
170 | .probe = cpcusb_probe, | 145 | .probe = cpcusb_probe, |
171 | .disconnect = cpcusb_disconnect, | 146 | .disconnect = cpcusb_disconnect, |
@@ -210,7 +185,7 @@ static int cpcusb_proc_read_info(char *page, char **start, off_t off, | |||
210 | /* | 185 | /* |
211 | * Remove CPC-USB and cleanup | 186 | * Remove CPC-USB and cleanup |
212 | */ | 187 | */ |
213 | static inline void cpcusb_delete(CPC_USB_T * card) | 188 | static inline void cpcusb_delete(CPC_USB_T *card) |
214 | { | 189 | { |
215 | if (card) { | 190 | if (card) { |
216 | if (card->chan) { | 191 | if (card->chan) { |
@@ -231,7 +206,7 @@ static inline void cpcusb_delete(CPC_USB_T * card) | |||
231 | /* | 206 | /* |
232 | * setup the interrupt IN endpoint of a specific CPC-USB device | 207 | * setup the interrupt IN endpoint of a specific CPC-USB device |
233 | */ | 208 | */ |
234 | static int cpcusb_setup_intrep(CPC_USB_T * card) | 209 | static int cpcusb_setup_intrep(CPC_USB_T *card) |
235 | { | 210 | { |
236 | int retval = 0; | 211 | int retval = 0; |
237 | struct usb_endpoint_descriptor *ep; | 212 | struct usb_endpoint_descriptor *ep; |
@@ -243,21 +218,21 @@ static int cpcusb_setup_intrep(CPC_USB_T * card) | |||
243 | 218 | ||
244 | /* setup the urb */ | 219 | /* setup the urb */ |
245 | usb_fill_int_urb(card->intr_in_urb, card->udev, | 220 | usb_fill_int_urb(card->intr_in_urb, card->udev, |
246 | usb_rcvintpipe(card->udev, card->num_intr_in), | 221 | usb_rcvintpipe(card->udev, card->num_intr_in), |
247 | card->intr_in_buffer, | 222 | card->intr_in_buffer, |
248 | sizeof(card->intr_in_buffer), | 223 | sizeof(card->intr_in_buffer), |
249 | cpcusb_read_interrupt_callback, | 224 | cpcusb_read_interrupt_callback, |
250 | card, | 225 | card, |
251 | ep->bInterval); | 226 | ep->bInterval); |
252 | 227 | ||
253 | card->intr_in_urb->status = 0; /* needed! */ | 228 | card->intr_in_urb->status = 0; /* needed! */ |
254 | 229 | ||
255 | /* submit the urb */ | 230 | /* submit the urb */ |
256 | retval = usb_submit_urb(card->intr_in_urb, GFP_KERNEL); | 231 | retval = usb_submit_urb(card->intr_in_urb, GFP_KERNEL); |
257 | 232 | ||
258 | if (retval) { | 233 | if (retval) |
259 | err("%s - failed submitting intr urb, error %d", __FUNCTION__, retval); | 234 | err("%s - failed submitting intr urb, error %d", __func__, |
260 | } | 235 | retval); |
261 | 236 | ||
262 | return retval; | 237 | return retval; |
263 | } | 238 | } |
@@ -277,7 +252,7 @@ static int cpcusb_open(struct inode *inode, struct file *file) | |||
277 | interface = usb_find_interface(&cpcusb_driver, subminor); | 252 | interface = usb_find_interface(&cpcusb_driver, subminor); |
278 | if (!interface) { | 253 | if (!interface) { |
279 | err("%s - error, can't find device for minor %d", | 254 | err("%s - error, can't find device for minor %d", |
280 | __FUNCTION__, subminor); | 255 | __func__, subminor); |
281 | retval = CPC_ERR_NO_INTERFACE_PRESENT; | 256 | retval = CPC_ERR_NO_INTERFACE_PRESENT; |
282 | goto exit_no_device; | 257 | goto exit_no_device; |
283 | } | 258 | } |
@@ -302,21 +277,21 @@ static int cpcusb_open(struct inode *inode, struct file *file) | |||
302 | file->private_data = card; | 277 | file->private_data = card; |
303 | for (j = 0; j < CPC_USB_URB_CNT; j++) { | 278 | for (j = 0; j < CPC_USB_URB_CNT; j++) { |
304 | usb_fill_bulk_urb(card->urbs[j].urb, card->udev, | 279 | usb_fill_bulk_urb(card->urbs[j].urb, card->udev, |
305 | usb_rcvbulkpipe(card->udev, card->num_bulk_in), | 280 | usb_rcvbulkpipe(card->udev, card->num_bulk_in), |
306 | card->urbs[j].buffer, card->urbs[j].size, | 281 | card->urbs[j].buffer, card->urbs[j].size, |
307 | cpcusb_read_bulk_callback, card); | 282 | cpcusb_read_bulk_callback, card); |
308 | 283 | ||
309 | retval = usb_submit_urb(card->urbs[j].urb, GFP_KERNEL); | 284 | retval = usb_submit_urb(card->urbs[j].urb, GFP_KERNEL); |
310 | 285 | ||
311 | if (retval) { | 286 | if (retval) { |
312 | err("%s - failed submitting read urb, error %d", | 287 | err("%s - failed submitting read urb, error %d", |
313 | __FUNCTION__, retval); | 288 | __func__, retval); |
314 | retval = CPC_ERR_TRANSMISSION_FAILED; | 289 | retval = CPC_ERR_TRANSMISSION_FAILED; |
315 | goto exit_on_error; | 290 | goto exit_on_error; |
316 | } | 291 | } |
317 | } | 292 | } |
318 | 293 | ||
319 | info("%s - %d URB's submitted", __FUNCTION__, j); | 294 | info("%s - %d URB's submitted", __func__, j); |
320 | 295 | ||
321 | ResetBuffer(card->chan); | 296 | ResetBuffer(card->chan); |
322 | 297 | ||
@@ -341,7 +316,7 @@ static unsigned int cpcusb_poll(struct file *file, poll_table * wait) | |||
341 | unsigned int retval = 0; | 316 | unsigned int retval = 0; |
342 | 317 | ||
343 | if (!card) { | 318 | if (!card) { |
344 | err("%s - device object lost", __FUNCTION__); | 319 | err("%s - device object lost", __func__); |
345 | return -EIO; | 320 | return -EIO; |
346 | } | 321 | } |
347 | 322 | ||
@@ -362,7 +337,7 @@ static int cpcusb_release(struct inode *inode, struct file *file) | |||
362 | int j, retval = 0; | 337 | int j, retval = 0; |
363 | 338 | ||
364 | if (card == NULL) { | 339 | if (card == NULL) { |
365 | dbg("%s - object is NULL", __FUNCTION__); | 340 | dbg("%s - object is NULL", __func__); |
366 | return CPC_ERR_NO_INTERFACE_PRESENT; | 341 | return CPC_ERR_NO_INTERFACE_PRESENT; |
367 | } | 342 | } |
368 | 343 | ||
@@ -370,7 +345,7 @@ static int cpcusb_release(struct inode *inode, struct file *file) | |||
370 | down(&card->sem); | 345 | down(&card->sem); |
371 | 346 | ||
372 | if (!card->open) { | 347 | if (!card->open) { |
373 | dbg("%s - device not opened", __FUNCTION__); | 348 | dbg("%s - device not opened", __func__); |
374 | retval = CPC_ERR_NO_INTERFACE_PRESENT; | 349 | retval = CPC_ERR_NO_INTERFACE_PRESENT; |
375 | goto exit_not_opened; | 350 | goto exit_not_opened; |
376 | } | 351 | } |
@@ -417,7 +392,7 @@ exit_not_opened: | |||
417 | } | 392 | } |
418 | 393 | ||
419 | static ssize_t cpcusb_read(struct file *file, char *buffer, size_t count, | 394 | static ssize_t cpcusb_read(struct file *file, char *buffer, size_t count, |
420 | loff_t * ppos) | 395 | loff_t *ppos) |
421 | { | 396 | { |
422 | CPC_USB_T *card = (CPC_USB_T *) file->private_data; | 397 | CPC_USB_T *card = (CPC_USB_T *) file->private_data; |
423 | CPC_CHAN_T *chan; | 398 | CPC_CHAN_T *chan; |
@@ -460,7 +435,7 @@ static ssize_t cpcusb_read(struct file *file, char *buffer, size_t count, | |||
460 | retval = sizeof(CPC_MSG_T); | 435 | retval = sizeof(CPC_MSG_T); |
461 | } | 436 | } |
462 | } | 437 | } |
463 | // spin_unlock_irqrestore(&card->slock, flags); | 438 | /* spin_unlock_irqrestore(&card->slock, flags); */ |
464 | 439 | ||
465 | /* unlock the device */ | 440 | /* unlock the device */ |
466 | up(&card->sem); | 441 | up(&card->sem); |
@@ -469,9 +444,9 @@ static ssize_t cpcusb_read(struct file *file, char *buffer, size_t count, | |||
469 | } | 444 | } |
470 | 445 | ||
471 | #define SHIFT 1 | 446 | #define SHIFT 1 |
472 | static void inline cpcusb_align_buffer_alignment(unsigned char *buf) | 447 | static inline void cpcusb_align_buffer_alignment(unsigned char *buf) |
473 | { | 448 | { |
474 | // CPC-USB uploads packed bytes. | 449 | /* CPC-USB uploads packed bytes. */ |
475 | CPC_MSG_T *cpc = (CPC_MSG_T *) buf; | 450 | CPC_MSG_T *cpc = (CPC_MSG_T *) buf; |
476 | unsigned int i; | 451 | unsigned int i; |
477 | 452 | ||
@@ -481,9 +456,9 @@ static void inline cpcusb_align_buffer_alignment(unsigned char *buf) | |||
481 | } | 456 | } |
482 | } | 457 | } |
483 | 458 | ||
484 | static int cpc_get_buffer_count(CPC_CHAN_T * chan) | 459 | static int cpc_get_buffer_count(CPC_CHAN_T *chan) |
485 | { | 460 | { |
486 | // check the buffer parameters | 461 | /* check the buffer parameters */ |
487 | if (chan->iidx == chan->oidx) | 462 | if (chan->iidx == chan->oidx) |
488 | return !chan->WnR ? CPC_MSG_BUF_CNT : 0; | 463 | return !chan->WnR ? CPC_MSG_BUF_CNT : 0; |
489 | else if (chan->iidx >= chan->oidx) | 464 | else if (chan->iidx >= chan->oidx) |
@@ -493,7 +468,7 @@ static int cpc_get_buffer_count(CPC_CHAN_T * chan) | |||
493 | } | 468 | } |
494 | 469 | ||
495 | static ssize_t cpcusb_write(struct file *file, const char *buffer, | 470 | static ssize_t cpcusb_write(struct file *file, const char *buffer, |
496 | size_t count, loff_t * ppos) | 471 | size_t count, loff_t *ppos) |
497 | { | 472 | { |
498 | CPC_USB_T *card = (CPC_USB_T *) file->private_data; | 473 | CPC_USB_T *card = (CPC_USB_T *) file->private_data; |
499 | CPC_USB_WRITE_URB_T *wrUrb = NULL; | 474 | CPC_USB_WRITE_URB_T *wrUrb = NULL; |
@@ -507,7 +482,7 @@ static ssize_t cpcusb_write(struct file *file, const char *buffer, | |||
507 | CPC_MSG_T *info = NULL; | 482 | CPC_MSG_T *info = NULL; |
508 | 483 | ||
509 | dbg("%s - entered minor %d, count = %d, present = %d", | 484 | dbg("%s - entered minor %d, count = %d, present = %d", |
510 | __FUNCTION__, card->minor, count, card->present); | 485 | __func__, card->minor, count, card->present); |
511 | 486 | ||
512 | if (count > sizeof(CPC_MSG_T)) | 487 | if (count > sizeof(CPC_MSG_T)) |
513 | return CPC_ERR_UNKNOWN; | 488 | return CPC_ERR_UNKNOWN; |
@@ -527,7 +502,7 @@ static ssize_t cpcusb_write(struct file *file, const char *buffer, | |||
527 | 502 | ||
528 | /* verify that we actually have some data to write */ | 503 | /* verify that we actually have some data to write */ |
529 | if (count == 0) { | 504 | if (count == 0) { |
530 | dbg("%s - write request of 0 bytes", __FUNCTION__); | 505 | dbg("%s - write request of 0 bytes", __func__); |
531 | goto exit; | 506 | goto exit; |
532 | } | 507 | } |
533 | 508 | ||
@@ -537,7 +512,7 @@ static ssize_t cpcusb_write(struct file *file, const char *buffer, | |||
537 | if (info->type != CPC_CMD_T_CLEAR_CMD_QUEUE | 512 | if (info->type != CPC_CMD_T_CLEAR_CMD_QUEUE |
538 | || card->free_slots <= 0) { | 513 | || card->free_slots <= 0) { |
539 | dbg("%s - send buffer full please try again %d", | 514 | dbg("%s - send buffer full please try again %d", |
540 | __FUNCTION__, card->free_slots); | 515 | __func__, card->free_slots); |
541 | retval = CPC_ERR_CAN_NO_TRANSMIT_BUF; | 516 | retval = CPC_ERR_CAN_NO_TRANSMIT_BUF; |
542 | goto exit; | 517 | goto exit; |
543 | } | 518 | } |
@@ -556,7 +531,7 @@ static ssize_t cpcusb_write(struct file *file, const char *buffer, | |||
556 | 531 | ||
557 | /* don't found write urb say error */ | 532 | /* don't found write urb say error */ |
558 | if (!wrUrb) { | 533 | if (!wrUrb) { |
559 | dbg("%s - no free send urb available", __FUNCTION__); | 534 | dbg("%s - no free send urb available", __func__); |
560 | retval = CPC_ERR_CAN_NO_TRANSMIT_BUF; | 535 | retval = CPC_ERR_CAN_NO_TRANSMIT_BUF; |
561 | goto exit; | 536 | goto exit; |
562 | } | 537 | } |
@@ -576,7 +551,7 @@ static ssize_t cpcusb_write(struct file *file, const char *buffer, | |||
576 | /* check if it is a DRIVER information message, so we can | 551 | /* check if it is a DRIVER information message, so we can |
577 | * response to that message and not the USB | 552 | * response to that message and not the USB |
578 | */ | 553 | */ |
579 | info = (CPC_MSG_T *) & obuf[4]; | 554 | info = (CPC_MSG_T *) &obuf[4]; |
580 | 555 | ||
581 | bytes_written = 11 + info->length; | 556 | bytes_written = 11 + info->length; |
582 | if (bytes_written >= wrUrb->size) { | 557 | if (bytes_written >= wrUrb->size) { |
@@ -662,7 +637,7 @@ static ssize_t cpcusb_write(struct file *file, const char *buffer, | |||
662 | /* if it is a parameter message convert it from SJA1000 controller | 637 | /* if it is a parameter message convert it from SJA1000 controller |
663 | * settings to M16C Basic controller settings | 638 | * settings to M16C Basic controller settings |
664 | */ | 639 | */ |
665 | SJA1000_TO_M16C_BASIC_Params((CPC_MSG_T *) & obuf[4]); | 640 | SJA1000_TO_M16C_BASIC_Params((CPC_MSG_T *) &obuf[4]); |
666 | } | 641 | } |
667 | 642 | ||
668 | /* don't forget the byte alignment */ | 643 | /* don't forget the byte alignment */ |
@@ -681,7 +656,7 @@ static ssize_t cpcusb_write(struct file *file, const char *buffer, | |||
681 | if (retval) { | 656 | if (retval) { |
682 | atomic_set(&wrUrb->busy, 0); /* release urb */ | 657 | atomic_set(&wrUrb->busy, 0); /* release urb */ |
683 | err("%s - failed submitting write urb, error %d", | 658 | err("%s - failed submitting write urb, error %d", |
684 | __FUNCTION__, retval); | 659 | __func__, retval); |
685 | } else { | 660 | } else { |
686 | retval = bytes_written; | 661 | retval = bytes_written; |
687 | } | 662 | } |
@@ -690,7 +665,7 @@ exit: | |||
690 | /* unlock the device */ | 665 | /* unlock the device */ |
691 | up(&card->sem); | 666 | up(&card->sem); |
692 | 667 | ||
693 | dbg("%s - leaved", __FUNCTION__); | 668 | dbg("%s - leaved", __func__); |
694 | 669 | ||
695 | return retval; | 670 | return retval; |
696 | } | 671 | } |
@@ -698,11 +673,7 @@ exit: | |||
698 | /* | 673 | /* |
699 | * callback for interrupt IN urb | 674 | * callback for interrupt IN urb |
700 | */ | 675 | */ |
701 | static void cpcusb_read_interrupt_callback(struct urb *urb | 676 | static void cpcusb_read_interrupt_callback(struct urb *urb) |
702 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) | ||
703 | , struct pt_regs *regs | ||
704 | #endif | ||
705 | ) | ||
706 | { | 677 | { |
707 | CPC_USB_T *card = (CPC_USB_T *) urb->context; | 678 | CPC_USB_T *card = (CPC_USB_T *) urb->context; |
708 | int retval; | 679 | int retval; |
@@ -712,7 +683,7 @@ static void cpcusb_read_interrupt_callback(struct urb *urb | |||
712 | 683 | ||
713 | if (!card->present) { | 684 | if (!card->present) { |
714 | spin_unlock_irqrestore(&card->slock, flags); | 685 | spin_unlock_irqrestore(&card->slock, flags); |
715 | info("%s - no such device", __FUNCTION__); | 686 | info("%s - no such device", __func__); |
716 | return; | 687 | return; |
717 | } | 688 | } |
718 | 689 | ||
@@ -725,17 +696,17 @@ static void cpcusb_read_interrupt_callback(struct urb *urb | |||
725 | case -ESHUTDOWN: | 696 | case -ESHUTDOWN: |
726 | /* urb was killed */ | 697 | /* urb was killed */ |
727 | spin_unlock_irqrestore(&card->slock, flags); | 698 | spin_unlock_irqrestore(&card->slock, flags); |
728 | dbg("%s - intr urb killed", __FUNCTION__); | 699 | dbg("%s - intr urb killed", __func__); |
729 | return; | 700 | return; |
730 | default: | 701 | default: |
731 | info("%s - nonzero urb status %d", __FUNCTION__, urb->status); | 702 | info("%s - nonzero urb status %d", __func__, urb->status); |
732 | break; | 703 | break; |
733 | } | 704 | } |
734 | 705 | ||
735 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 706 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
736 | if (retval) { | 707 | if (retval) { |
737 | err("%s - failed resubmitting intr urb, error %d", | 708 | err("%s - failed resubmitting intr urb, error %d", |
738 | __FUNCTION__, retval); | 709 | __func__, retval); |
739 | } | 710 | } |
740 | 711 | ||
741 | spin_unlock_irqrestore(&card->slock, flags); | 712 | spin_unlock_irqrestore(&card->slock, flags); |
@@ -746,18 +717,16 @@ static void cpcusb_read_interrupt_callback(struct urb *urb | |||
746 | 717 | ||
747 | #define UN_SHIFT 1 | 718 | #define UN_SHIFT 1 |
748 | #define CPCMSG_HEADER_LEN_FIRMWARE 11 | 719 | #define CPCMSG_HEADER_LEN_FIRMWARE 11 |
749 | static int inline cpcusb_unalign_and_copy_buffy(unsigned char *out, | 720 | static inline int cpcusb_unalign_and_copy_buffy(unsigned char *out, |
750 | unsigned char *in) | 721 | unsigned char *in) |
751 | { | 722 | { |
752 | unsigned int i, j; | 723 | unsigned int i, j; |
753 | 724 | ||
754 | for (i = 0; i < 3; i++) { | 725 | for (i = 0; i < 3; i++) |
755 | out[i] = in[i]; | 726 | out[i] = in[i]; |
756 | } | ||
757 | 727 | ||
758 | for (j = 0; j < (in[1] + (CPCMSG_HEADER_LEN_FIRMWARE - 3)); j++) { | 728 | for (j = 0; j < (in[1] + (CPCMSG_HEADER_LEN_FIRMWARE - 3)); j++) |
759 | out[j + i + UN_SHIFT] = in[j + i]; | 729 | out[j + i + UN_SHIFT] = in[j + i]; |
760 | } | ||
761 | 730 | ||
762 | return i + j; | 731 | return i + j; |
763 | } | 732 | } |
@@ -765,11 +734,7 @@ static int inline cpcusb_unalign_and_copy_buffy(unsigned char *out, | |||
765 | /* | 734 | /* |
766 | * callback for bulk IN urb | 735 | * callback for bulk IN urb |
767 | */ | 736 | */ |
768 | static void cpcusb_read_bulk_callback(struct urb *urb | 737 | static void cpcusb_read_bulk_callback(struct urb *urb) |
769 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) | ||
770 | , struct pt_regs *regs | ||
771 | #endif | ||
772 | ) | ||
773 | { | 738 | { |
774 | CPC_USB_T *card = (CPC_USB_T *) urb->context; | 739 | CPC_USB_T *card = (CPC_USB_T *) urb->context; |
775 | CPC_CHAN_T *chan; | 740 | CPC_CHAN_T *chan; |
@@ -778,7 +743,7 @@ static void cpcusb_read_bulk_callback(struct urb *urb | |||
778 | unsigned long flags; | 743 | unsigned long flags; |
779 | 744 | ||
780 | if (!card) { | 745 | if (!card) { |
781 | err("%s - device object lost", __FUNCTION__); | 746 | err("%s - device object lost", __func__); |
782 | return; | 747 | return; |
783 | } | 748 | } |
784 | 749 | ||
@@ -786,7 +751,7 @@ static void cpcusb_read_bulk_callback(struct urb *urb | |||
786 | 751 | ||
787 | if (!card->present) { | 752 | if (!card->present) { |
788 | spin_unlock_irqrestore(&card->slock, flags); | 753 | spin_unlock_irqrestore(&card->slock, flags); |
789 | info("%s - no such device", __FUNCTION__); | 754 | info("%s - no such device", __func__); |
790 | return; | 755 | return; |
791 | } | 756 | } |
792 | 757 | ||
@@ -798,10 +763,10 @@ static void cpcusb_read_bulk_callback(struct urb *urb | |||
798 | case -ESHUTDOWN: | 763 | case -ESHUTDOWN: |
799 | /* urb was killed */ | 764 | /* urb was killed */ |
800 | spin_unlock_irqrestore(&card->slock, flags); | 765 | spin_unlock_irqrestore(&card->slock, flags); |
801 | dbg("%s - read urb killed", __FUNCTION__); | 766 | dbg("%s - read urb killed", __func__); |
802 | return; | 767 | return; |
803 | default: | 768 | default: |
804 | info("%s - nonzero urb status %d", __FUNCTION__, urb->status); | 769 | info("%s - nonzero urb status %d", __func__, urb->status); |
805 | break; | 770 | break; |
806 | } | 771 | } |
807 | 772 | ||
@@ -833,15 +798,15 @@ static void cpcusb_read_bulk_callback(struct urb *urb | |||
833 | } | 798 | } |
834 | 799 | ||
835 | usb_fill_bulk_urb(urb, card->udev, | 800 | usb_fill_bulk_urb(urb, card->udev, |
836 | usb_rcvbulkpipe(card->udev, card->num_bulk_in), | 801 | usb_rcvbulkpipe(card->udev, card->num_bulk_in), |
837 | urb->transfer_buffer, | 802 | urb->transfer_buffer, |
838 | urb->transfer_buffer_length, | 803 | urb->transfer_buffer_length, |
839 | cpcusb_read_bulk_callback, card); | 804 | cpcusb_read_bulk_callback, card); |
840 | 805 | ||
841 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 806 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
842 | 807 | ||
843 | if (retval) { | 808 | if (retval) { |
844 | err("%s - failed resubmitting read urb, error %d", __FUNCTION__, retval); | 809 | err("%s - failed resubmitting read urb, error %d", __func__, retval); |
845 | } | 810 | } |
846 | 811 | ||
847 | spin_unlock_irqrestore(&card->slock, flags); | 812 | spin_unlock_irqrestore(&card->slock, flags); |
@@ -852,11 +817,7 @@ static void cpcusb_read_bulk_callback(struct urb *urb | |||
852 | /* | 817 | /* |
853 | * callback for bulk IN urb | 818 | * callback for bulk IN urb |
854 | */ | 819 | */ |
855 | static void cpcusb_write_bulk_callback(struct urb *urb | 820 | static void cpcusb_write_bulk_callback(struct urb *urb) |
856 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) | ||
857 | , struct pt_regs *regs | ||
858 | #endif | ||
859 | ) | ||
860 | { | 821 | { |
861 | CPC_USB_T *card = (CPC_USB_T *) urb->context; | 822 | CPC_USB_T *card = (CPC_USB_T *) urb->context; |
862 | unsigned long flags; | 823 | unsigned long flags; |
@@ -883,10 +844,10 @@ static void cpcusb_write_bulk_callback(struct urb *urb | |||
883 | case -ESHUTDOWN: | 844 | case -ESHUTDOWN: |
884 | /* urb was killed */ | 845 | /* urb was killed */ |
885 | spin_unlock_irqrestore(&card->slock, flags); | 846 | spin_unlock_irqrestore(&card->slock, flags); |
886 | dbg("%s - write urb no. %d killed", __FUNCTION__, j); | 847 | dbg("%s - write urb no. %d killed", __func__, j); |
887 | return; | 848 | return; |
888 | default: | 849 | default: |
889 | info("%s - nonzero urb status %d", __FUNCTION__, urb->status); | 850 | info("%s - nonzero urb status %d", __func__, urb->status); |
890 | break; | 851 | break; |
891 | } | 852 | } |
892 | 853 | ||
@@ -911,7 +872,7 @@ static inline int cpcusb_get_free_slot(void) | |||
911 | * probe function for new CPC-USB devices | 872 | * probe function for new CPC-USB devices |
912 | */ | 873 | */ |
913 | static int cpcusb_probe(struct usb_interface *interface, | 874 | static int cpcusb_probe(struct usb_interface *interface, |
914 | const struct usb_device_id *id) | 875 | const struct usb_device_id *id) |
915 | { | 876 | { |
916 | CPC_USB_T *card = NULL; | 877 | CPC_USB_T *card = NULL; |
917 | CPC_CHAN_T *chan = NULL; | 878 | CPC_CHAN_T *chan = NULL; |
@@ -922,7 +883,8 @@ static int cpcusb_probe(struct usb_interface *interface, | |||
922 | 883 | ||
923 | int i, j, retval = -ENOMEM, slot; | 884 | int i, j, retval = -ENOMEM, slot; |
924 | 885 | ||
925 | if ((slot = cpcusb_get_free_slot()) < 0) { | 886 | slot = cpcusb_get_free_slot(); |
887 | if (slot < 0) { | ||
926 | info("No more devices supported"); | 888 | info("No more devices supported"); |
927 | return -ENOMEM; | 889 | return -ENOMEM; |
928 | } | 890 | } |
@@ -961,7 +923,7 @@ static int cpcusb_probe(struct usb_interface *interface, | |||
961 | card->productId = udev->descriptor.idProduct; | 923 | card->productId = udev->descriptor.idProduct; |
962 | info("Product %s", | 924 | info("Product %s", |
963 | card->productId == USB_CPCUSB_LPC2119_PRODUCT_ID ? | 925 | card->productId == USB_CPCUSB_LPC2119_PRODUCT_ID ? |
964 | "CPC-USB/ARM7" : "CPC-USB/M16C"); | 926 | "CPC-USB/ARM7" : "CPC-USB/M16C"); |
965 | 927 | ||
966 | /* set up the endpoint information */ | 928 | /* set up the endpoint information */ |
967 | /* check out the endpoints */ | 929 | /* check out the endpoints */ |
@@ -1008,7 +970,7 @@ static int cpcusb_probe(struct usb_interface *interface, | |||
1008 | } | 970 | } |
1009 | } | 971 | } |
1010 | info("%s - %d reading URB's allocated", | 972 | info("%s - %d reading URB's allocated", |
1011 | __FUNCTION__, CPC_USB_URB_CNT); | 973 | __func__, CPC_USB_URB_CNT); |
1012 | } | 974 | } |
1013 | 975 | ||
1014 | if (!card->num_bulk_out && | 976 | if (!card->num_bulk_out && |
@@ -1028,8 +990,8 @@ static int cpcusb_probe(struct usb_interface *interface, | |||
1028 | goto error; | 990 | goto error; |
1029 | } | 991 | } |
1030 | card->wrUrbs[j].buffer = usb_buffer_alloc(udev, | 992 | card->wrUrbs[j].buffer = usb_buffer_alloc(udev, |
1031 | card->wrUrbs[j].size, GFP_KERNEL, | 993 | card->wrUrbs[j].size, GFP_KERNEL, |
1032 | &card->wrUrbs[j].urb->transfer_dma); | 994 | &card->wrUrbs[j].urb->transfer_dma); |
1033 | 995 | ||
1034 | if (!card->wrUrbs[j].buffer) { | 996 | if (!card->wrUrbs[j].buffer) { |
1035 | err("Couldn't allocate bulk_out_buffer"); | 997 | err("Couldn't allocate bulk_out_buffer"); |
@@ -1044,7 +1006,7 @@ static int cpcusb_probe(struct usb_interface *interface, | |||
1044 | card); | 1006 | card); |
1045 | } | 1007 | } |
1046 | 1008 | ||
1047 | info("%s - %d writing URB's allocated", __FUNCTION__, CPC_USB_URB_CNT); | 1009 | info("%s - %d writing URB's allocated", __func__, CPC_USB_URB_CNT); |
1048 | } | 1010 | } |
1049 | } | 1011 | } |
1050 | 1012 | ||