Add cec_get_drvdata()
Subsystems (6)
cover Add cec_get_drvdata()
Hi,
This series introduces a new helper function called cec_get_drvdata() which returns the adapter private data and can be used by drivers that use CEC.
Best regards,
Jose Miguel Abreu
Jose Abreu (8):
[media] cec: Add cec_get_drvdata()
[media] staging: st-cec: Use cec_get_drvdata()
[media] staging: s5p-cec: Use cec_get_drvdata()
[media] i2c: adv7511: Use cec_get_drvdata()
[media] i2c: adv7604: Use cec_get_drvdata()
[media] i2c: adv7842: Use cec_get_drvdata()
[media] usb: pulse8-cec: Use cec_get_drvdata()
[media] platform: vivid: Use cec_get_drvdata()
drivers/media/i2c/adv7511.c | 6 +++--- drivers/media/i2c/adv7604.c | 6 +++--- drivers/media/i2c/adv7842.c | 6 +++--- drivers/media/platform/vivid/vivid-cec.c | 4 ++-- drivers/media/usb/pulse8-cec/pulse8-cec.c | 6 +++--- drivers/staging/media/s5p-cec/s5p_cec.c | 6 +++--- drivers/staging/media/st-cec/stih-cec.c | 6 +++--- include/media/cec.h | 5 +++++ 8 files changed, 25 insertions(+), 20 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/8 cec: Add cec_get_drvdata()
Add a helper function to get driver private data from CEC adapter. This helps the readability a little bit and allows to change the 'priv' field name to something else without needing to touch all drivers.
--- include/media/cec.h | 5 +++++ 1 file changed, 5 insertions(+)
include/media/cec.h +5 -0
@@ -184,6 +184,11 @@ struct cec_adapter {char input_drv[32 ]; }; +static inline void *cec_get_drvdata (const struct cec_adapter *adap) +{ +return adap->priv; +} +static inline bool cec_has_log_addr (const struct cec_adapter *adap,u8 log_addr) {return adap->log_addrs.log_addr_mask & (1 << log_addr);
Signature · 1 line
1.9.1
PATCH 2/8 staging: st-cec: Use cec_get_drvdata()
In reply to Jose AbreuUse helper function to get driver private data from CEC adapter.
--- drivers/staging/media/st-cec/stih-cec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/st-cec/stih-cec.c +3 -3
@@ -133,7 +133,7 @@ struct stih_cec {static int stih_cec_adap_enable (struct cec_adapter *adap,bool enable) { -struct stih_cec *cec = adap->priv; +struct stih_cec *cec =cec_get_drvdata (adap);if (enable) {/* The doc says (input TCLK_PERIOD * CEC_CLK_DIV) = 0.1ms */
@@ -189,7 +189,7 @@ static int stih_cec_adap_enable(struct cec_adapter *adap, bool enable)static int stih_cec_adap_log_addr (struct cec_adapter *adap,u8 logical_addr) { -struct stih_cec *cec = adap->priv; +struct stih_cec *cec =cec_get_drvdata (adap);u32 reg =readl (cec->regs +CEC_ADDR_TABLE ); reg |=1 << logical_addr;
@@ -205,7 +205,7 @@ static int stih_cec_adap_log_addr(struct cec_adapter *adap, u8 logical_addr)static int stih_cec_adap_transmit (struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg) { -struct stih_cec *cec = adap->priv; +struct stih_cec *cec =cec_get_drvdata (adap);int i;/* Copy message into registers */
Signature · 1 line
1.9.1
Re: [PATCH 2/8] [media] staging: st-cec: Use cec_get_drvdata()
2017-03-24 17:47 GMT+01:00 Jose Abreu <[email protected]>:
Quoted 2 lines
Use helper function to get driver private data from CEC adapter.
That looks good for me but does it make sense to merge that now ? or should we wait until
cec drivers as move out of staging ?
Hans what is your view on that ?
Quoted 42 lines
Signed-off-by Jose Abreu <[email protected]>Cc Benjamin Gaignard <[email protected]>--- drivers/staging/media/st-cec/stih-cec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/staging/media/st-cec/stih-cec.c +3
-4@@ -133,7 +133,7 @@ struct stih_cec {static int stih_cec_adap_enable (struct cec_adapter *adap,bool enable) { -struct stih_cec *cec = adap->priv; +struct stih_cec *cec =cec_get_drvdata (adap);if (enable) {/* The doc says (input TCLK_PERIOD * CEC_CLK_DIV) = 0.1ms */ @@ -189,7 +189,7 @@ static int stih_cec_adap_enable(struct cec_adapter *adap, bool enable)static int stih_cec_adap_log_addr (struct cec_adapter *adap,u8 logical_addr) { -struct stih_cec *cec = adap->priv; +struct stih_cec *cec =cec_get_drvdata (adap);u32 reg =readl (cec->regs +CEC_ADDR_TABLE ); reg |=1 << logical_addr;@@ -205,7 +205,7 @@ static int stih_cec_adap_log_addr(struct cec_adapter *adap, u8 logical_addr)static int stih_cec_adap_transmit (struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg) { -struct stih_cec *cec = adap->priv; +struct stih_cec *cec =cec_get_drvdata (adap);int i;/* Copy message into registers */ --1.9.1
Re: [PATCH 2/8] [media] staging: st-cec: Use cec_get_drvdata()
Quoted 8 lines · Benjamin Gaignard
2017-03-24 17:47 GMT+01:00 Jose Abreu <[email protected]>:
Quoted 2 lines
Use helper function to get driver private data from CEC adapter.
That looks good for me but does it make sense to merge that now ? or should we wait until
cec drivers as move out of staging ?
Hans what is your view on that ?
Why not merge this? It makes no sense not to update staging drivers. Just because they are in staging doesn't mean you can't improve them :-)
Regards,
Hans
Quoted 43 lines
Quoted 43 lines
Signed-off-by Jose Abreu <[email protected]>Cc Benjamin Gaignard <[email protected]>--- drivers/staging/media/st-cec/stih-cec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/staging/media/st-cec/stih-cec.c +3
-4@@ -133,7 +133,7 @@ struct stih_cec {static int stih_cec_adap_enable (struct cec_adapter *adap,bool enable) { -struct stih_cec *cec = adap->priv; +struct stih_cec *cec =cec_get_drvdata (adap);if (enable) {/* The doc says (input TCLK_PERIOD * CEC_CLK_DIV) = 0.1ms */ @@ -189,7 +189,7 @@ static int stih_cec_adap_enable(struct cec_adapter *adap, bool enable)static int stih_cec_adap_log_addr (struct cec_adapter *adap,u8 logical_addr) { -struct stih_cec *cec = adap->priv; +struct stih_cec *cec =cec_get_drvdata (adap);u32 reg =readl (cec->regs +CEC_ADDR_TABLE ); reg |=1 << logical_addr;@@ -205,7 +205,7 @@ static int stih_cec_adap_log_addr(struct cec_adapter *adap, u8 logical_addr)static int stih_cec_adap_transmit (struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg) { -struct stih_cec *cec = adap->priv; +struct stih_cec *cec =cec_get_drvdata (adap);int i;/* Copy message into registers */ --1.9.1
PATCH 3/8 staging: s5p-cec: Use cec_get_drvdata()
In reply to Jose AbreuUse helper function to get driver private data from CEC adapter.
--- drivers/staging/media/s5p-cec/s5p_cec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/s5p-cec/s5p_cec.c +3 -3
@@ -37,7 +37,7 @@static int s5p_cec_adap_enable (struct cec_adapter *adap,bool enable) { -struct s5p_cec_dev *cec = adap->priv; +struct s5p_cec_dev *cec =cec_get_drvdata (adap);if (enable) {pm_runtime_get_sync (cec->dev);
@@ -61,7 +61,7 @@ static int s5p_cec_adap_enable(struct cec_adapter *adap, bool enable)static int s5p_cec_adap_log_addr (struct cec_adapter *adap,u8 addr) { -struct s5p_cec_dev *cec = adap->priv; +struct s5p_cec_dev *cec =cec_get_drvdata (adap);s5p_cec_set_addr (cec, addr);return 0 ;
@@ -70,7 +70,7 @@ static int s5p_cec_adap_log_addr(struct cec_adapter *adap, u8 addr)static int s5p_cec_adap_transmit (struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg) { -struct s5p_cec_dev *cec = adap->priv; +struct s5p_cec_dev *cec =cec_get_drvdata (adap);/* * Unclear if 0 retries are allowed by the hardware, so have 1 as
Signature · 1 line
1.9.1
PATCH 4/8 i2c: adv7511: Use cec_get_drvdata()
In reply to Jose AbreuUse helper function to get driver private data from CEC adapter.
--- drivers/media/i2c/adv7511.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/i2c/adv7511.c +3 -3
@@ -734,7 +734,7 @@ static int adv7511_s_power(struct v4l2_subdev *sd, int on)#if IS_ENABLED (CONFIG_VIDEO_ADV7511_CEC )static int adv7511_cec_adap_enable (struct cec_adapter *adap,bool enable) { -struct adv7511_state *state = adap->priv; +struct adv7511_state *state =cec_get_drvdata (adap);struct v4l2_subdev *sd = &state->sd;if (state->i2c_cec ==NULL )
@@ -769,7 +769,7 @@ static int adv7511_cec_adap_enable(struct cec_adapter *adap, bool enable)static int adv7511_cec_adap_log_addr (struct cec_adapter *adap,u8 addr) { -struct adv7511_state *state = adap->priv; +struct adv7511_state *state =cec_get_drvdata (adap);struct v4l2_subdev *sd = &state->sd;unsigned int i, free_idx =ADV7511_MAX_ADDRS ;
@@ -824,7 +824,7 @@ static int adv7511_cec_adap_log_addr(struct cec_adapter *adap, u8 addr)static int adv7511_cec_adap_transmit (struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg) { -struct adv7511_state *state = adap->priv; +struct adv7511_state *state =cec_get_drvdata (adap);struct v4l2_subdev *sd = &state->sd;u8 len = msg->len;unsigned int i;
Signature · 1 line
1.9.1
PATCH 5/8 i2c: adv7604: Use cec_get_drvdata()
In reply to Jose AbreuUse helper function to get driver private data from CEC adapter.
--- drivers/media/i2c/adv7604.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/i2c/adv7604.c +3 -3
@@ -2050,7 +2050,7 @@ static void adv76xx_cec_isr(struct v4l2_subdev *sd, bool *handled)static int adv76xx_cec_adap_enable (struct cec_adapter *adap,bool enable) { -struct adv76xx_state *state = adap->priv; +struct adv76xx_state *state =cec_get_drvdata (adap);struct v4l2_subdev *sd = &state->sd;if (!state->cec_enabled_adap && enable) {
@@ -2080,7 +2080,7 @@ static int adv76xx_cec_adap_enable(struct cec_adapter *adap, bool enable)static int adv76xx_cec_adap_log_addr (struct cec_adapter *adap,u8 addr) { -struct adv76xx_state *state = adap->priv; +struct adv76xx_state *state =cec_get_drvdata (adap);struct v4l2_subdev *sd = &state->sd;unsigned int i, free_idx =ADV76XX_MAX_ADDRS ;
@@ -2135,7 +2135,7 @@ static int adv76xx_cec_adap_log_addr(struct cec_adapter *adap, u8 addr)static int adv76xx_cec_adap_transmit (struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg) { -struct adv76xx_state *state = adap->priv; +struct adv76xx_state *state =cec_get_drvdata (adap);struct v4l2_subdev *sd = &state->sd;u8 len = msg->len;unsigned int i;
Signature · 1 line
1.9.1
PATCH 6/8 i2c: adv7842: Use cec_get_drvdata()
In reply to Jose AbreuUse helper function to get driver private data from CEC adapter.
--- drivers/media/i2c/adv7842.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/i2c/adv7842.c +3 -3
@@ -2250,7 +2250,7 @@ static void adv7842_cec_isr(struct v4l2_subdev *sd, bool *handled)static int adv7842_cec_adap_enable (struct cec_adapter *adap,bool enable) { -struct adv7842_state *state = adap->priv; +struct adv7842_state *state =cec_get_drvdata (adap);struct v4l2_subdev *sd = &state->sd;if (!state->cec_enabled_adap && enable) {
@@ -2279,7 +2279,7 @@ static int adv7842_cec_adap_enable(struct cec_adapter *adap, bool enable)static int adv7842_cec_adap_log_addr (struct cec_adapter *adap,u8 addr) { -struct adv7842_state *state = adap->priv; +struct adv7842_state *state =cec_get_drvdata (adap);struct v4l2_subdev *sd = &state->sd;unsigned int i, free_idx =ADV7842_MAX_ADDRS ;
@@ -2334,7 +2334,7 @@ static int adv7842_cec_adap_log_addr(struct cec_adapter *adap, u8 addr)static int adv7842_cec_adap_transmit (struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg) { -struct adv7842_state *state = adap->priv; +struct adv7842_state *state =cec_get_drvdata (adap);struct v4l2_subdev *sd = &state->sd;u8 len = msg->len;unsigned int i;
Signature · 1 line
1.9.1
PATCH 7/8 usb: pulse8-cec: Use cec_get_drvdata()
In reply to Jose AbreuUse helper function to get driver private data from CEC adapter.
--- drivers/media/usb/pulse8-cec/pulse8-cec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/usb/pulse8-cec/pulse8-cec.c +3 -3
@@ -461,7 +461,7 @@ static int pulse8_apply_persistent_config(struct pulse8 *pulse8,static int pulse8_cec_adap_enable (struct cec_adapter *adap,bool enable) { -struct pulse8 *pulse8 = adap->priv; +struct pulse8 *pulse8 =cec_get_drvdata (adap);u8 cmd[16 ];int err;
@@ -474,7 +474,7 @@ static int pulse8_cec_adap_enable(struct cec_adapter *adap, bool enable)static int pulse8_cec_adap_log_addr (struct cec_adapter *adap,u8 log_addr) { -struct pulse8 *pulse8 = adap->priv; +struct pulse8 *pulse8 =cec_get_drvdata (adap);u16 mask =0 ;u16 pa = adap->phys_addr;u8 cmd[16 ];
@@ -594,7 +594,7 @@ static int pulse8_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr)static int pulse8_cec_adap_transmit (struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg) { -struct pulse8 *pulse8 = adap->priv; +struct pulse8 *pulse8 =cec_get_drvdata (adap);u8 cmd[2 ];unsigned int i;int err;
Signature · 1 line
1.9.1
PATCH 8/8 platform: vivid: Use cec_get_drvdata()
In reply to Jose AbreuUse helper function to get driver private data from CEC adapter.
--- drivers/media/platform/vivid/vivid-cec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/vivid/vivid-cec.c +2 -2
@@ -135,7 +135,7 @@ static int vivid_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr)static int vivid_cec_adap_transmit (struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg) { -struct vivid_dev *dev = adap->priv; +struct vivid_dev *dev =cec_get_drvdata (adap);struct vivid_cec_work *cw =kzalloc (sizeof (*cw),GFP_KERNEL );long delta_jiffies =0 ;
@@ -166,7 +166,7 @@ static int vivid_cec_adap_transmit(struct cec_adapter *adap, u8 attempts,static int vivid_received (struct cec_adapter *adap,struct cec_msg *msg) { -struct vivid_dev *dev = adap->priv; +struct vivid_dev *dev =cec_get_drvdata (adap);struct cec_msg reply;u8 dest =cec_msg_destination (msg);u8 disp_ctl;
Signature · 1 line
1.9.1