Commit 87da32356bcee42569666bef1479d0e599a556f8

Authored by Joe Perches
Committed by Linus Torvalds
1 parent 6d154db6b3

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>

Showing 1 changed file with 44 additions and 43 deletions Side-by-side Diff

... ... @@ -84,10 +84,16 @@
84 84 };
85 85 // module_param_string_array(vendor_labels, NULL, 0444);
86 86  
87   -#define dprintk(fmt, arg...) if (debug) \
88   - printk(KERN_DEBUG "%s: " fmt, ch->name , ## arg)
89   -#define vprintk(fmt, arg...) if (verbose) \
90   - printk(KERN_INFO "%s: " fmt, ch->name , ## arg)
  87 +#define DPRINTK(fmt, arg...) \
  88 +do { \
  89 + if (debug) \
  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 @@
186 192 retry:
187 193 errno = 0;
188 194 if (debug) {
189   - dprintk("command: ");
  195 + DPRINTK("command: ");
190 196 __scsi_print_command(cmd);
191 197 }
192 198  
... ... @@ -194,7 +200,7 @@
194 200 buflength, &sshdr, timeout * HZ,
195 201 MAX_RETRIES, NULL);
196 202  
197   - dprintk("result: 0x%x\n",result);
  203 + DPRINTK("result: 0x%x\n",result);
198 204 if (driver_byte(result) & DRIVER_SENSE) {
199 205 if (debug)
200 206 scsi_print_sense_hdr(ch->name, &sshdr);
... ... @@ -250,7 +256,7 @@
250 256 cmd[9] = 255;
251 257 if (0 == (result = ch_do_scsi(ch, cmd, buffer, 256, DMA_FROM_DEVICE))) {
252 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 260 elem,(buffer[16] << 8) | buffer[17]);
255 261 kfree(buffer);
256 262 return -EIO;
257 263  
... ... @@ -259,10 +265,10 @@
259 265 } else {
260 266 if (ch->voltags) {
261 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 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 273 kfree(buffer);
268 274 return result;
269 275  
... ... @@ -274,12 +280,12 @@
274 280 int err;
275 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 284 memset(cmd,0,sizeof(cmd));
279 285 cmd[0] = INITIALIZE_ELEMENT_STATUS;
280 286 cmd[1] = ch->device->lun << 5;
281 287 err = ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE);
282   - vprintk("... finished\n");
  288 + VPRINTK(KERN_INFO, "... finished\n");
283 289 return err;
284 290 }
285 291  
286 292  
287 293  
288 294  
289 295  
... ... @@ -322,20 +328,20 @@
322 328 (buffer[buffer[3]+18] << 8) | buffer[buffer[3]+19];
323 329 ch->counts[CHET_DT] =
324 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 332 ch->firsts[CHET_MT],
327 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 335 ch->firsts[CHET_ST],
330 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 338 ch->firsts[CHET_IE],
333 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 341 ch->firsts[CHET_DT],
336 342 ch->counts[CHET_DT]);
337 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 347 /* vendor specific element types */
... ... @@ -346,7 +352,7 @@
346 352 continue;
347 353 ch->firsts[CHET_V1+i] = vendor_firsts[i];
348 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 356 i+5,i+1,vendor_firsts[i],vendor_counts[i],
351 357 vendor_labels[i]);
352 358 }
353 359  
354 360  
355 361  
356 362  
... ... @@ -366,21 +372,19 @@
366 372 if (elem < CH_DT_MAX && -1 != dt_id[elem]) {
367 373 id = dt_id[elem];
368 374 lun = dt_lun[elem];
369   - vprintk("dt 0x%x: [insmod option] ",
  375 + VPRINTK(KERN_INFO, "dt 0x%x: [insmod option] ",
370 376 elem+ch->firsts[CHET_DT]);
371 377 } else if (0 != ch_read_element_status
372 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 380 elem+ch->firsts[CHET_DT]);
375 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 383 if (data[6] & 0x80) {
378   - if (verbose)
379   - printk("not this SCSI bus\n");
  384 + VPRINTK(KERN_CONT, "not this SCSI bus\n");
380 385 ch->dt[elem] = NULL;
381 386 } else if (0 == (data[6] & 0x30)) {
382   - if (verbose)
383   - printk("ID/LUN unknown\n");
  387 + VPRINTK(KERN_CONT, "ID/LUN unknown\n");
384 388 ch->dt[elem] = NULL;
385 389 } else {
386 390 id = ch->device->id;
387 391  
388 392  
... ... @@ -390,22 +394,19 @@
390 394 }
391 395 }
392 396 if (-1 != id) {
393   - if (verbose)
394   - printk("ID %i, LUN %i, ",id,lun);
  397 + VPRINTK(KERN_CONT, "ID %i, LUN %i, ",id,lun);
395 398 ch->dt[elem] =
396 399 scsi_device_lookup(ch->device->host,
397 400 ch->device->channel,
398 401 id,lun);
399 402 if (!ch->dt[elem]) {
400 403 /* should not happen */
401   - if (verbose)
402   - printk("Huh? device not found!\n");
  404 + VPRINTK(KERN_CONT, "Huh? device not found!\n");
403 405 } else {
404   - if (verbose)
405   - printk("name: %8.8s %16.16s %4.4s\n",
406   - ch->dt[elem]->vendor,
407   - ch->dt[elem]->model,
408   - ch->dt[elem]->rev);
  406 + VPRINTK(KERN_CONT, "name: %8.8s %16.16s %4.4s\n",
  407 + ch->dt[elem]->vendor,
  408 + ch->dt[elem]->model,
  409 + ch->dt[elem]->rev);
409 410 }
410 411 }
411 412 }
... ... @@ -422,7 +423,7 @@
422 423 {
423 424 u_char cmd[10];
424 425  
425   - dprintk("position: 0x%x\n",elem);
  426 + DPRINTK("position: 0x%x\n",elem);
426 427 if (0 == trans)
427 428 trans = ch->firsts[CHET_MT];
428 429 memset(cmd,0,sizeof(cmd));
... ... @@ -441,7 +442,7 @@
441 442 {
442 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 446 if (0 == trans)
446 447 trans = ch->firsts[CHET_MT];
447 448 memset(cmd,0,sizeof(cmd));
... ... @@ -463,7 +464,7 @@
463 464 {
464 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 468 src,dest1,dest2);
468 469 if (0 == trans)
469 470 trans = ch->firsts[CHET_MT];
... ... @@ -511,7 +512,7 @@
511 512 if (!buffer)
512 513 return -ENOMEM;
513 514  
514   - dprintk("%s %s voltag: 0x%x => \"%s\"\n",
  515 + DPRINTK("%s %s voltag: 0x%x => \"%s\"\n",
515 516 clear ? "clear" : "set",
516 517 alternate ? "alternate" : "primary",
517 518 elem, tag);
... ... @@ -550,7 +551,7 @@
550 551 }
551 552 put_user(data[2], dest+i);
552 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 555 ch->firsts[type]+i,
555 556 (int)data[4],(int)data[5]);
556 557 retval = ch_read_element_status
... ... @@ -660,7 +661,7 @@
660 661 return -EFAULT;
661 662  
662 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 665 return -EBADSLT;
665 666 }
666 667 mutex_lock(&ch->lock);
... ... @@ -680,7 +681,7 @@
680 681  
681 682 if (0 != ch_checkrange(ch, mv.cm_fromtype, mv.cm_fromunit) ||
682 683 0 != ch_checkrange(ch, mv.cm_totype, mv.cm_tounit )) {
683   - dprintk("CHIOMOVE: invalid parameter\n");
  684 + DPRINTK("CHIOMOVE: invalid parameter\n");
684 685 return -EBADSLT;
685 686 }
686 687  
... ... @@ -703,7 +704,7 @@
703 704 if (0 != ch_checkrange(ch, mv.ce_srctype, mv.ce_srcunit ) ||
704 705 0 != ch_checkrange(ch, mv.ce_fdsttype, mv.ce_fdstunit) ||
705 706 0 != ch_checkrange(ch, mv.ce_sdsttype, mv.ce_sdstunit)) {
706   - dprintk("CHIOEXCHANGE: invalid parameter\n");
  707 + DPRINTK("CHIOEXCHANGE: invalid parameter\n");
707 708 return -EBADSLT;
708 709 }
709 710  
... ... @@ -796,7 +797,7 @@
796 797 }
797 798 } else if (ch->voltags) {
798 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 801 goto voltag_retry;
801 802 }
802 803 kfree(buffer);
... ... @@ -824,7 +825,7 @@
824 825 return -EFAULT;
825 826  
826 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 829 return -EBADSLT;
829 830 }
830 831 elem = ch->firsts[csv.csv_type] + csv.csv_unit;