From 5e5451a54d2c3bcca2e876be4a2d34b8da59b9b8 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Wed, 20 Jan 2010 09:30:36 +0000
Subject: [PATCH] rtl8366_smi: add Kconfig option for the debugfs stuff

SVN-Revision: 19243
---
 target/linux/ar71xx/config-2.6.30                    |  1 +
 target/linux/ar71xx/config-2.6.31                    |  1 +
 target/linux/ar71xx/config-2.6.32                    |  1 +
 .../linux/ar71xx/files/drivers/net/phy/rtl8366_smi.c | 12 +++++-------
 .../patches-2.6.30/204-rtl8366-smi-driver.patch      |  8 +++++++-
 .../patches-2.6.31/204-rtl8366-smi-driver.patch      |  8 +++++++-
 .../patches-2.6.32/204-rtl8366-smi-driver.patch      |  8 +++++++-
 7 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/target/linux/ar71xx/config-2.6.30 b/target/linux/ar71xx/config-2.6.30
index 6984319820..22aff9bda2 100644
--- a/target/linux/ar71xx/config-2.6.30
+++ b/target/linux/ar71xx/config-2.6.30
@@ -185,6 +185,7 @@ CONFIG_PHYLIB=y
 # CONFIG_PROBE_INITRD_HEADER is not set
 CONFIG_RTL8306_PHY=y
 CONFIG_RTL8366_SMI=y
+# CONFIG_RTL8366_SMI_DEBUG_FS is not set
 CONFIG_SCHED_OMIT_FRAME_POINTER=y
 # CONFIG_SCSI_DMA is not set
 # CONFIG_SERIAL_8250_EXTENDED is not set
diff --git a/target/linux/ar71xx/config-2.6.31 b/target/linux/ar71xx/config-2.6.31
index 11543ab4e9..ef62b7d17c 100644
--- a/target/linux/ar71xx/config-2.6.31
+++ b/target/linux/ar71xx/config-2.6.31
@@ -190,6 +190,7 @@ CONFIG_PHYLIB=y
 # CONFIG_PROBE_INITRD_HEADER is not set
 CONFIG_RTL8306_PHY=y
 CONFIG_RTL8366_SMI=y
+# CONFIG_RTL8366_SMI_DEBUG_FS is not set
 CONFIG_SCHED_OMIT_FRAME_POINTER=y
 # CONFIG_SCSI_DMA is not set
 # CONFIG_SERIAL_8250_EXTENDED is not set
diff --git a/target/linux/ar71xx/config-2.6.32 b/target/linux/ar71xx/config-2.6.32
index 8c958af491..8077926b6d 100644
--- a/target/linux/ar71xx/config-2.6.32
+++ b/target/linux/ar71xx/config-2.6.32
@@ -193,6 +193,7 @@ CONFIG_PHYLIB=y
 # CONFIG_PROBE_INITRD_HEADER is not set
 CONFIG_RTL8306_PHY=y
 CONFIG_RTL8366_SMI=y
+# CONFIG_RTL8366_SMI_DEBUG_FS is not set
 CONFIG_SCHED_OMIT_FRAME_POINTER=y
 # CONFIG_SCSI_DMA is not set
 # CONFIG_SERIAL_8250_EXTENDED is not set
diff --git a/target/linux/ar71xx/files/drivers/net/phy/rtl8366_smi.c b/target/linux/ar71xx/files/drivers/net/phy/rtl8366_smi.c
index 1043b3d44e..a6ca06e67c 100644
--- a/target/linux/ar71xx/files/drivers/net/phy/rtl8366_smi.c
+++ b/target/linux/ar71xx/files/drivers/net/phy/rtl8366_smi.c
@@ -21,9 +21,7 @@
 #include <linux/phy.h>
 #include <linux/rtl8366_smi.h>
 
-/* #define DEBUG 1 */
-
-#ifdef DEBUG
+#ifdef CONFIG_RTL8366_SMI_DEBUG_FS
 #include <linux/debugfs.h>
 #endif
 
@@ -210,12 +208,12 @@ struct rtl8366_smi {
 	struct switch_dev                  dev;
 	int				   mii_irq[PHY_MAX_ADDR];
 	char buf[4096];
-#ifdef DEBUG
+#ifdef CONFIG_RTL8366_SMI_DEBUG_FS
 	struct dentry                      *debugfs_root;
 #endif
 };
 
-#ifdef DEBUG
+#ifdef CONFIG_RTL8366_SMI_DEBUG_FS
 u16 g_dbg_reg;
 #endif
 
@@ -972,7 +970,7 @@ static int rtl8366s_reset_vlan(struct rtl8366_smi *smi)
 	return 0;
 }
 
-#ifdef DEBUG
+#ifdef CONFIG_RTL8366_SMI_DEBUG_FS
 static int rtl8366_debugfs_open(struct inode *inode, struct file *file)
 {
 	file->private_data = inode->i_private;
@@ -1197,7 +1195,7 @@ static void rtl8366_debugfs_remove(struct rtl8366_smi *smi)
 #else
 static inline void rtl8366_debugfs_init(struct rtl8366_smi *smi) {}
 static inline void rtl8366_debugfs_remove(struct rtl8366_smi *smi) {}
-#endif
+#endif /* CONFIG_RTL8366_SMI_DEBUG_FS */
 
 static int rtl8366_global_reset_mibs(struct switch_dev *dev,
 				     const struct switch_attr *attr,
diff --git a/target/linux/ar71xx/patches-2.6.30/204-rtl8366-smi-driver.patch b/target/linux/ar71xx/patches-2.6.30/204-rtl8366-smi-driver.patch
index 77874b49f6..23dc525ece 100644
--- a/target/linux/ar71xx/patches-2.6.30/204-rtl8366-smi-driver.patch
+++ b/target/linux/ar71xx/patches-2.6.30/204-rtl8366-smi-driver.patch
@@ -1,12 +1,18 @@
 --- a/drivers/net/phy/Kconfig
 +++ b/drivers/net/phy/Kconfig
-@@ -140,4 +140,8 @@ config MDIO_GPIO
+@@ -140,4 +140,14 @@ config MDIO_GPIO
  	  To compile this driver as a module, choose M here: the module
  	  will be called mdio-gpio.
  
 +config RTL8366_SMI
 +	tristate "Support for RTL8366 switch via SMI interface"
 +	depends on GENERIC_GPIO
++
++config RTL8366_SMI_DEBUG_FS
++	bool "RTL8366S driver DEBUG_FS support"
++	depends on RTL8366_SMI
++	depends on DEBUG_FS
++	default n
 +
  endif # PHYLIB
 --- a/drivers/net/phy/Makefile
diff --git a/target/linux/ar71xx/patches-2.6.31/204-rtl8366-smi-driver.patch b/target/linux/ar71xx/patches-2.6.31/204-rtl8366-smi-driver.patch
index 77874b49f6..23dc525ece 100644
--- a/target/linux/ar71xx/patches-2.6.31/204-rtl8366-smi-driver.patch
+++ b/target/linux/ar71xx/patches-2.6.31/204-rtl8366-smi-driver.patch
@@ -1,12 +1,18 @@
 --- a/drivers/net/phy/Kconfig
 +++ b/drivers/net/phy/Kconfig
-@@ -140,4 +140,8 @@ config MDIO_GPIO
+@@ -140,4 +140,14 @@ config MDIO_GPIO
  	  To compile this driver as a module, choose M here: the module
  	  will be called mdio-gpio.
  
 +config RTL8366_SMI
 +	tristate "Support for RTL8366 switch via SMI interface"
 +	depends on GENERIC_GPIO
++
++config RTL8366_SMI_DEBUG_FS
++	bool "RTL8366S driver DEBUG_FS support"
++	depends on RTL8366_SMI
++	depends on DEBUG_FS
++	default n
 +
  endif # PHYLIB
 --- a/drivers/net/phy/Makefile
diff --git a/target/linux/ar71xx/patches-2.6.32/204-rtl8366-smi-driver.patch b/target/linux/ar71xx/patches-2.6.32/204-rtl8366-smi-driver.patch
index 78ec2e44c0..383513cda7 100644
--- a/target/linux/ar71xx/patches-2.6.32/204-rtl8366-smi-driver.patch
+++ b/target/linux/ar71xx/patches-2.6.32/204-rtl8366-smi-driver.patch
@@ -1,12 +1,18 @@
 --- a/drivers/net/phy/Kconfig
 +++ b/drivers/net/phy/Kconfig
-@@ -146,4 +146,8 @@ config MDIO_GPIO
+@@ -146,4 +146,14 @@ config MDIO_GPIO
  	  To compile this driver as a module, choose M here: the module
  	  will be called mdio-gpio.
  
 +config RTL8366_SMI
 +	tristate "Support for RTL8366 switch via SMI interface"
 +	depends on GENERIC_GPIO
++
++config RTL8366_SMI_DEBUG_FS
++	bool "RTL8366S driver DEBUG_FS support"
++	depends on RTL8366_SMI
++	depends on DEBUG_FS
++	default n
 +
  endif # PHYLIB
 --- a/drivers/net/phy/Makefile
-- 
GitLab