From patchwork Wed Sep 27 03:57:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13399858 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAFE2134A5 for ; Wed, 27 Sep 2023 03:58:08 +0000 (UTC) Received: from mail-yw1-x112c.google.com (mail-yw1-x112c.google.com [IPv6:2607:f8b0:4864:20::112c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4821E1E953 for ; Tue, 26 Sep 2023 20:58:07 -0700 (PDT) Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-59f6e6b206fso75970847b3.3 for ; Tue, 26 Sep 2023 20:58:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1695787086; x=1696391886; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=UZGP3jLAK49z6VBhkQP5/gfVQ4vZzO/FNHztPkUzS10=; b=CI7lyrEm644dFm5i2uRWvIUt+MeAlRIFU1KONvntvJywhhDfqNsxNjv9c8cDG4BgAU IrTP2jw9e8R1+7FPpHo/IcycKV8GMTDSFqg7ri3vTB0wNA2QImmyzq9+AvLk6abkkQUr NjwxbtrHLmgGMhcRt0UaR3epUmRywhulv1sB4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695787086; x=1696391886; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UZGP3jLAK49z6VBhkQP5/gfVQ4vZzO/FNHztPkUzS10=; b=sEs3ejm0l280ETo769wzPWxvsn0ZBxCi4W7RE6yYMGmFut6Vc4SKhP3e2v8Ne3P1Y/ 9zFy21HVJ1q/kWOxyPSAqEDf7RAWrD1eoWXjMUi8yl6T8BFC9u5+SFDFj2SZ4uW2G29Q EqDG44g0C6nkwzXTlR7o5sjPFOD5Zf3iPxjuU0roeqks9Gt8P/TCx4Ibxdxjlu36Bcg3 xHAPrUrrC2h7H8V7CpjseO5UZfe8MWqTOh+ZCd/EgJiq9dK97zs0pUtIVRHWJaHvojPP 7i++A+XuQzie9o74bUNsg2iek2w8WCm2ajN2ytA9eohSChJSD9LvkLKBUpGUXox989mW qqSw== X-Gm-Message-State: AOJu0Yxaas7uIq92W0uKSKdqPAu+PbtBFlfRRdI/C2M5YVD7WdmOScCu Op5Z1pxSzrcE6GCZjcu7GLCizA== X-Google-Smtp-Source: AGHT+IH3DEix9zBQVCrnzLq61HEHACX1dkh1+9MgYhl98juP9g4WG7OvGu7XImXfYrdvdZ9b+axmxQ== X-Received: by 2002:a0d:d914:0:b0:56f:fffc:56ff with SMTP id b20-20020a0dd914000000b0056ffffc56ffmr1160919ywe.42.1695787086248; Tue, 26 Sep 2023 20:58:06 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id k67-20020a633d46000000b00577bc070c6bsm9736097pga.68.2023.09.26.20.58.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2023 20:58:05 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, gospo@broadcom.com, Kalesh AP , Somnath Kotur Subject: [PATCH net-next v2 2/9] bnxt_en: Enhance hwmon temperature reporting Date: Tue, 26 Sep 2023 20:57:27 -0700 Message-Id: <20230927035734.42816-3-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230927035734.42816-1-michael.chan@broadcom.com> References: <20230927035734.42816-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org From: Kalesh AP 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 Signed-off-by: Kalesh AP Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 7551aa8068f8..785084147994 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -10280,7 +10280,7 @@ static struct attribute *bnxt_attrs[] = { }; ATTRIBUTE_GROUPS(bnxt); -static void bnxt_hwmon_close(struct bnxt *bp) +static void bnxt_hwmon_uninit(struct bnxt *bp) { if (bp->hwmon_dev) { hwmon_device_unregister(bp->hwmon_dev); @@ -10288,7 +10288,7 @@ static void bnxt_hwmon_close(struct bnxt *bp) } } -static void bnxt_hwmon_open(struct bnxt *bp) +static void bnxt_hwmon_init(struct bnxt *bp) { struct hwrm_temp_monitor_query_input *req; struct pci_dev *pdev = bp->pdev; @@ -10298,7 +10298,7 @@ static void bnxt_hwmon_open(struct bnxt *bp) if (!rc) rc = hwrm_req_send_silent(bp, req); if (rc == -EACCES || rc == -EOPNOTSUPP) { - bnxt_hwmon_close(bp); + bnxt_hwmon_uninit(bp); return; } @@ -10314,11 +10314,11 @@ static void bnxt_hwmon_open(struct bnxt *bp) } } #else -static void bnxt_hwmon_close(struct bnxt *bp) +static void bnxt_hwmon_uninit(struct bnxt *bp) { } -static void bnxt_hwmon_open(struct bnxt *bp) +static void bnxt_hwmon_init(struct bnxt *bp) { } #endif @@ -10651,7 +10651,6 @@ static int bnxt_open(struct net_device *dev) bnxt_reenable_sriov(bp); } } - bnxt_hwmon_open(bp); } return rc; @@ -10736,7 +10735,6 @@ static int bnxt_close(struct net_device *dev) { struct bnxt *bp = netdev_priv(dev); - bnxt_hwmon_close(bp); bnxt_close_nic(bp, true, true); bnxt_hwrm_shutdown_link(bp); bnxt_hwrm_if_change(bp, false); @@ -12300,6 +12298,7 @@ static int bnxt_fw_init_one_p2(struct bnxt *bp) if (bp->fw_cap & BNXT_FW_CAP_PTP) __bnxt_hwrm_ptp_qcfg(bp); bnxt_dcb_init(bp); + bnxt_hwmon_init(bp); return 0; } @@ -13205,6 +13204,7 @@ static void bnxt_remove_one(struct pci_dev *pdev) bnxt_clear_int_mode(bp); bnxt_hwrm_func_drv_unrgtr(bp); bnxt_free_hwrm_resources(bp); + bnxt_hwmon_uninit(bp); bnxt_ethtool_free(bp); bnxt_dcb_free(bp); kfree(bp->ptp_cfg); @@ -13801,6 +13801,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) init_err_pci_clean: bnxt_hwrm_func_drv_unrgtr(bp); bnxt_free_hwrm_resources(bp); + bnxt_hwmon_uninit(bp); bnxt_ethtool_free(bp); bnxt_ptp_clear(bp); kfree(bp->ptp_cfg);