From patchwork Tue Feb 3 14:53:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Liljedahl X-Patchwork-Id: 44244 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f197.google.com (mail-we0-f197.google.com [74.125.82.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D8A842034D for ; Tue, 3 Feb 2015 14:55:21 +0000 (UTC) Received: by mail-we0-f197.google.com with SMTP id l61sf21228548wev.0 for ; Tue, 03 Feb 2015 06:55:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=zKytv416KD27PYOZADOcTwoxVkPhmwODh6hH4a7T9Bk=; b=KfGm7kHfva7FZrdHZp1KQTSAqW6w0KiZQ21pH6PqoUhFdFRx8fCpzWd0tmKhXtrE/C BDdEVdx5YUr4zyY1rXoWE4WTtgTE/uNlfj9nLcW+SZNNkyK7ZOx9oxnLNuC27lLyoIXz dl9sirSKK8oKFnABwFhf2orSUsau3BDDnCRidLIaUSL8yCbsDCEWwo+pIvARRazj+wp2 R5PMdbPSV+JPb7UpxqDt9seTO+OqllfAdefmx1e5wT0GdMQplhkHjyKRXKVJhSon76HC Vn8uPJWw52jukBMqeFaQImil6vxVy7JhPZyp80qKdIaW8nZPShRmhdms5CbTGxXeNslI 682g== X-Gm-Message-State: ALoCoQlhqowHwQ2+E3Ggs/vthjQCPDbiCtbXuf9q+E+jXicgT3jAyoXJZ7b2imkTfNux1VzUAdr0 X-Received: by 10.194.201.10 with SMTP id jw10mr3167014wjc.3.1422975321196; Tue, 03 Feb 2015 06:55:21 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.67 with SMTP id la3ls607401lab.25.gmail; Tue, 03 Feb 2015 06:55:21 -0800 (PST) X-Received: by 10.112.41.234 with SMTP id i10mr25111463lbl.25.1422975321023; Tue, 03 Feb 2015 06:55:21 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id lv1si9111845lac.49.2015.02.03.06.55.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 06:55:21 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id pn19so6463466lab.2 for ; Tue, 03 Feb 2015 06:55:20 -0800 (PST) X-Received: by 10.112.243.12 with SMTP id wu12mr25210063lbc.91.1422975320899; Tue, 03 Feb 2015 06:55:20 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1988485lbj; Tue, 3 Feb 2015 06:55:20 -0800 (PST) X-Received: by 10.224.43.10 with SMTP id u10mr53241426qae.20.1422975319431; Tue, 03 Feb 2015 06:55:19 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id k67si18436513qgk.87.2015.02.03.06.55.18 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 06:55:19 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIesm-0001ol-9L; Tue, 03 Feb 2015 14:55:16 +0000 Received: from mail-la0-f54.google.com ([209.85.215.54]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIerN-0001ZB-O3 for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 14:53:49 +0000 Received: by mail-la0-f54.google.com with SMTP id hv19so52298525lab.13 for ; Tue, 03 Feb 2015 06:53:44 -0800 (PST) X-Received: by 10.112.44.171 with SMTP id f11mr24631606lbm.65.1422975224158; Tue, 03 Feb 2015 06:53:44 -0800 (PST) Received: from localhost.localdomain (78-82-118-111.tn.glocalnet.net. [78.82.118.111]) by mx.google.com with ESMTPSA id jf3sm5082572lbc.44.2015.02.03.06.53.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Feb 2015 06:53:43 -0800 (PST) From: Ola Liljedahl To: lng-odp@lists.linaro.org Date: Tue, 3 Feb 2015 15:53:19 +0100 Message-Id: <1422975201-3364-17-git-send-email-ola.liljedahl@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422975201-3364-1-git-send-email-ola.liljedahl@linaro.org> References: <1422975201-3364-1-git-send-email-ola.liljedahl@linaro.org> X-Topics: timers patch Subject: [lng-odp] [PATCHv4 16/18] api: odp_timer.h: updated return descriptions X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ola.liljedahl@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Updated doxygen descriptions, particularly the @return/@retval descriptions. No change of implementation necessary. Documented API calls which are guaranteed to handle invalid/stale handles. Removed unnecessary warnings of undefined behavior. Signed-off-by: Ola Liljedahl --- (This document/code contribution attached is provided under the terms of agreement LES-LTM-21309) include/odp/api/timer.h | 52 ++++++++++++++++--------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/include/odp/api/timer.h b/include/odp/api/timer.h index 64ccc4b..1b813da 100644 --- a/include/odp/api/timer.h +++ b/include/odp/api/timer.h @@ -112,8 +112,8 @@ typedef struct { * @param name Name of the timer pool. The string will be copied. * @param params Timer pool parameters. The content will be copied. * - * @return Timer pool handle if successful, otherwise ODP_TIMER_POOL_INVALID - * and errno set + * @return Timer pool handle on success + * @retval ODP_TIMER_POOL_INVALID on failure and errno set */ odp_timer_pool_t odp_timer_pool_create(const char *name, @@ -135,14 +135,14 @@ void odp_timer_pool_start(void); * Destroy a timer pool, freeing all resources. * All timers must have been freed. * - * @param tpid Timer pool identifier + * @param tpid Timer pool handle */ void odp_timer_pool_destroy(odp_timer_pool_t tpid); /** * Convert timer ticks to nanoseconds * - * @param tpid Timer pool identifier + * @param tpid Timer pool handle * @param ticks Timer ticks * * @return Nanoseconds @@ -152,7 +152,7 @@ uint64_t odp_timer_tick_to_ns(odp_timer_pool_t tpid, uint64_t ticks); /** * Convert nanoseconds to timer ticks * - * @param tpid Timer pool identifier + * @param tpid Timer pool handle * @param ns Nanoseconds * * @return Timer ticks @@ -162,7 +162,7 @@ uint64_t odp_timer_ns_to_tick(odp_timer_pool_t tpid, uint64_t ns); /** * Current tick value * - * @param tpid Timer pool identifier + * @param tpid Timer pool handle * * @return Current time in timer ticks */ @@ -181,12 +181,14 @@ typedef struct { /** * Query timer pool configuration and current state + * @note This is the only timer API function which accepts invalid handles + * (any bit value) without causing undefined behavior. * - * @param tpid Timer pool identifier + * @param tpid Timer pool handle * @param[out] info Pointer to information buffer * - * @retval 0 Success - * @retval -1 Failure. Info could not be retrieved. + * @retval 0 on success + * @retval <0 on failure. Info could not be retrieved. */ int odp_timer_pool_info(odp_timer_pool_t tpid, odp_timer_pool_info_t *info); @@ -198,12 +200,12 @@ int odp_timer_pool_info(odp_timer_pool_t tpid, * the timer pool. The user_ptr is copied to timeouts and can be retrieved * using the odp_timeout_user_ptr() call. * - * @param tpid Timer pool identifier + * @param tpid Timer pool handle * @param queue Destination queue for timeout notifications * @param user_ptr User defined pointer or NULL to be copied to timeouts * - * @return Timer handle if successful, otherwise ODP_TIMER_INVALID and - * errno set. + * @return Timer handle on success + * @retval ODP_TIMER_INVALID on failure and errno set. */ odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid, odp_queue_t queue, @@ -218,7 +220,8 @@ odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid, * responsibility of the application to handle this timeout when it is received. * * @param tim Timer handle - * @return Event handle of timeout event or ODP_EVENT_INVALID + * @return Event handle of timeout event + * @retval ODP_EVENT_INVALID on failure */ odp_event_t odp_timer_free(odp_timer_t tim); @@ -228,9 +231,6 @@ odp_event_t odp_timer_free(odp_timer_t tim); * Set (arm) the timer to expire at specific time. The timeout * event will be enqueued when the timer expires. * - * Note: any invalid parameters will be treated as programming errors and will - * cause the application to abort. - * * @param tim Timer * @param abs_tck Expiration time in absolute timer ticks * @param[in,out] tmo_ev Reference to an event variable that points to @@ -255,9 +255,6 @@ int odp_timer_set_abs(odp_timer_t tim, * * Set (arm) the timer to expire at a relative future time. * - * Note: any invalid parameters will be treated as programming errors and will - * cause the application to abort. - * * @param tim Timer * @param rel_tck Expiration time in timer ticks relative to current time of * the timer pool the timer belongs to @@ -287,22 +284,16 @@ int odp_timer_set_rel(odp_timer_t tim, * A timer that has already expired may be impossible to cancel and the timeout * will instead be delivered to the destination queue. * - * Note: any invalid parameters will be treated as programming errors and will - * cause the application to abort. - * * @param tim Timer * @param[out] tmo_ev Pointer to an event variable * @retval 0 Success, active timer cancelled, timeout returned in '*tmo_ev' - * @retval -1 Failure, timer already expired (or inactive) + * @retval <0 on failure, timer already expired (or inactive) */ int odp_timer_cancel(odp_timer_t tim, odp_event_t *tmo_ev); /** * Return timeout handle that is associated with timeout event * - * Note: any invalid parameters will cause undefined behavior and may cause - * the application to abort or crash. - * * @param ev An event of type ODP_EVENT_TIMEOUT * * @return timeout handle @@ -332,9 +323,6 @@ int odp_timeout_fresh(odp_timeout_t tmo); /** * Return timer handle for the timeout * - * Note: any invalid parameters will cause undefined behavior and may cause - * the application to abort or crash. - * * @param tmo Timeout handle * * @return Timer handle @@ -344,9 +332,6 @@ odp_timer_t odp_timeout_timer(odp_timeout_t tmo); /** * Return expiration tick for the timeout * - * Note: any invalid parameters will cause undefined behavior and may cause - * the application to abort or crash. - * * @param tmo Timeout handle * * @return Expiration tick @@ -357,9 +342,6 @@ uint64_t odp_timeout_tick(odp_timeout_t tmo); * Return user pointer for the timeout * The user pointer was specified when the timer was allocated. * - * Note: any invalid parameters will cause undefined behavior and may cause - * the application to abort or crash. - * * @param tmo Timeout handle * * @return User pointer