From patchwork Fri Jun 3 06:33:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12868618 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A50B5CCA480 for ; Fri, 3 Jun 2022 06:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241521AbiFCGdy (ORCPT ); Fri, 3 Jun 2022 02:33:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241502AbiFCGdu (ORCPT ); Fri, 3 Jun 2022 02:33:50 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08D3E2BF3; Thu, 2 Jun 2022 23:33:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=hL0qdlLPGNQz2kcCUdvTM+8nVVuLUSOHVZ6rpwpj6XQ=; b=cx8RDfp916tlLF3pTFkj5FrxxT x4mU0pdjLgE9NDq/gNV9kW4C7Sl5ymhOhYci8q56Y0Abq1fX/ugAweHbdLhHEEMxwBiCjn4X1Vnac nWfThUw5aV83/kwdEILRoXV04JStwiNsoS7EiEQO/FIh5nAhA5ZLvitrs9t1Vabeo2zt/HdYFJbWf SEAPqz1E7vstMdzPdyqSAnwS6WeRoZkeHwHHV7SRoIzSJVaH1lKD5RE+Z39O5gJdIxDMUbLA12hHM omr/SgPFD/QD4xm/Z9XuFPkigPAGaYIYeuR+f3guiuHKBssELETv+f7Q4EVaOdsPaQRNu0O6cafnl WH4hdGrQ==; Received: from [2001:4bb8:185:a81e:b29a:8b56:eb9a:ca3b] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nx0sS-00612w-G3; Fri, 03 Jun 2022 06:33:45 +0000 From: Christoph Hellwig To: Kirti Wankhede , Tony Krowiak , Halil Pasic , Jason Herne , Eric Farman , Matthew Rosato , Zhenyu Wang , Zhi Wang , Alex Williamson Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org Subject: [PATCH 5/8] vfio/mdev: remove mdev_from_dev Date: Fri, 3 Jun 2022 08:33:25 +0200 Message-Id: <20220603063328.3715-6-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220603063328.3715-1-hch@lst.de> References: <20220603063328.3715-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Just open code it in the only caller. Signed-off-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian --- drivers/vfio/mdev/mdev_core.c | 6 ++---- include/linux/mdev.h | 4 ---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c index 34b01d45cfe9f..3575e893b5e43 100644 --- a/drivers/vfio/mdev/mdev_core.c +++ b/drivers/vfio/mdev/mdev_core.c @@ -56,10 +56,8 @@ static void mdev_device_remove_common(struct mdev_device *mdev) static int mdev_device_remove_cb(struct device *dev, void *data) { - struct mdev_device *mdev = mdev_from_dev(dev); - - if (mdev) - mdev_device_remove_common(mdev); + if (dev->bus == &mdev_bus_type) + mdev_device_remove_common(to_mdev_device(dev)); return 0; } diff --git a/include/linux/mdev.h b/include/linux/mdev.h index cbb53dcd20d9d..5811b5a52a511 100644 --- a/include/linux/mdev.h +++ b/include/linux/mdev.h @@ -102,9 +102,5 @@ static inline struct device *mdev_dev(struct mdev_device *mdev) { return &mdev->dev; } -static inline struct mdev_device *mdev_from_dev(struct device *dev) -{ - return dev->bus == &mdev_bus_type ? to_mdev_device(dev) : NULL; -} #endif /* MDEV_H */