mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
[media] media: Use a better owner for the media device
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> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
743e18377c
commit
85de721c46
4 changed files with 12 additions and 7 deletions
|
@ -372,7 +372,8 @@ static void media_device_release(struct media_devnode *mdev)
|
||||||
* - dev must point to the parent device
|
* - dev must point to the parent device
|
||||||
* - model must be filled with the device model name
|
* - 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;
|
int ret;
|
||||||
|
|
||||||
|
@ -388,7 +389,7 @@ int __must_check media_device_register(struct media_device *mdev)
|
||||||
mdev->devnode.fops = &media_device_fops;
|
mdev->devnode.fops = &media_device_fops;
|
||||||
mdev->devnode.parent = mdev->dev;
|
mdev->devnode.parent = mdev->dev;
|
||||||
mdev->devnode.release = media_device_release;
|
mdev->devnode.release = media_device_release;
|
||||||
ret = media_devnode_register(&mdev->devnode);
|
ret = media_devnode_register(&mdev->devnode, owner);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -400,7 +401,7 @@ int __must_check media_device_register(struct media_device *mdev)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(media_device_register);
|
EXPORT_SYMBOL_GPL(__media_device_register);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* media_device_unregister - unregister a media device
|
* media_device_unregister - unregister a media device
|
||||||
|
|
|
@ -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
|
* the media_devnode structure is *not* called, so the caller is responsible for
|
||||||
* freeing any data.
|
* 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 minor;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -253,7 +254,7 @@ int __must_check media_devnode_register(struct media_devnode *mdev)
|
||||||
|
|
||||||
/* Part 2: Initialize and register the character device */
|
/* Part 2: Initialize and register the character device */
|
||||||
cdev_init(&mdev->cdev, &media_devnode_fops);
|
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);
|
ret = cdev_add(&mdev->cdev, MKDEV(MAJOR(media_dev_t), mdev->minor), 1);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
|
@ -87,7 +87,9 @@ struct media_device {
|
||||||
/* media_devnode to media_device */
|
/* media_devnode to media_device */
|
||||||
#define to_media_device(node) container_of(node, struct media_device, devnode)
|
#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);
|
void media_device_unregister(struct media_device *mdev);
|
||||||
|
|
||||||
int __must_check media_device_register_entity(struct media_device *mdev,
|
int __must_check media_device_register_entity(struct media_device *mdev,
|
||||||
|
|
|
@ -82,7 +82,8 @@ struct media_devnode {
|
||||||
/* dev to media_devnode */
|
/* dev to media_devnode */
|
||||||
#define to_media_devnode(cd) container_of(cd, struct media_devnode, dev)
|
#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);
|
void media_devnode_unregister(struct media_devnode *mdev);
|
||||||
|
|
||||||
static inline struct media_devnode *media_devnode_data(struct file *filp)
|
static inline struct media_devnode *media_devnode_data(struct file *filp)
|
||||||
|
|
Loading…
Reference in a new issue