Skip to content

Commit

Permalink
[ifmgmt] Optimise prototype for ifcommon_exec()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Michael Brown committed Jun 28, 2009
1 parent ee1d315 commit 6e56432
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/hci/commands/ifmgmt_cmd.c
Expand Up @@ -98,15 +98,15 @@ static int ifcommon_do_list ( int ( * payload ) ( struct net_device * ),
/**
* Execute if<xxx> command
*
* @v payload Command to execute
* @v verb Verb describing the action of the command
* @v argc Argument count
* @v argv Argument list
* @v payload Command to execute
* @v verb Verb describing the action of the command
* @ret rc Exit code
*/
__attribute__ (( regparm ( 2 ) )) int
ifcommon_exec ( int ( * payload ) ( struct net_device * ),
const char *verb, int argc, char **argv ) {
int ifcommon_exec ( int argc, char **argv,
int ( * payload ) ( struct net_device * ),
const char *verb ) {
int c;

/* Parse options */
Expand Down Expand Up @@ -137,7 +137,7 @@ static int ifopen_payload ( struct net_device *netdev ) {
}

static int ifopen_exec ( int argc, char **argv ) {
return ifcommon_exec ( ifopen_payload, "Open", argc, argv );
return ifcommon_exec ( argc, argv, ifopen_payload, "Open" );
}

/* "ifclose" command */
Expand All @@ -148,7 +148,7 @@ static int ifclose_payload ( struct net_device *netdev ) {
}

static int ifclose_exec ( int argc, char **argv ) {
return ifcommon_exec ( ifclose_payload, "Close", argc, argv );
return ifcommon_exec ( argc, argv, ifclose_payload, "Close" );
}

/* "ifstat" command */
Expand All @@ -159,8 +159,8 @@ static int ifstat_payload ( struct net_device *netdev ) {
}

static int ifstat_exec ( int argc, char **argv ) {
return ifcommon_exec ( ifstat_payload, "Display status of",
argc, argv );
return ifcommon_exec ( argc, argv,
ifstat_payload, "Display status of" );
}

/** Interface management commands */
Expand Down
6 changes: 3 additions & 3 deletions src/hci/commands/ifmgmt_cmd.h
Expand Up @@ -23,8 +23,8 @@ FILE_LICENCE ( GPL2_OR_LATER );

struct net_device;

extern int ifcommon_exec ( int ( * payload ) ( struct net_device * ),
const char *verb, int argc, char **argv )
__attribute__ (( regparm ( 2 ) ));
extern int ifcommon_exec ( int argc, char **argv,
int ( * payload ) ( struct net_device * ),
const char *verb );

#endif /* _IFMGMT_CMD_H */

0 comments on commit 6e56432

Please sign in to comment.