Browse Source

[ifmgmt] Optimise prototype for ifcommon_exec()

ifcommon_exec() was long-ago marked as __attribute__((regparm(2))) in
order to minimise the size of functions that call into it.  Since
then, gPXE has added -mregparm=3 as a general compilation option, and
this "optimisation" is now counter-productive.

Change (and simplify) the prototype to minimise code size given the
current compilation conditions.
tags/v0.9.8
Michael Brown 15 years ago
parent
commit
6e564323e0
2 changed files with 12 additions and 12 deletions
  1. 9
    9
      src/hci/commands/ifmgmt_cmd.c
  2. 3
    3
      src/hci/commands/ifmgmt_cmd.h

+ 9
- 9
src/hci/commands/ifmgmt_cmd.c View File

@@ -98,15 +98,15 @@ static int ifcommon_do_list ( int ( * payload ) ( struct net_device * ),
98 98
 /**
99 99
  * Execute if<xxx> command
100 100
  *
101
- * @v payload		Command to execute
102
- * @v verb		Verb describing the action of the command
103 101
  * @v argc		Argument count
104 102
  * @v argv		Argument list
103
+ * @v payload		Command to execute
104
+ * @v verb		Verb describing the action of the command
105 105
  * @ret rc		Exit code
106 106
  */
107
-__attribute__ (( regparm ( 2 ) )) int
108
-ifcommon_exec ( int ( * payload ) ( struct net_device * ),
109
-		const char *verb, int argc, char **argv ) {
107
+int ifcommon_exec ( int argc, char **argv,
108
+		    int ( * payload ) ( struct net_device * ),
109
+		    const char *verb ) {
110 110
 	int c;
111 111
 
112 112
 	/* Parse options */
@@ -137,7 +137,7 @@ static int ifopen_payload ( struct net_device *netdev ) {
137 137
 }
138 138
 
139 139
 static int ifopen_exec ( int argc, char **argv ) {
140
-	return ifcommon_exec ( ifopen_payload, "Open", argc, argv );
140
+	return ifcommon_exec ( argc, argv, ifopen_payload, "Open" );
141 141
 }
142 142
 
143 143
 /* "ifclose" command */
@@ -148,7 +148,7 @@ static int ifclose_payload ( struct net_device *netdev ) {
148 148
 }
149 149
 
150 150
 static int ifclose_exec ( int argc, char **argv ) {
151
-	return ifcommon_exec ( ifclose_payload, "Close", argc, argv );
151
+	return ifcommon_exec ( argc, argv, ifclose_payload, "Close" );
152 152
 }
153 153
 
154 154
 /* "ifstat" command */
@@ -159,8 +159,8 @@ static int ifstat_payload ( struct net_device *netdev ) {
159 159
 }
160 160
 
161 161
 static int ifstat_exec ( int argc, char **argv ) {
162
-	return ifcommon_exec ( ifstat_payload, "Display status of",
163
-			       argc, argv );
162
+	return ifcommon_exec ( argc, argv,
163
+			       ifstat_payload, "Display status of" );
164 164
 }
165 165
 
166 166
 /** Interface management commands */

+ 3
- 3
src/hci/commands/ifmgmt_cmd.h View File

@@ -23,8 +23,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
23 23
 
24 24
 struct net_device;
25 25
 
26
-extern int ifcommon_exec ( int ( * payload ) ( struct net_device * ),
27
-			   const char *verb, int argc, char **argv )
28
-	__attribute__ (( regparm ( 2 ) ));
26
+extern int ifcommon_exec (  int argc, char **argv,
27
+			    int ( * payload ) ( struct net_device * ),
28
+			    const char *verb );
29 29
 
30 30
 #endif /* _IFMGMT_CMD_H */

Loading…
Cancel
Save