Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2710857pxb; Mon, 25 Apr 2022 00:10:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6d7/b/sSKyokYOW8f/X5rNQS8BbNMSyjS9U08WZsXAmX89TFVsKWsGDrc8RWDlOOh54Fn X-Received: by 2002:a05:6402:5189:b0:425:d7ca:caa4 with SMTP id q9-20020a056402518900b00425d7cacaa4mr8166225edd.177.1650870609279; Mon, 25 Apr 2022 00:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650870609; cv=none; d=google.com; s=arc-20160816; b=pM2OMuHkU9X8qE9+0N5TVZFf/d11M4ogjt0PE+SOR+wVHd2TCBhj3mbi0tdnDMjUY4 QG1IayKHP4+pCHaNzgWdxIrYUijCGSGVsVvygAJpVR0wWH9kYCE0dCwwdRh+4GdtXREy 3Yv3uWdBeuKr9RPg1BaTlr+mo7oilV2gBfhN3swDS1QnkzvEdM7Q6MYSiD8CYpRbyQOC XlNkrseb+MNLzwZLPZoR8F9leEg+hXgja1S+a6pZI9OfIhfTI9FSRLyPFJFNH8736H16 iq/nfw5YVMk0hEF7dU1Vvt0ZgLVijpJeP5q36xsWAbhq7Q7hl6UJ5h8gVT7jBxOAM0aB LkTw== 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=fz/K5MVrwYQcCpHC+g2ETqDjMuMbroKDJr5qSpPTTD4=; b=xARA/zfBlcbRslBONXMy7++iFPVnz8m0YkiP/qHuHSBBkLBm3zLZp28f6HJ5Lyqoq+ dW8rDjGIFHU7sJU0uW2yd9bM3fXi4N//wyvCx7gKo3/1fjZhJsoHHyvgiD957amX4nvr fhooLHTJepZqZzExhUvP9KCkQU7EaWsY3p/YnGWMm3Rw4L0lW4gtcCps1aezhWz9bLV3 7Z0mSLy6yHhRPQ2wDsJMQo8ShtTG3/XQFTebVp1IuXzJtrMCmFJ8chYDbHZvdgG/Kees l2O65BclxLanD+ZFHUiNYqmLMPZ2XZzg07leq+w2i/DUPEku+Bcvre3fshXdKzBEi/x6 icGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G3oTJ5cG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j41-20020a05640223a900b0041e97a8af57si10602084eda.63.2022.04.25.00.09.45; Mon, 25 Apr 2022 00:10:09 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G3oTJ5cG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240432AbiDYCr4 (ORCPT + 99 others); Sun, 24 Apr 2022 22:47:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240412AbiDYCrq (ORCPT ); Sun, 24 Apr 2022 22:47:46 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A164F68F8F for ; Sun, 24 Apr 2022 19:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650854683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fz/K5MVrwYQcCpHC+g2ETqDjMuMbroKDJr5qSpPTTD4=; b=G3oTJ5cG9HE1h+xCkXX0DW4UyVjeMy32P/W2660UzYz2tnUaaTzWq1kveLWr4TZ6h7yfff UPzwDy25u4OiYu2hEHDgS9wGx/RB40SihFPXkhPXmBb6Y6VAo20fYUnjSGPYYSs+P8/N2t sF8r0N0gmHlmFSOBadTrZy/zjjtOb7A= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-475-g1M8XoLtNRGGFhvYmd0nvA-1; Sun, 24 Apr 2022 22:44:42 -0400 X-MC-Unique: g1M8XoLtNRGGFhvYmd0nvA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 252C585A5BE; Mon, 25 Apr 2022 02:44:42 +0000 (UTC) Received: from localhost.localdomain (ovpn-13-160.pek2.redhat.com [10.72.13.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 502DB9E6F; Mon, 25 Apr 2022 02:44:31 +0000 (UTC) From: Jason Wang To: jasowang@redhat.com, mst@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: sgarzare@redhat.com, eperezma@redhat.com, lulu@redhat.com, tglx@linutronix.de, peterz@infradead.org, paulmck@kernel.org, maz@kernel.org, pasic@linux.ibm.com, cohuck@redhat.com Subject: [PATCH V3 1/9] virtio: use virtio_device_ready() in virtio_device_restore() Date: Mon, 25 Apr 2022 10:44:10 +0800 Message-Id: <20220425024418.8415-2-jasowang@redhat.com> In-Reply-To: <20220425024418.8415-1-jasowang@redhat.com> References: <20220425024418.8415-1-jasowang@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE 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 From: Stefano Garzarella It will allow us to do extension on virtio_device_ready() without duplicating code. Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: "Paul E. McKenney" Cc: Marc Zyngier Cc: Halil Pasic Cc: Cornelia Huck Signed-off-by: Stefano Garzarella Signed-off-by: Jason Wang --- drivers/virtio/virtio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 22f15f444f75..75c8d560bbd3 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -526,8 +526,9 @@ int virtio_device_restore(struct virtio_device *dev) goto err; } - /* Finally, tell the device we're all set */ - virtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); + /* If restore didn't do it, mark device DRIVER_OK ourselves. */ + if (!(dev->config->get_status(dev) & VIRTIO_CONFIG_S_DRIVER_OK)) + virtio_device_ready(dev); virtio_config_enable(dev); -- 2.25.1