Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1210981pxb; Tue, 17 Aug 2021 06:31:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0m99fh4FCvkuyC20ccNC+eQ3FJ5G3lRiWd2p9p8MmJ4AUk0WyCnJptLrmGiAO1L5rsnhx X-Received: by 2002:a17:907:785a:: with SMTP id lb26mr4059782ejc.77.1629207112810; Tue, 17 Aug 2021 06:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629207112; cv=none; d=google.com; s=arc-20160816; b=k/gnD6S6e0OmUX9N83UsBXO0lgKWjgewiPZqGaCsndCF8BS3Xl/ryZFbyOiUFnWhYP a9A/H+Sw7FNNbDucDkvYh+Qc0hpLccLPDeLI47HiXWapgW7DDet9c8A50yijvyLJahjL wKId2zorhIW5M2ANpORyLqgJg5keSk2s2VxgCC/stVyOl/LDAmrkqP9dQ2JN3xsXKB17 Om9S2jfav1PkosLkxjUhWmfjz8P7RdJ7/eL+D+gTZ7YHYMDPHKoDfP3+gDqfqboiYWH7 RfvtxJIE39xLH59KkeR8EKPHiy19RX7mnuEA+5DSs4JZIkRtFRz/QQhuQhvpjWZhAspK ktyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jhNRygkZSnokXeb7qSRMRLwwZtJvbBcUNqtBdqOfilA=; b=1Eimy0H7LAxn4Yr6lpfY71U0f8Y4SMRSsozdWMg73zjcLW61lGwhYssLaXKTzOHnXI 1QuRIUbHXS8UMe02FazzghHxh8eYlme8b5/7iGbnQtDVoQjWadqLaW9F3IQPsYzVXhHO QsBFKIoegFBvPmml1/R/JNLF79+lbV7gWW/fggp5fSBTRr4Nf9jyH0m1O1j1odZUawQp 3Rbcdw+784kExYitOeq/U4XzvN8jb7kILAeFgDzkY3cbBzC0NArbm2GLbPweKtaV6YBL XZCOUGpmNt8mcbjUPSOckZF6WYCD+mk54BxFLRNonm/s0cRsqRNG2CHOAZRqoNq/chaI QaWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dv469uMi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q24si2176520eju.305.2021.08.17.06.31.26; Tue, 17 Aug 2021 06:31:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dv469uMi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240016AbhHQN3o (ORCPT + 99 others); Tue, 17 Aug 2021 09:29:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239919AbhHQN3N (ORCPT ); Tue, 17 Aug 2021 09:29:13 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 434CEC0613C1; Tue, 17 Aug 2021 06:28:40 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id j1so32031361pjv.3; Tue, 17 Aug 2021 06:28:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jhNRygkZSnokXeb7qSRMRLwwZtJvbBcUNqtBdqOfilA=; b=dv469uMiCBKv8f19tkJvZluYNjYUk2n9vFUAj6y2pWd+gifcKmLdQVCpGqrUqd+9Az MUd8yVHC8sLMtImIi6T2C6QD6bl8iqudIo9AF37+azbdwKPRvTtHocfwAEDi6+1/4Qe3 ElyU8efNwS/D6AEWk78gj8r9CMoGnebgsyTwvl7ySzLAD+z90im2jJkfPCf7SPYMQ+jO GmtO9NoJJs3oPwIVqX0x+QTNIFWTVc18bVd0E2emt86tdLCjBeQdBY3ZUkaOSKFnvqyH 60mvx7s04i4ezrTge1TL5asNWcku7KSaWcVlCANbWX5vsXY+XzQk1lYEr1R+EmjEQnuC Shxg== 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:mime-version:content-transfer-encoding; bh=jhNRygkZSnokXeb7qSRMRLwwZtJvbBcUNqtBdqOfilA=; b=TNTUkHHbluIr3mhFrhIml6uBZDrlsm7kSsgeXxQzk8g3VNa0ciO3xearvobqf3+X7C mqSGmDj6J/xrzZrXQ7cN1+6zMJ3FRBKjzCmqTSQIGaMMXgT89CbET1UpHo4aedlMGcTb pgWy1s1UP9IagvstppEEOrZ8FoNgjJsVX4WfI7hz9ijiB99q7FJEtstDGMyj1Xp1maQj ab2fVtSMB8u9NdQh2Zv3kdYrFemuKI5DiFPQcYoOqv+FWF5zQM85LAW/664mVrvrAr9R n4EyKcezGHepZAhtOehAeBdNLSSiVgdatRcSPgqtbLBzeJAgOKx6q7eWvENrToA5itXK S+fQ== X-Gm-Message-State: AOAM533vMKp+8Bu8B3JATY0VNOpMJnVheDAtisiNDxzux9CigVT3RN1a +mfGkITNeCqYdZA6dNqCwWsn0YJ9vOkQZA== X-Received: by 2002:a17:902:ec06:b0:12d:8605:731d with SMTP id l6-20020a170902ec0600b0012d8605731dmr2797843pld.78.1629206919768; Tue, 17 Aug 2021 06:28:39 -0700 (PDT) Received: from ubuntu.localdomain ([182.226.226.37]) by smtp.gmail.com with ESMTPSA id j6sm2791577pfi.220.2021.08.17.06.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 06:28:39 -0700 (PDT) From: bongsu.jeon2@gmail.com To: shuah@kernel.org, krzysztof.kozlowski@canonical.com Cc: netdev@vger.kernel.org, linux-nfc@lists.01.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Bongsu Jeon Subject: [PATCH v2 net-next 2/8] selftests: nci: Remove the polling code to read a NCI frame Date: Tue, 17 Aug 2021 06:28:12 -0700 Message-Id: <20210817132818.8275-3-bongsu.jeon2@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210817132818.8275-1-bongsu.jeon2@gmail.com> References: <20210817132818.8275-1-bongsu.jeon2@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bongsu Jeon Because the virtual NCI device uses Wait Queue, the virtual device application doesn't need to poll the NCI frame. Signed-off-by: Bongsu Jeon Reviewed-by: Krzysztof Kozlowski --- tools/testing/selftests/nci/nci_dev.c | 33 +++++++++------------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/nci/nci_dev.c b/tools/testing/selftests/nci/nci_dev.c index 57b505cb1561..34e76c7fa1fe 100644 --- a/tools/testing/selftests/nci/nci_dev.c +++ b/tools/testing/selftests/nci/nci_dev.c @@ -270,8 +270,7 @@ static void *virtual_dev_open(void *data) dev_fd = *(int *)data; - while ((len = read(dev_fd, buf, 258)) == 0) - ; + len = read(dev_fd, buf, 258); if (len <= 0) goto error; if (len != sizeof(nci_reset_cmd)) @@ -280,8 +279,7 @@ static void *virtual_dev_open(void *data) goto error; write(dev_fd, nci_reset_rsp, sizeof(nci_reset_rsp)); - while ((len = read(dev_fd, buf, 258)) == 0) - ; + len = read(dev_fd, buf, 258); if (len <= 0) goto error; if (len != sizeof(nci_init_cmd)) @@ -290,8 +288,7 @@ static void *virtual_dev_open(void *data) goto error; write(dev_fd, nci_init_rsp, sizeof(nci_init_rsp)); - while ((len = read(dev_fd, buf, 258)) == 0) - ; + len = read(dev_fd, buf, 258); if (len <= 0) goto error; if (len != sizeof(nci_rf_disc_map_cmd)) @@ -313,8 +310,7 @@ static void *virtual_dev_open_v2(void *data) dev_fd = *(int *)data; - while ((len = read(dev_fd, buf, 258)) == 0) - ; + len = read(dev_fd, buf, 258); if (len <= 0) goto error; if (len != sizeof(nci_reset_cmd)) @@ -324,8 +320,7 @@ static void *virtual_dev_open_v2(void *data) write(dev_fd, nci_reset_rsp_v2, sizeof(nci_reset_rsp_v2)); write(dev_fd, nci_reset_ntf, sizeof(nci_reset_ntf)); - while ((len = read(dev_fd, buf, 258)) == 0) - ; + len = read(dev_fd, buf, 258); if (len <= 0) goto error; if (len != sizeof(nci_init_cmd_v2)) @@ -334,8 +329,7 @@ static void *virtual_dev_open_v2(void *data) goto error; write(dev_fd, nci_init_rsp_v2, sizeof(nci_init_rsp_v2)); - while ((len = read(dev_fd, buf, 258)) == 0) - ; + len = read(dev_fd, buf, 258); if (len <= 0) goto error; if (len != sizeof(nci_rf_disc_map_cmd)) @@ -402,8 +396,7 @@ static void *virtual_deinit(void *data) dev_fd = *(int *)data; - while ((len = read(dev_fd, buf, 258)) == 0) - ; + len = read(dev_fd, buf, 258); if (len <= 0) goto error; if (len != sizeof(nci_reset_cmd)) @@ -425,8 +418,7 @@ static void *virtual_deinit_v2(void *data) dev_fd = *(int *)data; - while ((len = read(dev_fd, buf, 258)) == 0) - ; + len = read(dev_fd, buf, 258); if (len <= 0) goto error; if (len != sizeof(nci_reset_cmd)) @@ -489,16 +481,14 @@ static void *virtual_poll_start(void *data) dev_fd = *(int *)data; - while ((len = read(dev_fd, buf, 258)) == 0) - ; + len = read(dev_fd, buf, 258); if (len <= 0) goto error; if (len != sizeof(nci_rf_discovery_cmd)) goto error; if (memcmp(nci_rf_discovery_cmd, buf, len)) goto error; - write(dev_fd, nci_rf_disc_rsp, sizeof(nci_rf_disc_rsp)) - ; + write(dev_fd, nci_rf_disc_rsp, sizeof(nci_rf_disc_rsp)); return (void *)0; error: @@ -513,8 +503,7 @@ static void *virtual_poll_stop(void *data) dev_fd = *(int *)data; - while ((len = read(dev_fd, buf, 258)) == 0) - ; + len = read(dev_fd, buf, 258); if (len <= 0) goto error; if (len != sizeof(nci_rf_deact_cmd)) -- 2.32.0