]> Pileus Git - ~andy/linux/commitdiff
[SCSI] bfa: New interface to handle firmware upgrade scenario
authorKrishna Gudipati <kgudipat@brocade.com>
Thu, 4 Mar 2010 01:43:30 +0000 (17:43 -0800)
committerJames Bottomley <James.Bottomley@suse.de>
Thu, 4 Mar 2010 10:44:10 +0000 (16:14 +0530)
Split bfa_fcs_init() into bfa_fcs_attach() and bfa_fcs_init().

Removed empty function definitions in FCS modules

Modified driver to call bfa_fcs_attach() and bfa_fcs_init() as needed.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
15 files changed:
drivers/scsi/bfa/bfa_fcs.c
drivers/scsi/bfa/bfa_fcs_port.c
drivers/scsi/bfa/bfa_fcs_uf.c
drivers/scsi/bfa/bfad.c
drivers/scsi/bfa/fabric.c
drivers/scsi/bfa/fcpim.c
drivers/scsi/bfa/fcs_fabric.h
drivers/scsi/bfa/fcs_fcpim.h
drivers/scsi/bfa/fcs_port.h
drivers/scsi/bfa/fcs_rport.h
drivers/scsi/bfa/fcs_uf.h
drivers/scsi/bfa/fcs_vport.h
drivers/scsi/bfa/include/fcs/bfa_fcs.h
drivers/scsi/bfa/rport.c
drivers/scsi/bfa/vport.c

index 50120c285fff2f78df280a0dd80e18edf703bc57..3516172c597c9f43633df2459bdfdd472589c72a 100644 (file)
@@ -36,6 +36,7 @@
  * FCS sub-modules
  */
 struct bfa_fcs_mod_s {
+       void            (*attach) (struct bfa_fcs_s *fcs);
        void            (*modinit) (struct bfa_fcs_s *fcs);
        void            (*modexit) (struct bfa_fcs_s *fcs);
 };
@@ -43,12 +44,10 @@ struct bfa_fcs_mod_s {
 #define BFA_FCS_MODULE(_mod) { _mod ## _modinit, _mod ## _modexit }
 
 static struct bfa_fcs_mod_s fcs_modules[] = {
-       BFA_FCS_MODULE(bfa_fcs_pport),
-       BFA_FCS_MODULE(bfa_fcs_uf),
-       BFA_FCS_MODULE(bfa_fcs_fabric),
-       BFA_FCS_MODULE(bfa_fcs_vport),
-       BFA_FCS_MODULE(bfa_fcs_rport),
-       BFA_FCS_MODULE(bfa_fcs_fcpim),
+       { bfa_fcs_pport_attach, NULL, NULL },
+       { bfa_fcs_uf_attach, NULL, NULL },
+       { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit,
+        bfa_fcs_fabric_modexit },
 };
 
 /**
@@ -71,16 +70,10 @@ bfa_fcs_exit_comp(void *fcs_cbarg)
  */
 
 /**
- *             FCS instance initialization.
- *
- *     param[in]               fcs             FCS instance
- *     param[in]               bfa             BFA instance
- *     param[in]               bfad            BFA driver instance
- *
- *     return None
+ * fcs attach -- called once to initialize data structures at driver attach time
  */
 void
-bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
+bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
                        bfa_boolean_t min_cfg)
 {
        int             i;
@@ -95,7 +88,24 @@ bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
 
        for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
                mod = &fcs_modules[i];
-               mod->modinit(fcs);
+               if (mod->attach)
+                       mod->attach(fcs);
+       }
+}
+
+/**
+ * fcs initialization, called once after bfa initialization is complete
+ */
+void
+bfa_fcs_init(struct bfa_fcs_s *fcs)
+{
+       int             i;
+       struct bfa_fcs_mod_s  *mod;
+
+       for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
+               mod = &fcs_modules[i];
+               if (mod->modinit)
+                       mod->modinit(fcs);
        }
 }
 
@@ -160,10 +170,12 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs)
        nmods = sizeof(fcs_modules) / sizeof(fcs_modules[0]);
 
        for (i = 0; i < nmods; i++) {
-               bfa_wc_up(&fcs->wc);
 
                mod = &fcs_modules[i];
-               mod->modexit(fcs);
+               if (mod->modexit) {
+                       bfa_wc_up(&fcs->wc);
+                       mod->modexit(fcs);
+               }
        }
 
        bfa_wc_wait(&fcs->wc);
index 9c4b24e62de1427ff4ed38afd7d27ee8eda153f9..53808d0418a10ac08ae3190a799209ce6273fb11 100644 (file)
@@ -55,14 +55,7 @@ bfa_fcs_pport_event_handler(void *cbarg, bfa_pport_event_t event)
 }
 
 void
-bfa_fcs_pport_modinit(struct bfa_fcs_s *fcs)
+bfa_fcs_pport_attach(struct bfa_fcs_s *fcs)
 {
-       bfa_pport_event_register(fcs->bfa, bfa_fcs_pport_event_handler,
-                                    fcs);
-}
-
-void
-bfa_fcs_pport_modexit(struct bfa_fcs_s *fcs)
-{
-       bfa_fcs_modexit_comp(fcs);
+       bfa_pport_event_register(fcs->bfa, bfa_fcs_pport_event_handler, fcs);
 }
index ad01db6444b2031e98e86c898776ae70e2d65bde..3d57d48bbae4ee0123f3603a7b1ff4a297112e75 100644 (file)
@@ -93,13 +93,7 @@ bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf)
 }
 
 void
-bfa_fcs_uf_modinit(struct bfa_fcs_s *fcs)
+bfa_fcs_uf_attach(struct bfa_fcs_s *fcs)
 {
        bfa_uf_recv_register(fcs->bfa, bfa_fcs_uf_recv, fcs);
 }
-
-void
-bfa_fcs_uf_modexit(struct bfa_fcs_s *fcs)
-{
-       bfa_fcs_modexit_comp(fcs);
-}
index 8e2b2a26cb74ece1cb91256e8b5bc6ad21446be1..965dfb575e5abc65b2ee1034206226b71c2bcef1 100644 (file)
@@ -748,7 +748,8 @@ bfad_drv_init(struct bfad_s *bfad)
        bfa_fcs_log_init(&bfad->bfa_fcs, bfad->logmod);
        bfa_fcs_trc_init(&bfad->bfa_fcs, bfad->trcmod);
        bfa_fcs_aen_init(&bfad->bfa_fcs, bfad->aen);
-       bfa_fcs_init(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE);
+       bfa_fcs_attach(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE);
+       bfa_fcs_init(&bfad->bfa_fcs);
        bfa_fcs_driver_info_init(&bfad->bfa_fcs, &driver_info);
        bfa_fcs_set_fdmi_param(&bfad->bfa_fcs, fdmi_enable);
        spin_unlock_irqrestore(&bfad->bfad_lock, flags);
index a4b5dd449573c38a490381a8143d703bededde39..e229898866464153bc344417e5ef0a5d58ecab41 100644 (file)
@@ -814,10 +814,10 @@ bfa_fcs_fabric_delete_comp(void *cbarg)
  */
 
 /**
- *   Module initialization
+ *   Attach time initialization
  */
 void
-bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs)
+bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs)
 {
        struct bfa_fcs_fabric_s *fabric;
 
@@ -841,7 +841,12 @@ bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs)
        bfa_wc_up(&fabric->wc); /* For the base port */
 
        bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit);
-       bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_CREATE);
+}
+
+void
+bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs)
+{
+       bfa_sm_send_event(&fcs->fabric, BFA_FCS_FABRIC_SM_CREATE);
        bfa_trc(fcs, 0);
 }
 
index 1f3c06efaa9ea42d7a7325e8fd8b2bec678928f7..06f8a46d19774b3804189e9c374ef599c5a660f7 100644 (file)
@@ -822,22 +822,3 @@ void
 bfa_fcs_itnim_resume(struct bfa_fcs_itnim_s *itnim)
 {
 }
-
-/**
- *   Module initialization
- */
-void
-bfa_fcs_fcpim_modinit(struct bfa_fcs_s *fcs)
-{
-}
-
-/**
- *   Module cleanup
- */
-void
-bfa_fcs_fcpim_modexit(struct bfa_fcs_s *fcs)
-{
-       bfa_fcs_modexit_comp(fcs);
-}
-
-
index eee960820f86c967cb5fd4fa9673bd03c0fe0b26..8237bd5e72178b4772d863212d407678cb696481 100644 (file)
@@ -29,6 +29,7 @@
 /*
 * fcs friend functions: only between fcs modules
  */
+void           bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs);
 void            bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs);
 void            bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs);
 void            bfa_fcs_fabric_modsusp(struct bfa_fcs_s *fcs);
index 61e9e2687de3c5e734d0df523a02f91e54928ff9..11e6e7bce9f63664134bfa9dab231c5dbfec00ab 100644 (file)
@@ -34,11 +34,6 @@ void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim);
 void bfa_fcs_itnim_pause(struct bfa_fcs_itnim_s *itnim);
 void bfa_fcs_itnim_resume(struct bfa_fcs_itnim_s *itnim);
 
-/*
- * Modudle init/cleanup routines.
- */
-void bfa_fcs_fcpim_modinit(struct bfa_fcs_s *fcs);
-void bfa_fcs_fcpim_modexit(struct bfa_fcs_s *fcs);
 void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim, struct fchs_s *fchs,
                        u16 len);
 #endif /* __FCS_FCPIM_H__ */
index abb65191dd27de55a0b962499e2ac7af75397245..408c06a7d164cb1879ee188b8f03836db7c4df67 100644 (file)
@@ -26,7 +26,6 @@
 /*
  * fcs friend functions: only between fcs modules
  */
-void bfa_fcs_pport_modinit(struct bfa_fcs_s *fcs);
-void bfa_fcs_pport_modexit(struct bfa_fcs_s *fcs);
+void bfa_fcs_pport_attach(struct bfa_fcs_s *fcs);
 
 #endif /* __FCS_PPORT_H__ */
index f601e9d742360eb2ad002306a306cc3788c59879..9c8d1d2923807b759549f2eaffc0a2858ad9f7b4 100644 (file)
@@ -24,9 +24,6 @@
 
 #include <fcs/bfa_fcs_rport.h>
 
-void bfa_fcs_rport_modinit(struct bfa_fcs_s *fcs);
-void bfa_fcs_rport_modexit(struct bfa_fcs_s *fcs);
-
 void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs,
                        u16 len);
 void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport);
index 96f1bdcb31ed35da8f8c5394d19206e5430f1111..f591072214febc7c64707c2347f4ef89fa77dc2a 100644 (file)
@@ -26,7 +26,6 @@
 /*
  * fcs friend functions: only between fcs modules
  */
-void bfa_fcs_uf_modinit(struct bfa_fcs_s *fcs);
-void bfa_fcs_uf_modexit(struct bfa_fcs_s *fcs);
+void bfa_fcs_uf_attach(struct bfa_fcs_s *fcs);
 
 #endif /* __FCS_UF_H__ */
index 9e80b6a97b7f6c28fcd06a21fc7d7d0901120c49..32565ba666eb774cb100e1ed4369f05b0648e892 100644 (file)
 #include <fcs/bfa_fcs_vport.h>
 #include <defs/bfa_defs_pci.h>
 
-/*
- * Modudle init/cleanup routines.
- */
-
-void bfa_fcs_vport_modinit(struct bfa_fcs_s *fcs);
-void bfa_fcs_vport_modexit(struct bfa_fcs_s *fcs);
-
 void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport);
 void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport);
 void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport);
index 0396ec460532e18d37229bd1c4995a04dac82e8a..f2fd35fdee28805cd71be4070792061a22d06e6c 100644 (file)
@@ -61,8 +61,9 @@ struct bfa_fcs_s {
 /*
  * bfa fcs API functions
  */
-void bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
+void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
                        bfa_boolean_t min_cfg);
+void bfa_fcs_init(struct bfa_fcs_s *fcs);
 void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
                        struct bfa_fcs_driver_info_s *driver_info);
 void bfa_fcs_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable);
index 9cf58bb138dc4a502555c54114c194f213b589f0..df714dcdf0317ef8536af0dc088046c38ba13f43 100644 (file)
@@ -2574,23 +2574,6 @@ bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs,
                      FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0);
 }
 
-/**
- *   Module initialization
- */
-void
-bfa_fcs_rport_modinit(struct bfa_fcs_s *fcs)
-{
-}
-
-/**
- *   Module cleanup
- */
-void
-bfa_fcs_rport_modexit(struct bfa_fcs_s *fcs)
-{
-       bfa_fcs_modexit_comp(fcs);
-}
-
 /**
  * Return state of rport.
  */
index 8d18589e1da2d156c89f85cd6c509d1a0903f40b..75d6f058a4617c27e99e689a7fd519fbd53c3348 100644 (file)
@@ -616,23 +616,6 @@ bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport)
        bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_DELCOMP);
 }
 
-/**
- *   Module initialization
- */
-void
-bfa_fcs_vport_modinit(struct bfa_fcs_s *fcs)
-{
-}
-
-/**
- *   Module cleanup
- */
-void
-bfa_fcs_vport_modexit(struct bfa_fcs_s *fcs)
-{
-       bfa_fcs_modexit_comp(fcs);
-}
-
 u32
 bfa_fcs_vport_get_max(struct bfa_fcs_s *fcs)
 {