[media] media: lirc_dev: introduce lirc_allocate_device and lirc_free_device
Introduce two new functions so that the API for lirc_dev matches that of the rc-core and input subsystems. This means that lirc_dev structs are managed using the usual four functions: lirc_allocate_device lirc_free_device lirc_register_device lirc_unregister_device The functions are pretty simplistic at this point, later patches will put more flesh on the bones of both. Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Sean Young <sean@mess.org>
This commit is contained in:
parent
5ddc9c098d
commit
6ecccc379b
|
@ -347,7 +347,7 @@ static int ir_lirc_register(struct rc_dev *dev)
|
||||||
int rc = -ENOMEM;
|
int rc = -ENOMEM;
|
||||||
unsigned long features = 0;
|
unsigned long features = 0;
|
||||||
|
|
||||||
ldev = kzalloc(sizeof(*ldev), GFP_KERNEL);
|
ldev = lirc_allocate_device();
|
||||||
if (!ldev)
|
if (!ldev)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,19 @@ static int lirc_allocate_buffer(struct irctl *ir)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct lirc_dev *
|
||||||
|
lirc_allocate_device(void)
|
||||||
|
{
|
||||||
|
return kzalloc(sizeof(struct lirc_dev), GFP_KERNEL);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(lirc_allocate_device);
|
||||||
|
|
||||||
|
void lirc_free_device(struct lirc_dev *d)
|
||||||
|
{
|
||||||
|
kfree(d);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(lirc_free_device);
|
||||||
|
|
||||||
int lirc_register_device(struct lirc_dev *d)
|
int lirc_register_device(struct lirc_dev *d)
|
||||||
{
|
{
|
||||||
struct irctl *ir;
|
struct irctl *ir;
|
||||||
|
|
|
@ -156,11 +156,10 @@ struct lirc_dev {
|
||||||
struct irctl *irctl;
|
struct irctl *irctl;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* following functions can be called ONLY from user context
|
struct lirc_dev *lirc_allocate_device(void);
|
||||||
*
|
|
||||||
* returns negative value on error or zero
|
void lirc_free_device(struct lirc_dev *d);
|
||||||
* contents of the structure pointed by p is copied
|
|
||||||
*/
|
|
||||||
int lirc_register_device(struct lirc_dev *d);
|
int lirc_register_device(struct lirc_dev *d);
|
||||||
|
|
||||||
void lirc_unregister_device(struct lirc_dev *d);
|
void lirc_unregister_device(struct lirc_dev *d);
|
||||||
|
|
Loading…
Reference in New Issue