[SCSI] bnx2i: link bnx2i hba and cnic device before registering the device

When bnx2/cnic/bnx2i drivers are loaded in certain order, bnx2i will
will not initialize the device correctly because 'hba->cnic' will be
NULL when bnx2i_start() is called from register_device() context.
Under this condition 'ifdown' and 'ifup' of associated network
interface is required to bring iscsi adapter state to ready state so
that it will accept iscsi connection setup within the chip

Initializing 'hba->cnic' before calling register_device() will fix
this issue

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Anil Veerabhadrappa <anilgv@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
Anil Veerabhadrappa 2010-03-25 10:54:42 -07:00 committed by James Bottomley
parent 2e15efc7e1
commit ce2d763a2c

View File

@ -278,6 +278,7 @@ static int bnx2i_init_one(struct bnx2i_hba *hba, struct cnic_dev *cnic)
int rc; int rc;
mutex_lock(&bnx2i_dev_lock); mutex_lock(&bnx2i_dev_lock);
hba->cnic = cnic;
rc = cnic->register_device(cnic, CNIC_ULP_ISCSI, hba); rc = cnic->register_device(cnic, CNIC_ULP_ISCSI, hba);
if (!rc) { if (!rc) {
hba->age++; hba->age++;
@ -324,8 +325,7 @@ void bnx2i_ulp_init(struct cnic_dev *dev)
if (bnx2i_init_one(hba, dev)) { if (bnx2i_init_one(hba, dev)) {
printk(KERN_ERR "bnx2i - hba %p init failed\n", hba); printk(KERN_ERR "bnx2i - hba %p init failed\n", hba);
bnx2i_free_hba(hba); bnx2i_free_hba(hba);
} else }
hba->cnic = dev;
} }