* [U-Boot-Users] [PATCH] common/miiphyutil.c: Cleanup MII_DEBUG and debug()
@ 2008-01-19 1:25 Shinya Kuribayashi
2008-01-19 13:36 ` Jean-Christophe PLAGNIOL-VILLARD
2008-02-14 21:10 ` Wolfgang Denk
0 siblings, 2 replies; 3+ messages in thread
From: Shinya Kuribayashi @ 2008-01-19 1:25 UTC (permalink / raw)
To: u-boot
Current MII_DEBUG is confusing in two ways. One is useless define-then-
undef at the top of the file. The other is there is only one debug() in
this file, and that doesn't seem worthwhile to bother having MII_DEBUG.
While there are many useful printf()/puts() debug codes, but they are for
DEBUG, not for MII_DEBUG.
This patch tries to put them all together into MII_DEBUG and debug().
Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
---
common/miiphyutil.c | 31 +++++++++----------------------
1 files changed, 9 insertions(+), 22 deletions(-)
diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 281f0b2..eac8275 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -36,7 +36,6 @@
#include <net.h>
/* local debug macro */
-#define MII_DEBUG
#undef MII_DEBUG
#undef debug
@@ -261,31 +260,25 @@ int miiphy_info (char *devname, unsigned char addr, unsigned int *oui,
unsigned short tmp;
if (miiphy_read (devname, addr, PHY_PHYIDR2, &tmp) != 0) {
-#ifdef DEBUG
- puts ("PHY ID register 2 read failed\n");
-#endif
+ debug ("PHY ID register 2 read failed\n");
return (-1);
}
reg = tmp;
-#ifdef DEBUG
- printf ("PHY_PHYIDR2 @ 0x%x = 0x%04x\n", addr, reg);
-#endif
+ debug ("PHY_PHYIDR2 @ 0x%x = 0x%04x\n", addr, reg);
+
if (reg == 0xFFFF) {
/* No physical device present at this address */
return (-1);
}
if (miiphy_read (devname, addr, PHY_PHYIDR1, &tmp) != 0) {
-#ifdef DEBUG
- puts ("PHY ID register 1 read failed\n");
-#endif
+ debug ("PHY ID register 1 read failed\n");
return (-1);
}
reg |= tmp << 16;
-#ifdef DEBUG
- printf ("PHY_PHYIDR[1,2] @ 0x%x = 0x%08x\n", addr, reg);
-#endif
+ debug ("PHY_PHYIDR[1,2] @ 0x%x = 0x%08x\n", addr, reg);
+
*oui = (reg >> 10);
*model = (unsigned char)((reg >> 4) & 0x0000003F);
*rev = (unsigned char)(reg & 0x0000000F);
@@ -304,15 +297,11 @@ int miiphy_reset (char *devname, unsigned char addr)
int loop_cnt;
if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) {
-#ifdef DEBUG
- printf ("PHY status read failed\n");
-#endif
+ debug ("PHY status read failed\n");
return (-1);
}
if (miiphy_write (devname, addr, PHY_BMCR, reg | 0x8000) != 0) {
-#ifdef DEBUG
- puts ("PHY reset failed\n");
-#endif
+ debug ("PHY reset failed\n");
return (-1);
}
#ifdef CONFIG_PHY_RESET_DELAY
@@ -327,9 +316,7 @@ int miiphy_reset (char *devname, unsigned char addr)
reg = 0x8000;
while (((reg & 0x8000) != 0) && (loop_cnt++ < 1000000)) {
if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) {
-# ifdef DEBUG
- puts ("PHY status read failed\n");
-# endif
+ debug ("PHY status read failed\n");
return (-1);
}
}
^ permalink raw reply related [flat|nested] 3+ messages in thread* [U-Boot-Users] [PATCH] common/miiphyutil.c: Cleanup MII_DEBUG and debug()
2008-01-19 1:25 [U-Boot-Users] [PATCH] common/miiphyutil.c: Cleanup MII_DEBUG and debug() Shinya Kuribayashi
@ 2008-01-19 13:36 ` Jean-Christophe PLAGNIOL-VILLARD
2008-02-14 21:10 ` Wolfgang Denk
1 sibling, 0 replies; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-01-19 13:36 UTC (permalink / raw)
To: u-boot
I think we should start to use CONFIG_ to simplify the migration go
kconfig ang suggest to use CONFIG_MII_DEBUG
Best Regards,
J.
Le 19 janv. 08 ? 02:25, Shinya Kuribayashi <skuribay@ruby.dti.ne.jp> a
?crit :
> Current MII_DEBUG is confusing in two ways. One is useless define-
> then-
> undef at the top of the file. The other is there is only one debug()
> in
> this file, and that doesn't seem worthwhile to bother having
> MII_DEBUG.
> While there are many useful printf()/puts() debug codes, but they
> are for
> DEBUG, not for MII_DEBUG.
>
> This patch tries to put them all together into MII_DEBUG and debug().
>
> Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
> ---
>
> common/miiphyutil.c | 31 +++++++++----------------------
> 1 files changed, 9 insertions(+), 22 deletions(-)
>
>
> diff --git a/common/miiphyutil.c b/common/miiphyutil.c
> index 281f0b2..eac8275 100644
> --- a/common/miiphyutil.c
> +++ b/common/miiphyutil.c
> @@ -36,7 +36,6 @@
> #include <net.h>
>
> /* local debug macro */
> -#define MII_DEBUG
> #undef MII_DEBUG
>
> #undef debug
> @@ -261,31 +260,25 @@ int miiphy_info (char *devname, unsigned char
> addr, unsigned int *oui,
> unsigned short tmp;
>
> if (miiphy_read (devname, addr, PHY_PHYIDR2, &tmp) != 0) {
> -#ifdef DEBUG
> - puts ("PHY ID register 2 read failed\n");
> -#endif
> + debug ("PHY ID register 2 read failed\n");
> return (-1);
> }
> reg = tmp;
>
> -#ifdef DEBUG
> - printf ("PHY_PHYIDR2 @ 0x%x = 0x%04x\n", addr, reg);
> -#endif
> + debug ("PHY_PHYIDR2 @ 0x%x = 0x%04x\n", addr, reg);
> +
> if (reg == 0xFFFF) {
> /* No physical device present at this address */
> return (-1);
> }
>
> if (miiphy_read (devname, addr, PHY_PHYIDR1, &tmp) != 0) {
> -#ifdef DEBUG
> - puts ("PHY ID register 1 read failed\n");
> -#endif
> + debug ("PHY ID register 1 read failed\n");
> return (-1);
> }
> reg |= tmp << 16;
> -#ifdef DEBUG
> - printf ("PHY_PHYIDR[1,2] @ 0x%x = 0x%08x\n", addr, reg);
> -#endif
> + debug ("PHY_PHYIDR[1,2] @ 0x%x = 0x%08x\n", addr, reg);
> +
> *oui = (reg >> 10);
> *model = (unsigned char)((reg >> 4) & 0x0000003F);
> *rev = (unsigned char)(reg & 0x0000000F);
> @@ -304,15 +297,11 @@ int miiphy_reset (char *devname, unsigned char
> addr)
> int loop_cnt;
>
> if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) {
> -#ifdef DEBUG
> - printf ("PHY status read failed\n");
> -#endif
> + debug ("PHY status read failed\n");
> return (-1);
> }
> if (miiphy_write (devname, addr, PHY_BMCR, reg | 0x8000) != 0) {
> -#ifdef DEBUG
> - puts ("PHY reset failed\n");
> -#endif
> + debug ("PHY reset failed\n");
> return (-1);
> }
> #ifdef CONFIG_PHY_RESET_DELAY
> @@ -327,9 +316,7 @@ int miiphy_reset (char *devname, unsigned char
> addr)
> reg = 0x8000;
> while (((reg & 0x8000) != 0) && (loop_cnt++ < 1000000)) {
> if (miiphy_read (devname, addr, PHY_BMCR, ®) != 0) {
> -# ifdef DEBUG
> - puts ("PHY status read failed\n");
> -# endif
> + debug ("PHY status read failed\n");
> return (-1);
> }
> }
>
> ---
> ----------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
^ permalink raw reply [flat|nested] 3+ messages in thread* [U-Boot-Users] [PATCH] common/miiphyutil.c: Cleanup MII_DEBUG and debug()
2008-01-19 1:25 [U-Boot-Users] [PATCH] common/miiphyutil.c: Cleanup MII_DEBUG and debug() Shinya Kuribayashi
2008-01-19 13:36 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2008-02-14 21:10 ` Wolfgang Denk
1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2008-02-14 21:10 UTC (permalink / raw)
To: u-boot
In message <479151A7.10004@ruby.dti.ne.jp> you wrote:
> Current MII_DEBUG is confusing in two ways. One is useless define-then-
> undef at the top of the file. The other is there is only one debug() in
> this file, and that doesn't seem worthwhile to bother having MII_DEBUG.
> While there are many useful printf()/puts() debug codes, but they are for
> DEBUG, not for MII_DEBUG.
>
> This patch tries to put them all together into MII_DEBUG and debug().
>
> Signed-off-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Who is the oldest inhabitant of this village?"
"We haven't got one; we had one, but he died three weeks ago."
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-14 21:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-19 1:25 [U-Boot-Users] [PATCH] common/miiphyutil.c: Cleanup MII_DEBUG and debug() Shinya Kuribayashi
2008-01-19 13:36 ` Jean-Christophe PLAGNIOL-VILLARD
2008-02-14 21:10 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox