From: Jike Song <jike.song@intel.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Zhenyu Wang <zhenyuw@linux.intel.com>,
Kirti Wankhede <kwankhede@nvidia.com>,
Zhi Wang <zhi.a.wang@intel.com>
Subject: Re: [PATCH 2/4] vfio-mdev: de-polute the namespace, rename parent_device & parent_ops
Date: Thu, 22 Dec 2016 15:51:54 +0800 [thread overview]
Message-ID: <585B861A.5060908@intel.com> (raw)
In-Reply-To: <20161221232726.6091.61919.stgit@gimli.home>
Not sure if this is appropriate, but if not having the Documentation considered,
for patch 2-4:
Reviewed-by: Jike Song <jike.song@intel.com>
--
Thanks,
Jike
On 12/22/2016 07:27 AM, Alex Williamson wrote:
> From: Alex Williamson <alwillia@nuc.home>
>
> Add an mdev_ prefix so we're not poluting the namespace so much.
>
> Cc: Kirti Wankhede <kwankhede@nvidia.com>
> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
> Cc: Zhi Wang <zhi.a.wang@intel.com>
> Cc: Jike Song <jike.song@intel.com>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
> drivers/vfio/mdev/mdev_core.c | 28 ++++++++++++++--------------
> drivers/vfio/mdev/mdev_private.h | 6 +++---
> drivers/vfio/mdev/mdev_sysfs.c | 8 ++++----
> drivers/vfio/mdev/vfio_mdev.c | 12 ++++++------
> include/linux/mdev.h | 16 ++++++++--------
> samples/vfio-mdev/mtty.c | 2 +-
> 7 files changed, 37 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index 4dd6722..081ada2 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -1089,7 +1089,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
> return 0;
> }
>
> -static const struct parent_ops intel_vgpu_ops = {
> +static const struct mdev_parent_ops intel_vgpu_ops = {
> .supported_type_groups = intel_vgpu_type_groups,
> .create = intel_vgpu_create,
> .remove = intel_vgpu_remove,
> diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
> index be1ee89..4a140e0 100644
> --- a/drivers/vfio/mdev/mdev_core.c
> +++ b/drivers/vfio/mdev/mdev_core.c
> @@ -42,7 +42,7 @@ static int _find_mdev_device(struct device *dev, void *data)
> return 0;
> }
>
> -static bool mdev_device_exist(struct parent_device *parent, uuid_le uuid)
> +static bool mdev_device_exist(struct mdev_parent *parent, uuid_le uuid)
> {
> struct device *dev;
>
> @@ -56,9 +56,9 @@ static bool mdev_device_exist(struct parent_device *parent, uuid_le uuid)
> }
>
> /* Should be called holding parent_list_lock */
> -static struct parent_device *__find_parent_device(struct device *dev)
> +static struct mdev_parent *__find_parent_device(struct device *dev)
> {
> - struct parent_device *parent;
> + struct mdev_parent *parent;
>
> list_for_each_entry(parent, &parent_list, next) {
> if (parent->dev == dev)
> @@ -69,8 +69,8 @@ static struct parent_device *__find_parent_device(struct device *dev)
>
> static void mdev_release_parent(struct kref *kref)
> {
> - struct parent_device *parent = container_of(kref, struct parent_device,
> - ref);
> + struct mdev_parent *parent = container_of(kref, struct mdev_parent,
> + ref);
> struct device *dev = parent->dev;
>
> kfree(parent);
> @@ -78,7 +78,7 @@ static void mdev_release_parent(struct kref *kref)
> }
>
> static
> -inline struct parent_device *mdev_get_parent(struct parent_device *parent)
> +inline struct mdev_parent *mdev_get_parent(struct mdev_parent *parent)
> {
> if (parent)
> kref_get(&parent->ref);
> @@ -86,7 +86,7 @@ inline struct parent_device *mdev_get_parent(struct parent_device *parent)
> return parent;
> }
>
> -static inline void mdev_put_parent(struct parent_device *parent)
> +static inline void mdev_put_parent(struct mdev_parent *parent)
> {
> if (parent)
> kref_put(&parent->ref, mdev_release_parent);
> @@ -95,7 +95,7 @@ static inline void mdev_put_parent(struct parent_device *parent)
> static int mdev_device_create_ops(struct kobject *kobj,
> struct mdev_device *mdev)
> {
> - struct parent_device *parent = mdev->parent;
> + struct mdev_parent *parent = mdev->parent;
> int ret;
>
> ret = parent->ops->create(kobj, mdev);
> @@ -122,7 +122,7 @@ static int mdev_device_create_ops(struct kobject *kobj,
> */
> static int mdev_device_remove_ops(struct mdev_device *mdev, bool force_remove)
> {
> - struct parent_device *parent = mdev->parent;
> + struct mdev_parent *parent = mdev->parent;
> int ret;
>
> /*
> @@ -153,10 +153,10 @@ static int mdev_device_remove_cb(struct device *dev, void *data)
> * Add device to list of registered parent devices.
> * Returns a negative value on error, otherwise 0.
> */
> -int mdev_register_device(struct device *dev, const struct parent_ops *ops)
> +int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)
> {
> int ret;
> - struct parent_device *parent;
> + struct mdev_parent *parent;
>
> /* check for mandatory ops */
> if (!ops || !ops->create || !ops->remove || !ops->supported_type_groups)
> @@ -229,7 +229,7 @@ int mdev_register_device(struct device *dev, const struct parent_ops *ops)
>
> void mdev_unregister_device(struct device *dev)
> {
> - struct parent_device *parent;
> + struct mdev_parent *parent;
> bool force_remove = true;
>
> mutex_lock(&parent_list_lock);
> @@ -266,7 +266,7 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid)
> {
> int ret;
> struct mdev_device *mdev;
> - struct parent_device *parent;
> + struct mdev_parent *parent;
> struct mdev_type *type = to_mdev_type(kobj);
>
> parent = mdev_get_parent(type->parent);
> @@ -330,7 +330,7 @@ int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid)
> int mdev_device_remove(struct device *dev, bool force_remove)
> {
> struct mdev_device *mdev;
> - struct parent_device *parent;
> + struct mdev_parent *parent;
> struct mdev_type *type;
> int ret;
>
> diff --git a/drivers/vfio/mdev/mdev_private.h b/drivers/vfio/mdev/mdev_private.h
> index d35097c..0b72c2d9 100644
> --- a/drivers/vfio/mdev/mdev_private.h
> +++ b/drivers/vfio/mdev/mdev_private.h
> @@ -19,7 +19,7 @@
> struct mdev_type {
> struct kobject kobj;
> struct kobject *devices_kobj;
> - struct parent_device *parent;
> + struct mdev_parent *parent;
> struct list_head next;
> struct attribute_group *group;
> };
> @@ -29,8 +29,8 @@ struct mdev_type {
> #define to_mdev_type(_kobj) \
> container_of(_kobj, struct mdev_type, kobj)
>
> -int parent_create_sysfs_files(struct parent_device *parent);
> -void parent_remove_sysfs_files(struct parent_device *parent);
> +int parent_create_sysfs_files(struct mdev_parent *parent);
> +void parent_remove_sysfs_files(struct mdev_parent *parent);
>
> int mdev_create_sysfs_files(struct device *dev, struct mdev_type *type);
> void mdev_remove_sysfs_files(struct device *dev, struct mdev_type *type);
> diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c
> index 1a53deb..802df21 100644
> --- a/drivers/vfio/mdev/mdev_sysfs.c
> +++ b/drivers/vfio/mdev/mdev_sysfs.c
> @@ -92,7 +92,7 @@ static void mdev_type_release(struct kobject *kobj)
> .release = mdev_type_release,
> };
>
> -struct mdev_type *add_mdev_supported_type(struct parent_device *parent,
> +struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent,
> struct attribute_group *group)
> {
> struct mdev_type *type;
> @@ -158,7 +158,7 @@ static void remove_mdev_supported_type(struct mdev_type *type)
> kobject_put(&type->kobj);
> }
>
> -static int add_mdev_supported_type_groups(struct parent_device *parent)
> +static int add_mdev_supported_type_groups(struct mdev_parent *parent)
> {
> int i;
>
> @@ -183,7 +183,7 @@ static int add_mdev_supported_type_groups(struct parent_device *parent)
> }
>
> /* mdev sysfs functions */
> -void parent_remove_sysfs_files(struct parent_device *parent)
> +void parent_remove_sysfs_files(struct mdev_parent *parent)
> {
> struct mdev_type *type, *tmp;
>
> @@ -196,7 +196,7 @@ void parent_remove_sysfs_files(struct parent_device *parent)
> kset_unregister(parent->mdev_types_kset);
> }
>
> -int parent_create_sysfs_files(struct parent_device *parent)
> +int parent_create_sysfs_files(struct mdev_parent *parent)
> {
> int ret;
>
> diff --git a/drivers/vfio/mdev/vfio_mdev.c b/drivers/vfio/mdev/vfio_mdev.c
> index ffc3675..fa848a7 100644
> --- a/drivers/vfio/mdev/vfio_mdev.c
> +++ b/drivers/vfio/mdev/vfio_mdev.c
> @@ -27,7 +27,7 @@
> static int vfio_mdev_open(void *device_data)
> {
> struct mdev_device *mdev = device_data;
> - struct parent_device *parent = mdev->parent;
> + struct mdev_parent *parent = mdev->parent;
> int ret;
>
> if (unlikely(!parent->ops->open))
> @@ -46,7 +46,7 @@ static int vfio_mdev_open(void *device_data)
> static void vfio_mdev_release(void *device_data)
> {
> struct mdev_device *mdev = device_data;
> - struct parent_device *parent = mdev->parent;
> + struct mdev_parent *parent = mdev->parent;
>
> if (likely(parent->ops->release))
> parent->ops->release(mdev);
> @@ -58,7 +58,7 @@ static long vfio_mdev_unlocked_ioctl(void *device_data,
> unsigned int cmd, unsigned long arg)
> {
> struct mdev_device *mdev = device_data;
> - struct parent_device *parent = mdev->parent;
> + struct mdev_parent *parent = mdev->parent;
>
> if (unlikely(!parent->ops->ioctl))
> return -EINVAL;
> @@ -70,7 +70,7 @@ static ssize_t vfio_mdev_read(void *device_data, char __user *buf,
> size_t count, loff_t *ppos)
> {
> struct mdev_device *mdev = device_data;
> - struct parent_device *parent = mdev->parent;
> + struct mdev_parent *parent = mdev->parent;
>
> if (unlikely(!parent->ops->read))
> return -EINVAL;
> @@ -82,7 +82,7 @@ static ssize_t vfio_mdev_write(void *device_data, const char __user *buf,
> size_t count, loff_t *ppos)
> {
> struct mdev_device *mdev = device_data;
> - struct parent_device *parent = mdev->parent;
> + struct mdev_parent *parent = mdev->parent;
>
> if (unlikely(!parent->ops->write))
> return -EINVAL;
> @@ -93,7 +93,7 @@ static ssize_t vfio_mdev_write(void *device_data, const char __user *buf,
> static int vfio_mdev_mmap(void *device_data, struct vm_area_struct *vma)
> {
> struct mdev_device *mdev = device_data;
> - struct parent_device *parent = mdev->parent;
> + struct mdev_parent *parent = mdev->parent;
>
> if (unlikely(!parent->ops->mmap))
> return -EINVAL;
> diff --git a/include/linux/mdev.h b/include/linux/mdev.h
> index c3dbf0e..f7c04bb 100644
> --- a/include/linux/mdev.h
> +++ b/include/linux/mdev.h
> @@ -14,9 +14,9 @@
> #define MDEV_H
>
> /* Parent device */
> -struct parent_device {
> - struct device *dev;
> - const struct parent_ops *ops;
> +struct mdev_parent {
> + struct device *dev;
> + const struct mdev_parent_ops *ops;
>
> /* internal */
> struct kref ref;
> @@ -29,7 +29,7 @@ struct parent_device {
> /* Mediated device */
> struct mdev_device {
> struct device dev;
> - struct parent_device *parent;
> + struct mdev_parent *parent;
> uuid_le uuid;
> void *driver_data;
>
> @@ -39,7 +39,7 @@ struct mdev_device {
> };
>
> /**
> - * struct parent_ops - Structure to be registered for each parent device to
> + * struct mdev_parent_ops - Structure to be registered for each parent device to
> * register the device to mdev module.
> *
> * @owner: The module owner.
> @@ -85,10 +85,10 @@ struct mdev_device {
> * @mdev: mediated device structure
> * @vma: vma structure
> * Parent device that support mediated device should be registered with mdev
> - * module with parent_ops structure.
> + * module with mdev_parent_ops structure.
> **/
>
> -struct parent_ops {
> +struct mdev_parent_ops {
> struct module *owner;
> const struct attribute_group **dev_attr_groups;
> const struct attribute_group **mdev_attr_groups;
> @@ -158,7 +158,7 @@ static inline void mdev_set_drvdata(struct mdev_device *mdev, void *data)
> #define dev_is_mdev(d) ((d)->bus == &mdev_bus_type)
>
> extern int mdev_register_device(struct device *dev,
> - const struct parent_ops *ops);
> + const struct mdev_parent_ops *ops);
> extern void mdev_unregister_device(struct device *dev);
>
> extern int mdev_register_driver(struct mdev_driver *drv, struct module *owner);
> diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c
> index 6b633a4..1a74f0e 100644
> --- a/samples/vfio-mdev/mtty.c
> +++ b/samples/vfio-mdev/mtty.c
> @@ -1402,7 +1402,7 @@ struct attribute_group *mdev_type_groups[] = {
> NULL,
> };
>
> -struct parent_ops mdev_fops = {
> +struct mdev_parent_ops mdev_fops = {
> .owner = THIS_MODULE,
> .dev_attr_groups = mtty_dev_groups,
> .mdev_attr_groups = mdev_dev_groups,
>
next prev parent reply other threads:[~2016-12-22 7:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-21 23:27 [PATCH 0/4] vfio-mdev: Clean namespace and better define ABI Alex Williamson
2016-12-21 23:27 ` [PATCH 1/4] vfio-mdev: Remove an unused structure element Alex Williamson
2016-12-21 23:27 ` [PATCH 2/4] vfio-mdev: de-polute the namespace, rename parent_device & parent_ops Alex Williamson
2016-12-22 7:51 ` Jike Song [this message]
2016-12-21 23:27 ` [PATCH 3/4] vfio-mdev: Make mdev_parent private Alex Williamson
2016-12-21 23:27 ` [PATCH 4/4] vfio-mdev: Make mdev_device private and abstract interfaces Alex Williamson
2016-12-22 2:11 ` [PATCH 0/4] vfio-mdev: Clean namespace and better define ABI Jike Song
2016-12-22 2:31 ` Alex Williamson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=585B861A.5060908@intel.com \
--to=jike.song@intel.com \
--cc=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zhenyuw@linux.intel.com \
--cc=zhi.a.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.