[v2 10/15] Convert CONFIG_NFS_TIMEOUT to Kconfig

Tom Rini trini at konsulko.com
Fri Mar 11 15:12:05 CET 2022


This converts the following to Kconfig:
   CONFIG_NFS_TIMEOUT

Cc: Ramon Fried <rfried.dev at gmail.com>
Signed-off-by: Tom Rini <trini at konsulko.com>
---
 README                  | 7 -------
 cmd/Kconfig             | 9 +++++++++
 configs/kzm9g_defconfig | 1 +
 include/configs/kzm9g.h | 2 --
 net/nfs.c               | 9 ++-------
 5 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/README b/README
index 227eb29a8902..b8b508f8a9c1 100644
--- a/README
+++ b/README
@@ -1555,13 +1555,6 @@ The following options need to be configured:
 			FLAGADM
 
 - Error Recovery:
-		CONFIG_NFS_TIMEOUT
-
-		Timeout in milliseconds used in NFS protocol.
-		If you encounter "ERROR: Cannot umount" in nfs command,
-		try longer timeout such as
-		#define CONFIG_NFS_TIMEOUT 10000UL
-
 	Note:
 
 		In the current implementation, the local variables
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 1ed63fa06c1e..d2aa06ad9c30 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1638,6 +1638,15 @@ config CMD_NFS
 	help
 	  Boot image via network using NFS protocol.
 
+config NFS_TIMEOUT
+	int "Timeout in milliseconds for NFS mounts"
+	depends on CMD_NFS
+	default 2000
+	help
+	  Timeout in milliseconds used in NFS protocol.  If you encounter
+	  "ERROR: Cannot umount" in nfs command, try longer timeout such as
+	  10000.
+
 config CMD_MII
 	bool "mii"
 	imply CMD_MDIO
diff --git a/configs/kzm9g_defconfig b/configs/kzm9g_defconfig
index 867673f57358..e790072e539f 100644
--- a/configs/kzm9g_defconfig
+++ b/configs/kzm9g_defconfig
@@ -21,6 +21,7 @@ CONFIG_CMD_IMLS=y
 CONFIG_CMD_I2C=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
+CONFIG_NFS_TIMEOUT=10000
 CONFIG_CMD_PING=y
 CONFIG_CMD_FAT=y
 CONFIG_ENV_IS_IN_FLASH=y
diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
index 022858f69282..42f881b0be9f 100644
--- a/include/configs/kzm9g.h
+++ b/include/configs/kzm9g.h
@@ -71,6 +71,4 @@
 #define CONFIG_SH_SCIF_CLK_FREQ get_board_sys_clk()
 #define TMU_CLK_DIVIDER		(4)	/* 4 (default), 16, 64, 256 or 1024 */
 
-#define CONFIG_NFS_TIMEOUT 10000UL
-
 #endif /* __KZM9G_H */
diff --git a/net/nfs.c b/net/nfs.c
index 70d0e08bde92..3c01cebd96f8 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -40,11 +40,6 @@
 
 #define HASHES_PER_LINE 65	/* Number of "loading" hashes per line	*/
 #define NFS_RETRY_COUNT 30
-#ifndef CONFIG_NFS_TIMEOUT
-# define NFS_TIMEOUT 2000UL
-#else
-# define NFS_TIMEOUT CONFIG_NFS_TIMEOUT
-#endif
 
 #define NFS_RPC_ERR	1
 #define NFS_RPC_DROP	124
@@ -53,7 +48,7 @@ static int fs_mounted;
 static unsigned long rpc_id;
 static int nfs_offset = -1;
 static int nfs_len;
-static ulong nfs_timeout = NFS_TIMEOUT;
+static const ulong nfs_timeout = CONFIG_NFS_TIMEOUT;
 
 static char dirfh[NFS_FHSIZE];	/* NFSv2 / NFSv3 file handle of directory */
 static char filefh[NFS3_FHSIZE]; /* NFSv2 / NFSv3 file handle */
@@ -733,7 +728,7 @@ static void nfs_timeout_handler(void)
 	} else {
 		puts("T ");
 		net_set_timeout_handler(nfs_timeout +
-					NFS_TIMEOUT * nfs_timeout_count,
+					nfs_timeout * nfs_timeout_count,
 					nfs_timeout_handler);
 		nfs_send();
 	}
-- 
2.25.1



More information about the U-Boot mailing list