From patchwork Mon Feb 2 17:20:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Liljedahl X-Patchwork-Id: 44170 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A73FC202A5 for ; Mon, 2 Feb 2015 17:21:46 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gm9sf17184729lab.0 for ; Mon, 02 Feb 2015 09:21:45 -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=gmJt3SWauaG7958WnGESkUTZ8WV0xQLAecko1l+4pSU=; b=QhfTlgZk2Vgul4gcPHwynSiiCKZ7kakAUD54vI9Jo00D6FOW+FLuQWIwOHCRBzrlC2 HpJukzKWUVXxjh9uZy8LnpvFf7/hS1OVkPfA8T0q31WIykHnGWLMs6bmgw9VCUxWJItW gsEjBvdk9+87Mb9hFuDslT/zB2Ap/rGQUeMx/iISdLZjHFHLheBHQsntEpiUOGtr5r60 Wit+sFqSYUoWeOFyV98enfRNxWPd2vHCyZ34FqpeQWC2bXqnkKW6ZVth+jRvI5/lyJ0o a6J76JDgXX2MnsRCqEMQwe1kDE7EDx9zpCzvExNomfWUh1XLoA1CDx74sI0aDxQI4C1s IpSQ== X-Gm-Message-State: ALoCoQm10625XJ9PU3atc0aST1UHVP3fBJBIaUpcJmiOF19hyVWA0Mdoco61Xmm2eeyF2zv67hFP X-Received: by 10.112.37.72 with SMTP id w8mr2493187lbj.6.1422897705658; Mon, 02 Feb 2015 09:21:45 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.234 with SMTP id r10ls150071lal.94.gmail; Mon, 02 Feb 2015 09:21:45 -0800 (PST) X-Received: by 10.152.2.41 with SMTP id 9mr1858413lar.59.1422897705416; Mon, 02 Feb 2015 09:21:45 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id zf10si1008991lbb.102.2015.02.02.09.21.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Feb 2015 09:21:45 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id hz20so43114851lab.6 for ; Mon, 02 Feb 2015 09:21:45 -0800 (PST) X-Received: by 10.152.3.70 with SMTP id a6mr20699607laa.71.1422897705257; Mon, 02 Feb 2015 09:21:45 -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 h5csp1431309lbj; Mon, 2 Feb 2015 09:21:44 -0800 (PST) X-Received: by 10.140.43.194 with SMTP id e60mr41598301qga.60.1422897703618; Mon, 02 Feb 2015 09:21:43 -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 45si25690734qgt.120.2015.02.02.09.21.39 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Feb 2015 09:21:43 -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 1YIKgr-00072j-7r; Mon, 02 Feb 2015 17:21:37 +0000 Received: from mail-la0-f49.google.com ([209.85.215.49]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIKgL-0006z7-2e for lng-odp@lists.linaro.org; Mon, 02 Feb 2015 17:21:05 +0000 Received: by mail-la0-f49.google.com with SMTP id gf13so43027050lab.8 for ; Mon, 02 Feb 2015 09:20:59 -0800 (PST) X-Received: by 10.152.29.6 with SMTP id f6mr9310250lah.82.1422897659486; Mon, 02 Feb 2015 09:20:59 -0800 (PST) Received: from macmini.lan (78-82-118-111.tn.glocalnet.net. [78.82.118.111]) by mx.google.com with ESMTPSA id rv1sm4530726lbb.25.2015.02.02.09.20.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Feb 2015 09:20:58 -0800 (PST) From: Ola Liljedahl To: lng-odp@lists.linaro.org Date: Mon, 2 Feb 2015 18:20:45 +0100 Message-Id: <1422897646-8064-8-git-send-email-ola.liljedahl@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422897646-8064-1-git-send-email-ola.liljedahl@linaro.org> References: <1422897646-8064-1-git-send-email-ola.liljedahl@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 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.47 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 6c27e8b..11e19de 100644 --- a/platform/linux-generic/odp_cpumask.c +++ b/platform/linux-generic/odp_cpumask.c @@ -143,20 +143,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); }