* [PATCH] net: dsa/mv88e6352: make mv88e6352_wait generic
@ 2015-01-23 23:34 Vivien Didelot
2015-01-24 1:47 ` Guenter Roeck
2015-01-27 8:06 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Vivien Didelot @ 2015-01-23 23:34 UTC (permalink / raw)
To: netdev; +Cc: Vivien Didelot, Guenter Roeck, linux-kernel, kernel
Some busy bits are available in the global register 1, such as the ATU
Busy bit. We may want to use this function to wait for them to change,
so add a new parameter to mv88e6352_wait() instead of hard-coding
REG_GLOBAL2.
In the meantime, since the REG_READ() macro already checks for error,
remove the redundant check for ret < 0.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/net/dsa/mv88e6352.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/net/dsa/mv88e6352.c b/drivers/net/dsa/mv88e6352.c
index 258d9ef..e13adc7 100644
--- a/drivers/net/dsa/mv88e6352.c
+++ b/drivers/net/dsa/mv88e6352.c
@@ -22,17 +22,14 @@
#include <net/dsa.h>
#include "mv88e6xxx.h"
-static int mv88e6352_wait(struct dsa_switch *ds, int reg, u16 mask)
+static int mv88e6352_wait(struct dsa_switch *ds, int reg, int offset, u16 mask)
{
unsigned long timeout = jiffies + HZ / 10;
while (time_before(jiffies, timeout)) {
int ret;
- ret = REG_READ(REG_GLOBAL2, reg);
- if (ret < 0)
- return ret;
-
+ ret = REG_READ(reg, offset);
if (!(ret & mask))
return 0;
@@ -43,17 +40,17 @@ static int mv88e6352_wait(struct dsa_switch *ds, int reg, u16 mask)
static inline int mv88e6352_phy_wait(struct dsa_switch *ds)
{
- return mv88e6352_wait(ds, 0x18, 0x8000);
+ return mv88e6352_wait(ds, REG_GLOBAL2, 0x18, 0x8000);
}
static inline int mv88e6352_eeprom_load_wait(struct dsa_switch *ds)
{
- return mv88e6352_wait(ds, 0x14, 0x0800);
+ return mv88e6352_wait(ds, REG_GLOBAL2, 0x14, 0x0800);
}
static inline int mv88e6352_eeprom_busy_wait(struct dsa_switch *ds)
{
- return mv88e6352_wait(ds, 0x14, 0x8000);
+ return mv88e6352_wait(ds, REG_GLOBAL2, 0x14, 0x8000);
}
static int __mv88e6352_phy_read(struct dsa_switch *ds, int addr, int regnum)
--
2.2.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: dsa/mv88e6352: make mv88e6352_wait generic
2015-01-23 23:34 [PATCH] net: dsa/mv88e6352: make mv88e6352_wait generic Vivien Didelot
@ 2015-01-24 1:47 ` Guenter Roeck
2015-01-27 8:06 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2015-01-24 1:47 UTC (permalink / raw)
To: Vivien Didelot, netdev; +Cc: linux-kernel, kernel
On 01/23/2015 03:34 PM, Vivien Didelot wrote:
> Some busy bits are available in the global register 1, such as the ATU
> Busy bit. We may want to use this function to wait for them to change,
> so add a new parameter to mv88e6352_wait() instead of hard-coding
> REG_GLOBAL2.
>
> In the meantime, since the REG_READ() macro already checks for error,
> remove the redundant check for ret < 0.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Guenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: dsa/mv88e6352: make mv88e6352_wait generic
2015-01-23 23:34 [PATCH] net: dsa/mv88e6352: make mv88e6352_wait generic Vivien Didelot
2015-01-24 1:47 ` Guenter Roeck
@ 2015-01-27 8:06 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-01-27 8:06 UTC (permalink / raw)
To: vivien.didelot; +Cc: netdev, linux, linux-kernel, kernel
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Fri, 23 Jan 2015 18:34:41 -0500
> Some busy bits are available in the global register 1, such as the ATU
> Busy bit. We may want to use this function to wait for them to change,
> so add a new parameter to mv88e6352_wait() instead of hard-coding
> REG_GLOBAL2.
>
> In the meantime, since the REG_READ() macro already checks for error,
> remove the redundant check for ret < 0.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-27 8:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-23 23:34 [PATCH] net: dsa/mv88e6352: make mv88e6352_wait generic Vivien Didelot
2015-01-24 1:47 ` Guenter Roeck
2015-01-27 8:06 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).