aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/fcoe/fcoe.c8
-rw-r--r--drivers/scsi/fnic/fnic_main.c10
-rw-r--r--drivers/scsi/libfc/fc_lport.c1
-rw-r--r--include/scsi/libfc.h15
4 files changed, 19 insertions, 15 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 4efbc17a7d7f..8ca488de492d 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -515,8 +515,6 @@ static int fcoe_shost_config(struct fc_lport *lp, struct Scsi_Host *shost,
515 int rc = 0; 515 int rc = 0;
516 516
517 /* lport scsi host config */ 517 /* lport scsi host config */
518 lp->host = shost;
519
520 lp->host->max_lun = FCOE_MAX_LUN; 518 lp->host->max_lun = FCOE_MAX_LUN;
521 lp->host->max_id = FCOE_MAX_FCP_TARGET; 519 lp->host->max_id = FCOE_MAX_FCP_TARGET;
522 lp->host->max_channel = 0; 520 lp->host->max_channel = 0;
@@ -734,14 +732,14 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe,
734 732
735 FCOE_NETDEV_DBG(netdev, "Create Interface\n"); 733 FCOE_NETDEV_DBG(netdev, "Create Interface\n");
736 734
737 shost = libfc_host_alloc(&fcoe_shost_template, 735 lport = libfc_host_alloc(&fcoe_shost_template,
738 sizeof(struct fcoe_port)); 736 sizeof(struct fcoe_port));
739 if (!shost) { 737 if (!lport) {
740 FCOE_NETDEV_DBG(netdev, "Could not allocate host structure\n"); 738 FCOE_NETDEV_DBG(netdev, "Could not allocate host structure\n");
741 rc = -ENOMEM; 739 rc = -ENOMEM;
742 goto out; 740 goto out;
743 } 741 }
744 lport = shost_priv(shost); 742 shost = lport->host;
745 port = lport_priv(lport); 743 port = lport_priv(lport);
746 port->lport = lport; 744 port->lport = lport;
747 port->fcoe = fcoe; 745 port->fcoe = fcoe;
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index fc61f17025ce..018cc427504a 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -424,15 +424,13 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
424 * Allocate SCSI Host and set up association between host, 424 * Allocate SCSI Host and set up association between host,
425 * local port, and fnic 425 * local port, and fnic
426 */ 426 */
427 host = scsi_host_alloc(&fnic_host_template, 427 lp = libfc_host_alloc(&fnic_host_template, sizeof(struct fnic));
428 sizeof(struct fc_lport) + sizeof(struct fnic)); 428 if (!lp) {
429 if (!host) { 429 printk(KERN_ERR PFX "Unable to alloc libfc local port\n");
430 printk(KERN_ERR PFX "Unable to alloc SCSI host\n");
431 err = -ENOMEM; 430 err = -ENOMEM;
432 goto err_out; 431 goto err_out;
433 } 432 }
434 lp = shost_priv(host); 433 host = lp->host;
435 lp->host = host;
436 fnic = lport_priv(lp); 434 fnic = lport_priv(lp);
437 fnic->lport = lp; 435 fnic->lport = lp;
438 436
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index f7f20a46e494..41650d336289 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1505,7 +1505,6 @@ int fc_lport_init(struct fc_lport *lport)
1505 if (lport->link_supported_speeds & FC_PORTSPEED_10GBIT) 1505 if (lport->link_supported_speeds & FC_PORTSPEED_10GBIT)
1506 fc_host_supported_speeds(lport->host) |= FC_PORTSPEED_10GBIT; 1506 fc_host_supported_speeds(lport->host) |= FC_PORTSPEED_10GBIT;
1507 1507
1508 INIT_LIST_HEAD(&lport->ema_list);
1509 return 0; 1508 return 0;
1510} 1509}
1511EXPORT_SYMBOL(fc_lport_init); 1510EXPORT_SYMBOL(fc_lport_init);
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 690f8296e633..ed3057b4e78d 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -739,12 +739,21 @@ static inline void *lport_priv(const struct fc_lport *lp)
739 * @sht: ptr to the scsi host templ 739 * @sht: ptr to the scsi host templ
740 * @priv_size: size of private data after fc_lport 740 * @priv_size: size of private data after fc_lport
741 * 741 *
742 * Returns: ptr to Scsi_Host 742 * Returns: libfc lport
743 */ 743 */
744static inline struct Scsi_Host * 744static inline struct fc_lport *
745libfc_host_alloc(struct scsi_host_template *sht, int priv_size) 745libfc_host_alloc(struct scsi_host_template *sht, int priv_size)
746{ 746{
747 return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size); 747 struct fc_lport *lport;
748 struct Scsi_Host *shost;
749
750 shost = scsi_host_alloc(sht, sizeof(*lport) + priv_size);
751 if (!shost)
752 return NULL;
753 lport = shost_priv(shost);
754 lport->host = shost;
755 INIT_LIST_HEAD(&lport->ema_list);
756 return lport;
748} 757}
749 758
750/* 759/*