[media] cec: pass parent device in register(), not allocate()

The cec_allocate_adapter function doesn't need the parent device, only the
cec_register_adapter function needs it.

Drop the cec_devnode parent field, since devnode.dev.parent can be used
instead.

This change makes the framework consistent with other frameworks where the
parent device is not used until the device is registered.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Hans Verkuil
2016-11-25 06:23:34 -02:00
committed by Mauro Carvalho Chehab
parent cf2113ca56
commit f51e80804f
13 changed files with 41 additions and 47 deletions

View File

@@ -35,7 +35,6 @@
* struct cec_devnode - cec device node
* @dev: cec device
* @cdev: cec character device
* @parent: parent device
* @minor: device node minor number
* @registered: the device was correctly registered
* @unregistered: the device was unregistered
@@ -51,7 +50,6 @@ struct cec_devnode {
/* sysfs */
struct device dev;
struct cdev cdev;
struct device *parent;
/* device info */
int minor;
@@ -198,9 +196,8 @@ static inline bool cec_is_sink(const struct cec_adapter *adap)
#if IS_ENABLED(CONFIG_MEDIA_CEC_SUPPORT)
struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
void *priv, const char *name, u32 caps, u8 available_las,
struct device *parent);
int cec_register_adapter(struct cec_adapter *adap);
void *priv, const char *name, u32 caps, u8 available_las);
int cec_register_adapter(struct cec_adapter *adap, struct device *parent);
void cec_unregister_adapter(struct cec_adapter *adap);
void cec_delete_adapter(struct cec_adapter *adap);
@@ -218,7 +215,8 @@ void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg);
#else
static inline int cec_register_adapter(struct cec_adapter *adap)
static inline int cec_register_adapter(struct cec_adapter *adap,
struct device *parent)
{
return 0;
}