From mboxrd@z Thu Jan 1 00:00:00 1970 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 206F2C6FA82 for ; Fri, 23 Sep 2022 09:27:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231754AbiIWJ1W (ORCPT ); Fri, 23 Sep 2022 05:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231726AbiIWJ1U (ORCPT ); Fri, 23 Sep 2022 05:27:20 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BF43B56F6; Fri, 23 Sep 2022 02:27:19 -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=Z1h3673Uq2kJ2j+5Me5K20pUonQL6wknNcFIcptZiYs=; b=MBqqDR7ulGf55YV5GUnd1wcl7F ekr007ExzPHgAJFY6IPDQB5MrM4mUskZ6u6fqW52vr8Ri1Qywsl3DLaghtgyJahn2Hbak/88rpYeI T54T4jLr0h24Dc1epNJVwWC0NbNrNCHeFBUOQWX3YTgvh0MFBgrIAVW2YMdfwibkIV+x8E+ieUb8b lvJOAp8bjW0Np8QL2P+W9HLQwnld87KsR5kCg9Oy+XIU3nqo3AjTHnMBeflnXy5OpfFvVDL3tFDLp dkix9Dss3I/rqjhQ8OfXQg+msCSxliEBkk2aBEJ8kfrjycTzIzyOQzjFTEgJPltvwRgZOQFoSGiyV jjVul5Dg==; Received: from ip4d15bec4.dynamic.kabel-deutschland.de ([77.21.190.196] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1obexi-003Jmt-9n; Fri, 23 Sep 2022 09:27:10 +0000 From: Christoph Hellwig To: Kirti Wankhede , Tony Krowiak , Halil Pasic , Jason Herne , Eric Farman , Matthew Rosato , Zhenyu Wang , Zhi Wang , Alex Williamson Cc: Jason Gunthorpe , kvm@vger.kernel.org, linux-s390@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, Kevin Tian Subject: [PATCH 06/14] vfio/mdev: remove mdev_from_dev Date: Fri, 23 Sep 2022 11:26:44 +0200 Message-Id: <20220923092652.100656-7-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220923092652.100656-1-hch@lst.de> References: <20220923092652.100656-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: linux-s390@vger.kernel.org Just open code it in the only caller. Signed-off-by: Christoph Hellwig Reviewed-by: Jason Gunthorpe Reviewed-by: Kevin Tian Reviewed By: Kirti Wankhede --- 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 2d95a497fd3b2..bde7ce620dae0 100644 --- a/drivers/vfio/mdev/mdev_core.c +++ b/drivers/vfio/mdev/mdev_core.c @@ -53,10 +53,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 19bc93c10e8c7..4f558de52fd94 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 */ -- 2.30.2