From patchwork Mon Mar 31 16:48:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 27500 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-fa0-f72.google.com (mail-fa0-f72.google.com [209.85.161.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3E98B20341 for ; Mon, 31 Mar 2014 16:48:17 +0000 (UTC) Received: by mail-fa0-f72.google.com with SMTP id m10sf17323541fae.11 for ; Mon, 31 Mar 2014 09:48:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:to:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe:content-type; bh=QxXBubKje1TLGSC5YIGb7Fk0q0F5+s3pVufzODDxgd8=; b=bTDRTvQIrp/2Myc86ZHA92kPdwXRCURg/e0Xw7NCifppGMpu2TyM2x4PtzfYSG6GD9 VIMOZL7XWxcz+gfFaMJQE+oTXC/rjZwshYnaLw9JuN337iEQPtFP77Mc2yX21xSlHelS r7HiuFLQxcpphwcAJy6oNIQ5MvEgsHEtc68yrv+KF8A+UDWTlmSWDS60Je5kAPQ58vqU CLpeRIRFd/X9prEP2qNzBotrM8d3/x7tq+zFJCCPkyNWkYB+e4uA1S1dyqVyMRviLHlB Dk1wmRe33QEvTbNCfgTeCVgkTIdxjOGHK4CvTuXyslPisnSi0rFA7Aaxv/0hcKG1kj5b XHjw== X-Gm-Message-State: ALoCoQkfRIpwPht9cbomxWJmAWbgpjC8idSR+MeH6rNBegfiA4QPmZdsXJ5RZU1ZmTw037s9lq1G X-Received: by 10.152.8.66 with SMTP id p2mr1796846laa.10.1396284496579; Mon, 31 Mar 2014 09:48:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: lng-odp@linaro.org Received: by 10.152.189.69 with SMTP id gg5ls368842lac.108.gmail; Mon, 31 Mar 2014 09:48:16 -0700 (PDT) X-Received: by 10.152.29.8 with SMTP id f8mr19576203lah.11.1396284496284; Mon, 31 Mar 2014 09:48:16 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by mx.google.com with ESMTPS id h4si9164171lae.4.2014.03.31.09.48.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 31 Mar 2014 09:48:16 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.217.173 is neither permitted nor denied by best guess record for domain of maxim.uvarov@linaro.org) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id p9so5942233lbv.4 for ; Mon, 31 Mar 2014 09:48:16 -0700 (PDT) X-Received: by 10.152.239.137 with SMTP id vs9mr967326lac.59.1396284496151; Mon, 31 Mar 2014 09:48:16 -0700 (PDT) Received: from maxim-lap.localhost.onion ([92.39.133.154]) by mx.google.com with ESMTPSA id oy7sm10262081lbb.16.2014.03.31.09.48.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 31 Mar 2014 09:48:15 -0700 (PDT) From: Maxim Uvarov To: lng-odp@linaro.org Subject: [lng-odp] [ODP/PATCH] code clean up and minor style fix Date: Mon, 31 Mar 2014 20:48:20 +0400 Message-Id: <1396284500-18327-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.217.173 is neither permitted nor denied by best guess record for domain of maxim.uvarov@linaro.org) smtp.mail=maxim.uvarov@linaro.org Precedence: list Mailing-list: list lng-odp@linaro.org; contact lng-odp+owners@linaro.org List-ID: X-Google-Group-Id: 474323889996 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Remove not needed empty lines and minor style clean up. Signed-off-by: Maxim Uvarov --- .../include/odp_buffer_pool_internal.h | 1 - platform/linux-generic/include/odp_internal.h | 7 ------ platform/linux-generic/include/odp_packet_socket.h | 2 -- .../linux-generic/include/odp_queue_internal.h | 1 - .../linux-generic/include/odp_schedule_internal.h | 2 -- platform/linux-generic/include/odp_spin_internal.h | 2 -- platform/linux-generic/source/odp_buffer.c | 11 --------- platform/linux-generic/source/odp_buffer_pool.c | 27 ++++------------------ platform/linux-generic/source/odp_coremask.c | 4 +--- platform/linux-generic/source/odp_linux.c | 7 ------ platform/linux-generic/source/odp_packet.c | 3 --- platform/linux-generic/source/odp_packet_flags.c | 5 ++-- platform/linux-generic/source/odp_queue.c | 13 ----------- platform/linux-generic/source/odp_rwlock.c | 2 -- platform/linux-generic/source/odp_shared_memory.c | 13 ----------- platform/linux-generic/source/odp_spinlock.c | 3 --- platform/linux-generic/source/odp_system_info.c | 9 -------- platform/linux-generic/source/odp_thread.c | 9 +------- platform/linux-generic/source/odp_timer.c | 12 ---------- 19 files changed, 8 insertions(+), 125 deletions(-) diff --git a/platform/linux-generic/include/odp_buffer_pool_internal.h b/platform/linux-generic/include/odp_buffer_pool_internal.h index 380de36..381482f 100644 --- a/platform/linux-generic/include/odp_buffer_pool_internal.h +++ b/platform/linux-generic/include/odp_buffer_pool_internal.h @@ -51,7 +51,6 @@ struct pool_entry_s { uint64_t free_bufs; char name[ODP_BUFFER_POOL_NAME_LEN]; - odp_buffer_pool_t pool ODP_ALIGNED_CACHE; uintptr_t buf_base; size_t buf_size; diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index ff34b5e..fb3be79 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -19,18 +19,14 @@ extern "C" { #endif - int odp_system_info_init(void); - void odp_thread_init_global(void); void odp_thread_init_local(int thr_id); - int odp_shm_init_global(void); int odp_shm_init_local(void); - int odp_buffer_pool_init_global(void); int odp_pktio_init_global(void); @@ -38,14 +34,11 @@ int odp_pktio_init_local(void); int odp_queue_init_global(void); - int odp_schedule_init_global(void); int odp_schedule_init_local(void); - int odp_timer_init_global(void); - #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h index fe216bb..4dea649 100644 --- a/platform/linux-generic/include/odp_packet_socket.h +++ b/platform/linux-generic/include/odp_packet_socket.h @@ -46,8 +46,6 @@ /** Max transmit (Tx) burst size*/ #define ODP_PACKET_SOCKET_MAX_BURST_TX 32 - - #if (ODP_PACKET_SOCKET_MODE == ODP_PACKET_SOCKET_BASIC) || \ (ODP_PACKET_SOCKET_MODE == ODP_PACKET_SOCKET_MMSG) diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h index fede56a..8b6c517 100644 --- a/platform/linux-generic/include/odp_queue_internal.h +++ b/platform/linux-generic/include/odp_queue_internal.h @@ -118,4 +118,3 @@ static inline queue_entry_t *queue_to_qentry(odp_queue_t handle) #endif #endif - diff --git a/platform/linux-generic/include/odp_schedule_internal.h b/platform/linux-generic/include/odp_schedule_internal.h index b0135c5..7b943bd 100644 --- a/platform/linux-generic/include/odp_schedule_internal.h +++ b/platform/linux-generic/include/odp_schedule_internal.h @@ -29,5 +29,3 @@ void odp_schedule_queue(odp_queue_t queue, int prio); #endif #endif - - diff --git a/platform/linux-generic/include/odp_spin_internal.h b/platform/linux-generic/include/odp_spin_internal.h index e70ccf1..1061e52 100644 --- a/platform/linux-generic/include/odp_spin_internal.h +++ b/platform/linux-generic/include/odp_spin_internal.h @@ -60,8 +60,6 @@ static inline void odp_spin(void) } - - #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/source/odp_buffer.c b/platform/linux-generic/source/odp_buffer.c index f5b02fd..f506d35 100644 --- a/platform/linux-generic/source/odp_buffer.c +++ b/platform/linux-generic/source/odp_buffer.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - #include #include #include @@ -13,10 +12,6 @@ #include - - - - void *odp_buffer_addr(odp_buffer_t buf) { odp_buffer_hdr_t *hdr = odp_buf_to_hdr(buf); @@ -105,7 +100,6 @@ int odp_buffer_snprint(char *str, size_t n, odp_buffer_t buf) } - void odp_buffer_print(odp_buffer_t buf) { int max_len = 512; @@ -117,8 +111,3 @@ void odp_buffer_print(odp_buffer_t buf) printf("\n%s\n", str); } - - - - - diff --git a/platform/linux-generic/source/odp_buffer_pool.c b/platform/linux-generic/source/odp_buffer_pool.c index fecdb18..90214ba 100644 --- a/platform/linux-generic/source/odp_buffer_pool.c +++ b/platform/linux-generic/source/odp_buffer_pool.c @@ -93,7 +93,6 @@ int odp_buffer_pool_init_global(void) memset(pool_tbl, 0, sizeof(pool_table_t)); - for (i = 0; i < ODP_CONFIG_BUFFER_POOLS; i++) { /* init locks */ pool_entry_t *pool = &pool_tbl->pool[i]; @@ -108,7 +107,6 @@ int odp_buffer_pool_init_global(void) ODP_DBG(" pool_entry_t size %zu\n", sizeof(pool_entry_t)); ODP_DBG(" odp_buffer_hdr_t size %zu\n", sizeof(odp_buffer_hdr_t)); ODP_DBG("\n"); - return 0; } @@ -118,7 +116,6 @@ static odp_buffer_hdr_t *index_to_hdr(pool_entry_t *pool, uint32_t index) odp_buffer_hdr_t *hdr; hdr = (odp_buffer_hdr_t *)(pool->s.buf_base + index * pool->s.buf_size); - return hdr; } @@ -139,7 +136,6 @@ static uint32_t rem_buf_index(odp_buffer_chunk_hdr_t *chunk_hdr) i = chunk_hdr->chunk.num_bufs - 1; index = chunk_hdr->chunk.buf_index[i]; chunk_hdr->chunk.num_bufs--; - return index; } @@ -150,7 +146,6 @@ static odp_buffer_chunk_hdr_t *next_chunk(pool_entry_t *pool, uint32_t index; index = chunk_hdr->chunk.buf_index[ODP_BUFS_PER_CHUNK-1]; - if (index == NULL_INDEX) return NULL; else @@ -163,19 +158,16 @@ static odp_buffer_chunk_hdr_t *rem_chunk(pool_entry_t *pool) odp_buffer_chunk_hdr_t *chunk_hdr; chunk_hdr = pool->s.head; - if (chunk_hdr == NULL) { /* Pool is empty */ return NULL; } pool->s.head = next_chunk(pool, chunk_hdr); - pool->s.free_bufs -= ODP_BUFS_PER_CHUNK; /* unlink */ rem_buf_index(chunk_hdr); - return chunk_hdr; } @@ -185,12 +177,10 @@ static void add_chunk(pool_entry_t *pool, odp_buffer_chunk_hdr_t *chunk_hdr) if (pool->s.head) { /* link pool head to the chunk */ add_buf_index(chunk_hdr, pool->s.head->buf_hdr.index); - } else { + } else add_buf_index(chunk_hdr, NULL_INDEX); - } pool->s.head = chunk_hdr; - pool->s.free_bufs += ODP_BUFS_PER_CHUNK; } @@ -255,24 +245,22 @@ static void link_bufs(pool_entry_t *pool) uintptr_t pool_base; int buf_type; - buf_type = pool->s.buf_type; payload_size = pool->s.payload_size; payload_align = pool->s.payload_align; pool_size = pool->s.pool_size; pool_base = (uintptr_t) pool->s.pool_base_addr; - if (buf_type == ODP_BUFFER_TYPE_RAW) { + if (buf_type == ODP_BUFFER_TYPE_RAW) hdr_size = sizeof(odp_buffer_hdr_t); - } else if (buf_type == ODP_BUFFER_TYPE_PACKET) { + else if (buf_type == ODP_BUFFER_TYPE_PACKET) hdr_size = sizeof(odp_packet_hdr_t); - } else { + else { ODP_ERR("odp_buffer_pool_create: Bad type %i\n", buf_type); exit(0); } - /* Chunk must fit into buffer payload.*/ min_size = sizeof(odp_buffer_chunk_hdr_t) - hdr_size; if (payload_size < min_size) @@ -291,7 +279,6 @@ static void link_bufs(pool_entry_t *pool) else size = payload_align + offset; - /* First buffer */ buf_base = ODP_ALIGN_ROUNDUP(pool_base + offset, payload_align) - offset; @@ -382,17 +369,14 @@ odp_buffer_pool_t odp_buffer_pool_lookup(const char *name) pool = get_pool_entry(i); LOCK(&pool->s.lock); - if (strcmp(name, pool->s.name) == 0) { /* found it */ UNLOCK(&pool->s.lock); return i; } - UNLOCK(&pool->s.lock); } - return ODP_BUFFER_POOL_INVALID; } @@ -432,8 +416,6 @@ odp_buffer_t odp_buffer_alloc(odp_buffer_pool_t pool_id) handle = hdr->handle; } - - return handle.u32; } @@ -450,7 +432,6 @@ void odp_buffer_free(odp_buffer_t buf) pool = get_pool_entry(pool_id); chunk_hdr = local_chunk[pool_id]; - if (chunk_hdr && chunk_hdr->chunk.num_bufs == ODP_BUFS_PER_CHUNK - 1) { /* Current chunk is full. Push back to the pool */ LOCK(&pool->s.lock); diff --git a/platform/linux-generic/source/odp_coremask.c b/platform/linux-generic/source/odp_coremask.c index 22be78f..c55eb72 100644 --- a/platform/linux-generic/source/odp_coremask.c +++ b/platform/linux-generic/source/odp_coremask.c @@ -50,10 +50,8 @@ void odp_coremask_from_u64(const uint64_t *u64, int num, odp_coremask_t *mask) num = ODP_COREMASK_SIZE_U64; } - for (i = 0; i < num; i++) { - /* */ + for (i = 0; i < num; i++) mask->_u64[0] |= u64[i]; - } } void odp_coremask_set(int core, odp_coremask_t *mask) diff --git a/platform/linux-generic/source/odp_linux.c b/platform/linux-generic/source/odp_linux.c index 42b7d89..6adeb3f 100644 --- a/platform/linux-generic/source/odp_linux.c +++ b/platform/linux-generic/source/odp_linux.c @@ -28,7 +28,6 @@ typedef struct { } odp_start_args_t; - static void *odp_run_start_routine(void *arg) { odp_start_args_t *start_args = arg; @@ -40,8 +39,6 @@ static void *odp_run_start_routine(void *arg) } - - void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, int first_core, void *(*start_routine) (void *), void *arg) { @@ -58,7 +55,6 @@ void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, memset(thread_tbl, 0, num * sizeof(odp_linux_pthread_t)); - for (i = 0; i < num; i++) { pthread_attr_init(&thread_tbl[i].attr); @@ -83,7 +79,6 @@ void odp_linux_pthread_create(odp_linux_pthread_t *thread_tbl, int num, } - void odp_linux_pthread_join(odp_linux_pthread_t *thread_tbl, int num) { int i; @@ -93,5 +88,3 @@ void odp_linux_pthread_join(odp_linux_pthread_t *thread_tbl, int num) pthread_join(thread_tbl[i].thread, NULL); } } - - diff --git a/platform/linux-generic/source/odp_packet.c b/platform/linux-generic/source/odp_packet.c index 5f07374..8af5169 100644 --- a/platform/linux-generic/source/odp_packet.c +++ b/platform/linux-generic/source/odp_packet.c @@ -87,7 +87,6 @@ void odp_packet_set_l2_offset(odp_packet_t pkt, size_t offset) odp_packet_hdr(pkt)->l2_offset = offset; } - uint8_t *odp_packet_l3(odp_packet_t pkt) { const size_t offset = odp_packet_l3_offset(pkt); @@ -108,7 +107,6 @@ void odp_packet_set_l3_offset(odp_packet_t pkt, size_t offset) odp_packet_hdr(pkt)->l3_offset = offset; } - uint8_t *odp_packet_l4(odp_packet_t pkt) { const size_t offset = odp_packet_l4_offset(pkt); @@ -330,4 +328,3 @@ void odp_packet_print(odp_packet_t pkt) printf("\n%s\n", str); } - diff --git a/platform/linux-generic/source/odp_packet_flags.c b/platform/linux-generic/source/odp_packet_flags.c index 0fd0aa9..992b94b 100644 --- a/platform/linux-generic/source/odp_packet_flags.c +++ b/platform/linux-generic/source/odp_packet_flags.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ - #include - #include +#include +#include int odp_packet_error(odp_packet_t pkt) @@ -113,4 +113,3 @@ void odp_packet_outflag_l4_chksum(odp_packet_t pkt) { odp_packet_hdr(pkt)->output_flags.l4_chksum = 1; } - diff --git a/platform/linux-generic/source/odp_queue.c b/platform/linux-generic/source/odp_queue.c index 648c18e..49bc766 100644 --- a/platform/linux-generic/source/odp_queue.c +++ b/platform/linux-generic/source/odp_queue.c @@ -146,7 +146,6 @@ odp_queue_t odp_queue_create(const char *name, odp_queue_type_t type, continue; LOCK(&queue->s.lock); - if (queue->s.status == QUEUE_STATUS_FREE) { queue_init(queue, name, type, param); @@ -157,28 +156,23 @@ odp_queue_t odp_queue_create(const char *name, odp_queue_type_t type, queue->s.status = QUEUE_STATUS_READY; handle = queue->s.handle; - UNLOCK(&queue->s.lock); break; } - UNLOCK(&queue->s.lock); } - if (handle != ODP_QUEUE_INVALID && (type == ODP_QUEUE_TYPE_SCHED || type == ODP_QUEUE_TYPE_PKTIN)) { odp_buffer_t buf; buf = odp_schedule_buffer_alloc(handle); - if (buf == ODP_BUFFER_INVALID) { ODP_ERR("queue_init: sched buf alloc failed\n"); return ODP_QUEUE_INVALID; } queue->s.sched_buf = buf; - odp_schedule_mask_set(handle, queue->s.param.sched.prio); } @@ -215,13 +209,11 @@ odp_queue_t odp_queue_lookup(const char *name) continue; LOCK(&queue->s.lock); - if (strcmp(name, queue->s.name) == 0) { /* found it */ UNLOCK(&queue->s.lock); return queue->s.handle; } - UNLOCK(&queue->s.lock); } @@ -234,7 +226,6 @@ int queue_enq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr) int sched = 0; LOCK(&queue->s.lock); - if (queue->s.head == NULL) { /* Empty queue */ queue->s.head = buf_hdr; @@ -250,7 +241,6 @@ int queue_enq(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr) queue->s.status = QUEUE_STATUS_SCHED; sched = 1; /* retval: schedule queue */ } - UNLOCK(&queue->s.lock); /* Add queue to scheduling */ @@ -274,7 +264,6 @@ int queue_enq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], int num) buf_hdr[num-1]->next = NULL; LOCK(&queue->s.lock); - /* Empty queue */ if (queue->s.head == NULL) queue->s.head = buf_hdr[0]; @@ -287,7 +276,6 @@ int queue_enq_multi(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr[], int num) queue->s.status = QUEUE_STATUS_SCHED; sched = 1; /* retval: schedule queue */ } - UNLOCK(&queue->s.lock); /* Add queue to scheduling */ @@ -411,7 +399,6 @@ int odp_queue_deq_multi(odp_queue_t handle, odp_buffer_t buf[], int num) } - odp_buffer_t odp_queue_deq(odp_queue_t handle) { queue_entry_t *queue; diff --git a/platform/linux-generic/source/odp_rwlock.c b/platform/linux-generic/source/odp_rwlock.c index 19c58e1..c2b34e3 100644 --- a/platform/linux-generic/source/odp_rwlock.c +++ b/platform/linux-generic/source/odp_rwlock.c @@ -59,5 +59,3 @@ void odp_rwlock_write_unlock(odp_rwlock_t *rwlock) { odp_atomic_inc_u32((odp_atomic_u32_t *)(intptr_t)&rwlock->cnt); } - - diff --git a/platform/linux-generic/source/odp_shared_memory.c b/platform/linux-generic/source/odp_shared_memory.c index c607c99..8288b46 100644 --- a/platform/linux-generic/source/odp_shared_memory.c +++ b/platform/linux-generic/source/odp_shared_memory.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - #include #include #include @@ -50,7 +49,6 @@ typedef struct { static odp_shm_table_t *odp_shm_tbl; - int odp_shm_init_global(void) { void *addr; @@ -172,7 +170,6 @@ void *odp_shm_reserve(const char *name, uint64_t size, uint64_t align) } - void *odp_shm_lookup(const char *name) { int i; @@ -194,7 +191,6 @@ void *odp_shm_lookup(const char *name) } - void odp_shm_print_all(void) { int i; @@ -226,12 +222,3 @@ void odp_shm_print_all(void) printf("\n"); } - - - - - - - - - diff --git a/platform/linux-generic/source/odp_spinlock.c b/platform/linux-generic/source/odp_spinlock.c index da98278..4eba015 100644 --- a/platform/linux-generic/source/odp_spinlock.c +++ b/platform/linux-generic/source/odp_spinlock.c @@ -38,6 +38,3 @@ int odp_spinlock_is_locked(odp_spinlock_t *spinlock) { return spinlock->lock != 0; } - - - diff --git a/platform/linux-generic/source/odp_system_info.c b/platform/linux-generic/source/odp_system_info.c index 17617b0..f78b746 100644 --- a/platform/linux-generic/source/odp_system_info.c +++ b/platform/linux-generic/source/odp_system_info.c @@ -52,7 +52,6 @@ static int sysconf_core_count(void) long ret; ret = sysconf(_SC_NPROCESSORS_CONF); - if (ret < 0) return 0; @@ -72,7 +71,6 @@ static int systemcpu_cache_line_size(void) int size = 0; file = fopen(CACHE_LNSZ_FILE, "rt"); - if (file == NULL) { /* File not found */ return 0; @@ -96,7 +94,6 @@ static int huge_page_size(void) int size = 0; dir = opendir(HUGE_PAGE_DIR); - if (dir == NULL) { ODP_ERR("%s not found\n", HUGE_PAGE_DIR); return 0; @@ -137,7 +134,6 @@ static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo) while (fgets(str, sizeof(str), file) != NULL && count > 0) { if (!mhz) { pos = strstr(str, "cpu MHz"); - if (pos) { sscanf(pos, "cpu MHz : %lf", &mhz); count--; @@ -146,7 +142,6 @@ static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo) if (!model) { pos = strstr(str, "model name"); - if (pos) { int len; pos = strchr(str, ':'); @@ -293,7 +288,6 @@ static int systemcpu(odp_system_info_t *sysinfo) int ret; ret = sysconf_core_count(); - if (ret == 0) { ODP_ERR("sysconf_core_count failed.\n"); return -1; @@ -303,7 +297,6 @@ static int systemcpu(odp_system_info_t *sysinfo) ret = systemcpu_cache_line_size(); - if (ret == 0) { ODP_ERR("systemcpu_cache_line_size failed.\n"); return -1; @@ -333,7 +326,6 @@ static int systemcpu(odp_system_info_t *sysinfo) int ret; ret = sysconf_core_count(); - if (ret == 0) { ODP_ERR("sysconf_core_count failed.\n"); return -1; @@ -364,7 +356,6 @@ int odp_system_info_init(void) odp_system_info.page_size = ODP_PAGE_SIZE; file = fopen("/proc/cpuinfo", "rt"); - if (file == NULL) { ODP_ERR("Failed to open /proc/cpuinfo\n"); return -1; diff --git a/platform/linux-generic/source/odp_thread.c b/platform/linux-generic/source/odp_thread.c index 4bee2aa..eaa480e 100644 --- a/platform/linux-generic/source/odp_thread.c +++ b/platform/linux-generic/source/odp_thread.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - #include #include #include @@ -14,8 +13,6 @@ #include - - typedef struct { int thr_id; int phys_core; @@ -23,8 +20,6 @@ typedef struct { } odp_thread_tbl_t; - - /* Globals */ static odp_thread_tbl_t odp_thread_tbl[ODP_CONFIG_MAX_THREADS]; static odp_atomic_int_t num_threads; @@ -48,7 +43,7 @@ void odp_thread_init_local(int thr_id) int odp_thread_create(int phys_core) { - int id = -1; + int id; id = odp_atomic_fetch_add_int(&num_threads, 1); @@ -71,5 +66,3 @@ int odp_thread_core(void) { return odp_this_thread->phys_core; } - - diff --git a/platform/linux-generic/source/odp_timer.c b/platform/linux-generic/source/odp_timer.c index 824ec0e..001b505 100644 --- a/platform/linux-generic/source/odp_timer.c +++ b/platform/linux-generic/source/odp_timer.c @@ -168,12 +168,10 @@ int odp_timer_init_global(void) timer_init(); - return 0; } - odp_timer_t odp_timer_create(const char *name, odp_buffer_pool_t pool, uint64_t resolution, uint64_t min_tmo, uint64_t max_tmo) @@ -185,7 +183,6 @@ odp_timer_t odp_timer_create(const char *name, odp_buffer_pool_t pool, return ODP_TIMER_INVALID; id = odp_atomic_fetch_inc_int(&odp_timer.num_timers); - if (id >= NUM_TIMERS) return ODP_TIMER_INVALID; @@ -213,14 +210,12 @@ odp_timer_tmo_t odp_timer_absolute_tmo(odp_timer_t timer, uint64_t tmo_tick, id = timer - 1; cur_tick = odp_timer.timer[id].cur_tick; - if (tmo_tick <= cur_tick) { ODP_DBG("timeout too close\n"); return ODP_TIMER_TMO_INVALID; } tick = tmo_tick - cur_tick; - if (tick > MAX_TICKS) { ODP_DBG("timeout too far\n"); return ODP_TIMER_TMO_INVALID; @@ -229,7 +224,6 @@ odp_timer_tmo_t odp_timer_absolute_tmo(odp_timer_t timer, uint64_t tmo_tick, tick = (cur_tick + tick) % MAX_TICKS; tmo_buf = odp_buffer_alloc(odp_timer.timer[id].pool); - if (tmo_buf == ODP_BUFFER_INVALID) { ODP_DBG("alloc failed\n"); return ODP_TIMER_TMO_INVALID; @@ -254,13 +248,11 @@ odp_timer_tmo_t odp_timer_absolute_tmo(odp_timer_t timer, uint64_t tmo_tick, } - uint64_t odp_timer_tick_to_ns(odp_timer_t timer, uint64_t ticks) { uint32_t id; id = timer - 1; - return ticks * odp_timer.timer[id].resolution_ns; } @@ -270,7 +262,6 @@ uint64_t odp_timer_ns_to_tick(odp_timer_t timer, uint64_t ns) uint32_t id; id = timer - 1; - return ns / odp_timer.timer[id].resolution_ns; } @@ -280,7 +271,6 @@ uint64_t odp_timer_resolution(odp_timer_t timer) uint32_t id; id = timer - 1; - return odp_timer.timer[id].resolution_ns; } @@ -290,7 +280,6 @@ uint64_t odp_timer_maximum_tmo(odp_timer_t timer) uint32_t id; id = timer - 1; - return odp_timer.timer[id].max_ticks; } @@ -300,6 +289,5 @@ uint64_t odp_timer_current_tick(odp_timer_t timer) uint32_t id; id = timer - 1; - return odp_timer.timer[id].cur_tick; }