From 71069893536962157b3b25330851a1c2c7cd6da5 Mon Sep 17 00:00:00 2001 From: Dawid Niedzwiecki Date: Wed, 28 Oct 2020 10:02:32 +0100 Subject: atomic: rename atomic_read_clear to atomic_clear Rename atomic_read_clear to atomic_clear to be consistent with the rest of the atomic functions, which return the previous value of the variable. BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Dawid Niedzwiecki Change-Id: I2588971bd7687879a28ec637cf5f6c3d27d393f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2505143 Reviewed-by: Tom Hughes Reviewed-by: Jett Rink Reviewed-by: Jack Rosenthal --- common/device_event.c | 2 +- common/fpsensor/fpsensor.c | 6 +++--- common/fpsensor/fpsensor_state.c | 2 +- common/motion_sense.c | 4 ++-- common/usb_common.c | 4 ++-- common/usb_pd_host_cmd.c | 2 +- common/usb_pd_protocol.c | 2 +- common/usbc/usb_tc_drp_acc_trysrc_sm.c | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) (limited to 'common') diff --git a/common/device_event.c b/common/device_event.c index ca13a58574..5e6ca049e9 100644 --- a/common/device_event.c +++ b/common/device_event.c @@ -27,7 +27,7 @@ uint32_t device_get_current_events(void) static uint32_t device_get_and_clear_events(void) { - return atomic_read_clear(&device_current_events); + return atomic_clear(&device_current_events); } static uint32_t device_get_enabled_events(void) diff --git a/common/fpsensor/fpsensor.c b/common/fpsensor/fpsensor.c index 2e88319b5d..6b782845f2 100644 --- a/common/fpsensor/fpsensor.c +++ b/common/fpsensor/fpsensor.c @@ -787,7 +787,7 @@ int command_fpenroll(int argc, char **argv) FP_MODE_ENROLL_IMAGE); if (rc != EC_SUCCESS) break; - event = atomic_read_clear(&fp_events); + event = atomic_clear(&fp_events); percent = EC_MKBP_FP_ENROLL_PROGRESS(event); CPRINTS("Enroll capture: %s (%d%%)", enroll_str[EC_MKBP_FP_ERRCODE(event) & 3], percent); @@ -810,7 +810,7 @@ DECLARE_CONSOLE_COMMAND_FLAGS(fpenroll, command_fpenroll, NULL, int command_fpmatch(int argc, char **argv) { enum ec_error_list rc = fp_console_action(FP_MODE_MATCH); - uint32_t event = atomic_read_clear(&fp_events); + uint32_t event = atomic_clear(&fp_events); if (rc == EC_SUCCESS && event & EC_MKBP_FP_MATCH) { uint32_t errcode = EC_MKBP_FP_ERRCODE(event); @@ -836,7 +836,7 @@ int command_fpclear(int argc, char **argv) if (rc < 0) CPRINTS("Failed to clear fingerprint context: %d", rc); - atomic_read_clear(&fp_events); + atomic_clear(&fp_events); return rc; } diff --git a/common/fpsensor/fpsensor_state.c b/common/fpsensor/fpsensor_state.c index ec4ddb4fd9..70568d8ec4 100644 --- a/common/fpsensor/fpsensor_state.c +++ b/common/fpsensor/fpsensor_state.c @@ -100,7 +100,7 @@ void fp_reset_and_clear_context(void) int fp_get_next_event(uint8_t *out) { - uint32_t event_out = atomic_read_clear(&fp_events); + uint32_t event_out = atomic_clear(&fp_events); memcpy(out, &event_out, sizeof(event_out)); diff --git a/common/motion_sense.c b/common/motion_sense.c index 6feed6738d..2869f93984 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -677,7 +677,7 @@ static int motion_sense_process(struct motion_sensor_t *sensor, if (*event & TASK_EVENT_MOTION_ODR_CHANGE) { const int sensor_bit = 1 << sensor_num; - int odr_pending = atomic_read_clear(&odr_event_required); + int odr_pending = atomic_clear(&odr_event_required); is_odr_pending = odr_pending & sensor_bit; odr_pending &= ~sensor_bit; @@ -707,7 +707,7 @@ static int motion_sense_process(struct motion_sensor_t *sensor, } if (IS_ENABLED(CONFIG_ACCEL_FIFO) && *event & TASK_EVENT_MOTION_FLUSH_PENDING) { - int flush_pending = atomic_read_clear(&sensor->flush_pending); + int flush_pending = atomic_clear(&sensor->flush_pending); for (; flush_pending > 0; flush_pending--) { motion_sense_fifo_insert_async_event( diff --git a/common/usb_common.c b/common/usb_common.c index 7053607433..c9100d15ad 100644 --- a/common/usb_common.c +++ b/common/usb_common.c @@ -468,7 +468,7 @@ static uint32_t port_oc_reset_req; static void re_enable_ports(void) { - uint32_t ports = atomic_read_clear(&port_oc_reset_req); + uint32_t ports = atomic_clear(&port_oc_reset_req); while (ports) { int port = __fls(ports); @@ -747,7 +747,7 @@ static uint32_t pd_ports_to_resume; static void resume_pd_port(void) { uint32_t port; - uint32_t suspended_ports = atomic_read_clear(&pd_ports_to_resume); + uint32_t suspended_ports = atomic_clear(&pd_ports_to_resume); while (suspended_ports) { port = __builtin_ctz(suspended_ports); diff --git a/common/usb_pd_host_cmd.c b/common/usb_pd_host_cmd.c index b9458bca67..11174ee7d4 100644 --- a/common/usb_pd_host_cmd.c +++ b/common/usb_pd_host_cmd.c @@ -611,7 +611,7 @@ hc_pd_host_event_status(struct host_cmd_handler_args *args) struct ec_response_host_event_status *r = args->response; /* Read and clear the host event status to return to AP */ - r->status = atomic_read_clear(&pd_host_event_status); + r->status = atomic_clear(&pd_host_event_status); args->response_size = sizeof(*r); return EC_RES_SUCCESS; diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index be17b187e8..4b1a79d07c 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -534,7 +534,7 @@ static int reset_device_and_notify(int port) atomic_clear_bits(task_get_event_bitmap(task_get_current()), PD_EVENT_TCPC_RESET); - waiting_tasks = atomic_read_clear(&pd[port].tasks_waiting_on_reset); + waiting_tasks = atomic_clear(&pd[port].tasks_waiting_on_reset); /* * Now that we are done waking up the device, handle device access diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c index 4785aa9b91..05e5f2ec94 100644 --- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c +++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c @@ -1779,7 +1779,7 @@ static __maybe_unused int reset_device_and_notify(int port) atomic_clear_bits(task_get_event_bitmap(task_get_current()), PD_EVENT_TCPC_RESET); - waiting_tasks = atomic_read_clear(&tc[port].tasks_waiting_on_reset); + waiting_tasks = atomic_clear(&tc[port].tasks_waiting_on_reset); /* Wake up all waiting tasks. */ while (waiting_tasks) { -- cgit v1.2.1