Browse Source

Place netdev_open()/netdev_close() calls in appropriate places.

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
cbd956535e
1 changed files with 24 additions and 8 deletions
  1. 24
    8
      src/interface/pxe/pxe_undi.c

+ 24
- 8
src/interface/pxe/pxe_undi.c View File

@@ -49,6 +49,24 @@
49 49
  */
50 50
 static int undi_tx_count = 0;
51 51
 
52
+/**
53
+ * Open PXE network device
54
+ *
55
+ * @ret rc		Return status code
56
+ */
57
+static int pxe_netdev_open ( void ) {
58
+	return netdev_open ( pxe_netdev );
59
+}
60
+
61
+/**
62
+ * Close PXE network device
63
+ *
64
+ */
65
+static void pxe_netdev_close ( void ) {
66
+	netdev_close ( pxe_netdev );
67
+	undi_tx_count = 0;
68
+}
69
+
52 70
 /* PXENV_UNDI_STARTUP
53 71
  *
54 72
  * Status: working
@@ -67,7 +85,7 @@ PXENV_EXIT_t pxenv_undi_startup ( struct s_PXENV_UNDI_STARTUP *undi_startup ) {
67 85
 PXENV_EXIT_t pxenv_undi_cleanup ( struct s_PXENV_UNDI_CLEANUP *undi_cleanup ) {
68 86
 	DBG ( "PXENV_UNDI_CLEANUP" );
69 87
 
70
-	netdev_close ( pxe_netdev );
88
+	pxe_netdev_close();
71 89
 
72 90
 	undi_cleanup->Status = PXENV_STATUS_SUCCESS;
73 91
 	return PXENV_EXIT_SUCCESS;
@@ -95,9 +113,8 @@ PXENV_EXIT_t pxenv_undi_reset_adapter ( struct s_PXENV_UNDI_RESET
95 113
 
96 114
 	DBG ( "PXENV_UNDI_RESET_ADAPTER" );
97 115
 
98
-	netdev_close ( pxe_netdev );
99
-	undi_tx_count = 0;
100
-	if ( ( rc = netdev_open ( pxe_netdev ) ) != 0 ) {
116
+	pxe_netdev_close();
117
+	if ( ( rc = pxe_netdev_open() ) != 0 ) {
101 118
 		undi_reset_adapter->Status = PXENV_STATUS ( rc );
102 119
 		return PXENV_EXIT_FAILURE;
103 120
 	}
@@ -114,7 +131,7 @@ PXENV_EXIT_t pxenv_undi_shutdown ( struct s_PXENV_UNDI_SHUTDOWN
114 131
 				   *undi_shutdown ) {
115 132
 	DBG ( "PXENV_UNDI_SHUTDOWN" );
116 133
 
117
-	shutdown();
134
+	pxe_netdev_close();
118 135
 
119 136
 	undi_shutdown->Status = PXENV_STATUS_SUCCESS;
120 137
 	return PXENV_EXIT_SUCCESS;
@@ -129,7 +146,7 @@ PXENV_EXIT_t pxenv_undi_open ( struct s_PXENV_UNDI_OPEN *undi_open ) {
129 146
 
130 147
 	DBG ( "PXENV_UNDI_OPEN" );
131 148
 
132
-	if ( ( rc = netdev_open ( pxe_netdev ) ) != 0 ) {
149
+	if ( ( rc = pxe_netdev_open() ) != 0 ) {
133 150
 		undi_open->Status = PXENV_STATUS ( rc );
134 151
 		return PXENV_EXIT_FAILURE;
135 152
 	}
@@ -145,8 +162,7 @@ PXENV_EXIT_t pxenv_undi_open ( struct s_PXENV_UNDI_OPEN *undi_open ) {
145 162
 PXENV_EXIT_t pxenv_undi_close ( struct s_PXENV_UNDI_CLOSE *undi_close ) {
146 163
 	DBG ( "PXENV_UNDI_CLOSE" );
147 164
 
148
-	netdev_close ( pxe_netdev );
149
-	undi_tx_count = 0;
165
+	pxe_netdev_close();
150 166
 
151 167
 	undi_close->Status = PXENV_STATUS_SUCCESS;
152 168
 	return PXENV_EXIT_SUCCESS;

Loading…
Cancel
Save