summaryrefslogtreecommitdiff
path: root/drivers/staging/et131x/et1310_pm.c
diff options
context:
space:
mode:
authorMark Einon <mark.einon@gmail.com>2011-10-01 11:14:11 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-04 10:43:12 -0700
commita3bf5fa772963ef0310d982077784ef6839f2fa7 (patch)
tree7b770e78b73a458c23ff3679b2c4903e0377d067 /drivers/staging/et131x/et1310_pm.c
parent53c3ee0db36db31d095f4e902bc42a4dea18fd8c (diff)
staging: et131x: Introduce et1310_in_phy_coma() call
In several places in the code, the pm_csr register is read and the PHY_SW_COMA bit checked. Move this check into its own small function to make the code more readable. Signed-off-by: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/et131x/et1310_pm.c')
-rw-r--r--drivers/staging/et131x/et1310_pm.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/staging/et131x/et1310_pm.c b/drivers/staging/et131x/et1310_pm.c
index b20d5d627ef4..55f2d3672b18 100644
--- a/drivers/staging/et131x/et1310_pm.c
+++ b/drivers/staging/et131x/et1310_pm.c
@@ -87,6 +87,21 @@
#include "et131x.h"
/**
+ * et1310_in_phy_coma - check if the device is in phy coma
+ * @adapter: pointer to our adapter structure
+ *
+ * Returns 0 if the device is not in phy coma, 1 if it is in phy coma
+ */
+int et1310_in_phy_coma(struct et131x_adapter *adapter)
+{
+ u32 pmcsr;
+
+ pmcsr = readl(&adapter->regs->global.pm_csr);
+
+ return ET_PM_PHY_SW_COMA & pmcsr ? 1 : 0;
+}
+
+/**
* et1310_enable_phy_coma - called when network cable is unplugged
* @adapter: pointer to our adapter structure
*