[media] rc-main: assign driver type during allocation
The driver type can be assigned immediately when an RC device requests to the framework to allocate the device. This is an 'enum rc_driver_type' data type and specifies whether the device is a raw receiver or scancode receiver. The type will be given as parameter to the rc_allocate_device device. Change accordingly all the drivers calling rc_allocate_device() so that the device type is specified during the rc device allocation. Whenever the device type is not specified, it will be set as RC_DRIVER_SCANCODE which was the default '0' value. Suggested-by: Sean Young <sean@mess.org> Signed-off-by: Andi Shyti <andi.shyti@samsung.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
97c129747a
commit
0f7499fddb
@@ -1577,7 +1577,7 @@ static struct device_type rc_dev_type = {
|
||||
.uevent = rc_dev_uevent,
|
||||
};
|
||||
|
||||
struct rc_dev *rc_allocate_device(void)
|
||||
struct rc_dev *rc_allocate_device(enum rc_driver_type type)
|
||||
{
|
||||
struct rc_dev *dev;
|
||||
|
||||
@@ -1604,6 +1604,8 @@ struct rc_dev *rc_allocate_device(void)
|
||||
dev->dev.class = &rc_class;
|
||||
device_initialize(&dev->dev);
|
||||
|
||||
dev->driver_type = type;
|
||||
|
||||
__module_get(THIS_MODULE);
|
||||
return dev;
|
||||
}
|
||||
@@ -1630,7 +1632,8 @@ static void devm_rc_alloc_release(struct device *dev, void *res)
|
||||
rc_free_device(*(struct rc_dev **)res);
|
||||
}
|
||||
|
||||
struct rc_dev *devm_rc_allocate_device(struct device *dev)
|
||||
struct rc_dev *devm_rc_allocate_device(struct device *dev,
|
||||
enum rc_driver_type type)
|
||||
{
|
||||
struct rc_dev **dr, *rc;
|
||||
|
||||
@@ -1638,7 +1641,7 @@ struct rc_dev *devm_rc_allocate_device(struct device *dev)
|
||||
if (!dr)
|
||||
return NULL;
|
||||
|
||||
rc = rc_allocate_device();
|
||||
rc = rc_allocate_device(type);
|
||||
if (!rc) {
|
||||
devres_free(dr);
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user