From patchwork Tue Feb 3 14:53:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Liljedahl X-Patchwork-Id: 44245 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 67D0D2034D for ; Tue, 3 Feb 2015 14:55:26 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf26033750wiv.2 for ; Tue, 03 Feb 2015 06:55:25 -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=FFlnQbrFbDxAUlB+qxOlm9IIAP51TZn9Z2kFSZANIF4=; b=f2Mh+3NoFAcIfySv4nIw4jNc5ul1NmSbkfEzkOY7GYvmL9iF8cyyTwZJhDA8faHEJM a275DT7h1uAkKd9O4VLxT6utEj6pBJrjOkB0dBICkJgY3+05aTgZTSwCABnte0HC0YBg oRHjpfYwVFg2U/xbN6A3UEAZTdJYUFv0nJMRZnGk5c171no7665Zq43IgFXfQ/Vs1DdZ OdKczLL88yadfKjRf/EHKEGZ4JtswLB6DeF7iCIchjLo3jCo6fDmtSJAXiLtawIsT4ix 5VOF49szeZodcmqwU40WdTd3F17TukKAWcUDGOqvMclTWaqQ//DG2UJQppb8KQWCaywT LtdQ== X-Gm-Message-State: ALoCoQlLkkyRTOVZiVcryO6aryitE/YlkWxcb2AGoLwNn2R8cImyN25o28rnjHvqbcsMCQvoEqn4 X-Received: by 10.112.30.131 with SMTP id s3mr3245717lbh.13.1422975325678; Tue, 03 Feb 2015 06:55:25 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.193 with SMTP id v1ls277421lag.102.gmail; Tue, 03 Feb 2015 06:55:25 -0800 (PST) X-Received: by 10.152.87.210 with SMTP id ba18mr24735951lab.3.1422975325533; Tue, 03 Feb 2015 06:55:25 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id a4si19299778lbg.132.2015.02.03.06.55.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 06:55:25 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id gf13so52339959lab.8 for ; Tue, 03 Feb 2015 06:55:25 -0800 (PST) X-Received: by 10.152.20.4 with SMTP id j4mr7913635lae.29.1422975325405; Tue, 03 Feb 2015 06:55:25 -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 h5csp1988527lbj; Tue, 3 Feb 2015 06:55:24 -0800 (PST) X-Received: by 10.224.87.197 with SMTP id x5mr43305213qal.99.1422975324030; Tue, 03 Feb 2015 06:55:24 -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 q67si29074609qgd.39.2015.02.03.06.55.22 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 06:55:24 -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 1YIesq-0001pr-WB; Tue, 03 Feb 2015 14:55:21 +0000 Received: from mail-la0-f50.google.com ([209.85.215.50]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIerO-0001ZL-OM for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 14:53:50 +0000 Received: by mail-la0-f50.google.com with SMTP id hs14so52377864lab.9 for ; Tue, 03 Feb 2015 06:53:45 -0800 (PST) X-Received: by 10.112.159.195 with SMTP id xe3mr24602098lbb.64.1422975225200; Tue, 03 Feb 2015 06:53:45 -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.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Feb 2015 06:53:44 -0800 (PST) From: Ola Liljedahl To: lng-odp@lists.linaro.org Date: Tue, 3 Feb 2015 15:53:20 +0100 Message-Id: <1422975201-3364-18-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: patch Subject: [lng-odp] [PATCHv4 17/18] api: odp_cpumask.h: updated descriptions, added const 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.49 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 function, parameter and return descriptions. Added const to some input parameters passed by reference. Signed-off-by: Ola Liljedahl --- (This document/code contribution attached is provided under the terms of agreement LES-LTM-21309) include/odp/api/cpumask.h | 100 +++++++++++++++++++++-------------- platform/linux-generic/odp_cpumask.c | 12 ++--- 2 files changed, 65 insertions(+), 47 deletions(-) diff --git a/include/odp/api/cpumask.h b/include/odp/api/cpumask.h index 65969c3..3007c87 100644 --- a/include/odp/api/cpumask.h +++ b/include/odp/api/cpumask.h @@ -53,102 +53,118 @@ void odp_cpumask_from_str(odp_cpumask_t *mask, const char *str); ssize_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *buf, ssize_t bufsz); /** - * Clear entire mask - * @param mask CPU mask to flush with zero value + * Clear entire CPU mask + * @param mask CPU mask to clear */ void odp_cpumask_zero(odp_cpumask_t *mask); /** - * Add cpu to mask - * @param mask add cpu number in CPU mask + * Add CPU to mask + * @param mask CPU mask to update * @param cpu CPU number */ void odp_cpumask_set(odp_cpumask_t *mask, int cpu); /** - * Remove cpu from mask - * @param mask clear cpu number from CPU mask + * Remove CPU from mask + * @param mask CPU mask to update * @param cpu CPU number */ void odp_cpumask_clr(odp_cpumask_t *mask, int cpu); /** - * Test if cpu is a member of mask - * @param mask CPU mask to check if cpu num set or not + * Test if CPU is a member of mask + * + * @param mask CPU mask to test * @param cpu CPU number - * @return non-zero if set otherwise 0 + * @return non-zero if set + * @retval 0 if not set */ int odp_cpumask_isset(const odp_cpumask_t *mask, int cpu); /** - * Count number of cpus in mask + * Count number of CPU's in mask + * * @param mask CPU mask - * @return cpumask count + * @return population count */ int odp_cpumask_count(const odp_cpumask_t *mask); /** - * Logical AND over two source masks. + * Member-wise AND over two CPU masks * - * @param dest Destination mask, can be one of the source masks - * @param src1 Source mask 1 - * @param src2 Source mask 2 + * @param dest Destination CPU mask (may be one of the source masks) + * @param src1 Source CPU mask 1 + * @param src2 Source CPU mask 2 */ -void odp_cpumask_and(odp_cpumask_t *dest, odp_cpumask_t *src1, - odp_cpumask_t *src2); +void odp_cpumask_and(odp_cpumask_t *dest, const odp_cpumask_t *src1, + const odp_cpumask_t *src2); /** - * Logical OR over two source masks. + * Member-wise OR over two CPU masks * - * @param dest Destination mask, can be one of the source masks - * @param src1 Source mask 1 - * @param src2 Source mask 2 + * @param dest Destination CPU mask (may be one of the source masks) + * @param src1 Source CPU mask 1 + * @param src2 Source CPU mask 2 */ -void odp_cpumask_or(odp_cpumask_t *dest, odp_cpumask_t *src1, - odp_cpumask_t *src2); +void odp_cpumask_or(odp_cpumask_t *dest, const odp_cpumask_t *src1, + const odp_cpumask_t *src2); /** - * Logical XOR over two source masks. + * Member-wise XOR over two CPU masks * - * @param dest Destination mask, can be one of the source masks - * @param src1 Source mask 1 - * @param src2 Source mask 2 + * @param dest Destination CPU mask (may be one of the source masks) + * @param src1 Source CPU mask 1 + * @param src2 Source CPU mask 2 */ -void odp_cpumask_xor(odp_cpumask_t *dest, odp_cpumask_t *src1, - odp_cpumask_t *src2); +void odp_cpumask_xor(odp_cpumask_t *dest, const odp_cpumask_t *src1, + const odp_cpumask_t *src2); /** - * Test if two masks contain the same cpus + * Test if two CPU masks contain the same CPU's + * + * @param mask1 CPU mask 1 + * @param mask2 CPU mask 2 + * + * @retval non-zero if CPU masks equal + * @retval 0 if CPU masks not equal */ int odp_cpumask_equal(const odp_cpumask_t *mask1, const odp_cpumask_t *mask2); /** * Copy a CPU mask + * + * @param dest Destination CPU mask + * @param src Source CPU mask */ void odp_cpumask_copy(odp_cpumask_t *dest, const odp_cpumask_t *src); /** - * Find first CPU that is set in the mask + * Find first set CPU in mask + * + * @param mask CPU mask * - * @param mask is the mask to be searched - * @return cpu else -1 if no bits set in cpumask + * @return cpu number + * @retval <0 if no CPU found */ int odp_cpumask_first(const odp_cpumask_t *mask); /** - * Find last CPU that is set in the mask + * Find last set CPU in mask * - * @param mask is the mask to be searched - * @return cpu else -1 if no bits set in cpumask + * @param mask CPU mask + * + * @return cpu number + * @retval <0 if no CPU found */ int odp_cpumask_last(const odp_cpumask_t *mask); /** - * Find next cpu in mask + * Find next set CPU in mask * - * Finds the next cpu in the CPU mask, starting at the cpu passed. - * Use with odp_cpumask_first to traverse a CPU mask, i.e. + * Finds the next CPU in the CPU mask, starting at the CPU passed. + * Use with odp_cpumask_first to traverse a CPU mask, e.g. * * int cpu = odp_cpumask_first(&mask); * while (0 <= cpu) { @@ -157,9 +173,11 @@ int odp_cpumask_last(const odp_cpumask_t *mask); * cpu = odp_cpumask_next(&mask, cpu); * } * - * @param mask CPU mask to find next cpu in + * @param mask CPU mask * @param cpu CPU to start from - * @return cpu found else -1 + * + * @return cpu number + * @retval <0 if no CPU found * * @see odp_cpumask_first() */ diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c index 0bae1ce..24b9d75 100644 --- a/platform/linux-generic/odp_cpumask.c +++ b/platform/linux-generic/odp_cpumask.c @@ -141,20 +141,20 @@ int odp_cpumask_count(const odp_cpumask_t *mask) return CPU_COUNT(&mask->set); } -void odp_cpumask_and(odp_cpumask_t *dest, odp_cpumask_t *src1, - odp_cpumask_t *src2) +void odp_cpumask_and(odp_cpumask_t *dest, const odp_cpumask_t *src1, + const odp_cpumask_t *src2) { CPU_AND(&dest->set, &src1->set, &src2->set); } -void odp_cpumask_or(odp_cpumask_t *dest, odp_cpumask_t *src1, - odp_cpumask_t *src2) +void odp_cpumask_or(odp_cpumask_t *dest, const odp_cpumask_t *src1, + const odp_cpumask_t *src2) { CPU_OR(&dest->set, &src1->set, &src2->set); } -void odp_cpumask_xor(odp_cpumask_t *dest, odp_cpumask_t *src1, - odp_cpumask_t *src2) +void odp_cpumask_xor(odp_cpumask_t *dest, const odp_cpumask_t *src1, + const odp_cpumask_t *src2) { CPU_XOR(&dest->set, &src1->set, &src2->set); }