Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cnic, bnx2x, bnx2: Simplify cnic probing.

Instead of using symbol_get(), cnic can now directly call the cnic_probe
functions in struct bnx2x and struct bnx2. symbol_get() is not reliable
as it fails when the module is still initializing.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Michael Chan and committed by
David S. Miller
4bd9b0ff 68c64d20

+17 -19
+1 -1
drivers/net/ethernet/broadcom/bnx2.c
··· 434 434 435 435 return cp; 436 436 } 437 - EXPORT_SYMBOL(bnx2_cnic_probe); 438 437 439 438 static void 440 439 bnx2_cnic_stop(struct bnx2 *bp) ··· 8421 8422 bp->cnic_eth_dev.max_iscsi_conn = 8422 8423 (bnx2_shmem_rd(bp, BNX2_ISCSI_MAX_CONN) & 8423 8424 BNX2_ISCSI_MAX_CONN_MASK) >> BNX2_ISCSI_MAX_CONN_SHIFT; 8425 + bp->cnic_probe = bnx2_cnic_probe; 8424 8426 #endif 8425 8427 pci_save_state(pdev); 8426 8428
+1
drivers/net/ethernet/broadcom/bnx2.h
··· 6984 6984 #ifdef BCM_CNIC 6985 6985 struct mutex cnic_lock; 6986 6986 struct cnic_eth_dev cnic_eth_dev; 6987 + struct cnic_eth_dev *(*cnic_probe)(struct net_device *); 6987 6988 #endif 6988 6989 6989 6990 const struct firmware *mips_firmware;
+1
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
··· 1337 1337 u8 cnic_support; 1338 1338 bool cnic_enabled; 1339 1339 bool cnic_loaded; 1340 + struct cnic_eth_dev *(*cnic_probe)(struct net_device *); 1340 1341 1341 1342 /* Flag that indicates that we can start looking for FCoE L2 queue 1342 1343 * completions in the default status block.
+3 -1
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
··· 12018 12018 return control & PCI_MSIX_FLAGS_QSIZE; 12019 12019 } 12020 12020 12021 + struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *); 12022 + 12021 12023 static int bnx2x_init_one(struct pci_dev *pdev, 12022 12024 const struct pci_device_id *ent) 12023 12025 { ··· 12099 12097 bp->igu_sb_cnt = max_non_def_sbs; 12100 12098 bp->msg_enable = debug; 12101 12099 bp->cnic_support = cnic_cnt; 12100 + bp->cnic_probe = bnx2x_cnic_probe; 12102 12101 12103 12102 pci_set_drvdata(pdev, dev); 12104 12103 ··· 13041 13038 cp->starting_cid); 13042 13039 return cp; 13043 13040 } 13044 - EXPORT_SYMBOL(bnx2x_cnic_probe); 13045 13041 13046 13042
+9 -12
drivers/net/ethernet/broadcom/cnic.c
··· 40 40 #include <net/ip6_checksum.h> 41 41 #include <scsi/iscsi_if.h> 42 42 43 + #define BCM_CNIC 1 43 44 #include "cnic_if.h" 44 45 #include "bnx2.h" 45 46 #include "bnx2x/bnx2x.h" ··· 5450 5449 struct pci_dev *pdev; 5451 5450 struct cnic_dev *cdev; 5452 5451 struct cnic_local *cp; 5452 + struct bnx2 *bp = netdev_priv(dev); 5453 5453 struct cnic_eth_dev *ethdev = NULL; 5454 - struct cnic_eth_dev *(*probe)(struct net_device *) = NULL; 5455 5454 5456 - probe = symbol_get(bnx2_cnic_probe); 5457 - if (probe) { 5458 - ethdev = (*probe)(dev); 5459 - symbol_put(bnx2_cnic_probe); 5460 - } 5455 + if (bp->cnic_probe) 5456 + ethdev = (bp->cnic_probe)(dev); 5457 + 5461 5458 if (!ethdev) 5462 5459 return NULL; 5463 5460 ··· 5510 5511 struct pci_dev *pdev; 5511 5512 struct cnic_dev *cdev; 5512 5513 struct cnic_local *cp; 5514 + struct bnx2x *bp = netdev_priv(dev); 5513 5515 struct cnic_eth_dev *ethdev = NULL; 5514 - struct cnic_eth_dev *(*probe)(struct net_device *) = NULL; 5515 5516 5516 - probe = symbol_get(bnx2x_cnic_probe); 5517 - if (probe) { 5518 - ethdev = (*probe)(dev); 5519 - symbol_put(bnx2x_cnic_probe); 5520 - } 5517 + if (bp->cnic_probe) 5518 + ethdev = bp->cnic_probe(dev); 5519 + 5521 5520 if (!ethdev) 5522 5521 return NULL; 5523 5522
+2 -5
drivers/net/ethernet/broadcom/cnic_if.h
··· 14 14 15 15 #include "bnx2x/bnx2x_mfw_req.h" 16 16 17 - #define CNIC_MODULE_VERSION "2.5.15" 18 - #define CNIC_MODULE_RELDATE "Dec 04, 2012" 17 + #define CNIC_MODULE_VERSION "2.5.16" 18 + #define CNIC_MODULE_RELDATE "Dec 05, 2012" 19 19 20 20 #define CNIC_ULP_RDMA 0 21 21 #define CNIC_ULP_ISCSI 1 ··· 352 352 extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); 353 353 354 354 extern int cnic_unregister_driver(int ulp_type); 355 - 356 - extern struct cnic_eth_dev *bnx2_cnic_probe(struct net_device *dev); 357 - extern struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev); 358 355 359 356 #endif