Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions cli/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ int switchtec_handler(const char *optarg, void *value_addr,
const struct argconfig_options *opt);
int mfg_handler(const char *optarg, void *value_addr,
const struct argconfig_options *opt);
int pax_handler(const char *optarg, void *value_addr,
const struct argconfig_options *opt);
enum switchtec_fw_type check_and_print_fw_image(int img_fd,
const char *img_filename);

Expand Down Expand Up @@ -73,16 +71,7 @@ enum switchtec_fw_type check_and_print_fw_image(int img_fd,
required_positional)

#define __DEVICE_OPTION(type) \
DEVICE_OPTION_BASIC(UART_HELP_TEXT, switchtec_handler, (type)), \
{ \
"pax", 'x', .cfg_type=CFG_CUSTOM, \
.value_addr=&cfg.dev, \
.argument_type=required_argument, \
.custom_handler=pax_handler, \
.env="SWITCHTEC_PAX", \
.help="PAX ID within a PAX fabric. Only valid on " \
"Switchtec PAX devices" \
}
DEVICE_OPTION_BASIC(UART_HELP_TEXT, switchtec_handler, (type))

#define DEVICE_OPTION __DEVICE_OPTION(required_positional)
#define DEVICE_OPTION_OPTIONAL __DEVICE_OPTION(optional_positional)
Expand Down
24 changes: 0 additions & 24 deletions cli/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,30 +122,6 @@ int mfg_handler(const char *optarg, void *value_addr,
return switchtec_handler(optarg, value_addr, opt);
}

int pax_handler(const char *optarg, void *value_addr,
const struct argconfig_options *opt)
{
char *end;
long num;

errno = 0;
num = strtol(optarg, &end, 0);
global_pax_id = num;

if ((end == optarg) || errno || num < 0 ||
(global_pax_id & ~SWITCHTEC_PAX_ID_MASK)) {
fprintf(stderr, "Invalid PAX ID specified: %s\n", optarg);
return 1;
}

if (set_global_pax_id()) {
fprintf(stderr, "%s: Setting PAX ID is not supported.\n", optarg);
return 4;
}

return 0;
}

#define CMD_DESC_LIST "list all Switchtec devices on this machine"

static int list(int argc, char **argv)
Expand Down