diff options
author | Joe Perches <joe@perches.com> | 2010-08-10 21:01:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 11:59:01 -0400 |
commit | 87da32356bcee42569666bef1479d0e599a556f8 (patch) | |
tree | 21f4e58d63d4e988780e802d68770498ee00fbda /drivers/scsi | |
parent | 6d154db6b3fc3c4dc3fbf7c32df0ad9d7aeaa18c (diff) |
drivers/scsi/ch.c: don't use vprintk as macro
It's an exported symbol of kernel/printk.c
Rename vprintk and dprintk macros to more common VPRINTK and DPRINTK
Add do { } while(0) around macros
Add level to VPRINTK so KERN_CONT can be used a couple of times.
Signed-off-by: Joe Perches <joe@perches.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ch.c | 87 |
1 files changed, 44 insertions, 43 deletions
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 769b35f8b39f..d6532187f616 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c | |||
@@ -84,10 +84,16 @@ static const char * vendor_labels[CH_TYPES-4] = { | |||
84 | }; | 84 | }; |
85 | // module_param_string_array(vendor_labels, NULL, 0444); | 85 | // module_param_string_array(vendor_labels, NULL, 0444); |
86 | 86 | ||
87 | #define dprintk(fmt, arg...) if (debug) \ | 87 | #define DPRINTK(fmt, arg...) \ |
88 | printk(KERN_DEBUG "%s: " fmt, ch->name , ## arg) | 88 | do { \ |
89 | #define vprintk(fmt, arg...) if (verbose) \ | 89 | if (debug) \ |
90 | printk(KERN_INFO "%s: " fmt, ch->name , ## arg) | 90 | printk(KERN_DEBUG "%s: " fmt, ch->name, ##arg); \ |
91 | } while (0) | ||
92 | #define VPRINTK(level, fmt, arg...) \ | ||
93 | do { \ | ||
94 | if (verbose) \ | ||
95 | printk(level "%s: " fmt, ch->name, ##arg); \ | ||
96 | } while (0) | ||
91 | 97 | ||
92 | /* ------------------------------------------------------------------- */ | 98 | /* ------------------------------------------------------------------- */ |
93 | 99 | ||
@@ -186,7 +192,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, | |||
186 | retry: | 192 | retry: |
187 | errno = 0; | 193 | errno = 0; |
188 | if (debug) { | 194 | if (debug) { |
189 | dprintk("command: "); | 195 | DPRINTK("command: "); |
190 | __scsi_print_command(cmd); | 196 | __scsi_print_command(cmd); |
191 | } | 197 | } |
192 | 198 | ||
@@ -194,7 +200,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, | |||
194 | buflength, &sshdr, timeout * HZ, | 200 | buflength, &sshdr, timeout * HZ, |
195 | MAX_RETRIES, NULL); | 201 | MAX_RETRIES, NULL); |
196 | 202 | ||
197 | dprintk("result: 0x%x\n",result); | 203 | DPRINTK("result: 0x%x\n",result); |
198 | if (driver_byte(result) & DRIVER_SENSE) { | 204 | if (driver_byte(result) & DRIVER_SENSE) { |
199 | if (debug) | 205 | if (debug) |
200 | scsi_print_sense_hdr(ch->name, &sshdr); | 206 | scsi_print_sense_hdr(ch->name, &sshdr); |
@@ -250,7 +256,7 @@ ch_read_element_status(scsi_changer *ch, u_int elem, char *data) | |||
250 | cmd[9] = 255; | 256 | cmd[9] = 255; |
251 | if (0 == (result = ch_do_scsi(ch, cmd, buffer, 256, DMA_FROM_DEVICE))) { | 257 | if (0 == (result = ch_do_scsi(ch, cmd, buffer, 256, DMA_FROM_DEVICE))) { |
252 | if (((buffer[16] << 8) | buffer[17]) != elem) { | 258 | if (((buffer[16] << 8) | buffer[17]) != elem) { |
253 | dprintk("asked for element 0x%02x, got 0x%02x\n", | 259 | DPRINTK("asked for element 0x%02x, got 0x%02x\n", |
254 | elem,(buffer[16] << 8) | buffer[17]); | 260 | elem,(buffer[16] << 8) | buffer[17]); |
255 | kfree(buffer); | 261 | kfree(buffer); |
256 | return -EIO; | 262 | return -EIO; |
@@ -259,10 +265,10 @@ ch_read_element_status(scsi_changer *ch, u_int elem, char *data) | |||
259 | } else { | 265 | } else { |
260 | if (ch->voltags) { | 266 | if (ch->voltags) { |
261 | ch->voltags = 0; | 267 | ch->voltags = 0; |
262 | vprintk("device has no volume tag support\n"); | 268 | VPRINTK(KERN_INFO, "device has no volume tag support\n"); |
263 | goto retry; | 269 | goto retry; |
264 | } | 270 | } |
265 | dprintk("READ ELEMENT STATUS for element 0x%x failed\n",elem); | 271 | DPRINTK("READ ELEMENT STATUS for element 0x%x failed\n",elem); |
266 | } | 272 | } |
267 | kfree(buffer); | 273 | kfree(buffer); |
268 | return result; | 274 | return result; |
@@ -274,12 +280,12 @@ ch_init_elem(scsi_changer *ch) | |||
274 | int err; | 280 | int err; |
275 | u_char cmd[6]; | 281 | u_char cmd[6]; |
276 | 282 | ||
277 | vprintk("INITIALIZE ELEMENT STATUS, may take some time ...\n"); | 283 | VPRINTK(KERN_INFO, "INITIALIZE ELEMENT STATUS, may take some time ...\n"); |
278 | memset(cmd,0,sizeof(cmd)); | 284 | memset(cmd,0,sizeof(cmd)); |
279 | cmd[0] = INITIALIZE_ELEMENT_STATUS; | 285 | cmd[0] = INITIALIZE_ELEMENT_STATUS; |
280 | cmd[1] = ch->device->lun << 5; | 286 | cmd[1] = ch->device->lun << 5; |
281 | err = ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE); | 287 | err = ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE); |
282 | vprintk("... finished\n"); | 288 | VPRINTK(KERN_INFO, "... finished\n"); |
283 | return err; | 289 | return err; |
284 | } | 290 | } |
285 | 291 | ||
@@ -322,20 +328,20 @@ ch_readconfig(scsi_changer *ch) | |||
322 | (buffer[buffer[3]+18] << 8) | buffer[buffer[3]+19]; | 328 | (buffer[buffer[3]+18] << 8) | buffer[buffer[3]+19]; |
323 | ch->counts[CHET_DT] = | 329 | ch->counts[CHET_DT] = |
324 | (buffer[buffer[3]+20] << 8) | buffer[buffer[3]+21]; | 330 | (buffer[buffer[3]+20] << 8) | buffer[buffer[3]+21]; |
325 | vprintk("type #1 (mt): 0x%x+%d [medium transport]\n", | 331 | VPRINTK(KERN_INFO, "type #1 (mt): 0x%x+%d [medium transport]\n", |
326 | ch->firsts[CHET_MT], | 332 | ch->firsts[CHET_MT], |
327 | ch->counts[CHET_MT]); | 333 | ch->counts[CHET_MT]); |
328 | vprintk("type #2 (st): 0x%x+%d [storage]\n", | 334 | VPRINTK(KERN_INFO, "type #2 (st): 0x%x+%d [storage]\n", |
329 | ch->firsts[CHET_ST], | 335 | ch->firsts[CHET_ST], |
330 | ch->counts[CHET_ST]); | 336 | ch->counts[CHET_ST]); |
331 | vprintk("type #3 (ie): 0x%x+%d [import/export]\n", | 337 | VPRINTK(KERN_INFO, "type #3 (ie): 0x%x+%d [import/export]\n", |
332 | ch->firsts[CHET_IE], | 338 | ch->firsts[CHET_IE], |
333 | ch->counts[CHET_IE]); | 339 | ch->counts[CHET_IE]); |
334 | vprintk("type #4 (dt): 0x%x+%d [data transfer]\n", | 340 | VPRINTK(KERN_INFO, "type #4 (dt): 0x%x+%d [data transfer]\n", |
335 | ch->firsts[CHET_DT], | 341 | ch->firsts[CHET_DT], |
336 | ch->counts[CHET_DT]); | 342 | ch->counts[CHET_DT]); |
337 | } else { | 343 | } else { |
338 | vprintk("reading element address assigment page failed!\n"); | 344 | VPRINTK(KERN_INFO, "reading element address assigment page failed!\n"); |
339 | } | 345 | } |
340 | 346 | ||
341 | /* vendor specific element types */ | 347 | /* vendor specific element types */ |
@@ -346,7 +352,7 @@ ch_readconfig(scsi_changer *ch) | |||
346 | continue; | 352 | continue; |
347 | ch->firsts[CHET_V1+i] = vendor_firsts[i]; | 353 | ch->firsts[CHET_V1+i] = vendor_firsts[i]; |
348 | ch->counts[CHET_V1+i] = vendor_counts[i]; | 354 | ch->counts[CHET_V1+i] = vendor_counts[i]; |
349 | vprintk("type #%d (v%d): 0x%x+%d [%s, vendor specific]\n", | 355 | VPRINTK(KERN_INFO, "type #%d (v%d): 0x%x+%d [%s, vendor specific]\n", |
350 | i+5,i+1,vendor_firsts[i],vendor_counts[i], | 356 | i+5,i+1,vendor_firsts[i],vendor_counts[i], |
351 | vendor_labels[i]); | 357 | vendor_labels[i]); |
352 | } | 358 | } |
@@ -366,21 +372,19 @@ ch_readconfig(scsi_changer *ch) | |||
366 | if (elem < CH_DT_MAX && -1 != dt_id[elem]) { | 372 | if (elem < CH_DT_MAX && -1 != dt_id[elem]) { |
367 | id = dt_id[elem]; | 373 | id = dt_id[elem]; |
368 | lun = dt_lun[elem]; | 374 | lun = dt_lun[elem]; |
369 | vprintk("dt 0x%x: [insmod option] ", | 375 | VPRINTK(KERN_INFO, "dt 0x%x: [insmod option] ", |
370 | elem+ch->firsts[CHET_DT]); | 376 | elem+ch->firsts[CHET_DT]); |
371 | } else if (0 != ch_read_element_status | 377 | } else if (0 != ch_read_element_status |
372 | (ch,elem+ch->firsts[CHET_DT],data)) { | 378 | (ch,elem+ch->firsts[CHET_DT],data)) { |
373 | vprintk("dt 0x%x: READ ELEMENT STATUS failed\n", | 379 | VPRINTK(KERN_INFO, "dt 0x%x: READ ELEMENT STATUS failed\n", |
374 | elem+ch->firsts[CHET_DT]); | 380 | elem+ch->firsts[CHET_DT]); |
375 | } else { | 381 | } else { |
376 | vprintk("dt 0x%x: ",elem+ch->firsts[CHET_DT]); | 382 | VPRINTK(KERN_INFO, "dt 0x%x: ",elem+ch->firsts[CHET_DT]); |
377 | if (data[6] & 0x80) { | 383 | if (data[6] & 0x80) { |
378 | if (verbose) | 384 | VPRINTK(KERN_CONT, "not this SCSI bus\n"); |
379 | printk("not this SCSI bus\n"); | ||
380 | ch->dt[elem] = NULL; | 385 | ch->dt[elem] = NULL; |
381 | } else if (0 == (data[6] & 0x30)) { | 386 | } else if (0 == (data[6] & 0x30)) { |
382 | if (verbose) | 387 | VPRINTK(KERN_CONT, "ID/LUN unknown\n"); |
383 | printk("ID/LUN unknown\n"); | ||
384 | ch->dt[elem] = NULL; | 388 | ch->dt[elem] = NULL; |
385 | } else { | 389 | } else { |
386 | id = ch->device->id; | 390 | id = ch->device->id; |
@@ -390,22 +394,19 @@ ch_readconfig(scsi_changer *ch) | |||
390 | } | 394 | } |
391 | } | 395 | } |
392 | if (-1 != id) { | 396 | if (-1 != id) { |
393 | if (verbose) | 397 | VPRINTK(KERN_CONT, "ID %i, LUN %i, ",id,lun); |
394 | printk("ID %i, LUN %i, ",id,lun); | ||
395 | ch->dt[elem] = | 398 | ch->dt[elem] = |
396 | scsi_device_lookup(ch->device->host, | 399 | scsi_device_lookup(ch->device->host, |
397 | ch->device->channel, | 400 | ch->device->channel, |
398 | id,lun); | 401 | id,lun); |
399 | if (!ch->dt[elem]) { | 402 | if (!ch->dt[elem]) { |
400 | /* should not happen */ | 403 | /* should not happen */ |
401 | if (verbose) | 404 | VPRINTK(KERN_CONT, "Huh? device not found!\n"); |
402 | printk("Huh? device not found!\n"); | ||
403 | } else { | 405 | } else { |
404 | if (verbose) | 406 | VPRINTK(KERN_CONT, "name: %8.8s %16.16s %4.4s\n", |
405 | printk("name: %8.8s %16.16s %4.4s\n", | 407 | ch->dt[elem]->vendor, |
406 | ch->dt[elem]->vendor, | 408 | ch->dt[elem]->model, |
407 | ch->dt[elem]->model, | 409 | ch->dt[elem]->rev); |
408 | ch->dt[elem]->rev); | ||
409 | } | 410 | } |
410 | } | 411 | } |
411 | } | 412 | } |
@@ -422,7 +423,7 @@ ch_position(scsi_changer *ch, u_int trans, u_int elem, int rotate) | |||
422 | { | 423 | { |
423 | u_char cmd[10]; | 424 | u_char cmd[10]; |
424 | 425 | ||
425 | dprintk("position: 0x%x\n",elem); | 426 | DPRINTK("position: 0x%x\n",elem); |
426 | if (0 == trans) | 427 | if (0 == trans) |
427 | trans = ch->firsts[CHET_MT]; | 428 | trans = ch->firsts[CHET_MT]; |
428 | memset(cmd,0,sizeof(cmd)); | 429 | memset(cmd,0,sizeof(cmd)); |
@@ -441,7 +442,7 @@ ch_move(scsi_changer *ch, u_int trans, u_int src, u_int dest, int rotate) | |||
441 | { | 442 | { |
442 | u_char cmd[12]; | 443 | u_char cmd[12]; |
443 | 444 | ||
444 | dprintk("move: 0x%x => 0x%x\n",src,dest); | 445 | DPRINTK("move: 0x%x => 0x%x\n",src,dest); |
445 | if (0 == trans) | 446 | if (0 == trans) |
446 | trans = ch->firsts[CHET_MT]; | 447 | trans = ch->firsts[CHET_MT]; |
447 | memset(cmd,0,sizeof(cmd)); | 448 | memset(cmd,0,sizeof(cmd)); |
@@ -463,7 +464,7 @@ ch_exchange(scsi_changer *ch, u_int trans, u_int src, | |||
463 | { | 464 | { |
464 | u_char cmd[12]; | 465 | u_char cmd[12]; |
465 | 466 | ||
466 | dprintk("exchange: 0x%x => 0x%x => 0x%x\n", | 467 | DPRINTK("exchange: 0x%x => 0x%x => 0x%x\n", |
467 | src,dest1,dest2); | 468 | src,dest1,dest2); |
468 | if (0 == trans) | 469 | if (0 == trans) |
469 | trans = ch->firsts[CHET_MT]; | 470 | trans = ch->firsts[CHET_MT]; |
@@ -511,7 +512,7 @@ ch_set_voltag(scsi_changer *ch, u_int elem, | |||
511 | if (!buffer) | 512 | if (!buffer) |
512 | return -ENOMEM; | 513 | return -ENOMEM; |
513 | 514 | ||
514 | dprintk("%s %s voltag: 0x%x => \"%s\"\n", | 515 | DPRINTK("%s %s voltag: 0x%x => \"%s\"\n", |
515 | clear ? "clear" : "set", | 516 | clear ? "clear" : "set", |
516 | alternate ? "alternate" : "primary", | 517 | alternate ? "alternate" : "primary", |
517 | elem, tag); | 518 | elem, tag); |
@@ -550,7 +551,7 @@ static int ch_gstatus(scsi_changer *ch, int type, unsigned char __user *dest) | |||
550 | } | 551 | } |
551 | put_user(data[2], dest+i); | 552 | put_user(data[2], dest+i); |
552 | if (data[2] & CESTATUS_EXCEPT) | 553 | if (data[2] & CESTATUS_EXCEPT) |
553 | vprintk("element 0x%x: asc=0x%x, ascq=0x%x\n", | 554 | VPRINTK(KERN_INFO, "element 0x%x: asc=0x%x, ascq=0x%x\n", |
554 | ch->firsts[type]+i, | 555 | ch->firsts[type]+i, |
555 | (int)data[4],(int)data[5]); | 556 | (int)data[4],(int)data[5]); |
556 | retval = ch_read_element_status | 557 | retval = ch_read_element_status |
@@ -660,7 +661,7 @@ static long ch_ioctl(struct file *file, | |||
660 | return -EFAULT; | 661 | return -EFAULT; |
661 | 662 | ||
662 | if (0 != ch_checkrange(ch, pos.cp_type, pos.cp_unit)) { | 663 | if (0 != ch_checkrange(ch, pos.cp_type, pos.cp_unit)) { |
663 | dprintk("CHIOPOSITION: invalid parameter\n"); | 664 | DPRINTK("CHIOPOSITION: invalid parameter\n"); |
664 | return -EBADSLT; | 665 | return -EBADSLT; |
665 | } | 666 | } |
666 | mutex_lock(&ch->lock); | 667 | mutex_lock(&ch->lock); |
@@ -680,7 +681,7 @@ static long ch_ioctl(struct file *file, | |||
680 | 681 | ||
681 | if (0 != ch_checkrange(ch, mv.cm_fromtype, mv.cm_fromunit) || | 682 | if (0 != ch_checkrange(ch, mv.cm_fromtype, mv.cm_fromunit) || |
682 | 0 != ch_checkrange(ch, mv.cm_totype, mv.cm_tounit )) { | 683 | 0 != ch_checkrange(ch, mv.cm_totype, mv.cm_tounit )) { |
683 | dprintk("CHIOMOVE: invalid parameter\n"); | 684 | DPRINTK("CHIOMOVE: invalid parameter\n"); |
684 | return -EBADSLT; | 685 | return -EBADSLT; |
685 | } | 686 | } |
686 | 687 | ||
@@ -703,7 +704,7 @@ static long ch_ioctl(struct file *file, | |||
703 | if (0 != ch_checkrange(ch, mv.ce_srctype, mv.ce_srcunit ) || | 704 | if (0 != ch_checkrange(ch, mv.ce_srctype, mv.ce_srcunit ) || |
704 | 0 != ch_checkrange(ch, mv.ce_fdsttype, mv.ce_fdstunit) || | 705 | 0 != ch_checkrange(ch, mv.ce_fdsttype, mv.ce_fdstunit) || |
705 | 0 != ch_checkrange(ch, mv.ce_sdsttype, mv.ce_sdstunit)) { | 706 | 0 != ch_checkrange(ch, mv.ce_sdsttype, mv.ce_sdstunit)) { |
706 | dprintk("CHIOEXCHANGE: invalid parameter\n"); | 707 | DPRINTK("CHIOEXCHANGE: invalid parameter\n"); |
707 | return -EBADSLT; | 708 | return -EBADSLT; |
708 | } | 709 | } |
709 | 710 | ||
@@ -796,7 +797,7 @@ static long ch_ioctl(struct file *file, | |||
796 | } | 797 | } |
797 | } else if (ch->voltags) { | 798 | } else if (ch->voltags) { |
798 | ch->voltags = 0; | 799 | ch->voltags = 0; |
799 | vprintk("device has no volume tag support\n"); | 800 | VPRINTK(KERN_INFO, "device has no volume tag support\n"); |
800 | goto voltag_retry; | 801 | goto voltag_retry; |
801 | } | 802 | } |
802 | kfree(buffer); | 803 | kfree(buffer); |
@@ -824,7 +825,7 @@ static long ch_ioctl(struct file *file, | |||
824 | return -EFAULT; | 825 | return -EFAULT; |
825 | 826 | ||
826 | if (0 != ch_checkrange(ch, csv.csv_type, csv.csv_unit)) { | 827 | if (0 != ch_checkrange(ch, csv.csv_type, csv.csv_unit)) { |
827 | dprintk("CHIOSVOLTAG: invalid parameter\n"); | 828 | DPRINTK("CHIOSVOLTAG: invalid parameter\n"); |
828 | return -EBADSLT; | 829 | return -EBADSLT; |
829 | } | 830 | } |
830 | elem = ch->firsts[csv.csv_type] + csv.csv_unit; | 831 | elem = ch->firsts[csv.csv_type] + csv.csv_unit; |