Skip to content

Commit e2813fc

Browse files
Karan Tilak Kumarmartinkpetersen
authored andcommitted
scsi: fnic: Replace shost_printk() with dev_info()/dev_err()
Sending host information to shost_printk() prior to host initialization in fnic is unnecessary. Replace shost_printk() and a printk() prior to this initialization with dev_info() and dev_err() accordingly. Reviewed-by: Sesidhar Baddela <[email protected]> Reviewed-by: Arulprabhu Ponnusamy <[email protected]> Reviewed-by: Gian Carlo Boffa <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Karan Tilak Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 40384c8 commit e2813fc

File tree

2 files changed

+51
-102
lines changed

2 files changed

+51
-102
lines changed

drivers/scsi/fnic/fnic_main.c

Lines changed: 28 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -344,25 +344,19 @@ void fnic_log_q_error(struct fnic *fnic)
344344
for (i = 0; i < fnic->raw_wq_count; i++) {
345345
error_status = ioread32(&fnic->wq[i].ctrl->error_status);
346346
if (error_status)
347-
shost_printk(KERN_ERR, fnic->lport->host,
348-
"WQ[%d] error_status"
349-
" %d\n", i, error_status);
347+
dev_err(&fnic->pdev->dev, "WQ[%d] error_status %d\n", i, error_status);
350348
}
351349

352350
for (i = 0; i < fnic->rq_count; i++) {
353351
error_status = ioread32(&fnic->rq[i].ctrl->error_status);
354352
if (error_status)
355-
shost_printk(KERN_ERR, fnic->lport->host,
356-
"RQ[%d] error_status"
357-
" %d\n", i, error_status);
353+
dev_err(&fnic->pdev->dev, "RQ[%d] error_status %d\n", i, error_status);
358354
}
359355

360356
for (i = 0; i < fnic->wq_copy_count; i++) {
361357
error_status = ioread32(&fnic->hw_copy_wq[i].ctrl->error_status);
362358
if (error_status)
363-
shost_printk(KERN_ERR, fnic->lport->host,
364-
"CWQ[%d] error_status"
365-
" %d\n", i, error_status);
359+
dev_err(&fnic->pdev->dev, "CWQ[%d] error_status %d\n", i, error_status);
366360
}
367361
}
368362

@@ -396,8 +390,7 @@ static int fnic_notify_set(struct fnic *fnic)
396390
err = vnic_dev_notify_set(fnic->vdev, fnic->wq_copy_count + fnic->copy_wq_base);
397391
break;
398392
default:
399-
shost_printk(KERN_ERR, fnic->lport->host,
400-
"Interrupt mode should be set up"
393+
dev_err(&fnic->pdev->dev, "Interrupt mode should be set up"
401394
" before devcmd notify set %d\n",
402395
vnic_dev_get_intr_mode(fnic->vdev));
403396
err = -1;
@@ -567,12 +560,10 @@ static int fnic_scsi_drv_init(struct fnic *fnic)
567560

568561
host->nr_hw_queues = fnic->wq_copy_count;
569562

570-
shost_printk(KERN_INFO, host,
571-
"fnic: can_queue: %d max_lun: %llu",
563+
dev_info(&fnic->pdev->dev, "fnic: can_queue: %d max_lun: %llu",
572564
host->can_queue, host->max_lun);
573565

574-
shost_printk(KERN_INFO, host,
575-
"fnic: max_id: %d max_cmd_len: %d nr_hw_queues: %d",
566+
dev_info(&fnic->pdev->dev, "fnic: max_id: %d max_cmd_len: %d nr_hw_queues: %d",
576567
host->max_id, host->max_cmd_len, host->nr_hw_queues);
577568

578569
return 0;
@@ -622,7 +613,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
622613
*/
623614
lp = libfc_host_alloc(&fnic_host_template, sizeof(struct fnic));
624615
if (!lp) {
625-
printk(KERN_ERR PFX "Unable to alloc libfc local port\n");
616+
dev_err(&pdev->dev, "Unable to alloc libfc local port\n");
626617
err = -ENOMEM;
627618
goto err_out;
628619
}
@@ -632,7 +623,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
632623

633624
fnic_id = ida_alloc(&fnic_ida, GFP_KERNEL);
634625
if (fnic_id < 0) {
635-
pr_err("Unable to alloc fnic ID\n");
626+
dev_err(&pdev->dev, "Unable to alloc fnic ID\n");
636627
err = fnic_id;
637628
goto err_out_ida_alloc;
638629
}
@@ -650,15 +641,13 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
650641

651642
err = pci_enable_device(pdev);
652643
if (err) {
653-
shost_printk(KERN_ERR, fnic->lport->host,
654-
"Cannot enable PCI device, aborting.\n");
644+
dev_err(&fnic->pdev->dev, "Cannot enable PCI device, aborting.\n");
655645
goto err_out_free_hba;
656646
}
657647

658648
err = pci_request_regions(pdev, DRV_NAME);
659649
if (err) {
660-
shost_printk(KERN_ERR, fnic->lport->host,
661-
"Cannot enable PCI resources, aborting\n");
650+
dev_err(&fnic->pdev->dev, "Cannot enable PCI resources, aborting\n");
662651
goto err_out_disable_device;
663652
}
664653

@@ -672,17 +661,15 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
672661
if (err) {
673662
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
674663
if (err) {
675-
shost_printk(KERN_ERR, fnic->lport->host,
676-
"No usable DMA configuration "
664+
dev_err(&fnic->pdev->dev, "No usable DMA configuration "
677665
"aborting\n");
678666
goto err_out_release_regions;
679667
}
680668
}
681669

682670
/* Map vNIC resources from BAR0 */
683671
if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
684-
shost_printk(KERN_ERR, fnic->lport->host,
685-
"BAR0 not memory-map'able, aborting.\n");
672+
dev_err(&fnic->pdev->dev, "BAR0 not memory-map'able, aborting.\n");
686673
err = -ENODEV;
687674
goto err_out_release_regions;
688675
}
@@ -692,49 +679,43 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
692679
fnic->bar0.len = pci_resource_len(pdev, 0);
693680

694681
if (!fnic->bar0.vaddr) {
695-
shost_printk(KERN_ERR, fnic->lport->host,
696-
"Cannot memory-map BAR0 res hdr, "
682+
dev_err(&fnic->pdev->dev, "Cannot memory-map BAR0 res hdr, "
697683
"aborting.\n");
698684
err = -ENODEV;
699685
goto err_out_release_regions;
700686
}
701687

702688
fnic->vdev = vnic_dev_register(NULL, fnic, pdev, &fnic->bar0);
703689
if (!fnic->vdev) {
704-
shost_printk(KERN_ERR, fnic->lport->host,
705-
"vNIC registration failed, "
690+
dev_err(&fnic->pdev->dev, "vNIC registration failed, "
706691
"aborting.\n");
707692
err = -ENODEV;
708693
goto err_out_iounmap;
709694
}
710695

711696
err = vnic_dev_cmd_init(fnic->vdev);
712697
if (err) {
713-
shost_printk(KERN_ERR, fnic->lport->host,
714-
"vnic_dev_cmd_init() returns %d, aborting\n",
698+
dev_err(&fnic->pdev->dev, "vnic_dev_cmd_init() returns %d, aborting\n",
715699
err);
716700
goto err_out_vnic_unregister;
717701
}
718702

719703
err = fnic_dev_wait(fnic->vdev, vnic_dev_open,
720704
vnic_dev_open_done, CMD_OPENF_RQ_ENABLE_THEN_POST);
721705
if (err) {
722-
shost_printk(KERN_ERR, fnic->lport->host,
723-
"vNIC dev open failed, aborting.\n");
706+
dev_err(&fnic->pdev->dev, "vNIC dev open failed, aborting.\n");
724707
goto err_out_dev_cmd_deinit;
725708
}
726709

727710
err = vnic_dev_init(fnic->vdev, 0);
728711
if (err) {
729-
shost_printk(KERN_ERR, fnic->lport->host,
730-
"vNIC dev init failed, aborting.\n");
712+
dev_err(&fnic->pdev->dev, "vNIC dev init failed, aborting.\n");
731713
goto err_out_dev_close;
732714
}
733715

734716
err = vnic_dev_mac_addr(fnic->vdev, fnic->ctlr.ctl_src_addr);
735717
if (err) {
736-
shost_printk(KERN_ERR, fnic->lport->host,
737-
"vNIC get MAC addr failed \n");
718+
dev_err(&fnic->pdev->dev, "vNIC get MAC addr failed\n");
738719
goto err_out_dev_close;
739720
}
740721
/* set data_src for point-to-point mode and to keep it non-zero */
@@ -743,8 +724,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
743724
/* Get vNIC configuration */
744725
err = fnic_get_vnic_config(fnic);
745726
if (err) {
746-
shost_printk(KERN_ERR, fnic->lport->host,
747-
"Get vNIC configuration failed, "
727+
dev_err(&fnic->pdev->dev, "Get vNIC configuration failed, "
748728
"aborting.\n");
749729
goto err_out_dev_close;
750730
}
@@ -756,16 +736,14 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
756736

757737
err = fnic_set_intr_mode(fnic);
758738
if (err) {
759-
shost_printk(KERN_ERR, fnic->lport->host,
760-
"Failed to set intr mode, "
739+
dev_err(&fnic->pdev->dev, "Failed to set intr mode, "
761740
"aborting.\n");
762741
goto err_out_dev_close;
763742
}
764743

765744
err = fnic_alloc_vnic_resources(fnic);
766745
if (err) {
767-
shost_printk(KERN_ERR, fnic->lport->host,
768-
"Failed to alloc vNIC resources, "
746+
dev_err(&fnic->pdev->dev, "Failed to alloc vNIC resources, "
769747
"aborting.\n");
770748
goto err_out_clear_intr;
771749
}
@@ -778,7 +756,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
778756
kzalloc((fnic->sw_copy_wq[hwq].ioreq_table_size + 1) *
779757
sizeof(struct fnic_io_req *), GFP_KERNEL);
780758
}
781-
shost_printk(KERN_INFO, fnic->lport->host, "fnic copy wqs: %d, Q0 ioreq table size: %d\n",
759+
dev_info(&fnic->pdev->dev, "fnic copy wqs: %d, Q0 ioreq table size: %d\n",
782760
fnic->wq_copy_count, fnic->sw_copy_wq[0].ioreq_table_size);
783761

784762
/* initialize all fnic locks */
@@ -818,8 +796,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
818796
fnic->ctlr.update_mac = fnic_update_mac;
819797
fnic->ctlr.get_src_addr = fnic_get_mac;
820798
if (fnic->config.flags & VFCF_FIP_CAPABLE) {
821-
shost_printk(KERN_INFO, fnic->lport->host,
822-
"firmware supports FIP\n");
799+
dev_info(&fnic->pdev->dev, "firmware supports FIP\n");
823800
/* enable directed and multicast */
824801
vnic_dev_packet_filter(fnic->vdev, 1, 1, 0, 0, 0);
825802
vnic_dev_add_addr(fnic->vdev, FIP_ALL_ENODE_MACS);
@@ -834,8 +811,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
834811
INIT_LIST_HEAD(&fnic->evlist);
835812
INIT_LIST_HEAD(&fnic->vlans);
836813
} else {
837-
shost_printk(KERN_INFO, fnic->lport->host,
838-
"firmware uses non-FIP mode\n");
814+
dev_info(&fnic->pdev->dev, "firmware uses non-FIP mode\n");
839815
fcoe_ctlr_init(&fnic->ctlr, FIP_MODE_NON_FIP);
840816
fnic->ctlr.state = FIP_ST_NON_FIP;
841817
}
@@ -850,8 +826,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
850826
/* Setup notification buffer area */
851827
err = fnic_notify_set(fnic);
852828
if (err) {
853-
shost_printk(KERN_ERR, fnic->lport->host,
854-
"Failed to alloc notify buffer, aborting.\n");
829+
dev_err(&fnic->pdev->dev, "Failed to alloc notify buffer, aborting.\n");
855830
goto err_out_free_max_pool;
856831
}
857832

@@ -863,8 +838,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
863838
for (i = 0; i < fnic->rq_count; i++) {
864839
err = vnic_rq_fill(&fnic->rq[i], fnic_alloc_rq_frame);
865840
if (err) {
866-
shost_printk(KERN_ERR, fnic->lport->host,
867-
"fnic_alloc_rq_frame can't alloc "
841+
dev_err(&fnic->pdev->dev, "fnic_alloc_rq_frame can't alloc "
868842
"frame\n");
869843
goto err_out_rq_buf;
870844
}
@@ -882,8 +856,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
882856

883857
err = fnic_request_intr(fnic);
884858
if (err) {
885-
shost_printk(KERN_ERR, fnic->lport->host,
886-
"Unable to request irq.\n");
859+
dev_err(&fnic->pdev->dev, "Unable to request irq.\n");
887860
goto err_out_request_intr;
888861
}
889862

@@ -893,8 +866,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
893866
*/
894867
err = scsi_add_host(lp->host, &pdev->dev);
895868
if (err) {
896-
shost_printk(KERN_ERR, fnic->lport->host,
897-
"fnic: scsi_add_host failed...exiting\n");
869+
dev_err(&fnic->pdev->dev, "fnic: scsi_add_host failed...exiting\n");
898870
goto err_out_scsi_add_host;
899871
}
900872

drivers/scsi/fnic/fnic_res.c

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ int fnic_get_vnic_config(struct fnic *fnic)
3030
offsetof(struct vnic_fc_config, m), \
3131
sizeof(c->m), &c->m); \
3232
if (err) { \
33-
shost_printk(KERN_ERR, fnic->lport->host, \
34-
"Error getting %s, %d\n", #m, \
35-
err); \
33+
dev_err(&fnic->pdev->dev, "Error getting %s, %d\n", #m, err); \
3634
return err; \
3735
} \
3836
} while (0);
@@ -139,40 +137,29 @@ int fnic_get_vnic_config(struct fnic *fnic)
139137

140138
c->wq_copy_count = min_t(u16, FNIC_WQ_COPY_MAX, c->wq_copy_count);
141139

142-
shost_printk(KERN_INFO, fnic->lport->host,
143-
"vNIC MAC addr %pM "
140+
dev_info(&fnic->pdev->dev, "vNIC MAC addr %pM "
144141
"wq/wq_copy/rq %d/%d/%d\n",
145142
fnic->ctlr.ctl_src_addr,
146143
c->wq_enet_desc_count, c->wq_copy_desc_count,
147144
c->rq_desc_count);
148-
shost_printk(KERN_INFO, fnic->lport->host,
149-
"vNIC node wwn %llx port wwn %llx\n",
145+
dev_info(&fnic->pdev->dev, "vNIC node wwn %llx port wwn %llx\n",
150146
c->node_wwn, c->port_wwn);
151-
shost_printk(KERN_INFO, fnic->lport->host,
152-
"vNIC ed_tov %d ra_tov %d\n",
147+
dev_info(&fnic->pdev->dev, "vNIC ed_tov %d ra_tov %d\n",
153148
c->ed_tov, c->ra_tov);
154-
shost_printk(KERN_INFO, fnic->lport->host,
155-
"vNIC mtu %d intr timer %d\n",
149+
dev_info(&fnic->pdev->dev, "vNIC mtu %d intr timer %d\n",
156150
c->maxdatafieldsize, c->intr_timer);
157-
shost_printk(KERN_INFO, fnic->lport->host,
158-
"vNIC flags 0x%x luns per tgt %d\n",
151+
dev_info(&fnic->pdev->dev, "vNIC flags 0x%x luns per tgt %d\n",
159152
c->flags, c->luns_per_tgt);
160-
shost_printk(KERN_INFO, fnic->lport->host,
161-
"vNIC flogi_retries %d flogi timeout %d\n",
153+
dev_info(&fnic->pdev->dev, "vNIC flogi_retries %d flogi timeout %d\n",
162154
c->flogi_retries, c->flogi_timeout);
163-
shost_printk(KERN_INFO, fnic->lport->host,
164-
"vNIC plogi retries %d plogi timeout %d\n",
155+
dev_info(&fnic->pdev->dev, "vNIC plogi retries %d plogi timeout %d\n",
165156
c->plogi_retries, c->plogi_timeout);
166-
shost_printk(KERN_INFO, fnic->lport->host,
167-
"vNIC io throttle count %d link dn timeout %d\n",
157+
dev_info(&fnic->pdev->dev, "vNIC io throttle count %d link dn timeout %d\n",
168158
c->io_throttle_count, c->link_down_timeout);
169-
shost_printk(KERN_INFO, fnic->lport->host,
170-
"vNIC port dn io retries %d port dn timeout %d\n",
159+
dev_info(&fnic->pdev->dev, "vNIC port dn io retries %d port dn timeout %d\n",
171160
c->port_down_io_retries, c->port_down_timeout);
172-
shost_printk(KERN_INFO, fnic->lport->host,
173-
"vNIC wq_copy_count: %d\n", c->wq_copy_count);
174-
shost_printk(KERN_INFO, fnic->lport->host,
175-
"vNIC intr mode: %d\n", c->intr_mode);
161+
dev_info(&fnic->pdev->dev, "vNIC wq_copy_count: %d\n", c->wq_copy_count);
162+
dev_info(&fnic->pdev->dev, "vNIC intr mode: %d\n", c->intr_mode);
176163

177164
return 0;
178165
}
@@ -206,18 +193,12 @@ void fnic_get_res_counts(struct fnic *fnic)
206193
fnic->intr_count = vnic_dev_get_res_count(fnic->vdev,
207194
RES_TYPE_INTR_CTRL);
208195

209-
shost_printk(KERN_INFO, fnic->lport->host,
210-
"vNIC fw resources wq_count: %d\n", fnic->wq_count);
211-
shost_printk(KERN_INFO, fnic->lport->host,
212-
"vNIC fw resources raw_wq_count: %d\n", fnic->raw_wq_count);
213-
shost_printk(KERN_INFO, fnic->lport->host,
214-
"vNIC fw resources wq_copy_count: %d\n", fnic->wq_copy_count);
215-
shost_printk(KERN_INFO, fnic->lport->host,
216-
"vNIC fw resources rq_count: %d\n", fnic->rq_count);
217-
shost_printk(KERN_INFO, fnic->lport->host,
218-
"vNIC fw resources cq_count: %d\n", fnic->cq_count);
219-
shost_printk(KERN_INFO, fnic->lport->host,
220-
"vNIC fw resources intr_count: %d\n", fnic->intr_count);
196+
dev_info(&fnic->pdev->dev, "vNIC fw resources wq_count: %d\n", fnic->wq_count);
197+
dev_info(&fnic->pdev->dev, "vNIC fw resources raw_wq_count: %d\n", fnic->raw_wq_count);
198+
dev_info(&fnic->pdev->dev, "vNIC fw resources wq_copy_count: %d\n", fnic->wq_copy_count);
199+
dev_info(&fnic->pdev->dev, "vNIC fw resources rq_count: %d\n", fnic->rq_count);
200+
dev_info(&fnic->pdev->dev, "vNIC fw resources cq_count: %d\n", fnic->cq_count);
201+
dev_info(&fnic->pdev->dev, "vNIC fw resources intr_count: %d\n", fnic->intr_count);
221202
}
222203

223204
void fnic_free_vnic_resources(struct fnic *fnic)
@@ -253,19 +234,17 @@ int fnic_alloc_vnic_resources(struct fnic *fnic)
253234

254235
intr_mode = vnic_dev_get_intr_mode(fnic->vdev);
255236

256-
shost_printk(KERN_INFO, fnic->lport->host, "vNIC interrupt mode: %s\n",
237+
dev_info(&fnic->pdev->dev, "vNIC interrupt mode: %s\n",
257238
intr_mode == VNIC_DEV_INTR_MODE_INTX ? "legacy PCI INTx" :
258239
intr_mode == VNIC_DEV_INTR_MODE_MSI ? "MSI" :
259240
intr_mode == VNIC_DEV_INTR_MODE_MSIX ?
260241
"MSI-X" : "unknown");
261242

262-
shost_printk(KERN_INFO, fnic->lport->host,
263-
"vNIC resources avail: wq %d cp_wq %d raw_wq %d rq %d",
243+
dev_info(&fnic->pdev->dev, "res avail: wq %d cp_wq %d raw_wq %d rq %d",
264244
fnic->wq_count, fnic->wq_copy_count,
265245
fnic->raw_wq_count, fnic->rq_count);
266246

267-
shost_printk(KERN_INFO, fnic->lport->host,
268-
"vNIC resources avail: cq %d intr %d cpy-wq desc count %d\n",
247+
dev_info(&fnic->pdev->dev, "res avail: cq %d intr %d cpy-wq desc count %d\n",
269248
fnic->cq_count, fnic->intr_count,
270249
fnic->config.wq_copy_desc_count);
271250

@@ -340,8 +319,7 @@ int fnic_alloc_vnic_resources(struct fnic *fnic)
340319
RES_TYPE_INTR_PBA_LEGACY, 0);
341320

342321
if (!fnic->legacy_pba && intr_mode == VNIC_DEV_INTR_MODE_INTX) {
343-
shost_printk(KERN_ERR, fnic->lport->host,
344-
"Failed to hook legacy pba resource\n");
322+
dev_err(&fnic->pdev->dev, "Failed to hook legacy pba resource\n");
345323
err = -ENODEV;
346324
goto err_out_cleanup;
347325
}
@@ -444,8 +422,7 @@ int fnic_alloc_vnic_resources(struct fnic *fnic)
444422
/* init the stats memory by making the first call here */
445423
err = vnic_dev_stats_dump(fnic->vdev, &fnic->stats);
446424
if (err) {
447-
shost_printk(KERN_ERR, fnic->lport->host,
448-
"vnic_dev_stats_dump failed - x%x\n", err);
425+
dev_err(&fnic->pdev->dev, "vnic_dev_stats_dump failed - x%x\n", err);
449426
goto err_out_cleanup;
450427
}
451428

0 commit comments

Comments
 (0)