From: Brett Creeley <[email protected]>

Currently there aren't any use-cases that require special handling
on whether or not to print devcmd failures. Specifically
non-generic failures, i.e. not supported failures. Add support to
allow these messages to be suppressed. This will be used when
adding support to negotiate PDS_CORE_IDENTITY_VERSION_2.

Signed-off-by: Brett Creeley <[email protected]>
---
 drivers/net/ethernet/amd/pds_core/dev.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/amd/pds_core/dev.c 
b/drivers/net/ethernet/amd/pds_core/dev.c
index 2e1d0d01d03a..5b86d6cd0ac3 100644
--- a/drivers/net/ethernet/amd/pds_core/dev.c
+++ b/drivers/net/ethernet/amd/pds_core/dev.c
@@ -126,7 +126,8 @@ static const char *pdsc_devcmd_str(int opcode)
        }
 }
 
-static int pdsc_devcmd_wait(struct pdsc *pdsc, u8 opcode, int max_seconds)
+static int __pdsc_devcmd_wait(struct pdsc *pdsc, u8 opcode, int max_seconds,
+                             const bool do_msg)
 {
        struct device *dev = pdsc->dev;
        unsigned long start_time;
@@ -172,7 +173,7 @@ static int pdsc_devcmd_wait(struct pdsc *pdsc, u8 opcode, 
int max_seconds)
 
        status = pdsc_devcmd_status(pdsc);
        err = pdsc_err_to_errno(status);
-       if (err && err != -EAGAIN)
+       if (do_msg && err && err != -EAGAIN)
                dev_err(dev, "DEVCMD %d %s failed, status=%d err %d %pe\n",
                        opcode, pdsc_devcmd_str(opcode), status, err,
                        ERR_PTR(err));
@@ -180,8 +181,9 @@ static int pdsc_devcmd_wait(struct pdsc *pdsc, u8 opcode, 
int max_seconds)
        return err;
 }
 
-int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,
-                      union pds_core_dev_comp *comp, int max_seconds)
+static int __pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,
+                               union pds_core_dev_comp *comp, int max_seconds,
+                               const bool do_msg)
 {
        int err;
 
@@ -190,7 +192,7 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union 
pds_core_dev_cmd *cmd,
 
        memcpy_toio(&pdsc->cmd_regs->cmd, cmd, sizeof(*cmd));
        pdsc_devcmd_dbell(pdsc);
-       err = pdsc_devcmd_wait(pdsc, cmd->opcode, max_seconds);
+       err = __pdsc_devcmd_wait(pdsc, cmd->opcode, max_seconds, do_msg);
 
        if ((err == -ENXIO || err == -ETIMEDOUT) && pdsc->wq)
                queue_work(pdsc->wq, &pdsc->health_work);
@@ -200,6 +202,12 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union 
pds_core_dev_cmd *cmd,
        return err;
 }
 
+int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,
+                      union pds_core_dev_comp *comp, int max_seconds)
+{
+       return __pdsc_devcmd_locked(pdsc, cmd, comp, max_seconds, true);
+}
+
 int pdsc_devcmd(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,
                union pds_core_dev_comp *comp, int max_seconds)
 {

-- 
2.43.0


Reply via email to