Commit 87da3235 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

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: default avatarJoe Perches <joe@perches.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6d154db6
...@@ -84,10 +84,16 @@ static const char * vendor_labels[CH_TYPES-4] = { ...@@ -84,10 +84,16 @@ static const char * vendor_labels[CH_TYPES-4] = {
}; };
// module_param_string_array(vendor_labels, NULL, 0444); // module_param_string_array(vendor_labels, NULL, 0444);
#define dprintk(fmt, arg...) if (debug) \ #define DPRINTK(fmt, arg...) \
printk(KERN_DEBUG "%s: " fmt, ch->name , ## arg) do { \
#define vprintk(fmt, arg...) if (verbose) \ if (debug) \
printk(KERN_INFO "%s: " fmt, ch->name , ## arg) printk(KERN_DEBUG "%s: " fmt, ch->name, ##arg); \
} while (0)
#define VPRINTK(level, fmt, arg...) \
do { \
if (verbose) \
printk(level "%s: " fmt, ch->name, ##arg); \
} while (0)
/* ------------------------------------------------------------------- */ /* ------------------------------------------------------------------- */
...@@ -186,7 +192,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, ...@@ -186,7 +192,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd,
retry: retry:
errno = 0; errno = 0;
if (debug) { if (debug) {
dprintk("command: "); DPRINTK("command: ");
__scsi_print_command(cmd); __scsi_print_command(cmd);
} }
...@@ -194,7 +200,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, ...@@ -194,7 +200,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd,
buflength, &sshdr, timeout * HZ, buflength, &sshdr, timeout * HZ,
MAX_RETRIES, NULL); MAX_RETRIES, NULL);
dprintk("result: 0x%x\n",result); DPRINTK("result: 0x%x\n",result);
if (driver_byte(result) & DRIVER_SENSE) { if (driver_byte(result) & DRIVER_SENSE) {
if (debug) if (debug)
scsi_print_sense_hdr(ch->name, &sshdr); scsi_print_sense_hdr(ch->name, &sshdr);
...@@ -250,7 +256,7 @@ ch_read_element_status(scsi_changer *ch, u_int elem, char *data) ...@@ -250,7 +256,7 @@ ch_read_element_status(scsi_changer *ch, u_int elem, char *data)
cmd[9] = 255; cmd[9] = 255;
if (0 == (result = ch_do_scsi(ch, cmd, buffer, 256, DMA_FROM_DEVICE))) { if (0 == (result = ch_do_scsi(ch, cmd, buffer, 256, DMA_FROM_DEVICE))) {
if (((buffer[16] << 8) | buffer[17]) != elem) { if (((buffer[16] << 8) | buffer[17]) != elem) {
dprintk("asked for element 0x%02x, got 0x%02x\n", DPRINTK("asked for element 0x%02x, got 0x%02x\n",
elem,(buffer[16] << 8) | buffer[17]); elem,(buffer[16] << 8) | buffer[17]);
kfree(buffer); kfree(buffer);
return -EIO; return -EIO;
...@@ -259,10 +265,10 @@ ch_read_element_status(scsi_changer *ch, u_int elem, char *data) ...@@ -259,10 +265,10 @@ ch_read_element_status(scsi_changer *ch, u_int elem, char *data)
} else { } else {
if (ch->voltags) { if (ch->voltags) {
ch->voltags = 0; ch->voltags = 0;
vprintk("device has no volume tag support\n"); VPRINTK(KERN_INFO, "device has no volume tag support\n");
goto retry; goto retry;
} }
dprintk("READ ELEMENT STATUS for element 0x%x failed\n",elem); DPRINTK("READ ELEMENT STATUS for element 0x%x failed\n",elem);
} }
kfree(buffer); kfree(buffer);
return result; return result;
...@@ -274,12 +280,12 @@ ch_init_elem(scsi_changer *ch) ...@@ -274,12 +280,12 @@ ch_init_elem(scsi_changer *ch)
int err; int err;
u_char cmd[6]; u_char cmd[6];
vprintk("INITIALIZE ELEMENT STATUS, may take some time ...\n"); VPRINTK(KERN_INFO, "INITIALIZE ELEMENT STATUS, may take some time ...\n");
memset(cmd,0,sizeof(cmd)); memset(cmd,0,sizeof(cmd));
cmd[0] = INITIALIZE_ELEMENT_STATUS; cmd[0] = INITIALIZE_ELEMENT_STATUS;
cmd[1] = ch->device->lun << 5; cmd[1] = ch->device->lun << 5;
err = ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE); err = ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE);
vprintk("... finished\n"); VPRINTK(KERN_INFO, "... finished\n");
return err; return err;
} }
...@@ -322,20 +328,20 @@ ch_readconfig(scsi_changer *ch) ...@@ -322,20 +328,20 @@ ch_readconfig(scsi_changer *ch)
(buffer[buffer[3]+18] << 8) | buffer[buffer[3]+19]; (buffer[buffer[3]+18] << 8) | buffer[buffer[3]+19];
ch->counts[CHET_DT] = ch->counts[CHET_DT] =
(buffer[buffer[3]+20] << 8) | buffer[buffer[3]+21]; (buffer[buffer[3]+20] << 8) | buffer[buffer[3]+21];
vprintk("type #1 (mt): 0x%x+%d [medium transport]\n", VPRINTK(KERN_INFO, "type #1 (mt): 0x%x+%d [medium transport]\n",
ch->firsts[CHET_MT], ch->firsts[CHET_MT],
ch->counts[CHET_MT]); ch->counts[CHET_MT]);
vprintk("type #2 (st): 0x%x+%d [storage]\n", VPRINTK(KERN_INFO, "type #2 (st): 0x%x+%d [storage]\n",
ch->firsts[CHET_ST], ch->firsts[CHET_ST],
ch->counts[CHET_ST]); ch->counts[CHET_ST]);
vprintk("type #3 (ie): 0x%x+%d [import/export]\n", VPRINTK(KERN_INFO, "type #3 (ie): 0x%x+%d [import/export]\n",
ch->firsts[CHET_IE], ch->firsts[CHET_IE],
ch->counts[CHET_IE]); ch->counts[CHET_IE]);
vprintk("type #4 (dt): 0x%x+%d [data transfer]\n", VPRINTK(KERN_INFO, "type #4 (dt): 0x%x+%d [data transfer]\n",
ch->firsts[CHET_DT], ch->firsts[CHET_DT],
ch->counts[CHET_DT]); ch->counts[CHET_DT]);
} else { } else {
vprintk("reading element address assigment page failed!\n"); VPRINTK(KERN_INFO, "reading element address assigment page failed!\n");
} }
/* vendor specific element types */ /* vendor specific element types */
...@@ -346,7 +352,7 @@ ch_readconfig(scsi_changer *ch) ...@@ -346,7 +352,7 @@ ch_readconfig(scsi_changer *ch)
continue; continue;
ch->firsts[CHET_V1+i] = vendor_firsts[i]; ch->firsts[CHET_V1+i] = vendor_firsts[i];
ch->counts[CHET_V1+i] = vendor_counts[i]; ch->counts[CHET_V1+i] = vendor_counts[i];
vprintk("type #%d (v%d): 0x%x+%d [%s, vendor specific]\n", VPRINTK(KERN_INFO, "type #%d (v%d): 0x%x+%d [%s, vendor specific]\n",
i+5,i+1,vendor_firsts[i],vendor_counts[i], i+5,i+1,vendor_firsts[i],vendor_counts[i],
vendor_labels[i]); vendor_labels[i]);
} }
...@@ -366,21 +372,19 @@ ch_readconfig(scsi_changer *ch) ...@@ -366,21 +372,19 @@ ch_readconfig(scsi_changer *ch)
if (elem < CH_DT_MAX && -1 != dt_id[elem]) { if (elem < CH_DT_MAX && -1 != dt_id[elem]) {
id = dt_id[elem]; id = dt_id[elem];
lun = dt_lun[elem]; lun = dt_lun[elem];
vprintk("dt 0x%x: [insmod option] ", VPRINTK(KERN_INFO, "dt 0x%x: [insmod option] ",
elem+ch->firsts[CHET_DT]); elem+ch->firsts[CHET_DT]);
} else if (0 != ch_read_element_status } else if (0 != ch_read_element_status
(ch,elem+ch->firsts[CHET_DT],data)) { (ch,elem+ch->firsts[CHET_DT],data)) {
vprintk("dt 0x%x: READ ELEMENT STATUS failed\n", VPRINTK(KERN_INFO, "dt 0x%x: READ ELEMENT STATUS failed\n",
elem+ch->firsts[CHET_DT]); elem+ch->firsts[CHET_DT]);
} else { } else {
vprintk("dt 0x%x: ",elem+ch->firsts[CHET_DT]); VPRINTK(KERN_INFO, "dt 0x%x: ",elem+ch->firsts[CHET_DT]);
if (data[6] & 0x80) { if (data[6] & 0x80) {
if (verbose) VPRINTK(KERN_CONT, "not this SCSI bus\n");
printk("not this SCSI bus\n");
ch->dt[elem] = NULL; ch->dt[elem] = NULL;
} else if (0 == (data[6] & 0x30)) { } else if (0 == (data[6] & 0x30)) {
if (verbose) VPRINTK(KERN_CONT, "ID/LUN unknown\n");
printk("ID/LUN unknown\n");
ch->dt[elem] = NULL; ch->dt[elem] = NULL;
} else { } else {
id = ch->device->id; id = ch->device->id;
...@@ -390,19 +394,16 @@ ch_readconfig(scsi_changer *ch) ...@@ -390,19 +394,16 @@ ch_readconfig(scsi_changer *ch)
} }
} }
if (-1 != id) { if (-1 != id) {
if (verbose) VPRINTK(KERN_CONT, "ID %i, LUN %i, ",id,lun);
printk("ID %i, LUN %i, ",id,lun);
ch->dt[elem] = ch->dt[elem] =
scsi_device_lookup(ch->device->host, scsi_device_lookup(ch->device->host,
ch->device->channel, ch->device->channel,
id,lun); id,lun);
if (!ch->dt[elem]) { if (!ch->dt[elem]) {
/* should not happen */ /* should not happen */
if (verbose) VPRINTK(KERN_CONT, "Huh? device not found!\n");
printk("Huh? device not found!\n");
} else { } else {
if (verbose) VPRINTK(KERN_CONT, "name: %8.8s %16.16s %4.4s\n",
printk("name: %8.8s %16.16s %4.4s\n",
ch->dt[elem]->vendor, ch->dt[elem]->vendor,
ch->dt[elem]->model, ch->dt[elem]->model,
ch->dt[elem]->rev); ch->dt[elem]->rev);
...@@ -422,7 +423,7 @@ ch_position(scsi_changer *ch, u_int trans, u_int elem, int rotate) ...@@ -422,7 +423,7 @@ ch_position(scsi_changer *ch, u_int trans, u_int elem, int rotate)
{ {
u_char cmd[10]; u_char cmd[10];
dprintk("position: 0x%x\n",elem); DPRINTK("position: 0x%x\n",elem);
if (0 == trans) if (0 == trans)
trans = ch->firsts[CHET_MT]; trans = ch->firsts[CHET_MT];
memset(cmd,0,sizeof(cmd)); 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,7 +442,7 @@ ch_move(scsi_changer *ch, u_int trans, u_int src, u_int dest, int rotate)
{ {
u_char cmd[12]; u_char cmd[12];
dprintk("move: 0x%x => 0x%x\n",src,dest); DPRINTK("move: 0x%x => 0x%x\n",src,dest);
if (0 == trans) if (0 == trans)
trans = ch->firsts[CHET_MT]; trans = ch->firsts[CHET_MT];
memset(cmd,0,sizeof(cmd)); memset(cmd,0,sizeof(cmd));
...@@ -463,7 +464,7 @@ ch_exchange(scsi_changer *ch, u_int trans, u_int src, ...@@ -463,7 +464,7 @@ ch_exchange(scsi_changer *ch, u_int trans, u_int src,
{ {
u_char cmd[12]; u_char cmd[12];
dprintk("exchange: 0x%x => 0x%x => 0x%x\n", DPRINTK("exchange: 0x%x => 0x%x => 0x%x\n",
src,dest1,dest2); src,dest1,dest2);
if (0 == trans) if (0 == trans)
trans = ch->firsts[CHET_MT]; trans = ch->firsts[CHET_MT];
...@@ -511,7 +512,7 @@ ch_set_voltag(scsi_changer *ch, u_int elem, ...@@ -511,7 +512,7 @@ ch_set_voltag(scsi_changer *ch, u_int elem,
if (!buffer) if (!buffer)
return -ENOMEM; return -ENOMEM;
dprintk("%s %s voltag: 0x%x => \"%s\"\n", DPRINTK("%s %s voltag: 0x%x => \"%s\"\n",
clear ? "clear" : "set", clear ? "clear" : "set",
alternate ? "alternate" : "primary", alternate ? "alternate" : "primary",
elem, tag); elem, tag);
...@@ -550,7 +551,7 @@ static int ch_gstatus(scsi_changer *ch, int type, unsigned char __user *dest) ...@@ -550,7 +551,7 @@ static int ch_gstatus(scsi_changer *ch, int type, unsigned char __user *dest)
} }
put_user(data[2], dest+i); put_user(data[2], dest+i);
if (data[2] & CESTATUS_EXCEPT) if (data[2] & CESTATUS_EXCEPT)
vprintk("element 0x%x: asc=0x%x, ascq=0x%x\n", VPRINTK(KERN_INFO, "element 0x%x: asc=0x%x, ascq=0x%x\n",
ch->firsts[type]+i, ch->firsts[type]+i,
(int)data[4],(int)data[5]); (int)data[4],(int)data[5]);
retval = ch_read_element_status retval = ch_read_element_status
...@@ -660,7 +661,7 @@ static long ch_ioctl(struct file *file, ...@@ -660,7 +661,7 @@ static long ch_ioctl(struct file *file,
return -EFAULT; return -EFAULT;
if (0 != ch_checkrange(ch, pos.cp_type, pos.cp_unit)) { if (0 != ch_checkrange(ch, pos.cp_type, pos.cp_unit)) {
dprintk("CHIOPOSITION: invalid parameter\n"); DPRINTK("CHIOPOSITION: invalid parameter\n");
return -EBADSLT; return -EBADSLT;
} }
mutex_lock(&ch->lock); mutex_lock(&ch->lock);
...@@ -680,7 +681,7 @@ static long ch_ioctl(struct file *file, ...@@ -680,7 +681,7 @@ static long ch_ioctl(struct file *file,
if (0 != ch_checkrange(ch, mv.cm_fromtype, mv.cm_fromunit) || if (0 != ch_checkrange(ch, mv.cm_fromtype, mv.cm_fromunit) ||
0 != ch_checkrange(ch, mv.cm_totype, mv.cm_tounit )) { 0 != ch_checkrange(ch, mv.cm_totype, mv.cm_tounit )) {
dprintk("CHIOMOVE: invalid parameter\n"); DPRINTK("CHIOMOVE: invalid parameter\n");
return -EBADSLT; return -EBADSLT;
} }
...@@ -703,7 +704,7 @@ static long ch_ioctl(struct file *file, ...@@ -703,7 +704,7 @@ static long ch_ioctl(struct file *file,
if (0 != ch_checkrange(ch, mv.ce_srctype, mv.ce_srcunit ) || if (0 != ch_checkrange(ch, mv.ce_srctype, mv.ce_srcunit ) ||
0 != ch_checkrange(ch, mv.ce_fdsttype, mv.ce_fdstunit) || 0 != ch_checkrange(ch, mv.ce_fdsttype, mv.ce_fdstunit) ||
0 != ch_checkrange(ch, mv.ce_sdsttype, mv.ce_sdstunit)) { 0 != ch_checkrange(ch, mv.ce_sdsttype, mv.ce_sdstunit)) {
dprintk("CHIOEXCHANGE: invalid parameter\n"); DPRINTK("CHIOEXCHANGE: invalid parameter\n");
return -EBADSLT; return -EBADSLT;
} }
...@@ -796,7 +797,7 @@ static long ch_ioctl(struct file *file, ...@@ -796,7 +797,7 @@ static long ch_ioctl(struct file *file,
} }
} else if (ch->voltags) { } else if (ch->voltags) {
ch->voltags = 0; ch->voltags = 0;
vprintk("device has no volume tag support\n"); VPRINTK(KERN_INFO, "device has no volume tag support\n");
goto voltag_retry; goto voltag_retry;
} }
kfree(buffer); kfree(buffer);
...@@ -824,7 +825,7 @@ static long ch_ioctl(struct file *file, ...@@ -824,7 +825,7 @@ static long ch_ioctl(struct file *file,
return -EFAULT; return -EFAULT;
if (0 != ch_checkrange(ch, csv.csv_type, csv.csv_unit)) { if (0 != ch_checkrange(ch, csv.csv_type, csv.csv_unit)) {
dprintk("CHIOSVOLTAG: invalid parameter\n"); DPRINTK("CHIOSVOLTAG: invalid parameter\n");
return -EBADSLT; return -EBADSLT;
} }
elem = ch->firsts[csv.csv_type] + csv.csv_unit; elem = ch->firsts[csv.csv_type] + csv.csv_unit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment