Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp104137ybe; Sun, 1 Sep 2019 21:27:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOH8GkyfHD97vEmP9JkMhjGtkIfPemS3xoRTyAQdZ2YRMjqJM5jBgLS19nDiQUn7h/MDx4 X-Received: by 2002:a17:902:b605:: with SMTP id b5mr28205580pls.103.1567398424137; Sun, 01 Sep 2019 21:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567398424; cv=none; d=google.com; s=arc-20160816; b=W2oYnJ0QTAMvdZzwKilQFBE4oKTD3SiPIaL9C2CwjCmK2B9rEJMp1KUiQoXYyVlAY0 idQZOHsH96KfnUjaxLKTcv++V98ANX5GTgNqtenTE94y9hoqufheF8Tv/YxZlWUYl6gK bk+zbPACLfHFA1+i+4Me5dNmo4niXsaUjWooCJ0tNoHUYXhihQ3vwdsIuvsGcvQAv0dP aHWhDelQV4D1HJHFFHuKhdx6zo3Z5OUu6UNP2GGWzeNNNOoQJSe8bHqg8fD7/fB0skJb jMNr6dTvv25bN1QAsoCo7rXl5osH01uqqASy60reT4LuzhS17TRIbpVvPG5y7to6fG4r /prA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=U0xRY5lLFlCZkj5l6BuHriy9lBVm09jVAQaxiCNau+U=; b=n91s7eNzHnFfxa+aexIUrlBYIRSxnRr5fO88xf6P+pfuYxyHdDn3Sbt9Cui/3WYQCv zOMBLBcmFoy8n7B/kAEGEGwQbHIryivGW0TDr0sQ/PKSJogOonwy0QIphBOhlG2pfueK 8fb9K6tb8LpzVbdF0let7+toFS5qvc2A+bjmzDSosFKKV6z2IEZHtnMZDT7w//IC9Xzg 7WCS+fGRCa0AXOB7FLA4jcV5NkZIXwR5/Qn4r6Uhptn7YI03gvnmfif63m62V7Ix76CN 32afeeUNu68EHQG0hdUEg1kQEirQl5U8/mIlbPWwzXAWPb0R4LXRDwgn8Fu9JM4DUa5l JRIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g13si10580152pgp.405.2019.09.01.21.26.49; Sun, 01 Sep 2019 21:27:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729613AbfIBEZN (ORCPT + 99 others); Mon, 2 Sep 2019 00:25:13 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:35695 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729568AbfIBEY4 (ORCPT ); Mon, 2 Sep 2019 00:24:56 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from parav@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Sep 2019 07:24:51 +0300 Received: from sw-mtx-036.mtx.labs.mlnx (sw-mtx-036.mtx.labs.mlnx [10.12.150.149]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x824OeRO001225; Mon, 2 Sep 2019 07:24:49 +0300 From: Parav Pandit To: alex.williamson@redhat.com, jiri@mellanox.com, kwankhede@nvidia.com, cohuck@redhat.com, davem@davemloft.net Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Parav Pandit Subject: [PATCH v3 4/5] mdev: Introduce an API mdev_alias Date: Sun, 1 Sep 2019 23:24:35 -0500 Message-Id: <20190902042436.23294-5-parav@mellanox.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190902042436.23294-1-parav@mellanox.com> References: <20190826204119.54386-1-parav@mellanox.com> <20190902042436.23294-1-parav@mellanox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce an API mdev_alias() to provide access to optionally generated alias. Signed-off-by: Parav Pandit --- drivers/vfio/mdev/mdev_core.c | 12 ++++++++++++ include/linux/mdev.h | 1 + 2 files changed, 13 insertions(+) diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c index c8cd40366783..9eec556fbdd4 100644 --- a/drivers/vfio/mdev/mdev_core.c +++ b/drivers/vfio/mdev/mdev_core.c @@ -517,6 +517,18 @@ struct device *mdev_get_iommu_device(struct device *dev) } EXPORT_SYMBOL(mdev_get_iommu_device); +/** + * mdev_alias: Return alias string of a mdev device + * @mdev: Pointer to the mdev device + * mdev_alias() returns alias string of a mdev device if alias is present, + * returns NULL otherwise. + */ +const char *mdev_alias(struct mdev_device *mdev) +{ + return mdev->alias; +} +EXPORT_SYMBOL(mdev_alias); + static int __init mdev_init(void) { int ret; diff --git a/include/linux/mdev.h b/include/linux/mdev.h index f036fe9854ee..6da82213bc4e 100644 --- a/include/linux/mdev.h +++ b/include/linux/mdev.h @@ -148,5 +148,6 @@ void mdev_unregister_driver(struct mdev_driver *drv); struct device *mdev_parent_dev(struct mdev_device *mdev); struct device *mdev_dev(struct mdev_device *mdev); struct mdev_device *mdev_from_dev(struct device *dev); +const char *mdev_alias(struct mdev_device *mdev); #endif /* MDEV_H */ -- 2.19.2