mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 12:20:52 +07:00
[media] cec: fix confusing CEC_CAP_RC and IS_REACHABLE(CONFIG_RC_CORE) code
It is a bit confusing how CEC_CAP_RC and IS_REACHABLE(CONFIG_RC_CORE) interact. By stripping CEC_CAP_RC at the beginning rather than after #else it should be a bit clearer what is going on. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
43c0c03961
commit
ee044f5be1
@ -220,6 +220,10 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
|
|||||||
struct cec_adapter *adap;
|
struct cec_adapter *adap;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
#if !IS_REACHABLE(CONFIG_RC_CORE)
|
||||||
|
caps &= ~CEC_CAP_RC;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (WARN_ON(!caps))
|
if (WARN_ON(!caps))
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
if (WARN_ON(!ops))
|
if (WARN_ON(!ops))
|
||||||
@ -252,10 +256,10 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
|
|||||||
return ERR_PTR(res);
|
return ERR_PTR(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if IS_REACHABLE(CONFIG_RC_CORE)
|
||||||
if (!(caps & CEC_CAP_RC))
|
if (!(caps & CEC_CAP_RC))
|
||||||
return adap;
|
return adap;
|
||||||
|
|
||||||
#if IS_REACHABLE(CONFIG_RC_CORE)
|
|
||||||
/* Prepare the RC input device */
|
/* Prepare the RC input device */
|
||||||
adap->rc = rc_allocate_device(RC_DRIVER_SCANCODE);
|
adap->rc = rc_allocate_device(RC_DRIVER_SCANCODE);
|
||||||
if (!adap->rc) {
|
if (!adap->rc) {
|
||||||
@ -282,8 +286,6 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
|
|||||||
adap->rc->priv = adap;
|
adap->rc->priv = adap;
|
||||||
adap->rc->map_name = RC_MAP_CEC;
|
adap->rc->map_name = RC_MAP_CEC;
|
||||||
adap->rc->timeout = MS_TO_NS(100);
|
adap->rc->timeout = MS_TO_NS(100);
|
||||||
#else
|
|
||||||
adap->capabilities &= ~CEC_CAP_RC;
|
|
||||||
#endif
|
#endif
|
||||||
return adap;
|
return adap;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user