aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJohn Garry <john.garry@huawei.com>2018-11-15 05:20:31 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2018-11-15 14:37:06 -0500
commit15ba7806c316ce88d45db7d12d32380f53c01a06 (patch)
tree37af10a8d6ee1aad4267f1161726306c27a2d89d /drivers/scsi
parent71a4a9923122091be1167bac9379d5d1cfdb1153 (diff)
scsi: libsas: Drop SAS_DPRINTK() and revise logs levels
Like sas_printk() did previously, SAS_DPRINTK() offers little value now that libsas logs already have the "sas" prefix through pr_fmt(fmt). So it can be dropped. However, after reviewing some logs in libsas, it is noticed that debug level is too low in many instances. So this change drops SAS_DPRINTK() and revises some logs to a more appropriate level. However many stay at debug level, although some are significantly promoted. We add -DDEBUG for compilation so that we keep the debug messages by default, as before. All the pre-existing checkpatch errors for spanning messages across multiple lines are also fixed. Finally, all other references to printk() [apart from special formatting in sas_ata.c] are removed and replaced with appropriate pr_xxx(). Suggested-by: Joe Perches <joe@perches.com> Signed-off-by: John Garry <john.garry@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/libsas/Makefile2
-rw-r--r--drivers/scsi/libsas/sas_ata.c24
-rw-r--r--drivers/scsi/libsas/sas_discover.c33
-rw-r--r--drivers/scsi/libsas/sas_expander.c214
-rw-r--r--drivers/scsi/libsas/sas_init.c6
-rw-r--r--drivers/scsi/libsas/sas_internal.h11
-rw-r--r--drivers/scsi/libsas/sas_port.c23
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c123
-rw-r--r--drivers/scsi/libsas/sas_task.c7
9 files changed, 207 insertions, 236 deletions
diff --git a/drivers/scsi/libsas/Makefile b/drivers/scsi/libsas/Makefile
index c1db90272122..5d51520c6f23 100644
--- a/drivers/scsi/libsas/Makefile
+++ b/drivers/scsi/libsas/Makefile
@@ -32,3 +32,5 @@ libsas-y += sas_init.o \
32 sas_task.o 32 sas_task.o
33libsas-$(CONFIG_SCSI_SAS_ATA) += sas_ata.o 33libsas-$(CONFIG_SCSI_SAS_ATA) += sas_ata.o
34libsas-$(CONFIG_SCSI_SAS_HOST_SMP) += sas_host_smp.o 34libsas-$(CONFIG_SCSI_SAS_HOST_SMP) += sas_host_smp.o
35
36ccflags-y := -DDEBUG
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 9f3521fae64e..daf898c87e20 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -75,8 +75,8 @@ static enum ata_completion_errors sas_to_ata_err(struct task_status_struct *ts)
75 75
76 case SAS_OPEN_TO: 76 case SAS_OPEN_TO:
77 case SAS_OPEN_REJECT: 77 case SAS_OPEN_REJECT:
78 SAS_DPRINTK("%s: Saw error %d. What to do?\n", 78 pr_warn("%s: Saw error %d. What to do?\n",
79 __func__, ts->stat); 79 __func__, ts->stat);
80 return AC_ERR_OTHER; 80 return AC_ERR_OTHER;
81 81
82 case SAM_STAT_CHECK_CONDITION: 82 case SAM_STAT_CHECK_CONDITION:
@@ -151,8 +151,7 @@ static void sas_ata_task_done(struct sas_task *task)
151 } else { 151 } else {
152 ac = sas_to_ata_err(stat); 152 ac = sas_to_ata_err(stat);
153 if (ac) { 153 if (ac) {
154 SAS_DPRINTK("%s: SAS error %x\n", __func__, 154 pr_warn("%s: SAS error %x\n", __func__, stat->stat);
155 stat->stat);
156 /* We saw a SAS error. Send a vague error. */ 155 /* We saw a SAS error. Send a vague error. */
157 if (!link->sactive) { 156 if (!link->sactive) {
158 qc->err_mask = ac; 157 qc->err_mask = ac;
@@ -237,7 +236,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
237 236
238 ret = i->dft->lldd_execute_task(task, GFP_ATOMIC); 237 ret = i->dft->lldd_execute_task(task, GFP_ATOMIC);
239 if (ret) { 238 if (ret) {
240 SAS_DPRINTK("lldd_execute_task returned: %d\n", ret); 239 pr_debug("lldd_execute_task returned: %d\n", ret);
241 240
242 if (qc->scsicmd) 241 if (qc->scsicmd)
243 ASSIGN_SAS_TASK(qc->scsicmd, NULL); 242 ASSIGN_SAS_TASK(qc->scsicmd, NULL);
@@ -282,9 +281,9 @@ int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy)
282 res = sas_get_report_phy_sata(dev->parent, phy->phy_id, 281 res = sas_get_report_phy_sata(dev->parent, phy->phy_id,
283 &dev->sata_dev.rps_resp); 282 &dev->sata_dev.rps_resp);
284 if (res) { 283 if (res) {
285 SAS_DPRINTK("report phy sata to %016llx:0x%x returned " 284 pr_debug("report phy sata to %016llx:0x%x returned 0x%x\n",
286 "0x%x\n", SAS_ADDR(dev->parent->sas_addr), 285 SAS_ADDR(dev->parent->sas_addr),
287 phy->phy_id, res); 286 phy->phy_id, res);
288 return res; 287 return res;
289 } 288 }
290 memcpy(dev->frame_rcvd, &dev->sata_dev.rps_resp.rps.fis, 289 memcpy(dev->frame_rcvd, &dev->sata_dev.rps_resp.rps.fis,
@@ -431,8 +430,7 @@ static void sas_ata_internal_abort(struct sas_task *task)
431 if (task->task_state_flags & SAS_TASK_STATE_ABORTED || 430 if (task->task_state_flags & SAS_TASK_STATE_ABORTED ||
432 task->task_state_flags & SAS_TASK_STATE_DONE) { 431 task->task_state_flags & SAS_TASK_STATE_DONE) {
433 spin_unlock_irqrestore(&task->task_state_lock, flags); 432 spin_unlock_irqrestore(&task->task_state_lock, flags);
434 SAS_DPRINTK("%s: Task %p already finished.\n", __func__, 433 pr_debug("%s: Task %p already finished.\n", __func__, task);
435 task);
436 goto out; 434 goto out;
437 } 435 }
438 task->task_state_flags |= SAS_TASK_STATE_ABORTED; 436 task->task_state_flags |= SAS_TASK_STATE_ABORTED;
@@ -452,7 +450,7 @@ static void sas_ata_internal_abort(struct sas_task *task)
452 * aborted ata tasks, otherwise we (likely) leak the sas task 450 * aborted ata tasks, otherwise we (likely) leak the sas task
453 * here 451 * here
454 */ 452 */
455 SAS_DPRINTK("%s: Task %p leaked.\n", __func__, task); 453 pr_warn("%s: Task %p leaked.\n", __func__, task);
456 454
457 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) 455 if (!(task->task_state_flags & SAS_TASK_STATE_DONE))
458 task->task_state_flags &= ~SAS_TASK_STATE_ABORTED; 456 task->task_state_flags &= ~SAS_TASK_STATE_ABORTED;
@@ -558,7 +556,7 @@ int sas_ata_init(struct domain_device *found_dev)
558 556
559 ata_host = kzalloc(sizeof(*ata_host), GFP_KERNEL); 557 ata_host = kzalloc(sizeof(*ata_host), GFP_KERNEL);
560 if (!ata_host) { 558 if (!ata_host) {
561 SAS_DPRINTK("ata host alloc failed.\n"); 559 pr_err("ata host alloc failed.\n");
562 return -ENOMEM; 560 return -ENOMEM;
563 } 561 }
564 562
@@ -566,7 +564,7 @@ int sas_ata_init(struct domain_device *found_dev)
566 564
567 ap = ata_sas_port_alloc(ata_host, &sata_port_info, shost); 565 ap = ata_sas_port_alloc(ata_host, &sata_port_info, shost);
568 if (!ap) { 566 if (!ap) {
569 SAS_DPRINTK("ata_sas_port_alloc failed.\n"); 567 pr_err("ata_sas_port_alloc failed.\n");
570 rc = -ENODEV; 568 rc = -ENODEV;
571 goto free_host; 569 goto free_host;
572 } 570 }
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index dde433aa59c2..3eb9ff288b71 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -128,7 +128,7 @@ static int sas_get_port_device(struct asd_sas_port *port)
128 SAS_FANOUT_EXPANDER_DEVICE); 128 SAS_FANOUT_EXPANDER_DEVICE);
129 break; 129 break;
130 default: 130 default:
131 printk("ERROR: Unidentified device type %d\n", dev->dev_type); 131 pr_warn("ERROR: Unidentified device type %d\n", dev->dev_type);
132 rphy = NULL; 132 rphy = NULL;
133 break; 133 break;
134 } 134 }
@@ -186,10 +186,9 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
186 186
187 res = i->dft->lldd_dev_found(dev); 187 res = i->dft->lldd_dev_found(dev);
188 if (res) { 188 if (res) {
189 printk("sas: driver on pcidev %s cannot handle " 189 pr_warn("driver on pcidev %s cannot handle device %llx, error:%d\n",
190 "device %llx, error:%d\n", 190 dev_name(sas_ha->dev),
191 dev_name(sas_ha->dev), 191 SAS_ADDR(dev->sas_addr), res);
192 SAS_ADDR(dev->sas_addr), res);
193 } 192 }
194 set_bit(SAS_DEV_FOUND, &dev->state); 193 set_bit(SAS_DEV_FOUND, &dev->state);
195 kref_get(&dev->kref); 194 kref_get(&dev->kref);
@@ -456,8 +455,8 @@ static void sas_discover_domain(struct work_struct *work)
456 return; 455 return;
457 dev = port->port_dev; 456 dev = port->port_dev;
458 457
459 SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id, 458 pr_debug("DOING DISCOVERY on port %d, pid:%d\n", port->id,
460 task_pid_nr(current)); 459 task_pid_nr(current));
461 460
462 switch (dev->dev_type) { 461 switch (dev->dev_type) {
463 case SAS_END_DEVICE: 462 case SAS_END_DEVICE:
@@ -473,12 +472,12 @@ static void sas_discover_domain(struct work_struct *work)
473 error = sas_discover_sata(dev); 472 error = sas_discover_sata(dev);
474 break; 473 break;
475#else 474#else
476 SAS_DPRINTK("ATA device seen but CONFIG_SCSI_SAS_ATA=N so cannot attach\n"); 475 pr_notice("ATA device seen but CONFIG_SCSI_SAS_ATA=N so cannot attach\n");
477 /* Fall through */ 476 /* Fall through */
478#endif 477#endif
479 default: 478 default:
480 error = -ENXIO; 479 error = -ENXIO;
481 SAS_DPRINTK("unhandled device %d\n", dev->dev_type); 480 pr_err("unhandled device %d\n", dev->dev_type);
482 break; 481 break;
483 } 482 }
484 483
@@ -495,8 +494,8 @@ static void sas_discover_domain(struct work_struct *work)
495 494
496 sas_probe_devices(port); 495 sas_probe_devices(port);
497 496
498 SAS_DPRINTK("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id, 497 pr_debug("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id,
499 task_pid_nr(current), error); 498 task_pid_nr(current), error);
500} 499}
501 500
502static void sas_revalidate_domain(struct work_struct *work) 501static void sas_revalidate_domain(struct work_struct *work)
@@ -510,22 +509,22 @@ static void sas_revalidate_domain(struct work_struct *work)
510 /* prevent revalidation from finding sata links in recovery */ 509 /* prevent revalidation from finding sata links in recovery */
511 mutex_lock(&ha->disco_mutex); 510 mutex_lock(&ha->disco_mutex);
512 if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) { 511 if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) {
513 SAS_DPRINTK("REVALIDATION DEFERRED on port %d, pid:%d\n", 512 pr_debug("REVALIDATION DEFERRED on port %d, pid:%d\n",
514 port->id, task_pid_nr(current)); 513 port->id, task_pid_nr(current));
515 goto out; 514 goto out;
516 } 515 }
517 516
518 clear_bit(DISCE_REVALIDATE_DOMAIN, &port->disc.pending); 517 clear_bit(DISCE_REVALIDATE_DOMAIN, &port->disc.pending);
519 518
520 SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id, 519 pr_debug("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id,
521 task_pid_nr(current)); 520 task_pid_nr(current));
522 521
523 if (ddev && (ddev->dev_type == SAS_FANOUT_EXPANDER_DEVICE || 522 if (ddev && (ddev->dev_type == SAS_FANOUT_EXPANDER_DEVICE ||
524 ddev->dev_type == SAS_EDGE_EXPANDER_DEVICE)) 523 ddev->dev_type == SAS_EDGE_EXPANDER_DEVICE))
525 res = sas_ex_revalidate_domain(ddev); 524 res = sas_ex_revalidate_domain(ddev);
526 525
527 SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n", 526 pr_debug("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n",
528 port->id, task_pid_nr(current), res); 527 port->id, task_pid_nr(current), res);
529 out: 528 out:
530 mutex_unlock(&ha->disco_mutex); 529 mutex_unlock(&ha->disco_mutex);
531 530
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 579304ded008..17eb4185f29d 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -99,17 +99,17 @@ static int smp_execute_task_sg(struct domain_device *dev,
99 99
100 if (res) { 100 if (res) {
101 del_timer(&task->slow_task->timer); 101 del_timer(&task->slow_task->timer);
102 SAS_DPRINTK("executing SMP task failed:%d\n", res); 102 pr_notice("executing SMP task failed:%d\n", res);
103 break; 103 break;
104 } 104 }
105 105
106 wait_for_completion(&task->slow_task->completion); 106 wait_for_completion(&task->slow_task->completion);
107 res = -ECOMM; 107 res = -ECOMM;
108 if ((task->task_state_flags & SAS_TASK_STATE_ABORTED)) { 108 if ((task->task_state_flags & SAS_TASK_STATE_ABORTED)) {
109 SAS_DPRINTK("smp task timed out or aborted\n"); 109 pr_notice("smp task timed out or aborted\n");
110 i->dft->lldd_abort_task(task); 110 i->dft->lldd_abort_task(task);
111 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) { 111 if (!(task->task_state_flags & SAS_TASK_STATE_DONE)) {
112 SAS_DPRINTK("SMP task aborted and not done\n"); 112 pr_notice("SMP task aborted and not done\n");
113 break; 113 break;
114 } 114 }
115 } 115 }
@@ -134,11 +134,11 @@ static int smp_execute_task_sg(struct domain_device *dev,
134 task->task_status.stat == SAS_DEVICE_UNKNOWN) 134 task->task_status.stat == SAS_DEVICE_UNKNOWN)
135 break; 135 break;
136 else { 136 else {
137 SAS_DPRINTK("%s: task to dev %016llx response: 0x%x " 137 pr_notice("%s: task to dev %016llx response: 0x%x status 0x%x\n",
138 "status 0x%x\n", __func__, 138 __func__,
139 SAS_ADDR(dev->sas_addr), 139 SAS_ADDR(dev->sas_addr),
140 task->task_status.resp, 140 task->task_status.resp,
141 task->task_status.stat); 141 task->task_status.stat);
142 sas_free_task(task); 142 sas_free_task(task);
143 task = NULL; 143 task = NULL;
144 } 144 }
@@ -347,11 +347,11 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
347 if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) 347 if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state))
348 set_bit(DISCE_REVALIDATE_DOMAIN, &dev->port->disc.pending); 348 set_bit(DISCE_REVALIDATE_DOMAIN, &dev->port->disc.pending);
349 349
350 SAS_DPRINTK("%sex %016llx phy%02d:%c:%X attached: %016llx (%s)\n", 350 pr_debug("%sex %016llx phy%02d:%c:%X attached: %016llx (%s)\n",
351 test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state) ? "ata: " : "", 351 test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state) ? "ata: " : "",
352 SAS_ADDR(dev->sas_addr), phy->phy_id, 352 SAS_ADDR(dev->sas_addr), phy->phy_id,
353 sas_route_char(dev, phy), phy->linkrate, 353 sas_route_char(dev, phy), phy->linkrate,
354 SAS_ADDR(phy->attached_sas_addr), type); 354 SAS_ADDR(phy->attached_sas_addr), type);
355} 355}
356 356
357/* check if we have an existing attached ata device on this expander phy */ 357/* check if we have an existing attached ata device on this expander phy */
@@ -500,12 +500,12 @@ static int sas_ex_general(struct domain_device *dev)
500 RG_RESP_SIZE); 500 RG_RESP_SIZE);
501 501
502 if (res) { 502 if (res) {
503 SAS_DPRINTK("RG to ex %016llx failed:0x%x\n", 503 pr_notice("RG to ex %016llx failed:0x%x\n",
504 SAS_ADDR(dev->sas_addr), res); 504 SAS_ADDR(dev->sas_addr), res);
505 goto out; 505 goto out;
506 } else if (rg_resp->result != SMP_RESP_FUNC_ACC) { 506 } else if (rg_resp->result != SMP_RESP_FUNC_ACC) {
507 SAS_DPRINTK("RG:ex %016llx returned SMP result:0x%x\n", 507 pr_debug("RG:ex %016llx returned SMP result:0x%x\n",
508 SAS_ADDR(dev->sas_addr), rg_resp->result); 508 SAS_ADDR(dev->sas_addr), rg_resp->result);
509 res = rg_resp->result; 509 res = rg_resp->result;
510 goto out; 510 goto out;
511 } 511 }
@@ -513,8 +513,8 @@ static int sas_ex_general(struct domain_device *dev)
513 ex_assign_report_general(dev, rg_resp); 513 ex_assign_report_general(dev, rg_resp);
514 514
515 if (dev->ex_dev.configuring) { 515 if (dev->ex_dev.configuring) {
516 SAS_DPRINTK("RG: ex %llx self-configuring...\n", 516 pr_debug("RG: ex %llx self-configuring...\n",
517 SAS_ADDR(dev->sas_addr)); 517 SAS_ADDR(dev->sas_addr));
518 schedule_timeout_interruptible(5*HZ); 518 schedule_timeout_interruptible(5*HZ);
519 } else 519 } else
520 break; 520 break;
@@ -568,12 +568,12 @@ static int sas_ex_manuf_info(struct domain_device *dev)
568 568
569 res = smp_execute_task(dev, mi_req, MI_REQ_SIZE, mi_resp,MI_RESP_SIZE); 569 res = smp_execute_task(dev, mi_req, MI_REQ_SIZE, mi_resp,MI_RESP_SIZE);
570 if (res) { 570 if (res) {
571 SAS_DPRINTK("MI: ex %016llx failed:0x%x\n", 571 pr_notice("MI: ex %016llx failed:0x%x\n",
572 SAS_ADDR(dev->sas_addr), res); 572 SAS_ADDR(dev->sas_addr), res);
573 goto out; 573 goto out;
574 } else if (mi_resp[2] != SMP_RESP_FUNC_ACC) { 574 } else if (mi_resp[2] != SMP_RESP_FUNC_ACC) {
575 SAS_DPRINTK("MI ex %016llx returned SMP result:0x%x\n", 575 pr_debug("MI ex %016llx returned SMP result:0x%x\n",
576 SAS_ADDR(dev->sas_addr), mi_resp[2]); 576 SAS_ADDR(dev->sas_addr), mi_resp[2]);
577 goto out; 577 goto out;
578 } 578 }
579 579
@@ -836,10 +836,9 @@ static struct domain_device *sas_ex_discover_end_dev(
836 836
837 res = sas_discover_sata(child); 837 res = sas_discover_sata(child);
838 if (res) { 838 if (res) {
839 SAS_DPRINTK("sas_discover_sata() for device %16llx at " 839 pr_notice("sas_discover_sata() for device %16llx at %016llx:0x%x returned 0x%x\n",
840 "%016llx:0x%x returned 0x%x\n", 840 SAS_ADDR(child->sas_addr),
841 SAS_ADDR(child->sas_addr), 841 SAS_ADDR(parent->sas_addr), phy_id, res);
842 SAS_ADDR(parent->sas_addr), phy_id, res);
843 goto out_list_del; 842 goto out_list_del;
844 } 843 }
845 } else 844 } else
@@ -861,16 +860,15 @@ static struct domain_device *sas_ex_discover_end_dev(
861 860
862 res = sas_discover_end_dev(child); 861 res = sas_discover_end_dev(child);
863 if (res) { 862 if (res) {
864 SAS_DPRINTK("sas_discover_end_dev() for device %16llx " 863 pr_notice("sas_discover_end_dev() for device %16llx at %016llx:0x%x returned 0x%x\n",
865 "at %016llx:0x%x returned 0x%x\n", 864 SAS_ADDR(child->sas_addr),
866 SAS_ADDR(child->sas_addr), 865 SAS_ADDR(parent->sas_addr), phy_id, res);
867 SAS_ADDR(parent->sas_addr), phy_id, res);
868 goto out_list_del; 866 goto out_list_del;
869 } 867 }
870 } else { 868 } else {
871 SAS_DPRINTK("target proto 0x%x at %016llx:0x%x not handled\n", 869 pr_notice("target proto 0x%x at %016llx:0x%x not handled\n",
872 phy->attached_tproto, SAS_ADDR(parent->sas_addr), 870 phy->attached_tproto, SAS_ADDR(parent->sas_addr),
873 phy_id); 871 phy_id);
874 goto out_free; 872 goto out_free;
875 } 873 }
876 874
@@ -927,11 +925,10 @@ static struct domain_device *sas_ex_discover_expander(
927 int res; 925 int res;
928 926
929 if (phy->routing_attr == DIRECT_ROUTING) { 927 if (phy->routing_attr == DIRECT_ROUTING) {
930 SAS_DPRINTK("ex %016llx:0x%x:D <--> ex %016llx:0x%x is not " 928 pr_warn("ex %016llx:0x%x:D <--> ex %016llx:0x%x is not allowed\n",
931 "allowed\n", 929 SAS_ADDR(parent->sas_addr), phy_id,
932 SAS_ADDR(parent->sas_addr), phy_id, 930 SAS_ADDR(phy->attached_sas_addr),
933 SAS_ADDR(phy->attached_sas_addr), 931 phy->attached_phy_id);
934 phy->attached_phy_id);
935 return NULL; 932 return NULL;
936 } 933 }
937 child = sas_alloc_device(); 934 child = sas_alloc_device();
@@ -1038,25 +1035,24 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
1038 ex_phy->attached_dev_type != SAS_FANOUT_EXPANDER_DEVICE && 1035 ex_phy->attached_dev_type != SAS_FANOUT_EXPANDER_DEVICE &&
1039 ex_phy->attached_dev_type != SAS_EDGE_EXPANDER_DEVICE && 1036 ex_phy->attached_dev_type != SAS_EDGE_EXPANDER_DEVICE &&
1040 ex_phy->attached_dev_type != SAS_SATA_PENDING) { 1037 ex_phy->attached_dev_type != SAS_SATA_PENDING) {
1041 SAS_DPRINTK("unknown device type(0x%x) attached to ex %016llx " 1038 pr_warn("unknown device type(0x%x) attached to ex %016llx phy 0x%x\n",
1042 "phy 0x%x\n", ex_phy->attached_dev_type, 1039 ex_phy->attached_dev_type,
1043 SAS_ADDR(dev->sas_addr), 1040 SAS_ADDR(dev->sas_addr),
1044 phy_id); 1041 phy_id);
1045 return 0; 1042 return 0;
1046 } 1043 }
1047 1044
1048 res = sas_configure_routing(dev, ex_phy->attached_sas_addr); 1045 res = sas_configure_routing(dev, ex_phy->attached_sas_addr);
1049 if (res) { 1046 if (res) {
1050 SAS_DPRINTK("configure routing for dev %016llx " 1047 pr_notice("configure routing for dev %016llx reported 0x%x. Forgotten\n",
1051 "reported 0x%x. Forgotten\n", 1048 SAS_ADDR(ex_phy->attached_sas_addr), res);
1052 SAS_ADDR(ex_phy->attached_sas_addr), res);
1053 sas_disable_routing(dev, ex_phy->attached_sas_addr); 1049 sas_disable_routing(dev, ex_phy->attached_sas_addr);
1054 return res; 1050 return res;
1055 } 1051 }
1056 1052
1057 if (sas_ex_join_wide_port(dev, phy_id)) { 1053 if (sas_ex_join_wide_port(dev, phy_id)) {
1058 SAS_DPRINTK("Attaching ex phy%d to wide port %016llx\n", 1054 pr_debug("Attaching ex phy%d to wide port %016llx\n",
1059 phy_id, SAS_ADDR(ex_phy->attached_sas_addr)); 1055 phy_id, SAS_ADDR(ex_phy->attached_sas_addr));
1060 return res; 1056 return res;
1061 } 1057 }
1062 1058
@@ -1067,12 +1063,11 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
1067 break; 1063 break;
1068 case SAS_FANOUT_EXPANDER_DEVICE: 1064 case SAS_FANOUT_EXPANDER_DEVICE:
1069 if (SAS_ADDR(dev->port->disc.fanout_sas_addr)) { 1065 if (SAS_ADDR(dev->port->disc.fanout_sas_addr)) {
1070 SAS_DPRINTK("second fanout expander %016llx phy 0x%x " 1066 pr_debug("second fanout expander %016llx phy 0x%x attached to ex %016llx phy 0x%x\n",
1071 "attached to ex %016llx phy 0x%x\n", 1067 SAS_ADDR(ex_phy->attached_sas_addr),
1072 SAS_ADDR(ex_phy->attached_sas_addr), 1068 ex_phy->attached_phy_id,
1073 ex_phy->attached_phy_id, 1069 SAS_ADDR(dev->sas_addr),
1074 SAS_ADDR(dev->sas_addr), 1070 phy_id);
1075 phy_id);
1076 sas_ex_disable_phy(dev, phy_id); 1071 sas_ex_disable_phy(dev, phy_id);
1077 break; 1072 break;
1078 } else 1073 } else
@@ -1101,9 +1096,8 @@ static int sas_ex_discover_dev(struct domain_device *dev, int phy_id)
1101 SAS_ADDR(child->sas_addr)) { 1096 SAS_ADDR(child->sas_addr)) {
1102 ex->ex_phy[i].phy_state= PHY_DEVICE_DISCOVERED; 1097 ex->ex_phy[i].phy_state= PHY_DEVICE_DISCOVERED;
1103 if (sas_ex_join_wide_port(dev, i)) 1098 if (sas_ex_join_wide_port(dev, i))
1104 SAS_DPRINTK("Attaching ex phy%d to wide port %016llx\n", 1099 pr_debug("Attaching ex phy%d to wide port %016llx\n",
1105 i, SAS_ADDR(ex->ex_phy[i].attached_sas_addr)); 1100 i, SAS_ADDR(ex->ex_phy[i].attached_sas_addr));
1106
1107 } 1101 }
1108 } 1102 }
1109 } 1103 }
@@ -1154,13 +1148,11 @@ static int sas_check_level_subtractive_boundary(struct domain_device *dev)
1154 if (sas_find_sub_addr(child, s2) && 1148 if (sas_find_sub_addr(child, s2) &&
1155 (SAS_ADDR(sub_addr) != SAS_ADDR(s2))) { 1149 (SAS_ADDR(sub_addr) != SAS_ADDR(s2))) {
1156 1150
1157 SAS_DPRINTK("ex %016llx->%016llx-?->%016llx " 1151 pr_notice("ex %016llx->%016llx-?->%016llx diverges from subtractive boundary %016llx\n",
1158 "diverges from subtractive " 1152 SAS_ADDR(dev->sas_addr),
1159 "boundary %016llx\n", 1153 SAS_ADDR(child->sas_addr),
1160 SAS_ADDR(dev->sas_addr), 1154 SAS_ADDR(s2),
1161 SAS_ADDR(child->sas_addr), 1155 SAS_ADDR(sub_addr));
1162 SAS_ADDR(s2),
1163 SAS_ADDR(sub_addr));
1164 1156
1165 sas_ex_disable_port(child, s2); 1157 sas_ex_disable_port(child, s2);
1166 } 1158 }
@@ -1239,12 +1231,10 @@ static int sas_check_ex_subtractive_boundary(struct domain_device *dev)
1239 else if (SAS_ADDR(sub_sas_addr) != 1231 else if (SAS_ADDR(sub_sas_addr) !=
1240 SAS_ADDR(phy->attached_sas_addr)) { 1232 SAS_ADDR(phy->attached_sas_addr)) {
1241 1233
1242 SAS_DPRINTK("ex %016llx phy 0x%x " 1234 pr_notice("ex %016llx phy 0x%x diverges(%016llx) on subtractive boundary(%016llx). Disabled\n",
1243 "diverges(%016llx) on subtractive " 1235 SAS_ADDR(dev->sas_addr), i,
1244 "boundary(%016llx). Disabled\n", 1236 SAS_ADDR(phy->attached_sas_addr),
1245 SAS_ADDR(dev->sas_addr), i, 1237 SAS_ADDR(sub_sas_addr));
1246 SAS_ADDR(phy->attached_sas_addr),
1247 SAS_ADDR(sub_sas_addr));
1248 sas_ex_disable_phy(dev, i); 1238 sas_ex_disable_phy(dev, i);
1249 } 1239 }
1250 } 1240 }
@@ -1284,13 +1274,12 @@ static int sas_check_eeds(struct domain_device *child,
1284 1274
1285 if (SAS_ADDR(parent->port->disc.fanout_sas_addr) != 0) { 1275 if (SAS_ADDR(parent->port->disc.fanout_sas_addr) != 0) {
1286 res = -ENODEV; 1276 res = -ENODEV;
1287 SAS_DPRINTK("edge ex %016llx phy S:0x%x <--> edge ex %016llx " 1277 pr_warn("edge ex %016llx phy S:0x%x <--> edge ex %016llx phy S:0x%x, while there is a fanout ex %016llx\n",
1288 "phy S:0x%x, while there is a fanout ex %016llx\n", 1278 SAS_ADDR(parent->sas_addr),
1289 SAS_ADDR(parent->sas_addr), 1279 parent_phy->phy_id,
1290 parent_phy->phy_id, 1280 SAS_ADDR(child->sas_addr),
1291 SAS_ADDR(child->sas_addr), 1281 child_phy->phy_id,
1292 child_phy->phy_id, 1282 SAS_ADDR(parent->port->disc.fanout_sas_addr));
1293 SAS_ADDR(parent->port->disc.fanout_sas_addr));
1294 } else if (SAS_ADDR(parent->port->disc.eeds_a) == 0) { 1283 } else if (SAS_ADDR(parent->port->disc.eeds_a) == 0) {
1295 memcpy(parent->port->disc.eeds_a, parent->sas_addr, 1284 memcpy(parent->port->disc.eeds_a, parent->sas_addr,
1296 SAS_ADDR_SIZE); 1285 SAS_ADDR_SIZE);
@@ -1308,12 +1297,11 @@ static int sas_check_eeds(struct domain_device *child,
1308 ; 1297 ;
1309 else { 1298 else {
1310 res = -ENODEV; 1299 res = -ENODEV;
1311 SAS_DPRINTK("edge ex %016llx phy 0x%x <--> edge ex %016llx " 1300 pr_warn("edge ex %016llx phy 0x%x <--> edge ex %016llx phy 0x%x link forms a third EEDS!\n",
1312 "phy 0x%x link forms a third EEDS!\n", 1301 SAS_ADDR(parent->sas_addr),
1313 SAS_ADDR(parent->sas_addr), 1302 parent_phy->phy_id,
1314 parent_phy->phy_id, 1303 SAS_ADDR(child->sas_addr),
1315 SAS_ADDR(child->sas_addr), 1304 child_phy->phy_id);
1316 child_phy->phy_id);
1317 } 1305 }
1318 1306
1319 return res; 1307 return res;
@@ -1427,14 +1415,13 @@ static int sas_configure_present(struct domain_device *dev, int phy_id,
1427 goto out; 1415 goto out;
1428 res = rri_resp[2]; 1416 res = rri_resp[2];
1429 if (res == SMP_RESP_NO_INDEX) { 1417 if (res == SMP_RESP_NO_INDEX) {
1430 SAS_DPRINTK("overflow of indexes: dev %016llx " 1418 pr_warn("overflow of indexes: dev %016llx phy 0x%x index 0x%x\n",
1431 "phy 0x%x index 0x%x\n", 1419 SAS_ADDR(dev->sas_addr), phy_id, i);
1432 SAS_ADDR(dev->sas_addr), phy_id, i);
1433 goto out; 1420 goto out;
1434 } else if (res != SMP_RESP_FUNC_ACC) { 1421 } else if (res != SMP_RESP_FUNC_ACC) {
1435 SAS_DPRINTK("%s: dev %016llx phy 0x%x index 0x%x " 1422 pr_notice("%s: dev %016llx phy 0x%x index 0x%x result 0x%x\n",
1436 "result 0x%x\n", __func__, 1423 __func__, SAS_ADDR(dev->sas_addr), phy_id,
1437 SAS_ADDR(dev->sas_addr), phy_id, i, res); 1424 i, res);
1438 goto out; 1425 goto out;
1439 } 1426 }
1440 if (SAS_ADDR(sas_addr) != 0) { 1427 if (SAS_ADDR(sas_addr) != 0) {
@@ -1498,9 +1485,8 @@ static int sas_configure_set(struct domain_device *dev, int phy_id,
1498 goto out; 1485 goto out;
1499 res = cri_resp[2]; 1486 res = cri_resp[2];
1500 if (res == SMP_RESP_NO_INDEX) { 1487 if (res == SMP_RESP_NO_INDEX) {
1501 SAS_DPRINTK("overflow of indexes: dev %016llx phy 0x%x " 1488 pr_warn("overflow of indexes: dev %016llx phy 0x%x index 0x%x\n",
1502 "index 0x%x\n", 1489 SAS_ADDR(dev->sas_addr), phy_id, index);
1503 SAS_ADDR(dev->sas_addr), phy_id, index);
1504 } 1490 }
1505out: 1491out:
1506 kfree(cri_req); 1492 kfree(cri_req);
@@ -1547,8 +1533,8 @@ static int sas_configure_parent(struct domain_device *parent,
1547 } 1533 }
1548 1534
1549 if (ex_parent->conf_route_table == 0) { 1535 if (ex_parent->conf_route_table == 0) {
1550 SAS_DPRINTK("ex %016llx has self-configuring routing table\n", 1536 pr_debug("ex %016llx has self-configuring routing table\n",
1551 SAS_ADDR(parent->sas_addr)); 1537 SAS_ADDR(parent->sas_addr));
1552 return 0; 1538 return 0;
1553 } 1539 }
1554 1540
@@ -1609,8 +1595,8 @@ static int sas_discover_expander(struct domain_device *dev)
1609 1595
1610 res = sas_expander_discover(dev); 1596 res = sas_expander_discover(dev);
1611 if (res) { 1597 if (res) {
1612 SAS_DPRINTK("expander %016llx discovery failed(0x%x)\n", 1598 pr_warn("expander %016llx discovery failed(0x%x)\n",
1613 SAS_ADDR(dev->sas_addr), res); 1599 SAS_ADDR(dev->sas_addr), res);
1614 goto out_err; 1600 goto out_err;
1615 } 1601 }
1616 1602
@@ -1854,10 +1840,10 @@ static int sas_find_bcast_dev(struct domain_device *dev,
1854 if (phy_id != -1) { 1840 if (phy_id != -1) {
1855 *src_dev = dev; 1841 *src_dev = dev;
1856 ex->ex_change_count = ex_change_count; 1842 ex->ex_change_count = ex_change_count;
1857 SAS_DPRINTK("Expander phy change count has changed\n"); 1843 pr_info("Expander phy change count has changed\n");
1858 return res; 1844 return res;
1859 } else 1845 } else
1860 SAS_DPRINTK("Expander phys DID NOT change\n"); 1846 pr_info("Expander phys DID NOT change\n");
1861 } 1847 }
1862 list_for_each_entry(ch, &ex->children, siblings) { 1848 list_for_each_entry(ch, &ex->children, siblings) {
1863 if (ch->dev_type == SAS_EDGE_EXPANDER_DEVICE || ch->dev_type == SAS_FANOUT_EXPANDER_DEVICE) { 1849 if (ch->dev_type == SAS_EDGE_EXPANDER_DEVICE || ch->dev_type == SAS_FANOUT_EXPANDER_DEVICE) {
@@ -1967,8 +1953,8 @@ static int sas_discover_new(struct domain_device *dev, int phy_id)
1967 struct domain_device *child; 1953 struct domain_device *child;
1968 int res; 1954 int res;
1969 1955
1970 SAS_DPRINTK("ex %016llx phy%d new device attached\n", 1956 pr_debug("ex %016llx phy%d new device attached\n",
1971 SAS_ADDR(dev->sas_addr), phy_id); 1957 SAS_ADDR(dev->sas_addr), phy_id);
1972 res = sas_ex_phy_discover(dev, phy_id); 1958 res = sas_ex_phy_discover(dev, phy_id);
1973 if (res) 1959 if (res)
1974 return res; 1960 return res;
@@ -2046,15 +2032,15 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last)
2046 2032
2047 if (ata_dev && phy->attached_dev_type == SAS_SATA_PENDING) 2033 if (ata_dev && phy->attached_dev_type == SAS_SATA_PENDING)
2048 action = ", needs recovery"; 2034 action = ", needs recovery";
2049 SAS_DPRINTK("ex %016llx phy 0x%x broadcast flutter%s\n", 2035 pr_debug("ex %016llx phy 0x%x broadcast flutter%s\n",
2050 SAS_ADDR(dev->sas_addr), phy_id, action); 2036 SAS_ADDR(dev->sas_addr), phy_id, action);
2051 return res; 2037 return res;
2052 } 2038 }
2053 2039
2054 /* we always have to delete the old device when we went here */ 2040 /* we always have to delete the old device when we went here */
2055 SAS_DPRINTK("ex %016llx phy 0x%x replace %016llx\n", 2041 pr_info("ex %016llx phy 0x%x replace %016llx\n",
2056 SAS_ADDR(dev->sas_addr), phy_id, 2042 SAS_ADDR(dev->sas_addr), phy_id,
2057 SAS_ADDR(phy->attached_sas_addr)); 2043 SAS_ADDR(phy->attached_sas_addr));
2058 sas_unregister_devs_sas_addr(dev, phy_id, last); 2044 sas_unregister_devs_sas_addr(dev, phy_id, last);
2059 2045
2060 return sas_discover_new(dev, phy_id); 2046 return sas_discover_new(dev, phy_id);
@@ -2082,8 +2068,8 @@ static int sas_rediscover(struct domain_device *dev, const int phy_id)
2082 int i; 2068 int i;
2083 bool last = true; /* is this the last phy of the port */ 2069 bool last = true; /* is this the last phy of the port */
2084 2070
2085 SAS_DPRINTK("ex %016llx phy%d originated BROADCAST(CHANGE)\n", 2071 pr_debug("ex %016llx phy%d originated BROADCAST(CHANGE)\n",
2086 SAS_ADDR(dev->sas_addr), phy_id); 2072 SAS_ADDR(dev->sas_addr), phy_id);
2087 2073
2088 if (SAS_ADDR(changed_phy->attached_sas_addr) != 0) { 2074 if (SAS_ADDR(changed_phy->attached_sas_addr) != 0) {
2089 for (i = 0; i < ex->num_phys; i++) { 2075 for (i = 0; i < ex->num_phys; i++) {
@@ -2093,8 +2079,8 @@ static int sas_rediscover(struct domain_device *dev, const int phy_id)
2093 continue; 2079 continue;
2094 if (SAS_ADDR(phy->attached_sas_addr) == 2080 if (SAS_ADDR(phy->attached_sas_addr) ==
2095 SAS_ADDR(changed_phy->attached_sas_addr)) { 2081 SAS_ADDR(changed_phy->attached_sas_addr)) {
2096 SAS_DPRINTK("phy%d part of wide port with " 2082 pr_debug("phy%d part of wide port with phy%d\n",
2097 "phy%d\n", phy_id, i); 2083 phy_id, i);
2098 last = false; 2084 last = false;
2099 break; 2085 break;
2100 } 2086 }
@@ -2152,23 +2138,23 @@ void sas_smp_handler(struct bsg_job *job, struct Scsi_Host *shost,
2152 case SAS_FANOUT_EXPANDER_DEVICE: 2138 case SAS_FANOUT_EXPANDER_DEVICE:
2153 break; 2139 break;
2154 default: 2140 default:
2155 printk("%s: can we send a smp request to a device?\n", 2141 pr_err("%s: can we send a smp request to a device?\n",
2156 __func__); 2142 __func__);
2157 goto out; 2143 goto out;
2158 } 2144 }
2159 2145
2160 dev = sas_find_dev_by_rphy(rphy); 2146 dev = sas_find_dev_by_rphy(rphy);
2161 if (!dev) { 2147 if (!dev) {
2162 printk("%s: fail to find a domain_device?\n", __func__); 2148 pr_err("%s: fail to find a domain_device?\n", __func__);
2163 goto out; 2149 goto out;
2164 } 2150 }
2165 2151
2166 /* do we need to support multiple segments? */ 2152 /* do we need to support multiple segments? */
2167 if (job->request_payload.sg_cnt > 1 || 2153 if (job->request_payload.sg_cnt > 1 ||
2168 job->reply_payload.sg_cnt > 1) { 2154 job->reply_payload.sg_cnt > 1) {
2169 printk("%s: multiple segments req %u, rsp %u\n", 2155 pr_info("%s: multiple segments req %u, rsp %u\n",
2170 __func__, job->request_payload.payload_len, 2156 __func__, job->request_payload.payload_len,
2171 job->reply_payload.payload_len); 2157 job->reply_payload.payload_len);
2172 goto out; 2158 goto out;
2173 } 2159 }
2174 2160
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c
index a3c25e22b939..221340ee8651 100644
--- a/drivers/scsi/libsas/sas_init.c
+++ b/drivers/scsi/libsas/sas_init.c
@@ -128,19 +128,19 @@ int sas_register_ha(struct sas_ha_struct *sas_ha)
128 128
129 error = sas_register_phys(sas_ha); 129 error = sas_register_phys(sas_ha);
130 if (error) { 130 if (error) {
131 printk(KERN_NOTICE "couldn't register sas phys:%d\n", error); 131 pr_notice("couldn't register sas phys:%d\n", error);
132 return error; 132 return error;
133 } 133 }
134 134
135 error = sas_register_ports(sas_ha); 135 error = sas_register_ports(sas_ha);
136 if (error) { 136 if (error) {
137 printk(KERN_NOTICE "couldn't register sas ports:%d\n", error); 137 pr_notice("couldn't register sas ports:%d\n", error);
138 goto Undo_phys; 138 goto Undo_phys;
139 } 139 }
140 140
141 error = sas_init_events(sas_ha); 141 error = sas_init_events(sas_ha);
142 if (error) { 142 if (error) {
143 printk(KERN_NOTICE "couldn't start event thread:%d\n", error); 143 pr_notice("couldn't start event thread:%d\n", error);
144 goto Undo_ports; 144 goto Undo_ports;
145 } 145 }
146 146
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h
index 910aa3145715..2cdb981cf476 100644
--- a/drivers/scsi/libsas/sas_internal.h
+++ b/drivers/scsi/libsas/sas_internal.h
@@ -40,9 +40,6 @@
40 40
41#define pr_fmt(fmt) SAS_FMT fmt 41#define pr_fmt(fmt) SAS_FMT fmt
42 42
43#define SAS_DPRINTK(fmt, ...) printk(KERN_DEBUG fmt, ## __VA_ARGS__)
44
45
46#define TO_SAS_TASK(_scsi_cmd) ((void *)(_scsi_cmd)->host_scribble) 43#define TO_SAS_TASK(_scsi_cmd) ((void *)(_scsi_cmd)->host_scribble)
47#define ASSIGN_SAS_TASK(_sc, _t) do { (_sc)->host_scribble = (void *) _t; } while (0) 44#define ASSIGN_SAS_TASK(_sc, _t) do { (_sc)->host_scribble = (void *) _t; } while (0)
48 45
@@ -127,10 +124,10 @@ static inline void sas_smp_host_handler(struct bsg_job *job,
127 124
128static inline void sas_fail_probe(struct domain_device *dev, const char *func, int err) 125static inline void sas_fail_probe(struct domain_device *dev, const char *func, int err)
129{ 126{
130 SAS_DPRINTK("%s: for %s device %16llx returned %d\n", 127 pr_warn("%s: for %s device %16llx returned %d\n",
131 func, dev->parent ? "exp-attached" : 128 func, dev->parent ? "exp-attached" :
132 "direct-attached", 129 "direct-attached",
133 SAS_ADDR(dev->sas_addr), err); 130 SAS_ADDR(dev->sas_addr), err);
134 sas_unregister_dev(dev->port, dev); 131 sas_unregister_dev(dev->port, dev);
135} 132}
136 133
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
index fad23dd39114..03fe479359b6 100644
--- a/drivers/scsi/libsas/sas_port.c
+++ b/drivers/scsi/libsas/sas_port.c
@@ -110,9 +110,9 @@ static void sas_form_port(struct asd_sas_phy *phy)
110 wake_up(&sas_ha->eh_wait_q); 110 wake_up(&sas_ha->eh_wait_q);
111 return; 111 return;
112 } else { 112 } else {
113 SAS_DPRINTK("%s: phy%d belongs to port%d already(%d)!\n", 113 pr_info("%s: phy%d belongs to port%d already(%d)!\n",
114 __func__, phy->id, phy->port->id, 114 __func__, phy->id, phy->port->id,
115 phy->port->num_phys); 115 phy->port->num_phys);
116 return; 116 return;
117 } 117 }
118 } 118 }
@@ -125,8 +125,8 @@ static void sas_form_port(struct asd_sas_phy *phy)
125 if (*(u64 *) port->sas_addr && 125 if (*(u64 *) port->sas_addr &&
126 phy_is_wideport_member(port, phy) && port->num_phys > 0) { 126 phy_is_wideport_member(port, phy) && port->num_phys > 0) {
127 /* wide port */ 127 /* wide port */
128 SAS_DPRINTK("phy%d matched wide port%d\n", phy->id, 128 pr_debug("phy%d matched wide port%d\n", phy->id,
129 port->id); 129 port->id);
130 break; 130 break;
131 } 131 }
132 spin_unlock(&port->phy_list_lock); 132 spin_unlock(&port->phy_list_lock);
@@ -147,8 +147,7 @@ static void sas_form_port(struct asd_sas_phy *phy)
147 } 147 }
148 148
149 if (i >= sas_ha->num_phys) { 149 if (i >= sas_ha->num_phys) {
150 printk(KERN_NOTICE "%s: couldn't find a free port, bug?\n", 150 pr_err("%s: couldn't find a free port, bug?\n", __func__);
151 __func__);
152 spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); 151 spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags);
153 return; 152 return;
154 } 153 }
@@ -180,10 +179,10 @@ static void sas_form_port(struct asd_sas_phy *phy)
180 } 179 }
181 sas_port_add_phy(port->port, phy->phy); 180 sas_port_add_phy(port->port, phy->phy);
182 181
183 SAS_DPRINTK("%s added to %s, phy_mask:0x%x (%16llx)\n", 182 pr_debug("%s added to %s, phy_mask:0x%x (%16llx)\n",
184 dev_name(&phy->phy->dev), dev_name(&port->port->dev), 183 dev_name(&phy->phy->dev), dev_name(&port->port->dev),
185 port->phy_mask, 184 port->phy_mask,
186 SAS_ADDR(port->attached_sas_addr)); 185 SAS_ADDR(port->attached_sas_addr));
187 186
188 if (port->port_dev) 187 if (port->port_dev)
189 port->port_dev->pathways = port->num_phys; 188 port->port_dev->pathways = port->num_phys;
@@ -279,7 +278,7 @@ void sas_porte_broadcast_rcvd(struct work_struct *work)
279 prim = phy->sas_prim; 278 prim = phy->sas_prim;
280 spin_unlock_irqrestore(&phy->sas_prim_lock, flags); 279 spin_unlock_irqrestore(&phy->sas_prim_lock, flags);
281 280
282 SAS_DPRINTK("broadcast received: %d\n", prim); 281 pr_debug("broadcast received: %d\n", prim);
283 sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN); 282 sas_discover_event(phy->port, DISCE_REVALIDATE_DOMAIN);
284 283
285 if (phy->port) 284 if (phy->port)
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 33229348dcb6..674789b3bab0 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -93,9 +93,8 @@ static void sas_end_task(struct scsi_cmnd *sc, struct sas_task *task)
93 hs = DID_ERROR; 93 hs = DID_ERROR;
94 break; 94 break;
95 case SAS_PROTO_RESPONSE: 95 case SAS_PROTO_RESPONSE:
96 SAS_DPRINTK("LLDD:%s sent SAS_PROTO_RESP for an SSP " 96 pr_notice("LLDD:%s sent SAS_PROTO_RESP for an SSP task; please report this\n",
97 "task; please report this\n", 97 task->dev->port->ha->sas_ha_name);
98 task->dev->port->ha->sas_ha_name);
99 break; 98 break;
100 case SAS_ABORTED_TASK: 99 case SAS_ABORTED_TASK:
101 hs = DID_ABORT; 100 hs = DID_ABORT;
@@ -132,12 +131,12 @@ static void sas_scsi_task_done(struct sas_task *task)
132 131
133 if (unlikely(!task)) { 132 if (unlikely(!task)) {
134 /* task will be completed by the error handler */ 133 /* task will be completed by the error handler */
135 SAS_DPRINTK("task done but aborted\n"); 134 pr_debug("task done but aborted\n");
136 return; 135 return;
137 } 136 }
138 137
139 if (unlikely(!sc)) { 138 if (unlikely(!sc)) {
140 SAS_DPRINTK("task_done called with non existing SCSI cmnd!\n"); 139 pr_debug("task_done called with non existing SCSI cmnd!\n");
141 sas_free_task(task); 140 sas_free_task(task);
142 return; 141 return;
143 } 142 }
@@ -208,7 +207,7 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
208 return 0; 207 return 0;
209 208
210out_free_task: 209out_free_task:
211 SAS_DPRINTK("lldd_execute_task returned: %d\n", res); 210 pr_debug("lldd_execute_task returned: %d\n", res);
212 ASSIGN_SAS_TASK(cmd, NULL); 211 ASSIGN_SAS_TASK(cmd, NULL);
213 sas_free_task(task); 212 sas_free_task(task);
214 if (res == -SAS_QUEUE_FULL) 213 if (res == -SAS_QUEUE_FULL)
@@ -301,40 +300,38 @@ static enum task_disposition sas_scsi_find_task(struct sas_task *task)
301 to_sas_internal(task->dev->port->ha->core.shost->transportt); 300 to_sas_internal(task->dev->port->ha->core.shost->transportt);
302 301
303 for (i = 0; i < 5; i++) { 302 for (i = 0; i < 5; i++) {
304 SAS_DPRINTK("%s: aborting task 0x%p\n", __func__, task); 303 pr_notice("%s: aborting task 0x%p\n", __func__, task);
305 res = si->dft->lldd_abort_task(task); 304 res = si->dft->lldd_abort_task(task);
306 305
307 spin_lock_irqsave(&task->task_state_lock, flags); 306 spin_lock_irqsave(&task->task_state_lock, flags);
308 if (task->task_state_flags & SAS_TASK_STATE_DONE) { 307 if (task->task_state_flags & SAS_TASK_STATE_DONE) {
309 spin_unlock_irqrestore(&task->task_state_lock, flags); 308 spin_unlock_irqrestore(&task->task_state_lock, flags);
310 SAS_DPRINTK("%s: task 0x%p is done\n", __func__, 309 pr_debug("%s: task 0x%p is done\n", __func__, task);
311 task);
312 return TASK_IS_DONE; 310 return TASK_IS_DONE;
313 } 311 }
314 spin_unlock_irqrestore(&task->task_state_lock, flags); 312 spin_unlock_irqrestore(&task->task_state_lock, flags);
315 313
316 if (res == TMF_RESP_FUNC_COMPLETE) { 314 if (res == TMF_RESP_FUNC_COMPLETE) {
317 SAS_DPRINTK("%s: task 0x%p is aborted\n", 315 pr_notice("%s: task 0x%p is aborted\n",
318 __func__, task); 316 __func__, task);
319 return TASK_IS_ABORTED; 317 return TASK_IS_ABORTED;
320 } else if (si->dft->lldd_query_task) { 318 } else if (si->dft->lldd_query_task) {
321 SAS_DPRINTK("%s: querying task 0x%p\n", 319 pr_notice("%s: querying task 0x%p\n", __func__, task);
322 __func__, task);
323 res = si->dft->lldd_query_task(task); 320 res = si->dft->lldd_query_task(task);
324 switch (res) { 321 switch (res) {
325 case TMF_RESP_FUNC_SUCC: 322 case TMF_RESP_FUNC_SUCC:
326 SAS_DPRINTK("%s: task 0x%p at LU\n", 323 pr_notice("%s: task 0x%p at LU\n", __func__,
327 __func__, task); 324 task);
328 return TASK_IS_AT_LU; 325 return TASK_IS_AT_LU;
329 case TMF_RESP_FUNC_COMPLETE: 326 case TMF_RESP_FUNC_COMPLETE:
330 SAS_DPRINTK("%s: task 0x%p not at LU\n", 327 pr_notice("%s: task 0x%p not at LU\n",
331 __func__, task); 328 __func__, task);
332 return TASK_IS_NOT_AT_LU; 329 return TASK_IS_NOT_AT_LU;
333 case TMF_RESP_FUNC_FAILED: 330 case TMF_RESP_FUNC_FAILED:
334 SAS_DPRINTK("%s: task 0x%p failed to abort\n", 331 pr_notice("%s: task 0x%p failed to abort\n",
335 __func__, task); 332 __func__, task);
336 return TASK_ABORT_FAILED; 333 return TASK_ABORT_FAILED;
337 } 334 }
338 335
339 } 336 }
340 } 337 }
@@ -350,9 +347,9 @@ static int sas_recover_lu(struct domain_device *dev, struct scsi_cmnd *cmd)
350 347
351 int_to_scsilun(cmd->device->lun, &lun); 348 int_to_scsilun(cmd->device->lun, &lun);
352 349
353 SAS_DPRINTK("eh: device %llx LUN %llx has the task\n", 350 pr_notice("eh: device %llx LUN %llx has the task\n",
354 SAS_ADDR(dev->sas_addr), 351 SAS_ADDR(dev->sas_addr),
355 cmd->device->lun); 352 cmd->device->lun);
356 353
357 if (i->dft->lldd_abort_task_set) 354 if (i->dft->lldd_abort_task_set)
358 res = i->dft->lldd_abort_task_set(dev, lun.scsi_lun); 355 res = i->dft->lldd_abort_task_set(dev, lun.scsi_lun);
@@ -376,8 +373,8 @@ static int sas_recover_I_T(struct domain_device *dev)
376 struct sas_internal *i = 373 struct sas_internal *i =
377 to_sas_internal(dev->port->ha->core.shost->transportt); 374 to_sas_internal(dev->port->ha->core.shost->transportt);
378 375
379 SAS_DPRINTK("I_T nexus reset for dev %016llx\n", 376 pr_notice("I_T nexus reset for dev %016llx\n",
380 SAS_ADDR(dev->sas_addr)); 377 SAS_ADDR(dev->sas_addr));
381 378
382 if (i->dft->lldd_I_T_nexus_reset) 379 if (i->dft->lldd_I_T_nexus_reset)
383 res = i->dft->lldd_I_T_nexus_reset(dev); 380 res = i->dft->lldd_I_T_nexus_reset(dev);
@@ -471,9 +468,9 @@ static int sas_queue_reset(struct domain_device *dev, int reset_type,
471 return SUCCESS; 468 return SUCCESS;
472 } 469 }
473 470
474 SAS_DPRINTK("%s reset of %s failed\n", 471 pr_warn("%s reset of %s failed\n",
475 reset_type == SAS_DEV_LU_RESET ? "LUN" : "Bus", 472 reset_type == SAS_DEV_LU_RESET ? "LUN" : "Bus",
476 dev_name(&dev->rphy->dev)); 473 dev_name(&dev->rphy->dev));
477 474
478 return FAILED; 475 return FAILED;
479} 476}
@@ -501,7 +498,7 @@ int sas_eh_abort_handler(struct scsi_cmnd *cmd)
501 if (task) 498 if (task)
502 res = i->dft->lldd_abort_task(task); 499 res = i->dft->lldd_abort_task(task);
503 else 500 else
504 SAS_DPRINTK("no task to abort\n"); 501 pr_notice("no task to abort\n");
505 if (res == TMF_RESP_FUNC_SUCC || res == TMF_RESP_FUNC_COMPLETE) 502 if (res == TMF_RESP_FUNC_SUCC || res == TMF_RESP_FUNC_COMPLETE)
506 return SUCCESS; 503 return SUCCESS;
507 504
@@ -612,34 +609,33 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
612 spin_unlock_irqrestore(&task->task_state_lock, flags); 609 spin_unlock_irqrestore(&task->task_state_lock, flags);
613 610
614 if (need_reset) { 611 if (need_reset) {
615 SAS_DPRINTK("%s: task 0x%p requests reset\n", 612 pr_notice("%s: task 0x%p requests reset\n",
616 __func__, task); 613 __func__, task);
617 goto reset; 614 goto reset;
618 } 615 }
619 616
620 SAS_DPRINTK("trying to find task 0x%p\n", task); 617 pr_debug("trying to find task 0x%p\n", task);
621 res = sas_scsi_find_task(task); 618 res = sas_scsi_find_task(task);
622 619
623 switch (res) { 620 switch (res) {
624 case TASK_IS_DONE: 621 case TASK_IS_DONE:
625 SAS_DPRINTK("%s: task 0x%p is done\n", __func__, 622 pr_notice("%s: task 0x%p is done\n", __func__,
626 task); 623 task);
627 sas_eh_finish_cmd(cmd); 624 sas_eh_finish_cmd(cmd);
628 continue; 625 continue;
629 case TASK_IS_ABORTED: 626 case TASK_IS_ABORTED:
630 SAS_DPRINTK("%s: task 0x%p is aborted\n", 627 pr_notice("%s: task 0x%p is aborted\n",
631 __func__, task); 628 __func__, task);
632 sas_eh_finish_cmd(cmd); 629 sas_eh_finish_cmd(cmd);
633 continue; 630 continue;
634 case TASK_IS_AT_LU: 631 case TASK_IS_AT_LU:
635 SAS_DPRINTK("task 0x%p is at LU: lu recover\n", task); 632 pr_info("task 0x%p is at LU: lu recover\n", task);
636 reset: 633 reset:
637 tmf_resp = sas_recover_lu(task->dev, cmd); 634 tmf_resp = sas_recover_lu(task->dev, cmd);
638 if (tmf_resp == TMF_RESP_FUNC_COMPLETE) { 635 if (tmf_resp == TMF_RESP_FUNC_COMPLETE) {
639 SAS_DPRINTK("dev %016llx LU %llx is " 636 pr_notice("dev %016llx LU %llx is recovered\n",
640 "recovered\n", 637 SAS_ADDR(task->dev),
641 SAS_ADDR(task->dev), 638 cmd->device->lun);
642 cmd->device->lun);
643 sas_eh_finish_cmd(cmd); 639 sas_eh_finish_cmd(cmd);
644 sas_scsi_clear_queue_lu(work_q, cmd); 640 sas_scsi_clear_queue_lu(work_q, cmd);
645 goto Again; 641 goto Again;
@@ -647,14 +643,14 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
647 /* fallthrough */ 643 /* fallthrough */
648 case TASK_IS_NOT_AT_LU: 644 case TASK_IS_NOT_AT_LU:
649 case TASK_ABORT_FAILED: 645 case TASK_ABORT_FAILED:
650 SAS_DPRINTK("task 0x%p is not at LU: I_T recover\n", 646 pr_notice("task 0x%p is not at LU: I_T recover\n",
651 task); 647 task);
652 tmf_resp = sas_recover_I_T(task->dev); 648 tmf_resp = sas_recover_I_T(task->dev);
653 if (tmf_resp == TMF_RESP_FUNC_COMPLETE || 649 if (tmf_resp == TMF_RESP_FUNC_COMPLETE ||
654 tmf_resp == -ENODEV) { 650 tmf_resp == -ENODEV) {
655 struct domain_device *dev = task->dev; 651 struct domain_device *dev = task->dev;
656 SAS_DPRINTK("I_T %016llx recovered\n", 652 pr_notice("I_T %016llx recovered\n",
657 SAS_ADDR(task->dev->sas_addr)); 653 SAS_ADDR(task->dev->sas_addr));
658 sas_eh_finish_cmd(cmd); 654 sas_eh_finish_cmd(cmd);
659 sas_scsi_clear_queue_I_T(work_q, dev); 655 sas_scsi_clear_queue_I_T(work_q, dev);
660 goto Again; 656 goto Again;
@@ -663,12 +659,12 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
663 try_to_reset_cmd_device(cmd); 659 try_to_reset_cmd_device(cmd);
664 if (i->dft->lldd_clear_nexus_port) { 660 if (i->dft->lldd_clear_nexus_port) {
665 struct asd_sas_port *port = task->dev->port; 661 struct asd_sas_port *port = task->dev->port;
666 SAS_DPRINTK("clearing nexus for port:%d\n", 662 pr_debug("clearing nexus for port:%d\n",
667 port->id); 663 port->id);
668 res = i->dft->lldd_clear_nexus_port(port); 664 res = i->dft->lldd_clear_nexus_port(port);
669 if (res == TMF_RESP_FUNC_COMPLETE) { 665 if (res == TMF_RESP_FUNC_COMPLETE) {
670 SAS_DPRINTK("clear nexus port:%d " 666 pr_notice("clear nexus port:%d succeeded\n",
671 "succeeded\n", port->id); 667 port->id);
672 sas_eh_finish_cmd(cmd); 668 sas_eh_finish_cmd(cmd);
673 sas_scsi_clear_queue_port(work_q, 669 sas_scsi_clear_queue_port(work_q,
674 port); 670 port);
@@ -676,11 +672,10 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
676 } 672 }
677 } 673 }
678 if (i->dft->lldd_clear_nexus_ha) { 674 if (i->dft->lldd_clear_nexus_ha) {
679 SAS_DPRINTK("clear nexus ha\n"); 675 pr_debug("clear nexus ha\n");
680 res = i->dft->lldd_clear_nexus_ha(ha); 676 res = i->dft->lldd_clear_nexus_ha(ha);
681 if (res == TMF_RESP_FUNC_COMPLETE) { 677 if (res == TMF_RESP_FUNC_COMPLETE) {
682 SAS_DPRINTK("clear nexus ha " 678 pr_notice("clear nexus ha succeeded\n");
683 "succeeded\n");
684 sas_eh_finish_cmd(cmd); 679 sas_eh_finish_cmd(cmd);
685 goto clear_q; 680 goto clear_q;
686 } 681 }
@@ -689,10 +684,9 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
689 * of effort could recover from errors. Quite 684 * of effort could recover from errors. Quite
690 * possibly the HA just disappeared. 685 * possibly the HA just disappeared.
691 */ 686 */
692 SAS_DPRINTK("error from device %llx, LUN %llx " 687 pr_err("error from device %llx, LUN %llx couldn't be recovered in any way\n",
693 "couldn't be recovered in any way\n", 688 SAS_ADDR(task->dev->sas_addr),
694 SAS_ADDR(task->dev->sas_addr), 689 cmd->device->lun);
695 cmd->device->lun);
696 690
697 sas_eh_finish_cmd(cmd); 691 sas_eh_finish_cmd(cmd);
698 goto clear_q; 692 goto clear_q;
@@ -704,7 +698,7 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
704 return; 698 return;
705 699
706 clear_q: 700 clear_q:
707 SAS_DPRINTK("--- Exit %s -- clear_q\n", __func__); 701 pr_debug("--- Exit %s -- clear_q\n", __func__);
708 list_for_each_entry_safe(cmd, n, work_q, eh_entry) 702 list_for_each_entry_safe(cmd, n, work_q, eh_entry)
709 sas_eh_finish_cmd(cmd); 703 sas_eh_finish_cmd(cmd);
710 goto out; 704 goto out;
@@ -758,8 +752,8 @@ retry:
758 list_splice_init(&shost->eh_cmd_q, &eh_work_q); 752 list_splice_init(&shost->eh_cmd_q, &eh_work_q);
759 spin_unlock_irq(shost->host_lock); 753 spin_unlock_irq(shost->host_lock);
760 754
761 SAS_DPRINTK("Enter %s busy: %d failed: %d\n", 755 pr_notice("Enter %s busy: %d failed: %d\n",
762 __func__, scsi_host_busy(shost), shost->host_failed); 756 __func__, scsi_host_busy(shost), shost->host_failed);
763 /* 757 /*
764 * Deal with commands that still have SAS tasks (i.e. they didn't 758 * Deal with commands that still have SAS tasks (i.e. they didn't
765 * complete via the normal sas_task completion mechanism), 759 * complete via the normal sas_task completion mechanism),
@@ -800,9 +794,9 @@ out:
800 if (retry) 794 if (retry)
801 goto retry; 795 goto retry;
802 796
803 SAS_DPRINTK("--- Exit %s: busy: %d failed: %d tries: %d\n", 797 pr_notice("--- Exit %s: busy: %d failed: %d tries: %d\n",
804 __func__, scsi_host_busy(shost), 798 __func__, scsi_host_busy(shost),
805 shost->host_failed, tries); 799 shost->host_failed, tries);
806} 800}
807 801
808int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) 802int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
@@ -875,9 +869,8 @@ int sas_slave_configure(struct scsi_device *scsi_dev)
875 if (scsi_dev->tagged_supported) { 869 if (scsi_dev->tagged_supported) {
876 scsi_change_queue_depth(scsi_dev, SAS_DEF_QD); 870 scsi_change_queue_depth(scsi_dev, SAS_DEF_QD);
877 } else { 871 } else {
878 SAS_DPRINTK("device %llx, LUN %llx doesn't support " 872 pr_notice("device %llx, LUN %llx doesn't support TCQ\n",
879 "TCQ\n", SAS_ADDR(dev->sas_addr), 873 SAS_ADDR(dev->sas_addr), scsi_dev->lun);
880 scsi_dev->lun);
881 scsi_change_queue_depth(scsi_dev, 1); 874 scsi_change_queue_depth(scsi_dev, 1);
882 } 875 }
883 876
diff --git a/drivers/scsi/libsas/sas_task.c b/drivers/scsi/libsas/sas_task.c
index d305c8f90ee9..c3b9befad4e6 100644
--- a/drivers/scsi/libsas/sas_task.c
+++ b/drivers/scsi/libsas/sas_task.c
@@ -26,11 +26,8 @@ void sas_ssp_task_response(struct device *dev, struct sas_task *task,
26 memcpy(tstat->buf, iu->sense_data, tstat->buf_valid_size); 26 memcpy(tstat->buf, iu->sense_data, tstat->buf_valid_size);
27 27
28 if (iu->status != SAM_STAT_CHECK_CONDITION) 28 if (iu->status != SAM_STAT_CHECK_CONDITION)
29 dev_printk(KERN_WARNING, dev, 29 dev_warn(dev, "dev %llx sent sense data, but stat(%x) is not CHECK CONDITION\n",
30 "dev %llx sent sense data, but " 30 SAS_ADDR(task->dev->sas_addr), iu->status);
31 "stat(%x) is not CHECK CONDITION\n",
32 SAS_ADDR(task->dev->sas_addr),
33 iu->status);
34 } 31 }
35 else 32 else
36 /* when datapres contains corrupt/unknown value... */ 33 /* when datapres contains corrupt/unknown value... */