Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp93455imw; Mon, 4 Jul 2022 05:54:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sPs+KOB42vjkPW+KgtMpjdSfpnHv0cwAYH2LaryRVc+fn/nkR6Gd4kceFt1wvkG+fH3JYp X-Received: by 2002:a17:907:7b84:b0:726:c8a0:c9e7 with SMTP id ne4-20020a1709077b8400b00726c8a0c9e7mr27745483ejc.375.1656939254218; Mon, 04 Jul 2022 05:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656939254; cv=none; d=google.com; s=arc-20160816; b=LUIHUyYgD/pnop5hYWUTsi439QvbAkag6eljY/HNGbutmIM1y4652vp56rlIsihRB9 OobRjTRPOYlsVqYCf8+f55XshjfdMqwHOVko4oqKG8NqLfuC+MoZ/Z6DCMOrfAS3Fxxc TliAnBakICVTMd7FDKezAzEuV1jxlNQgwGc4sSPdtNp3EZ0ykz3nuCDWUjIqiOY7kcL7 SNe7a8L+9S7NlxT7NfRn1SGMSfpUraMuc72UjagJRefpJVtRgkfoLhSmkF6/uTzw4mhx s9vmyJYLkD+MmfYb9I6445oz4xAy+ZLR8DL/0Dmc3QkniN2npq0sllFsl14uu8cLdXJ+ vF4Q== 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 :message-id:date:subject:cc:to:from; bh=ju6jKxJl9s09SwRBUdZKGD9GR54qYLvSZcNJaILBbTM=; b=pTK0NvSzSahorUCQ7wdis7qUy0xFww6uzLZU/kxT6y+L85yMKVUa5KHMNUoNozJcmP iX+jyeAbGhSzPt2SlxFgENhN/LgsFaehwJLU+KQv7nhyDsljsY/YxtDkEwE9Tu7PyW1d IZPiEGv53nasK6MsUiXsDy7fQFY5wYWPcqmNlJn6mqocFtJZH/VTsYWxOBablu7cNC6L bUjwTOKcgKlE68YHKDIOhjY0f7mFBbkIVHqZyvu7kQbpJbNW22wmi7Azd/ao1EnYeA6+ am6NvfT/qzigHhiPGYv+Ca4WLUX8UEufD2Xc3EELh279V2fwuHdQhTlJ3MJPbVL5N4Ya 14rA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a17090617c500b00726f9797afbsi12081197eje.569.2022.07.04.05.53.48; Mon, 04 Jul 2022 05:54:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232989AbiGDMlG (ORCPT + 99 others); Mon, 4 Jul 2022 08:41:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbiGDMlF (ORCPT ); Mon, 4 Jul 2022 08:41:05 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D90D71115E for ; Mon, 4 Jul 2022 05:41:04 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Lc52w2BMXzkWkF; Mon, 4 Jul 2022 20:39:04 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 4 Jul 2022 20:41:03 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 4 Jul 2022 20:41:02 +0800 From: Yang Yingliang To: CC: , Subject: [PATCH -next] virt: acrn: using for_each_set_bit to simplify the code Date: Mon, 4 Jul 2022 20:50:44 +0800 Message-ID: <20220704125044.2192381-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's more cleanly to use for_each_set_bit() instead of opencoding it. Signed-off-by: Yang Yingliang --- drivers/virt/acrn/ioreq.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/virt/acrn/ioreq.c b/drivers/virt/acrn/ioreq.c index 5ff1c53740c0..d75ab3f66da4 100644 --- a/drivers/virt/acrn/ioreq.c +++ b/drivers/virt/acrn/ioreq.c @@ -246,12 +246,8 @@ void acrn_ioreq_request_clear(struct acrn_vm *vm) spin_lock_bh(&vm->ioreq_clients_lock); client = vm->default_client; if (client) { - vcpu = find_first_bit(client->ioreqs_map, ACRN_IO_REQUEST_MAX); - while (vcpu < ACRN_IO_REQUEST_MAX) { + for_each_set_bit(vcpu, client->ioreqs_map, ACRN_IO_REQUEST_MAX) acrn_ioreq_complete_request(client, vcpu, NULL); - vcpu = find_next_bit(client->ioreqs_map, - ACRN_IO_REQUEST_MAX, vcpu + 1); - } } spin_unlock_bh(&vm->ioreq_clients_lock); -- 2.25.1