From patchwork Tue Feb 3 16:48:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Liljedahl X-Patchwork-Id: 44273 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 A03792034D for ; Tue, 3 Feb 2015 16:50:06 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf26538084wiv.2 for ; Tue, 03 Feb 2015 08:50:05 -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=ZxKx0XYoXSy/nq1xDl07gm/VZ5OYN2kBhlHaL05rVhs=; b=NrF7jq1rFss19UYxB7rC1vOEOYe1vCAg4Gab3jNh5L/QUXy+7xjYE09ttATKOoG2OT YKtFpIBPLgpNG3MUVmSKymD8rIOqilXYEBX+PmCXTVrWJNdxxbyjpz4W4JvYqjpC4zM6 jxcMJ2xO0A+zazugZPb+DO8ikfEzL0jjl0OnIBpA3FPj7TEi55vdvmO1XAW15x90bUSU n5XzGae+rmhyoyauQS7pN1E/1KbYu8YkaKodyNrBXkRtF+12idlyqMwG+2rso+5RoRAB qTlI3qPgOBc/rCnmV13MjnoWN2PYTm4bJWzngG0J6/EENlximLFdZoeCQ4SY/svxu3dj LEFw== X-Gm-Message-State: ALoCoQlqoJii8K6sH29+XoJkyIp9W0kZZBIQUMokYejfl9npvbg39+ghIg5gKSaAJUFyai4m2Yaa X-Received: by 10.112.64.171 with SMTP id p11mr3226843lbs.12.1422982205899; Tue, 03 Feb 2015 08:50:05 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.137 with SMTP id lc9ls93512lab.28.gmail; Tue, 03 Feb 2015 08:50:05 -0800 (PST) X-Received: by 10.152.5.2 with SMTP id o2mr25889647lao.5.1422982205753; Tue, 03 Feb 2015 08:50:05 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id p3si3782537laj.107.2015.02.03.08.50.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Feb 2015 08:50:05 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id hs14so53286332lab.9 for ; Tue, 03 Feb 2015 08:50:05 -0800 (PST) X-Received: by 10.152.116.43 with SMTP id jt11mr25938594lab.69.1422982205310; Tue, 03 Feb 2015 08:50:05 -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 h5csp2058902lbj; Tue, 3 Feb 2015 08:50:04 -0800 (PST) X-Received: by 10.224.5.131 with SMTP id 3mr55539982qav.36.1422982203520; Tue, 03 Feb 2015 08:50:03 -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 n74si29329935qgd.96.2015.02.03.08.50.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 03 Feb 2015 08:50:03 -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 1YIgfo-0008Lc-0d; Tue, 03 Feb 2015 16:50:00 +0000 Received: from mail-lb0-f175.google.com ([209.85.217.175]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YIgen-00087w-4b for lng-odp@lists.linaro.org; Tue, 03 Feb 2015 16:48:57 +0000 Received: by mail-lb0-f175.google.com with SMTP id 10so39756316lbg.6 for ; Tue, 03 Feb 2015 08:48:51 -0800 (PST) X-Received: by 10.152.36.232 with SMTP id t8mr13297036laj.90.1422982131607; Tue, 03 Feb 2015 08:48:51 -0800 (PST) Received: from macmini.lan (78-82-118-111.tn.glocalnet.net. [78.82.118.111]) by mx.google.com with ESMTPSA id y2sm434179lay.23.2015.02.03.08.48.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Feb 2015 08:48:50 -0800 (PST) From: Ola Liljedahl To: lng-odp@lists.linaro.org Date: Tue, 3 Feb 2015 17:48:27 +0100 Message-Id: <1422982108-13813-18-git-send-email-ola.liljedahl@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422982108-13813-1-git-send-email-ola.liljedahl@linaro.org> References: <1422982108-13813-1-git-send-email-ola.liljedahl@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv5 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.50 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 409f3b4..6b675c5 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 *str, ssize_t size); /** - * 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); }