From patchwork Wed Feb 22 12:56:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 94326 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp929033obz; Wed, 22 Feb 2017 04:15:18 -0800 (PST) X-Received: by 10.107.6.210 with SMTP id f79mr27165975ioi.140.1487765717933; Wed, 22 Feb 2017 04:15:17 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id n133si1349790ion.1.2017.02.22.04.15.17; Wed, 22 Feb 2017 04:15:17 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 6F86A62C92; Wed, 22 Feb 2017 12:15:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 3E86E6356F; Wed, 22 Feb 2017 12:00:23 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 1C06E62CEF; Wed, 22 Feb 2017 12:00:16 +0000 (UTC) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) by lists.linaro.org (Postfix) with ESMTPS id 3A7A962C3D for ; Wed, 22 Feb 2017 11:57:42 +0000 (UTC) Received: by mail-lf0-f53.google.com with SMTP id g134so164196lfe.1 for ; Wed, 22 Feb 2017 03:57:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=R27JvWnk31V7essmqdZs49X6/7DMOersngUSdpyvrQY=; b=NLJqRa93hLkw/LHBen6dVq7Hq2QYYraHeYP57t8zpXU8U1GkZ+xXZSo4r+SM//oHAx bAqKDpjFUpZE4YI5CC3MUhvzaWGUPbZgzqAUk9kTzQHVocJ5pBh3REF01Q04nYCRBwzs WZbMCtdcqMZVaPCRmEGPYbZTOI1qU0aZC7MZ0t4M87YY7kv0gWRwuxTyjAD7j/3nfD6w hpsHzC+HU7G0LO5bFX3IPDl7MJqBain0KHJydLQXDoeS+B+74GNY6A9+nuwVPjHI010w ifOZDupHnhqsPTzOXGVh+l6n+agnkPBEIEuGcaWGi3wVUf9jpaL6yieoEwV72VAggVAE QdPw== X-Gm-Message-State: AMke39k6bHPFq3Hs+1XtBUOILK64Ht3FpcZDi0ClQUhHU72UfdQHGY3kuV9FOh+7wuI+cB+lcsE= X-Received: by 10.25.217.79 with SMTP id q76mr8420279lfg.178.1487764661147; Wed, 22 Feb 2017 03:57:41 -0800 (PST) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id v21sm7035187ljd.9.2017.02.22.03.57.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Feb 2017 03:57:40 -0800 (PST) From: Christophe Milard To: mike.holmes@linaro.org, yi.he@linaro.org, forrest.shi@linaro.org, sachin.saxena@linaro.com, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Wed, 22 Feb 2017 13:56:04 +0100 Message-Id: <1487768164-43184-22-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487768164-43184-1-git-send-email-christophe.milard@linaro.org> References: <1487768164-43184-1-git-send-email-christophe.milard@linaro.org> Subject: [lng-odp] [API-NEXT PATCH 21/21] test: drv: test for setting and retrieving driver's data X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" trivial tests for function odpdrv_device_set_data() and odpdrv_device_get_data(). Signed-off-by: Christophe Milard --- test/common_plat/validation/drv/drvdriver/drvdriver_driver.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.7.4 diff --git a/test/common_plat/validation/drv/drvdriver/drvdriver_driver.c b/test/common_plat/validation/drv/drvdriver/drvdriver_driver.c index c293b06..4143acd 100644 --- a/test/common_plat/validation/drv/drvdriver/drvdriver_driver.c +++ b/test/common_plat/validation/drv/drvdriver/drvdriver_driver.c @@ -380,6 +380,8 @@ static int driver1_probe(odpdrv_device_t dev, odpdrv_devio_t devio, int idx) if (dev == E1_devs[i]) { driver1_probed_index |= (1 << i); dev_found = 1; + /* just set dev index as driver data */ + odpdrv_device_set_data(dev, (void *)(uintptr_t)i); } } CU_ASSERT(dev_found); @@ -430,6 +432,7 @@ static int driver1_unbind(odpdrv_device_t dev, void (*callback)(odpdrv_device_t dev), uint32_t flags) { + CU_ASSERT(E1_devs[(uintptr_t)odpdrv_device_get_data(dev)] == dev); CU_ASSERT(dev != ODPDRV_DEVICE_INVALID); CU_ASSERT(flags == ODPDRV_DRV_UNBIND_IMMEDIATE); callback(dev);