diff options
author | Vasu Dev <vasu.dev@intel.com> | 2009-03-17 14:42:29 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-04-03 10:23:07 -0400 |
commit | a0a25da2a495a889664dc946942b8666665cd1e1 (patch) | |
tree | f3ac1dd6adb76490afa828298e71992ba5045d8f /drivers | |
parent | fdd78027fd472351783fb6110a72d991c1a07402 (diff) |
[SCSI] fcoe, libfc: fix double fcoe_softc memory alloc
The foce_softc mem was reserved by libfc_host_alloc as well as
by fcoe_host_alloc.
Removes one liner fcoe_host_alloc completely, instead directly calls
libfc_host_alloc to alloc scsi_host with libfc for just one fcoe_softc
as fcoe private data.
Moves libfc_host_alloc to libfc.h since it is a libfc API, placed
lport_priv API adjacent to libfc_host_alloc since this is related
to scsi_host priv data.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 30161a26387a..d5f009ad0388 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -70,8 +70,6 @@ static struct fc_lport *fcoe_hostlist_lookup(const struct net_device *); | |||
70 | static int fcoe_hostlist_add(const struct fc_lport *); | 70 | static int fcoe_hostlist_add(const struct fc_lport *); |
71 | static int fcoe_hostlist_remove(const struct fc_lport *); | 71 | static int fcoe_hostlist_remove(const struct fc_lport *); |
72 | 72 | ||
73 | static struct Scsi_Host *fcoe_host_alloc(struct scsi_host_template *, int); | ||
74 | |||
75 | static int fcoe_check_wait_queue(struct fc_lport *); | 73 | static int fcoe_check_wait_queue(struct fc_lport *); |
76 | static void fcoe_recv_flogi(struct fcoe_softc *, struct fc_frame *, u8 *); | 74 | static void fcoe_recv_flogi(struct fcoe_softc *, struct fc_frame *, u8 *); |
77 | static int fcoe_device_notification(struct notifier_block *, ulong, void *); | 75 | static int fcoe_device_notification(struct notifier_block *, ulong, void *); |
@@ -464,8 +462,8 @@ static int fcoe_if_create(struct net_device *netdev) | |||
464 | if (lp) | 462 | if (lp) |
465 | return -EEXIST; | 463 | return -EEXIST; |
466 | 464 | ||
467 | shost = fcoe_host_alloc(&fcoe_shost_template, | 465 | shost = libfc_host_alloc(&fcoe_shost_template, |
468 | sizeof(struct fcoe_softc)); | 466 | sizeof(struct fcoe_softc)); |
469 | if (!shost) { | 467 | if (!shost) { |
470 | FC_DBG("Could not allocate host structure\n"); | 468 | FC_DBG("Could not allocate host structure\n"); |
471 | return -ENOMEM; | 469 | return -ENOMEM; |
@@ -1716,33 +1714,6 @@ void fcoe_clean_pending_queue(struct fc_lport *lp) | |||
1716 | EXPORT_SYMBOL_GPL(fcoe_clean_pending_queue); | 1714 | EXPORT_SYMBOL_GPL(fcoe_clean_pending_queue); |
1717 | 1715 | ||
1718 | /** | 1716 | /** |
1719 | * libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport | ||
1720 | * @sht: ptr to the scsi host templ | ||
1721 | * @priv_size: size of private data after fc_lport | ||
1722 | * | ||
1723 | * Returns: ptr to Scsi_Host | ||
1724 | * TODO: to libfc? | ||
1725 | */ | ||
1726 | static inline struct Scsi_Host * | ||
1727 | libfc_host_alloc(struct scsi_host_template *sht, int priv_size) | ||
1728 | { | ||
1729 | return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size); | ||
1730 | } | ||
1731 | |||
1732 | /** | ||
1733 | * fcoe_host_alloc() - Allocate a Scsi_Host with room for the fcoe_softc | ||
1734 | * @sht: ptr to the scsi host templ | ||
1735 | * @priv_size: size of private data after fc_lport | ||
1736 | * | ||
1737 | * Returns: ptr to Scsi_Host | ||
1738 | */ | ||
1739 | struct Scsi_Host *fcoe_host_alloc(struct scsi_host_template *sht, int priv_size) | ||
1740 | { | ||
1741 | return libfc_host_alloc(sht, sizeof(struct fcoe_softc) + priv_size); | ||
1742 | } | ||
1743 | EXPORT_SYMBOL_GPL(fcoe_host_alloc); | ||
1744 | |||
1745 | /** | ||
1746 | * fcoe_reset() - Resets the fcoe | 1717 | * fcoe_reset() - Resets the fcoe |
1747 | * @shost: shost the reset is from | 1718 | * @shost: shost the reset is from |
1748 | * | 1719 | * |