From 55cb7bc2468a442c10294ee396dff0ebf3ed007f Mon Sep 17 00:00:00 2001 From: Florian Pose Date: Wed, 15 Jul 2026 10:42:14 +0200 Subject: [PATCH] Accepted some cpplint suggestions. --- master/master.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/master/master.c b/master/master.c index c0c89ce0..09768f13 100644 --- a/master/master.c +++ b/master/master.c @@ -53,7 +53,8 @@ #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) || \ - (defined(CONFIG_PREEMPT_RT_FULL) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) + (defined(CONFIG_PREEMPT_RT_FULL) && \ + LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) # define ec_rt_lock_interruptible(lock) \ rt_mutex_lock_interruptible(lock) #else @@ -65,15 +66,15 @@ #define smp_store_release(p, v) \ do { \ - smp_mb(); \ - ACCESS_ONCE(*p) = (v); \ + smp_mb(); \ + ACCESS_ONCE(*p) = (v); \ } while (0) -#define smp_load_acquire(p) \ +#define smp_load_acquire(p) \ ({ \ - typeof(*p) ___p1 = ACCESS_ONCE(*p); \ - smp_mb(); \ - ___p1; \ + typeof(*p) ___p1 = ACCESS_ONCE(*p); \ + smp_mb(); \ + ___p1; \ }) #endif @@ -614,8 +615,9 @@ int ec_master_thread_start( return err; } if (0xffffffff != master->run_on_cpu) { - EC_MASTER_INFO(master, " binding thread to cpu %u\n",master->run_on_cpu); - kthread_bind(master->thread,master->run_on_cpu); + EC_MASTER_INFO(master, " binding thread to cpu %u\n", + master->run_on_cpu); + kthread_bind(master->thread, master->run_on_cpu); } /* Ignoring return value of wake_up_process */ (void) wake_up_process(master->thread); @@ -1072,8 +1074,8 @@ void ec_master_send_datagrams( } // EtherCAT datagram header - EC_WRITE_U8 (cur_data, datagram->type); - EC_WRITE_U8 (cur_data + 1, datagram->index); + EC_WRITE_U8(cur_data, datagram->type); + EC_WRITE_U8(cur_data + 1, datagram->index); memcpy(cur_data + 2, datagram->address, EC_ADDR_LEN); EC_WRITE_U16(cur_data + 6, datagram->data_size & 0x7FF); EC_WRITE_U16(cur_data + 8, 0x0000); @@ -1195,8 +1197,8 @@ void ec_master_receive_datagrams( cmd_follows = 1; while (cmd_follows) { // process datagram header - datagram_type = EC_READ_U8 (cur_data); - datagram_index = EC_READ_U8 (cur_data + 1); + datagram_type = EC_READ_U8(cur_data); + datagram_index = EC_READ_U8(cur_data + 1); data_size = EC_READ_U16(cur_data + 6) & 0x07FF; cmd_follows = EC_READ_U16(cur_data + 6) & 0x8000; cur_data += EC_DATAGRAM_HEADER_SIZE; @@ -1433,12 +1435,12 @@ void ec_master_nanosleep(const unsigned long nsecs) set_current_state(TASK_INTERRUPTIBLE); hrtimer_start(&t.timer, hrtimer_get_expires(&t.timer), mode); - if (likely(t.task)) + if (likely(t.task)) { schedule(); + } hrtimer_cancel(&t.timer); mode = HRTIMER_MODE_ABS; - } while (t.task && !signal_pending(current)); } @@ -1507,7 +1509,6 @@ void ec_master_exec_slave_fsms( while (master->fsm_exec_count < EC_EXT_RING_SIZE / 2 && count < master->slave_count) { - if (ec_fsm_slave_is_ready(&master->fsm_slave->fsm)) { datagram = ec_master_get_external_datagram(master); @@ -1627,7 +1628,6 @@ static int ec_master_operation_thread(void *priv_data) * https://gitlab.com/etherlab.org/ethercat/-/work_items/168 */ seq_rt = smp_load_acquire(&master->injection_seq_rt); if (seq_rt == master->injection_seq_fsm) { // was injected - // output statistics ec_master_output_stats(master); @@ -2105,7 +2105,6 @@ void ec_master_find_dc_ref_clock( break; } } - } master->dc_ref_clock = ref; @@ -2416,7 +2415,6 @@ int ecrt_master_deactivate(ec_master_t *master) for (slave = master->slaves; slave < master->slaves + master->slave_count; slave++) { - // set states for all slaves ec_slave_request_state(slave, EC_SLAVE_STATE_PREOP);