aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2015-07-28 09:54:20 -0400
committerJames Bottomley <JBottomley@Odin.com>2015-09-06 13:58:38 -0400
commitc1287970f4847a973830daf4076bc25929f3b2d9 (patch)
treef93507e050d4264c3e18adccccd1dd8539881713
parent008549f6e8a1dc4aeea4a8d64184909786b27713 (diff)
scsi_debug: define pr_fmt() for consistent logging
Use pr_fmt with both module name and __func__ Also drop few bare printk leftovers The log format should stay pretty much intact Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: James Bottomley <JBottomley@Odin.com>
-rw-r--r--drivers/scsi/scsi_debug.c118
1 files changed, 53 insertions, 65 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 30268bb2ddb6..6e6bf0f03cf7 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -25,6 +25,9 @@
25 * module options to "modprobe scsi_debug num_tgts=2" [20021221] 25 * module options to "modprobe scsi_debug num_tgts=2" [20021221]
26 */ 26 */
27 27
28
29#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
30
28#include <linux/module.h> 31#include <linux/module.h>
29 32
30#include <linux/kernel.h> 33#include <linux/kernel.h>
@@ -2446,8 +2449,7 @@ static int dif_verify(struct sd_dif_tuple *sdt, const void *data,
2446 __be16 csum = dif_compute_csum(data, scsi_debug_sector_size); 2449 __be16 csum = dif_compute_csum(data, scsi_debug_sector_size);
2447 2450
2448 if (sdt->guard_tag != csum) { 2451 if (sdt->guard_tag != csum) {
2449 pr_err("%s: GUARD check failed on sector %lu rcvd 0x%04x, data 0x%04x\n", 2452 pr_err("GUARD check failed on sector %lu rcvd 0x%04x, data 0x%04x\n",
2450 __func__,
2451 (unsigned long)sector, 2453 (unsigned long)sector,
2452 be16_to_cpu(sdt->guard_tag), 2454 be16_to_cpu(sdt->guard_tag),
2453 be16_to_cpu(csum)); 2455 be16_to_cpu(csum));
@@ -2455,14 +2457,14 @@ static int dif_verify(struct sd_dif_tuple *sdt, const void *data,
2455 } 2457 }
2456 if (scsi_debug_dif == SD_DIF_TYPE1_PROTECTION && 2458 if (scsi_debug_dif == SD_DIF_TYPE1_PROTECTION &&
2457 be32_to_cpu(sdt->ref_tag) != (sector & 0xffffffff)) { 2459 be32_to_cpu(sdt->ref_tag) != (sector & 0xffffffff)) {
2458 pr_err("%s: REF check failed on sector %lu\n", 2460 pr_err("REF check failed on sector %lu\n",
2459 __func__, (unsigned long)sector); 2461 (unsigned long)sector);
2460 return 0x03; 2462 return 0x03;
2461 } 2463 }
2462 if (scsi_debug_dif == SD_DIF_TYPE2_PROTECTION && 2464 if (scsi_debug_dif == SD_DIF_TYPE2_PROTECTION &&
2463 be32_to_cpu(sdt->ref_tag) != ei_lba) { 2465 be32_to_cpu(sdt->ref_tag) != ei_lba) {
2464 pr_err("%s: REF check failed on sector %lu\n", 2466 pr_err("REF check failed on sector %lu\n",
2465 __func__, (unsigned long)sector); 2467 (unsigned long)sector);
2466 return 0x03; 2468 return 0x03;
2467 } 2469 }
2468 return 0; 2470 return 0;
@@ -3449,7 +3451,7 @@ static void sdebug_q_cmd_complete(unsigned long indx)
3449 atomic_inc(&sdebug_completions); 3451 atomic_inc(&sdebug_completions);
3450 qa_indx = indx; 3452 qa_indx = indx;
3451 if ((qa_indx < 0) || (qa_indx >= SCSI_DEBUG_CANQUEUE)) { 3453 if ((qa_indx < 0) || (qa_indx >= SCSI_DEBUG_CANQUEUE)) {
3452 pr_err("%s: wild qa_indx=%d\n", __func__, qa_indx); 3454 pr_err("wild qa_indx=%d\n", qa_indx);
3453 return; 3455 return;
3454 } 3456 }
3455 spin_lock_irqsave(&queued_arr_lock, iflags); 3457 spin_lock_irqsave(&queued_arr_lock, iflags);
@@ -3457,21 +3459,21 @@ static void sdebug_q_cmd_complete(unsigned long indx)
3457 scp = sqcp->a_cmnd; 3459 scp = sqcp->a_cmnd;
3458 if (NULL == scp) { 3460 if (NULL == scp) {
3459 spin_unlock_irqrestore(&queued_arr_lock, iflags); 3461 spin_unlock_irqrestore(&queued_arr_lock, iflags);
3460 pr_err("%s: scp is NULL\n", __func__); 3462 pr_err("scp is NULL\n");
3461 return; 3463 return;
3462 } 3464 }
3463 devip = (struct sdebug_dev_info *)scp->device->hostdata; 3465 devip = (struct sdebug_dev_info *)scp->device->hostdata;
3464 if (devip) 3466 if (devip)
3465 atomic_dec(&devip->num_in_q); 3467 atomic_dec(&devip->num_in_q);
3466 else 3468 else
3467 pr_err("%s: devip=NULL\n", __func__); 3469 pr_err("devip=NULL\n");
3468 if (atomic_read(&retired_max_queue) > 0) 3470 if (atomic_read(&retired_max_queue) > 0)
3469 retiring = 1; 3471 retiring = 1;
3470 3472
3471 sqcp->a_cmnd = NULL; 3473 sqcp->a_cmnd = NULL;
3472 if (!test_and_clear_bit(qa_indx, queued_in_use_bm)) { 3474 if (!test_and_clear_bit(qa_indx, queued_in_use_bm)) {
3473 spin_unlock_irqrestore(&queued_arr_lock, iflags); 3475 spin_unlock_irqrestore(&queued_arr_lock, iflags);
3474 pr_err("%s: Unexpected completion\n", __func__); 3476 pr_err("Unexpected completion\n");
3475 return; 3477 return;
3476 } 3478 }
3477 3479
@@ -3481,7 +3483,7 @@ static void sdebug_q_cmd_complete(unsigned long indx)
3481 retval = atomic_read(&retired_max_queue); 3483 retval = atomic_read(&retired_max_queue);
3482 if (qa_indx >= retval) { 3484 if (qa_indx >= retval) {
3483 spin_unlock_irqrestore(&queued_arr_lock, iflags); 3485 spin_unlock_irqrestore(&queued_arr_lock, iflags);
3484 pr_err("%s: index %d too large\n", __func__, retval); 3486 pr_err("index %d too large\n", retval);
3485 return; 3487 return;
3486 } 3488 }
3487 k = find_last_bit(queued_in_use_bm, retval); 3489 k = find_last_bit(queued_in_use_bm, retval);
@@ -3509,7 +3511,7 @@ sdebug_q_cmd_hrt_complete(struct hrtimer *timer)
3509 atomic_inc(&sdebug_completions); 3511 atomic_inc(&sdebug_completions);
3510 qa_indx = sd_hrtp->qa_indx; 3512 qa_indx = sd_hrtp->qa_indx;
3511 if ((qa_indx < 0) || (qa_indx >= SCSI_DEBUG_CANQUEUE)) { 3513 if ((qa_indx < 0) || (qa_indx >= SCSI_DEBUG_CANQUEUE)) {
3512 pr_err("%s: wild qa_indx=%d\n", __func__, qa_indx); 3514 pr_err("wild qa_indx=%d\n", qa_indx);
3513 goto the_end; 3515 goto the_end;
3514 } 3516 }
3515 spin_lock_irqsave(&queued_arr_lock, iflags); 3517 spin_lock_irqsave(&queued_arr_lock, iflags);
@@ -3517,21 +3519,21 @@ sdebug_q_cmd_hrt_complete(struct hrtimer *timer)
3517 scp = sqcp->a_cmnd; 3519 scp = sqcp->a_cmnd;
3518 if (NULL == scp) { 3520 if (NULL == scp) {
3519 spin_unlock_irqrestore(&queued_arr_lock, iflags); 3521 spin_unlock_irqrestore(&queued_arr_lock, iflags);
3520 pr_err("%s: scp is NULL\n", __func__); 3522 pr_err("scp is NULL\n");
3521 goto the_end; 3523 goto the_end;
3522 } 3524 }
3523 devip = (struct sdebug_dev_info *)scp->device->hostdata; 3525 devip = (struct sdebug_dev_info *)scp->device->hostdata;
3524 if (devip) 3526 if (devip)
3525 atomic_dec(&devip->num_in_q); 3527 atomic_dec(&devip->num_in_q);
3526 else 3528 else
3527 pr_err("%s: devip=NULL\n", __func__); 3529 pr_err("devip=NULL\n");
3528 if (atomic_read(&retired_max_queue) > 0) 3530 if (atomic_read(&retired_max_queue) > 0)
3529 retiring = 1; 3531 retiring = 1;
3530 3532
3531 sqcp->a_cmnd = NULL; 3533 sqcp->a_cmnd = NULL;
3532 if (!test_and_clear_bit(qa_indx, queued_in_use_bm)) { 3534 if (!test_and_clear_bit(qa_indx, queued_in_use_bm)) {
3533 spin_unlock_irqrestore(&queued_arr_lock, iflags); 3535 spin_unlock_irqrestore(&queued_arr_lock, iflags);
3534 pr_err("%s: Unexpected completion\n", __func__); 3536 pr_err("Unexpected completion\n");
3535 goto the_end; 3537 goto the_end;
3536 } 3538 }
3537 3539
@@ -3541,7 +3543,7 @@ sdebug_q_cmd_hrt_complete(struct hrtimer *timer)
3541 retval = atomic_read(&retired_max_queue); 3543 retval = atomic_read(&retired_max_queue);
3542 if (qa_indx >= retval) { 3544 if (qa_indx >= retval) {
3543 spin_unlock_irqrestore(&queued_arr_lock, iflags); 3545 spin_unlock_irqrestore(&queued_arr_lock, iflags);
3544 pr_err("%s: index %d too large\n", __func__, retval); 3546 pr_err("index %d too large\n", retval);
3545 goto the_end; 3547 goto the_end;
3546 } 3548 }
3547 k = find_last_bit(queued_in_use_bm, retval); 3549 k = find_last_bit(queued_in_use_bm, retval);
@@ -3580,7 +3582,7 @@ static struct sdebug_dev_info * devInfoReg(struct scsi_device * sdev)
3580 return devip; 3582 return devip;
3581 sdbg_host = *(struct sdebug_host_info **)shost_priv(sdev->host); 3583 sdbg_host = *(struct sdebug_host_info **)shost_priv(sdev->host);
3582 if (!sdbg_host) { 3584 if (!sdbg_host) {
3583 pr_err("%s: Host info NULL\n", __func__); 3585 pr_err("Host info NULL\n");
3584 return NULL; 3586 return NULL;
3585 } 3587 }
3586 list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) { 3588 list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) {
@@ -3596,8 +3598,7 @@ static struct sdebug_dev_info * devInfoReg(struct scsi_device * sdev)
3596 if (!open_devip) { /* try and make a new one */ 3598 if (!open_devip) { /* try and make a new one */
3597 open_devip = sdebug_device_create(sdbg_host, GFP_ATOMIC); 3599 open_devip = sdebug_device_create(sdbg_host, GFP_ATOMIC);
3598 if (!open_devip) { 3600 if (!open_devip) {
3599 printk(KERN_ERR "%s: out of memory at line %d\n", 3601 pr_err("out of memory at line %d\n", __LINE__);
3600 __func__, __LINE__);
3601 return NULL; 3602 return NULL;
3602 } 3603 }
3603 } 3604 }
@@ -3615,7 +3616,7 @@ static struct sdebug_dev_info * devInfoReg(struct scsi_device * sdev)
3615static int scsi_debug_slave_alloc(struct scsi_device *sdp) 3616static int scsi_debug_slave_alloc(struct scsi_device *sdp)
3616{ 3617{
3617 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) 3618 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
3618 printk(KERN_INFO "scsi_debug: slave_alloc <%u %u %u %llu>\n", 3619 pr_info("slave_alloc <%u %u %u %llu>\n",
3619 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); 3620 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
3620 queue_flag_set_unlocked(QUEUE_FLAG_BIDI, sdp->request_queue); 3621 queue_flag_set_unlocked(QUEUE_FLAG_BIDI, sdp->request_queue);
3621 return 0; 3622 return 0;
@@ -3626,7 +3627,7 @@ static int scsi_debug_slave_configure(struct scsi_device *sdp)
3626 struct sdebug_dev_info *devip; 3627 struct sdebug_dev_info *devip;
3627 3628
3628 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) 3629 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
3629 printk(KERN_INFO "scsi_debug: slave_configure <%u %u %u %llu>\n", 3630 pr_info("slave_configure <%u %u %u %llu>\n",
3630 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); 3631 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
3631 if (sdp->host->max_cmd_len != SCSI_DEBUG_MAX_CMD_LEN) 3632 if (sdp->host->max_cmd_len != SCSI_DEBUG_MAX_CMD_LEN)
3632 sdp->host->max_cmd_len = SCSI_DEBUG_MAX_CMD_LEN; 3633 sdp->host->max_cmd_len = SCSI_DEBUG_MAX_CMD_LEN;
@@ -3646,7 +3647,7 @@ static void scsi_debug_slave_destroy(struct scsi_device *sdp)
3646 (struct sdebug_dev_info *)sdp->hostdata; 3647 (struct sdebug_dev_info *)sdp->hostdata;
3647 3648
3648 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) 3649 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
3649 printk(KERN_INFO "scsi_debug: slave_destroy <%u %u %u %llu>\n", 3650 pr_info("slave_destroy <%u %u %u %llu>\n",
3650 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); 3651 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
3651 if (devip) { 3652 if (devip) {
3652 /* make this slot available for re-use */ 3653 /* make this slot available for re-use */
@@ -3897,8 +3898,7 @@ static void __init sdebug_build_parts(unsigned char *ramp,
3897 return; 3898 return;
3898 if (scsi_debug_num_parts > SDEBUG_MAX_PARTS) { 3899 if (scsi_debug_num_parts > SDEBUG_MAX_PARTS) {
3899 scsi_debug_num_parts = SDEBUG_MAX_PARTS; 3900 scsi_debug_num_parts = SDEBUG_MAX_PARTS;
3900 pr_warn("%s: reducing partitions to %d\n", __func__, 3901 pr_warn("reducing partitions to %d\n", SDEBUG_MAX_PARTS);
3901 SDEBUG_MAX_PARTS);
3902 } 3902 }
3903 num_sectors = (int)sdebug_store_sectors; 3903 num_sectors = (int)sdebug_store_sectors;
3904 sectors_per_part = (num_sectors - sdebug_sectors_per) 3904 sectors_per_part = (num_sectors - sdebug_sectors_per)
@@ -3945,8 +3945,7 @@ schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
3945 struct scsi_device *sdp = cmnd->device; 3945 struct scsi_device *sdp = cmnd->device;
3946 3946
3947 if (NULL == cmnd || NULL == devip) { 3947 if (NULL == cmnd || NULL == devip) {
3948 pr_warn("%s: called with NULL cmnd or devip pointer\n", 3948 pr_warn("called with NULL cmnd or devip pointer\n");
3949 __func__);
3950 /* no particularly good error to report back */ 3949 /* no particularly good error to report back */
3951 return SCSI_MLQUEUE_HOST_BUSY; 3950 return SCSI_MLQUEUE_HOST_BUSY;
3952 } 3951 }
@@ -4383,8 +4382,7 @@ static ssize_t fake_rw_store(struct device_driver *ddp, const char *buf,
4383 4382
4384 fake_storep = vmalloc(sz); 4383 fake_storep = vmalloc(sz);
4385 if (NULL == fake_storep) { 4384 if (NULL == fake_storep) {
4386 pr_err("%s: out of memory, 9\n", 4385 pr_err("out of memory, 9\n");
4387 __func__);
4388 return -ENOMEM; 4386 return -ENOMEM;
4389 } 4387 }
4390 memset(fake_storep, 0, sz); 4388 memset(fake_storep, 0, sz);
@@ -4784,8 +4782,7 @@ static int __init scsi_debug_init(void)
4784 atomic_set(&retired_max_queue, 0); 4782 atomic_set(&retired_max_queue, 0);
4785 4783
4786 if (scsi_debug_ndelay >= 1000000000) { 4784 if (scsi_debug_ndelay >= 1000000000) {
4787 pr_warn("%s: ndelay must be less than 1 second, ignored\n", 4785 pr_warn("ndelay must be less than 1 second, ignored\n");
4788 __func__);
4789 scsi_debug_ndelay = 0; 4786 scsi_debug_ndelay = 0;
4790 } else if (scsi_debug_ndelay > 0) 4787 } else if (scsi_debug_ndelay > 0)
4791 scsi_debug_delay = DELAY_OVERRIDDEN; 4788 scsi_debug_delay = DELAY_OVERRIDDEN;
@@ -4797,8 +4794,7 @@ static int __init scsi_debug_init(void)
4797 case 4096: 4794 case 4096:
4798 break; 4795 break;
4799 default: 4796 default:
4800 pr_err("%s: invalid sector_size %d\n", __func__, 4797 pr_err("invalid sector_size %d\n", scsi_debug_sector_size);
4801 scsi_debug_sector_size);
4802 return -EINVAL; 4798 return -EINVAL;
4803 } 4799 }
4804 4800
@@ -4811,29 +4807,28 @@ static int __init scsi_debug_init(void)
4811 break; 4807 break;
4812 4808
4813 default: 4809 default:
4814 pr_err("%s: dif must be 0, 1, 2 or 3\n", __func__); 4810 pr_err("dif must be 0, 1, 2 or 3\n");
4815 return -EINVAL; 4811 return -EINVAL;
4816 } 4812 }
4817 4813
4818 if (scsi_debug_guard > 1) { 4814 if (scsi_debug_guard > 1) {
4819 pr_err("%s: guard must be 0 or 1\n", __func__); 4815 pr_err("guard must be 0 or 1\n");
4820 return -EINVAL; 4816 return -EINVAL;
4821 } 4817 }
4822 4818
4823 if (scsi_debug_ato > 1) { 4819 if (scsi_debug_ato > 1) {
4824 pr_err("%s: ato must be 0 or 1\n", __func__); 4820 pr_err("ato must be 0 or 1\n");
4825 return -EINVAL; 4821 return -EINVAL;
4826 } 4822 }
4827 4823
4828 if (scsi_debug_physblk_exp > 15) { 4824 if (scsi_debug_physblk_exp > 15) {
4829 pr_err("%s: invalid physblk_exp %u\n", __func__, 4825 pr_err("invalid physblk_exp %u\n", scsi_debug_physblk_exp);
4830 scsi_debug_physblk_exp);
4831 return -EINVAL; 4826 return -EINVAL;
4832 } 4827 }
4833 4828
4834 if (scsi_debug_lowest_aligned > 0x3fff) { 4829 if (scsi_debug_lowest_aligned > 0x3fff) {
4835 pr_err("%s: lowest_aligned too big: %u\n", __func__, 4830 pr_err("lowest_aligned too big: %u\n",
4836 scsi_debug_lowest_aligned); 4831 scsi_debug_lowest_aligned);
4837 return -EINVAL; 4832 return -EINVAL;
4838 } 4833 }
4839 4834
@@ -4863,7 +4858,7 @@ static int __init scsi_debug_init(void)
4863 if (0 == scsi_debug_fake_rw) { 4858 if (0 == scsi_debug_fake_rw) {
4864 fake_storep = vmalloc(sz); 4859 fake_storep = vmalloc(sz);
4865 if (NULL == fake_storep) { 4860 if (NULL == fake_storep) {
4866 pr_err("%s: out of memory, 1\n", __func__); 4861 pr_err("out of memory, 1\n");
4867 return -ENOMEM; 4862 return -ENOMEM;
4868 } 4863 }
4869 memset(fake_storep, 0, sz); 4864 memset(fake_storep, 0, sz);
@@ -4877,11 +4872,10 @@ static int __init scsi_debug_init(void)
4877 dif_size = sdebug_store_sectors * sizeof(struct sd_dif_tuple); 4872 dif_size = sdebug_store_sectors * sizeof(struct sd_dif_tuple);
4878 dif_storep = vmalloc(dif_size); 4873 dif_storep = vmalloc(dif_size);
4879 4874
4880 pr_err("%s: dif_storep %u bytes @ %p\n", __func__, dif_size, 4875 pr_err("dif_storep %u bytes @ %p\n", dif_size, dif_storep);
4881 dif_storep);
4882 4876
4883 if (dif_storep == NULL) { 4877 if (dif_storep == NULL) {
4884 pr_err("%s: out of mem. (DIX)\n", __func__); 4878 pr_err("out of mem. (DIX)\n");
4885 ret = -ENOMEM; 4879 ret = -ENOMEM;
4886 goto free_vm; 4880 goto free_vm;
4887 } 4881 }
@@ -4903,18 +4897,17 @@ static int __init scsi_debug_init(void)
4903 if (scsi_debug_unmap_alignment && 4897 if (scsi_debug_unmap_alignment &&
4904 scsi_debug_unmap_granularity <= 4898 scsi_debug_unmap_granularity <=
4905 scsi_debug_unmap_alignment) { 4899 scsi_debug_unmap_alignment) {
4906 pr_err("%s: ERR: unmap_granularity <= unmap_alignment\n", 4900 pr_err("ERR: unmap_granularity <= unmap_alignment\n");
4907 __func__);
4908 return -EINVAL; 4901 return -EINVAL;
4909 } 4902 }
4910 4903
4911 map_size = lba_to_map_index(sdebug_store_sectors - 1) + 1; 4904 map_size = lba_to_map_index(sdebug_store_sectors - 1) + 1;
4912 map_storep = vmalloc(BITS_TO_LONGS(map_size) * sizeof(long)); 4905 map_storep = vmalloc(BITS_TO_LONGS(map_size) * sizeof(long));
4913 4906
4914 pr_info("%s: %lu provisioning blocks\n", __func__, map_size); 4907 pr_info("%lu provisioning blocks\n", map_size);
4915 4908
4916 if (map_storep == NULL) { 4909 if (map_storep == NULL) {
4917 pr_err("%s: out of mem. (MAP)\n", __func__); 4910 pr_err("out of mem. (MAP)\n");
4918 ret = -ENOMEM; 4911 ret = -ENOMEM;
4919 goto free_vm; 4912 goto free_vm;
4920 } 4913 }
@@ -4928,18 +4921,18 @@ static int __init scsi_debug_init(void)
4928 4921
4929 pseudo_primary = root_device_register("pseudo_0"); 4922 pseudo_primary = root_device_register("pseudo_0");
4930 if (IS_ERR(pseudo_primary)) { 4923 if (IS_ERR(pseudo_primary)) {
4931 pr_warn("%s: root_device_register() error\n", __func__); 4924 pr_warn("root_device_register() error\n");
4932 ret = PTR_ERR(pseudo_primary); 4925 ret = PTR_ERR(pseudo_primary);
4933 goto free_vm; 4926 goto free_vm;
4934 } 4927 }
4935 ret = bus_register(&pseudo_lld_bus); 4928 ret = bus_register(&pseudo_lld_bus);
4936 if (ret < 0) { 4929 if (ret < 0) {
4937 pr_warn("%s: bus_register error: %d\n", __func__, ret); 4930 pr_warn("bus_register error: %d\n", ret);
4938 goto dev_unreg; 4931 goto dev_unreg;
4939 } 4932 }
4940 ret = driver_register(&sdebug_driverfs_driver); 4933 ret = driver_register(&sdebug_driverfs_driver);
4941 if (ret < 0) { 4934 if (ret < 0) {
4942 pr_warn("%s: driver_register error: %d\n", __func__, ret); 4935 pr_warn("driver_register error: %d\n", ret);
4943 goto bus_unreg; 4936 goto bus_unreg;
4944 } 4937 }
4945 4938
@@ -4948,16 +4941,14 @@ static int __init scsi_debug_init(void)
4948 4941
4949 for (k = 0; k < host_to_add; k++) { 4942 for (k = 0; k < host_to_add; k++) {
4950 if (sdebug_add_adapter()) { 4943 if (sdebug_add_adapter()) {
4951 pr_err("%s: sdebug_add_adapter failed k=%d\n", 4944 pr_err("sdebug_add_adapter failed k=%d\n", k);
4952 __func__, k);
4953 break; 4945 break;
4954 } 4946 }
4955 } 4947 }
4956 4948
4957 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) { 4949 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
4958 pr_info("%s: built %d host(s)\n", __func__, 4950 pr_info("built %d host(s)\n", scsi_debug_add_host);
4959 scsi_debug_add_host); 4951
4960 }
4961 return 0; 4952 return 0;
4962 4953
4963bus_unreg: 4954bus_unreg:
@@ -5012,8 +5003,7 @@ static int sdebug_add_adapter(void)
5012 5003
5013 sdbg_host = kzalloc(sizeof(*sdbg_host),GFP_KERNEL); 5004 sdbg_host = kzalloc(sizeof(*sdbg_host),GFP_KERNEL);
5014 if (NULL == sdbg_host) { 5005 if (NULL == sdbg_host) {
5015 printk(KERN_ERR "%s: out of memory at line %d\n", 5006 pr_err("out of memory at line %d\n", __LINE__);
5016 __func__, __LINE__);
5017 return -ENOMEM; 5007 return -ENOMEM;
5018 } 5008 }
5019 5009
@@ -5023,8 +5013,7 @@ static int sdebug_add_adapter(void)
5023 for (k = 0; k < devs_per_host; k++) { 5013 for (k = 0; k < devs_per_host; k++) {
5024 sdbg_devinfo = sdebug_device_create(sdbg_host, GFP_KERNEL); 5014 sdbg_devinfo = sdebug_device_create(sdbg_host, GFP_KERNEL);
5025 if (!sdbg_devinfo) { 5015 if (!sdbg_devinfo) {
5026 printk(KERN_ERR "%s: out of memory at line %d\n", 5016 pr_err("out of memory at line %d\n", __LINE__);
5027 __func__, __LINE__);
5028 error = -ENOMEM; 5017 error = -ENOMEM;
5029 goto clean; 5018 goto clean;
5030 } 5019 }
@@ -5338,7 +5327,7 @@ static int sdebug_driver_probe(struct device * dev)
5338 sdebug_driver_template.use_clustering = ENABLE_CLUSTERING; 5327 sdebug_driver_template.use_clustering = ENABLE_CLUSTERING;
5339 hpnt = scsi_host_alloc(&sdebug_driver_template, sizeof(sdbg_host)); 5328 hpnt = scsi_host_alloc(&sdebug_driver_template, sizeof(sdbg_host));
5340 if (NULL == hpnt) { 5329 if (NULL == hpnt) {
5341 pr_err("%s: scsi_host_alloc failed\n", __func__); 5330 pr_err("scsi_host_alloc failed\n");
5342 error = -ENODEV; 5331 error = -ENODEV;
5343 return error; 5332 return error;
5344 } 5333 }
@@ -5381,7 +5370,7 @@ static int sdebug_driver_probe(struct device * dev)
5381 5370
5382 scsi_host_set_prot(hpnt, host_prot); 5371 scsi_host_set_prot(hpnt, host_prot);
5383 5372
5384 printk(KERN_INFO "scsi_debug: host protection%s%s%s%s%s%s%s\n", 5373 pr_info("host protection%s%s%s%s%s%s%s\n",
5385 (host_prot & SHOST_DIF_TYPE1_PROTECTION) ? " DIF1" : "", 5374 (host_prot & SHOST_DIF_TYPE1_PROTECTION) ? " DIF1" : "",
5386 (host_prot & SHOST_DIF_TYPE2_PROTECTION) ? " DIF2" : "", 5375 (host_prot & SHOST_DIF_TYPE2_PROTECTION) ? " DIF2" : "",
5387 (host_prot & SHOST_DIF_TYPE3_PROTECTION) ? " DIF3" : "", 5376 (host_prot & SHOST_DIF_TYPE3_PROTECTION) ? " DIF3" : "",
@@ -5409,7 +5398,7 @@ static int sdebug_driver_probe(struct device * dev)
5409 5398
5410 error = scsi_add_host(hpnt, &sdbg_host->dev); 5399 error = scsi_add_host(hpnt, &sdbg_host->dev);
5411 if (error) { 5400 if (error) {
5412 printk(KERN_ERR "%s: scsi_add_host failed\n", __func__); 5401 pr_err("scsi_add_host failed\n");
5413 error = -ENODEV; 5402 error = -ENODEV;
5414 scsi_host_put(hpnt); 5403 scsi_host_put(hpnt);
5415 } else 5404 } else
@@ -5426,8 +5415,7 @@ static int sdebug_driver_remove(struct device * dev)
5426 sdbg_host = to_sdebug_host(dev); 5415 sdbg_host = to_sdebug_host(dev);
5427 5416
5428 if (!sdbg_host) { 5417 if (!sdbg_host) {
5429 printk(KERN_ERR "%s: Unable to locate host info\n", 5418 pr_err("Unable to locate host info\n");
5430 __func__);
5431 return -ENODEV; 5419 return -ENODEV;
5432 } 5420 }
5433 5421