Skip to content

Commit

Permalink
net: phy: qsfp-mem: fix kernel message storm
Browse files Browse the repository at this point in the history
In certain cases, the kernel log would get written to by
the qsfp-mem-core driver every 500 ms. Prevent this message
storm and only give messages on cable unplug/plug.

Signed-off-by: Matthew Gerlach <[email protected]>
  • Loading branch information
matthew-gerlach authored and fpgamatt committed May 22, 2024
1 parent 2fd7bfa commit 5e592f2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/net/phy/qsfp-mem-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ static int qsfp_init(struct qsfp *qsfp)
}

if (cnt >= QSFP_CHK_RDY_CNT) {
dev_err(qsfp->dev, "QSFP I2C check ready timeout error");
dev_dbg(qsfp->dev, "QSFP I2C check ready timeout error");
return -ETIMEDOUT;
}

Expand Down Expand Up @@ -242,9 +242,10 @@ void qsfp_check_hotplug(struct work_struct *work)
dev_dbg(qsfp->dev, "qsfp status 0x%llx\n", status);

if (check_qsfp_plugin(qsfp) && qsfp->init == QSFP_INIT_RESET) {
dev_info(qsfp->dev, "detected QSFP plugin\n");
if (!qsfp_init(qsfp))
if (!qsfp_init(qsfp)) {
WRITE_ONCE(qsfp->init, QSFP_INIT_DONE);
dev_info(qsfp->dev, "detected QSFP plugin\n");
}
} else if (!check_qsfp_plugin(qsfp) &&
qsfp->init == QSFP_INIT_DONE) {
dev_info(qsfp->dev, "detected QSFP unplugin\n");
Expand Down

0 comments on commit 5e592f2

Please sign in to comment.