From e744855f94f37388d4adb1f9a79077aca61ec71c Mon Sep 17 00:00:00 2001 From: Dawid Niedzwiecki Date: Wed, 24 Nov 2021 09:51:31 +0100 Subject: atomic: cast pointers to atomic_t* for atomic_* calls Some atomic_* calls use pointers to different types of variables than atomic_t. Cast those to atomic_t* to avoid compilation errors. It shouldn't change the generated code. BUG=b:207082842 TEST=make buildall && zmake testall && build_compare.sh -b all BRANCH=main Signed-off-by: Dawid Niedzwiecki Change-Id: I5d8e8eca7c5d7fe661c75bc75f82c49083c88be0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3300319 Reviewed-by: Keith Short Commit-Queue: Keith Short --- common/charge_manager.c | 4 ++-- common/keyboard_scan.c | 4 ++-- common/timer.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'common') diff --git a/common/charge_manager.c b/common/charge_manager.c index 3d41c3a08d..041f41f1bc 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -1388,9 +1388,9 @@ void charge_manager_source_port(int port, int enable) int p, rp; if (enable) - atomic_or((uint32_t *)&source_port_bitmap, 1 << port); + atomic_or((atomic_t *)&source_port_bitmap, 1 << port); else - atomic_clear_bits((uint32_t *)&source_port_bitmap, 1 << port); + atomic_clear_bits((atomic_t *)&source_port_bitmap, 1 << port); /* No change, exit early. */ if (prev_bitmap == source_port_bitmap) diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c index 071b441cfa..d192214f1e 100644 --- a/common/keyboard_scan.c +++ b/common/keyboard_scan.c @@ -140,9 +140,9 @@ void keyboard_scan_enable(int enable, enum kb_scan_disable_masks mask) { /* Access atomically */ if (enable) { - atomic_clear_bits((uint32_t *)&disable_scanning_mask, mask); + atomic_clear_bits((atomic_t *)&disable_scanning_mask, mask); } else { - atomic_or((uint32_t *)&disable_scanning_mask, mask); + atomic_or((atomic_t *)&disable_scanning_mask, mask); clear_typematic_key(); } diff --git a/common/timer.c b/common/timer.c index 0490741c4c..0cb0d97289 100644 --- a/common/timer.c +++ b/common/timer.c @@ -49,7 +49,7 @@ static int timer_irq; static void expire_timer(task_id_t tskid) { /* we are done with this timer */ - atomic_clear_bits(&timer_running, 1 << tskid); + atomic_clear_bits((atomic_t *)&timer_running, 1 << tskid); /* wake up the taks waiting for this timer */ task_set_event(tskid, TASK_EVENT_TIMER); } @@ -142,7 +142,7 @@ int timer_arm(timestamp_t event, task_id_t tskid) return EC_ERROR_BUSY; timer_deadline[tskid] = event; - atomic_or(&timer_running, BIT(tskid)); + atomic_or((atomic_t *)&timer_running, BIT(tskid)); /* Modify the next event if needed */ if ((event.le.hi < now.le.hi) || @@ -156,7 +156,7 @@ void timer_cancel(task_id_t tskid) { ASSERT(tskid < TASK_ID_COUNT); - atomic_clear_bits(&timer_running, BIT(tskid)); + atomic_clear_bits((atomic_t *)&timer_running, BIT(tskid)); /* * Don't need to cancel the hardware timer interrupt, instead do * timer-related housekeeping when the next timer interrupt fires. -- cgit v1.2.1