Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: Implement ch_printk()

Update the ch driver to use dev_printk() variants instead of
plain printk(); this will prefix logging messages with the
appropriate device.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>

authored by

Hannes Reinecke and committed by
Christoph Hellwig
28c31729 95e159d6

+9 -5
+9 -5
drivers/scsi/ch.c
··· 84 84 }; 85 85 // module_param_string_array(vendor_labels, NULL, 0444); 86 86 87 + #define ch_printk(prefix, ch, fmt, a...) \ 88 + sdev_printk(prefix, (ch)->device, "[%s] " fmt, \ 89 + (ch)->name, ##a) 90 + 87 91 #define DPRINTK(fmt, arg...) \ 88 92 do { \ 89 93 if (debug) \ 90 - printk(KERN_DEBUG "%s: " fmt, ch->name, ##arg); \ 94 + ch_printk(KERN_DEBUG, ch, fmt, ##arg); \ 91 95 } while (0) 92 96 #define VPRINTK(level, fmt, arg...) \ 93 97 do { \ 94 98 if (verbose) \ 95 - printk(level "%s: " fmt, ch->name, ##arg); \ 99 + ch_printk(level, ch, fmt, ##arg); \ 96 100 } while (0) 97 101 98 102 /* ------------------------------------------------------------------- */ ··· 200 196 __scsi_print_command(cmd); 201 197 } 202 198 203 - result = scsi_execute_req(ch->device, cmd, direction, buffer, 199 + result = scsi_execute_req(ch->device, cmd, direction, buffer, 204 200 buflength, &sshdr, timeout * HZ, 205 201 MAX_RETRIES, NULL); 206 202 ··· 928 924 MKDEV(SCSI_CHANGER_MAJOR, ch->minor), ch, 929 925 "s%s", ch->name); 930 926 if (IS_ERR(class_dev)) { 931 - printk(KERN_WARNING "ch%d: device_create failed\n", 932 - ch->minor); 927 + sdev_printk(KERN_WARNING, sd, "ch%d: device_create failed\n", 928 + ch->minor); 933 929 ret = PTR_ERR(class_dev); 934 930 goto remove_idr; 935 931 }