From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: Roel Kluin <roel.kluin@gmail.com>,
netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: [PATCH 2/9] sfc: Fix test for MDIO read failure
Date: Fri, 27 Feb 2009 23:06:12 +0000 [thread overview]
Message-ID: <1235775972.3164.17.camel@achroite> (raw)
In-Reply-To: <1235775847.3164.6.camel@achroite>
Commit 27dd2caca4eabe7c13a052b7456495ba75535e6a changed
mdio_clause45_check_mmds() to read both DEVS0 and DEVS1 registers and
to combine their values into an unsigned 32-bit mask. This made the
following test for a negative (failure) value useless. Fix it to
check whether either read failed.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/sfc/mdio_10g.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index f9e2f95..4462fb5 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -125,24 +125,25 @@ int mdio_clause45_wait_reset_mmds(struct efx_nic *efx,
int mdio_clause45_check_mmds(struct efx_nic *efx,
unsigned int mmd_mask, unsigned int fatal_mask)
{
+ int mmd = 0, probe_mmd, devs0, devs1;
u32 devices;
- int mmd = 0, probe_mmd;
/* Historically we have probed the PHYXS to find out what devices are
* present,but that doesn't work so well if the PHYXS isn't expected
* to exist, if so just find the first item in the list supplied. */
probe_mmd = (mmd_mask & MDIO_MMDREG_DEVS_PHYXS) ? MDIO_MMD_PHYXS :
__ffs(mmd_mask);
- devices = (mdio_clause45_read(efx, efx->mii.phy_id,
- probe_mmd, MDIO_MMDREG_DEVS0) |
- mdio_clause45_read(efx, efx->mii.phy_id,
- probe_mmd, MDIO_MMDREG_DEVS1) << 16);
/* Check all the expected MMDs are present */
- if (devices < 0) {
+ devs0 = mdio_clause45_read(efx, efx->mii.phy_id,
+ probe_mmd, MDIO_MMDREG_DEVS0);
+ devs1 = mdio_clause45_read(efx, efx->mii.phy_id,
+ probe_mmd, MDIO_MMDREG_DEVS1);
+ if (devs0 < 0 || devs1 < 0) {
EFX_ERR(efx, "failed to read devices present\n");
return -EIO;
}
+ devices = devs0 | (devs1 << 16);
if ((devices & mmd_mask) != mmd_mask) {
EFX_ERR(efx, "required MMDs not present: got %x, "
"wanted %x\n", devices, mmd_mask);
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2009-02-27 23:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-27 23:04 [PATCH 1/9] sfc: SFT9001: Include non-breaking cable diagnostics in online self-tests Ben Hutchings
2009-02-27 23:06 ` Ben Hutchings [this message]
2009-03-02 11:26 ` [PATCH 2/9] sfc: Fix test for MDIO read failure David Miller
2009-02-27 23:06 ` [PATCH 3/9] sfc: SFT9001/SFN4111T: Check PHY boot status during board initialisation Ben Hutchings
2009-03-02 11:26 ` David Miller
2009-02-27 23:06 ` [PATCH 4/9] sfc: Remove "XFP" from log messages that are not specific to XFP Ben Hutchings
2009-03-02 11:26 ` David Miller
2009-02-27 23:07 ` [PATCH 5/9] sfc: Fix reporting of PHY id Ben Hutchings
2009-03-02 11:26 ` David Miller
2009-02-27 23:07 ` [PATCH 6/9] sfc: Add support for QT2025C PHY Ben Hutchings
2009-03-02 11:26 ` David Miller
2009-02-27 23:07 ` [PATCH 7/9] sfc: Delete unused efx_blinker::led_num field Ben Hutchings
2009-03-02 11:26 ` David Miller
2009-02-27 23:08 ` [PATCH 8/9] sfc: Clean up LED control Ben Hutchings
2009-03-02 11:26 ` David Miller
2009-02-27 23:08 ` [PATCH 9/9] sfc: Add support for SFN4112F SFP+ reference design Ben Hutchings
2009-03-02 11:26 ` David Miller
2009-03-02 11:26 ` [PATCH 1/9] sfc: SFT9001: Include non-breaking cable diagnostics in online self-tests David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1235775972.3164.17.camel@achroite \
--to=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=linux-net-drivers@solarflare.com \
--cc=netdev@vger.kernel.org \
--cc=roel.kluin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.