Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1133093pxb; Wed, 10 Feb 2021 00:25:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzFCHphCXpSTUMbfkyIo9Gde4s/Y6tUc8qsuDSXCF61+Ct/ARbSz0aJyWMsS7tm+KCPX+M X-Received: by 2002:a17:906:c318:: with SMTP id s24mr1834207ejz.187.1612945553402; Wed, 10 Feb 2021 00:25:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612945553; cv=none; d=google.com; s=arc-20160816; b=Ce/GViH/eW9998z1KrjJNBoIcGLTgRGkyqEVg8XVzPg6kwtX8PpXrgWVBhmWbR3226 xRWnb78bjRyv/iUY5UN+yTk0kCYbcqEJtS6BUEMcF4WGQTy8aMsWLj8/F5n7HZ0DT++Z 7NF4kZSdTsoS0ICKADzQsOfqOMiiOT2AGsCxIVS3Ai3IdUWbbWxqPAHBB7RF9LBW5vV7 HfyL6ejrLgNnJtI/tRFTJdqS7QIKxMVE4pR3GLME49LRDpoqI0ytxdfA+NypRL4QArRj +G2ptfz9KoiBo3/z4JpHyLTwnaoeMsMPW6EPuZFknNVpYMxnUOX3luHjZx7/0zF89R+u IrMg== 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=yRMFEMFdhB06ok9lGlvQ+Ci9imXBZkzEErKlh972F74=; b=Mem+X+8M3iT+IOf0HkPKjEsSHz5D5Xx3b4ueI4Epg9gmfBKn9UQKFrCbz/n9hsPQ8h 9f5su0L4NlT9Elthmoc2IRrd6HPDZA4hCwzXMeSF5wlXQfsVXuJA52g0r9Nz20NdUWzO OSaq1UB1VtUYebM8RNrTj8yKkAi8sBrxJKhsrtMyHvhQy0lNusxRYRsEQ7OLo0lnyOzd po/0AnFkEbhU05O3OFBd39w9PNcbbEBQDhokxGzbS+GwTTiIy/bFMvPcv9ROHgr12Bc/ 8k/22caZpNwQ6VanIoMvjQ780jwHACPTKT/JoXmDOzwLM+PxJnSVJiQOhmsHGS1JTasu V6ag== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si973905edk.141.2021.02.10.00.25.29; Wed, 10 Feb 2021 00:25:53 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231337AbhBJDFF (ORCPT + 99 others); Tue, 9 Feb 2021 22:05:05 -0500 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:6504 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233589AbhBJDFA (ORCPT ); Tue, 9 Feb 2021 22:05:00 -0500 Received: from spf.mail.chinamobile.com (unknown[172.16.121.19]) by rmmx-syy-dmz-app05-12005 (RichMail) with SMTP id 2ee560234d0f09f-345f1; Wed, 10 Feb 2021 11:03:43 +0800 (CST) X-RM-TRANSID: 2ee560234d0f09f-345f1 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.112.105.130]) by rmsmtp-syy-appsvr10-12010 (RichMail) with SMTP id 2eea60234d0bebc-67c97; Wed, 10 Feb 2021 11:03:43 +0800 (CST) X-RM-TRANSID: 2eea60234d0bebc-67c97 From: Tang Bin To: mst@redhat.com, jasowang@redhat.com Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Tang Bin Subject: [PATCH] virtio-mmio: Use to_virtio_mmio_device() to simply code Date: Wed, 10 Feb 2021 11:04:01 +0800 Message-Id: <20210210030401.5532-1-tangbin@cmss.chinamobile.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The file virtio_mmio.c has defined the function to_virtio_mmio_device, so use it instead of container_of() to simply code. And remove superfluous blank lines in this file. Signed-off-by: Tang Bin --- drivers/virtio/virtio_mmio.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 627ac0487..449d0f209 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -69,14 +69,10 @@ #include #include - - /* The alignment to use between consumer and producer parts of vring. * Currently hardcoded to the page size. */ #define VIRTIO_MMIO_VRING_ALIGN PAGE_SIZE - - #define to_virtio_mmio_device(_plat_dev) \ container_of(_plat_dev, struct virtio_mmio_device, vdev) @@ -100,8 +96,6 @@ struct virtio_mmio_vq_info { struct list_head node; }; - - /* Configuration interface */ static u64 vm_get_features(struct virtio_device *vdev) @@ -264,8 +258,6 @@ static void vm_reset(struct virtio_device *vdev) writel(0, vm_dev->base + VIRTIO_MMIO_STATUS); } - - /* Transport interface */ /* the notify function used when creating a virt queue */ @@ -307,8 +299,6 @@ static irqreturn_t vm_interrupt(int irq, void *opaque) return ret; } - - static void vm_del_vq(struct virtqueue *vq) { struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev); @@ -512,13 +502,11 @@ static const struct virtio_config_ops virtio_mmio_config_ops = { .bus_name = vm_bus_name, }; - static void virtio_mmio_release_dev(struct device *_d) { struct virtio_device *vdev = container_of(_d, struct virtio_device, dev); - struct virtio_mmio_device *vm_dev = - container_of(vdev, struct virtio_mmio_device, vdev); + struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); struct platform_device *pdev = vm_dev->pdev; devm_kfree(&pdev->dev, vm_dev); @@ -608,8 +596,6 @@ static int virtio_mmio_remove(struct platform_device *pdev) return 0; } - - /* Devices list parameter */ #if defined(CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES) -- 2.20.1.windows.1