Skip to content

Commit 6ad7198

Browse files
Kalesh APdavem330
authored andcommitted
bnxt_en: Enhance hwmon temperature reporting
Driver currently does hwmon device register and unregister in open and close() respectively. As a result, user will not be able to query hwmon temperature when interface is in ifdown state. Enhance it by moving the hwmon register/unregister to the probe/remove functions. Reviewed-by: Somnath Kotur <[email protected]> Signed-off-by: Kalesh AP <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 754fbf6 commit 6ad7198

File tree

1 file changed

+8
-7
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+8
-7
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10280,15 +10280,15 @@ static struct attribute *bnxt_attrs[] = {
1028010280
};
1028110281
ATTRIBUTE_GROUPS(bnxt);
1028210282

10283-
static void bnxt_hwmon_close(struct bnxt *bp)
10283+
static void bnxt_hwmon_uninit(struct bnxt *bp)
1028410284
{
1028510285
if (bp->hwmon_dev) {
1028610286
hwmon_device_unregister(bp->hwmon_dev);
1028710287
bp->hwmon_dev = NULL;
1028810288
}
1028910289
}
1029010290

10291-
static void bnxt_hwmon_open(struct bnxt *bp)
10291+
static void bnxt_hwmon_init(struct bnxt *bp)
1029210292
{
1029310293
struct hwrm_temp_monitor_query_input *req;
1029410294
struct pci_dev *pdev = bp->pdev;
@@ -10298,7 +10298,7 @@ static void bnxt_hwmon_open(struct bnxt *bp)
1029810298
if (!rc)
1029910299
rc = hwrm_req_send_silent(bp, req);
1030010300
if (rc == -EACCES || rc == -EOPNOTSUPP) {
10301-
bnxt_hwmon_close(bp);
10301+
bnxt_hwmon_uninit(bp);
1030210302
return;
1030310303
}
1030410304

@@ -10314,11 +10314,11 @@ static void bnxt_hwmon_open(struct bnxt *bp)
1031410314
}
1031510315
}
1031610316
#else
10317-
static void bnxt_hwmon_close(struct bnxt *bp)
10317+
static void bnxt_hwmon_uninit(struct bnxt *bp)
1031810318
{
1031910319
}
1032010320

10321-
static void bnxt_hwmon_open(struct bnxt *bp)
10321+
static void bnxt_hwmon_init(struct bnxt *bp)
1032210322
{
1032310323
}
1032410324
#endif
@@ -10651,7 +10651,6 @@ static int bnxt_open(struct net_device *dev)
1065110651
bnxt_reenable_sriov(bp);
1065210652
}
1065310653
}
10654-
bnxt_hwmon_open(bp);
1065510654
}
1065610655

1065710656
return rc;
@@ -10736,7 +10735,6 @@ static int bnxt_close(struct net_device *dev)
1073610735
{
1073710736
struct bnxt *bp = netdev_priv(dev);
1073810737

10739-
bnxt_hwmon_close(bp);
1074010738
bnxt_close_nic(bp, true, true);
1074110739
bnxt_hwrm_shutdown_link(bp);
1074210740
bnxt_hwrm_if_change(bp, false);
@@ -12300,6 +12298,7 @@ static int bnxt_fw_init_one_p2(struct bnxt *bp)
1230012298
if (bp->fw_cap & BNXT_FW_CAP_PTP)
1230112299
__bnxt_hwrm_ptp_qcfg(bp);
1230212300
bnxt_dcb_init(bp);
12301+
bnxt_hwmon_init(bp);
1230312302
return 0;
1230412303
}
1230512304

@@ -13205,6 +13204,7 @@ static void bnxt_remove_one(struct pci_dev *pdev)
1320513204
bnxt_clear_int_mode(bp);
1320613205
bnxt_hwrm_func_drv_unrgtr(bp);
1320713206
bnxt_free_hwrm_resources(bp);
13207+
bnxt_hwmon_uninit(bp);
1320813208
bnxt_ethtool_free(bp);
1320913209
bnxt_dcb_free(bp);
1321013210
kfree(bp->ptp_cfg);
@@ -13801,6 +13801,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1380113801
init_err_pci_clean:
1380213802
bnxt_hwrm_func_drv_unrgtr(bp);
1380313803
bnxt_free_hwrm_resources(bp);
13804+
bnxt_hwmon_uninit(bp);
1380413805
bnxt_ethtool_free(bp);
1380513806
bnxt_ptp_clear(bp);
1380613807
kfree(bp->ptp_cfg);

0 commit comments

Comments
 (0)