From patchwork Wed Nov 26 17:03:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 41553 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AE882203C2 for ; Wed, 26 Nov 2014 17:03:37 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id r20sf2202718wiv.5 for ; Wed, 26 Nov 2014 09:03:37 -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=Dn2B4lHoe8fUeT7L2Q2z6xX3BkTThWj2eC2A0dmNa/k=; b=T/qJM5wxzHkZQOtFtoqPU6qwYcW1dY1Gac9KYWXT41Ex4dmWKkMeVyxqufpikHFWx0 JTOzBGCfqpN8mnWk2CV6B4LOvOFWcptIUuD4KdkQ71rDZP0G7j/HTVHHIIox/NtmbcOI P0UwEXl8jPYSYxOnU4jnz/RvqNLlWtXqsajYay8MEWCx0Xca59WzOlLAZpgmrQ1SRD/A 5gqIJSAxX94hLh2Oag8gPBRVMjnZfrbeeZeVnkKDJ/q4b5zAKN8H3uTbUgFFuR5Jsy2T fAPt5ov+LN2i5rWtBdZ2csItoaoVmWP4bwd/j89S4S5Qv84mwAsBiZTReBmYgcwiDVTe S+qg== X-Gm-Message-State: ALoCoQl14kPuz5uSdnMRDu6GN4YQlzwqQFy8iVsddy7n8u3hRFVUjSeC894malSLsOYAQ0kYpB6Z X-Received: by 10.180.19.226 with SMTP id i2mr7301884wie.5.1417021417013; Wed, 26 Nov 2014 09:03:37 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.200 with SMTP id 8ls701359law.102.gmail; Wed, 26 Nov 2014 09:03:36 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr34526480lbo.32.1417021416694; Wed, 26 Nov 2014 09:03:36 -0800 (PST) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id un3si4992381lbb.21.2014.11.26.09.03.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Nov 2014 09:03:36 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by mail-lb0-f176.google.com with SMTP id p9so2844759lbv.35 for ; Wed, 26 Nov 2014 09:03:36 -0800 (PST) X-Received: by 10.152.37.69 with SMTP id w5mr34376230laj.67.1417021416610; Wed, 26 Nov 2014 09:03:36 -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.184.201 with SMTP id ew9csp658723lbc; Wed, 26 Nov 2014 09:03:35 -0800 (PST) X-Received: by 10.220.136.17 with SMTP id p17mr18618212vct.3.1417021415257; Wed, 26 Nov 2014 09:03:35 -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 dn9si1873392vcb.13.2014.11.26.09.03.34 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Nov 2014 09:03:35 -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 1Xtg05-0001r0-Ar; Wed, 26 Nov 2014 17:03:33 +0000 Received: from mail-lb0-f170.google.com ([209.85.217.170]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Xtfzu-0001qh-I7 for lng-odp@lists.linaro.org; Wed, 26 Nov 2014 17:03:22 +0000 Received: by mail-lb0-f170.google.com with SMTP id w7so2816051lbi.29 for ; Wed, 26 Nov 2014 09:03:17 -0800 (PST) X-Received: by 10.152.164.232 with SMTP id yt8mr34908894lab.7.1417021397023; Wed, 26 Nov 2014 09:03:17 -0800 (PST) Received: from uglx0153363.synapse.com ([195.238.92.128]) by mx.google.com with ESMTPSA id u2sm1302695laj.1.2014.11.26.09.03.15 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Nov 2014 09:03:16 -0800 (PST) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Wed, 26 Nov 2014 19:03:08 +0200 Message-Id: <1417021388-15432-2-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1417021388-15432-1-git-send-email-taras.kondratiuk@linaro.org> References: <1417021388-15432-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/2] platform: implement odp_queue_destroy() 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: taras.kondratiuk@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.217.176 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 Signed-off-by: Taras Kondratiuk --- platform/linux-generic/odp_queue.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 1318bcd..f44aba0 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -192,6 +192,23 @@ odp_queue_t odp_queue_create(const char *name, odp_queue_type_t type, return handle; } +int odp_queue_destroy(odp_queue_t handle) +{ + queue_entry_t *queue; + queue = queue_to_qentry(handle); + + if (queue->s.status == QUEUE_STATUS_FREE) + return -1; /* Queue is alredy freed */ + + LOCK(&queue->s.lock); + queue->s.status = QUEUE_STATUS_FREE; + queue->s.head = NULL; + queue->s.tail = NULL; + queue->s.sched_buf = ODP_BUFFER_INVALID; + UNLOCK(&queue->s.lock); + + return 0; +} odp_buffer_t queue_sched_buf(odp_queue_t handle) {