From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [RFC 1/2] media: Use a better owner for the media device
Date: Thu, 26 Dec 2013 00:23:41 +0100 [thread overview]
Message-ID: <7531072.aOyNN2I7IG@avalon> (raw)
In-Reply-To: <1386936216-32296-1-git-send-email-sakari.ailus@linux.intel.com>
Hi Sakari,
Thank you for the patch.
On Friday 13 December 2013 14:03:35 Sakari Ailus wrote:
> mdev->fops->owner is actually the owner of the very same module which
> implements media_device_register(), so it can't be unloaded anyway. Instead,
> use THIS_MODULE through a macro as does video_register_device().
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
This looks good to me.
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/media/media-device.c | 7 ++++---
> drivers/media/media-devnode.c | 5 +++--
> include/media/media-device.h | 4 +++-
> include/media/media-devnode.h | 3 ++-
> 4 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index d5a7a13..51217f0 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -372,7 +372,8 @@ static void media_device_release(struct media_devnode
> *mdev) * - dev must point to the parent device
> * - model must be filled with the device model name
> */
> -int __must_check media_device_register(struct media_device *mdev)
> +int __must_check __media_device_register(struct media_device *mdev,
> + struct module *owner)
> {
> int ret;
>
> @@ -388,7 +389,7 @@ int __must_check media_device_register(struct
> media_device *mdev) mdev->devnode.fops = &media_device_fops;
> mdev->devnode.parent = mdev->dev;
> mdev->devnode.release = media_device_release;
> - ret = media_devnode_register(&mdev->devnode);
> + ret = media_devnode_register(&mdev->devnode, owner);
> if (ret < 0)
> return ret;
>
> @@ -400,7 +401,7 @@ int __must_check media_device_register(struct
> media_device *mdev)
>
> return 0;
> }
> -EXPORT_SYMBOL_GPL(media_device_register);
> +EXPORT_SYMBOL_GPL(__media_device_register);
>
> /**
> * media_device_unregister - unregister a media device
> diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
> index fb0f046..7acd19c 100644
> --- a/drivers/media/media-devnode.c
> +++ b/drivers/media/media-devnode.c
> @@ -232,7 +232,8 @@ static const struct file_operations media_devnode_fops =
> { * the media_devnode structure is *not* called, so the caller is
> responsible for * freeing any data.
> */
> -int __must_check media_devnode_register(struct media_devnode *mdev)
> +int __must_check media_devnode_register(struct media_devnode *mdev,
> + struct module *owner)
> {
> int minor;
> int ret;
> @@ -253,7 +254,7 @@ int __must_check media_devnode_register(struct
> media_devnode *mdev)
>
> /* Part 2: Initialize and register the character device */
> cdev_init(&mdev->cdev, &media_devnode_fops);
> - mdev->cdev.owner = mdev->fops->owner;
> + mdev->cdev.owner = owner;
>
> ret = cdev_add(&mdev->cdev, MKDEV(MAJOR(media_dev_t), mdev->minor), 1);
> if (ret < 0) {
> diff --git a/include/media/media-device.h b/include/media/media-device.h
> index 12155a9..6e6db78 100644
> --- a/include/media/media-device.h
> +++ b/include/media/media-device.h
> @@ -87,7 +87,9 @@ struct media_device {
> /* media_devnode to media_device */
> #define to_media_device(node) container_of(node, struct media_device,
> devnode)
>
> -int __must_check media_device_register(struct media_device *mdev);
> +int __must_check __media_device_register(struct media_device *mdev,
> + struct module *owner);
> +#define media_device_register(mdev) __media_device_register(mdev,
> THIS_MODULE) void media_device_unregister(struct media_device *mdev);
>
> int __must_check media_device_register_entity(struct media_device *mdev,
> diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h
> index 3446af2..0dc7060 100644
> --- a/include/media/media-devnode.h
> +++ b/include/media/media-devnode.h
> @@ -82,7 +82,8 @@ struct media_devnode {
> /* dev to media_devnode */
> #define to_media_devnode(cd) container_of(cd, struct media_devnode, dev)
>
> -int __must_check media_devnode_register(struct media_devnode *mdev);
> +int __must_check media_devnode_register(struct media_devnode *mdev,
> + struct module *owner);
> void media_devnode_unregister(struct media_devnode *mdev);
>
> static inline struct media_devnode *media_devnode_data(struct file *filp)
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2013-12-25 23:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-13 12:03 [RFC 1/2] media: Use a better owner for the media device Sakari Ailus
2013-12-13 12:03 ` [RFC 2/2] media: v4l: Only get module if it's different than the driver for v4l2_dev Sakari Ailus
2013-12-17 13:49 ` [RFC v1.1 " Sakari Ailus
2013-12-25 23:44 ` Laurent Pinchart
2014-01-10 9:08 ` Sakari Ailus
2013-12-25 23:23 ` Laurent Pinchart [this message]
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=7531072.aOyNN2I7IG@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox