Skip to content

Commit

Permalink
rename user_arg to user_data
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Mar 17, 2022
1 parent 9dd2f11 commit f89ff93
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 85 deletions.
2 changes: 1 addition & 1 deletion src/class/cdc/cdc_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ bool tuh_cdc_set_control_line_state(uint8_t dev_addr, bool dtr, bool rts, tuh_xf
.setup = &request,
.buffer = NULL,
.complete_cb = complete_cb,
.user_arg = 0
.user_data = 0
};

return tuh_control_xfer(dev_addr, &xfer);
Expand Down
18 changes: 9 additions & 9 deletions src/class/hid/hid_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static void set_protocol_complete(uint8_t dev_addr, tuh_xfer_t* xfer)
}


static bool _hidh_set_protocol(uint8_t dev_addr, uint8_t itf_num, uint8_t protocol, tuh_xfer_cb_t complete_cb, uintptr_t user_arg)
static bool _hidh_set_protocol(uint8_t dev_addr, uint8_t itf_num, uint8_t protocol, tuh_xfer_cb_t complete_cb, uintptr_t user_data)
{
TU_LOG2("HID Set Protocol = %d\r\n", protocol);

Expand All @@ -145,7 +145,7 @@ static bool _hidh_set_protocol(uint8_t dev_addr, uint8_t itf_num, uint8_t protoc
.setup = &request,
.buffer = NULL,
.complete_cb = complete_cb,
.user_arg = user_arg
.user_data = user_data
};

TU_ASSERT( tuh_control_xfer(dev_addr, &xfer) );
Expand Down Expand Up @@ -202,14 +202,14 @@ bool tuh_hid_set_report(uint8_t dev_addr, uint8_t instance, uint8_t report_id, u
.setup = &request,
.buffer = report,
.complete_cb = set_report_complete,
.user_arg = 0
.user_data = 0
};

TU_ASSERT( tuh_control_xfer(dev_addr, &xfer) );
return true;
}

static bool _hidh_set_idle(uint8_t dev_addr, uint8_t itf_num, uint16_t idle_rate, tuh_xfer_cb_t complete_cb, uintptr_t user_arg)
static bool _hidh_set_idle(uint8_t dev_addr, uint8_t itf_num, uint16_t idle_rate, tuh_xfer_cb_t complete_cb, uintptr_t user_data)
{
// SET IDLE request, device can stall if not support this request
TU_LOG2("HID Set Idle \r\n");
Expand All @@ -233,7 +233,7 @@ static bool _hidh_set_idle(uint8_t dev_addr, uint8_t itf_num, uint16_t idle_rate
.setup = &request,
.buffer = NULL,
.complete_cb = complete_cb,
.user_arg = user_arg
.user_data = user_data
};

TU_ASSERT( tuh_control_xfer(dev_addr, &xfer) );
Expand Down Expand Up @@ -397,9 +397,9 @@ bool hidh_set_config(uint8_t dev_addr, uint8_t itf_num)
request.wIndex = tu_htole16((uint16_t) itf_num);

tuh_xfer_t xfer;
xfer.result = XFER_RESULT_SUCCESS;
xfer.setup = &request;
xfer.user_arg = CONFG_SET_IDLE;
xfer.result = XFER_RESULT_SUCCESS;
xfer.setup = &request;
xfer.user_data = CONFG_SET_IDLE;

// fake request to kick-off the set config process
process_set_config(dev_addr, &xfer);
Expand All @@ -415,7 +415,7 @@ static void process_set_config(uint8_t dev_addr, tuh_xfer_t* xfer)
TU_ASSERT(xfer->result == XFER_RESULT_SUCCESS, );
}

uintptr_t const state = xfer->user_arg;
uintptr_t const state = xfer->user_data;
uint8_t const itf_num = (uint8_t) tu_le16toh(xfer->setup->wIndex);
uint8_t const instance = get_instance_id_by_itfnum(dev_addr, itf_num);
hidh_interface_t* hid_itf = get_instance(dev_addr, instance);
Expand Down
2 changes: 1 addition & 1 deletion src/class/msc/msc_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ bool msch_set_config(uint8_t dev_addr, uint8_t itf_num)
.setup = &request,
.buffer = &p_msc->max_lun,
.complete_cb = config_get_maxlun_complete,
.user_arg = 0
.user_data = 0
};
TU_ASSERT(tuh_control_xfer(dev_addr, &xfer));

Expand Down
14 changes: 7 additions & 7 deletions src/host/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static char const* const _hub_feature_str[] =
// HUB
//--------------------------------------------------------------------+
bool hub_port_clear_feature(uint8_t hub_addr, uint8_t hub_port, uint8_t feature,
tuh_xfer_cb_t complete_cb, uintptr_t user_arg)
tuh_xfer_cb_t complete_cb, uintptr_t user_data)
{
tusb_control_request_t const request =
{
Expand All @@ -100,7 +100,7 @@ bool hub_port_clear_feature(uint8_t hub_addr, uint8_t hub_port, uint8_t feature,
.setup = &request,
.buffer = NULL,
.complete_cb = complete_cb,
.user_arg = user_arg
.user_data = user_data
};

TU_LOG2("HUB Clear Feature: %s, addr = %u port = %u\r\n", _hub_feature_str[feature], hub_addr, hub_port);
Expand All @@ -109,7 +109,7 @@ bool hub_port_clear_feature(uint8_t hub_addr, uint8_t hub_port, uint8_t feature,
}

bool hub_port_set_feature(uint8_t hub_addr, uint8_t hub_port, uint8_t feature,
tuh_xfer_cb_t complete_cb, uintptr_t user_arg)
tuh_xfer_cb_t complete_cb, uintptr_t user_data)
{
tusb_control_request_t const request =
{
Expand All @@ -131,7 +131,7 @@ bool hub_port_set_feature(uint8_t hub_addr, uint8_t hub_port, uint8_t feature,
.setup = &request,
.buffer = NULL,
.complete_cb = complete_cb,
.user_arg = user_arg
.user_data = user_data
};

TU_LOG2("HUB Set Feature: %s, addr = %u port = %u\r\n", _hub_feature_str[feature], hub_addr, hub_port);
Expand All @@ -140,7 +140,7 @@ bool hub_port_set_feature(uint8_t hub_addr, uint8_t hub_port, uint8_t feature,
}

bool hub_port_get_status(uint8_t hub_addr, uint8_t hub_port, void* resp,
tuh_xfer_cb_t complete_cb, uintptr_t user_arg)
tuh_xfer_cb_t complete_cb, uintptr_t user_data)
{
tusb_control_request_t const request =
{
Expand All @@ -162,7 +162,7 @@ bool hub_port_get_status(uint8_t hub_addr, uint8_t hub_port, void* resp,
.setup = &request,
.buffer = resp,
.complete_cb = complete_cb,
.user_arg = user_arg
.user_data = user_data
};

TU_LOG2("HUB Get Port Status: addr = %u port = %u\r\n", hub_addr, hub_port);
Expand Down Expand Up @@ -254,7 +254,7 @@ bool hub_set_config(uint8_t dev_addr, uint8_t itf_num)
.setup = &request,
.buffer = _hub_buffer,
.complete_cb = config_set_port_power,
.user_arg = 0
.user_data = 0
};

TU_ASSERT( tuh_control_xfer(dev_addr, &xfer) );
Expand Down
14 changes: 7 additions & 7 deletions src/host/hub.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,31 +173,31 @@ TU_VERIFY_STATIC( sizeof(hub_port_status_response_t) == 4, "size is not correct"

// Clear feature
bool hub_port_clear_feature (uint8_t hub_addr, uint8_t hub_port, uint8_t feature,
tuh_xfer_cb_t complete_cb, uintptr_t user_arg);
tuh_xfer_cb_t complete_cb, uintptr_t user_data);

// Set feature
bool hub_port_set_feature (uint8_t hub_addr, uint8_t hub_port, uint8_t feature,
tuh_xfer_cb_t complete_cb, uintptr_t user_arg);
tuh_xfer_cb_t complete_cb, uintptr_t user_data);

// Get port status
bool hub_port_get_status (uint8_t hub_addr, uint8_t hub_port, void* resp,
tuh_xfer_cb_t complete_cb, uintptr_t user_arg);
tuh_xfer_cb_t complete_cb, uintptr_t user_data);

// Get status from Interrupt endpoint
bool hub_edpt_status_xfer(uint8_t dev_addr);

// Reset a port
static inline bool hub_port_reset(uint8_t hub_addr, uint8_t hub_port,
tuh_xfer_cb_t complete_cb, uintptr_t user_arg)
tuh_xfer_cb_t complete_cb, uintptr_t user_data)
{
return hub_port_set_feature(hub_addr, hub_port, HUB_FEATURE_PORT_RESET, complete_cb, user_arg);
return hub_port_set_feature(hub_addr, hub_port, HUB_FEATURE_PORT_RESET, complete_cb, user_data);
}

// Clear Reset Change
static inline bool hub_port_clear_reset_change(uint8_t hub_addr, uint8_t hub_port,
tuh_xfer_cb_t complete_cb, uintptr_t user_arg)
tuh_xfer_cb_t complete_cb, uintptr_t user_data)
{
return hub_port_clear_feature(hub_addr, hub_port, HUB_FEATURE_PORT_RESET_CHANGE, complete_cb, user_arg);
return hub_port_clear_feature(hub_addr, hub_port, HUB_FEATURE_PORT_RESET_CHANGE, complete_cb, user_data);
}


Expand Down
Loading

0 comments on commit f89ff93

Please sign in to comment.