diff mbox

[v2,2/7] drm/i2c: tda998x: move CEC device initialisation later

Message ID E1eMYvA-0004VY-Sp@rmk-PC.armlinux.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Russell King (Oracle) Dec. 6, 2017, 12:35 p.m. UTC
We no longer use the CEC client to access the CEC part itself, so we can
move this later in the initialisation sequence.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Russell King (Oracle) Dec. 8, 2017, 11:59 a.m. UTC | #1
On Wed, Dec 06, 2017 at 02:54:04PM +0100, Hans Verkuil wrote:
> On 12/06/17 13:35, Russell King wrote:
> > We no longer use the CEC client to access the CEC part itself, so we can
> > move this later in the initialisation sequence.
> > 
> > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> > ---
> >  drivers/gpu/drm/i2c/tda998x_drv.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
> > index 7f4dbca7f7f4..4aeac2127974 100644
> > --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> > +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> > @@ -1490,9 +1490,6 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
> >  	priv->cec_addr = 0x34 + (client->addr & 0x03);
> >  	priv->current_page = 0xff;
> >  	priv->hdmi = client;
> > -	priv->cec = i2c_new_dummy(client->adapter, priv->cec_addr);
> > -	if (!priv->cec)
> > -		return -ENODEV;
> >  
> >  	/* wake up the device: */
> >  	cec_write(priv, REG_CEC_ENAMODS,
> > @@ -1546,6 +1543,10 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
> >  			CEC_FRO_IM_CLK_CTRL_GHOST_DIS | CEC_FRO_IM_CLK_CTRL_IMCLK_SEL);
> >  
> >  	/* initialize the optional IRQ */
> > +	priv->cec = i2c_new_dummy(client->adapter, priv->cec_addr);
> > +	if (!priv->cec)
> > +		return -ENODEV;
> > +
> 
> I'd move this up to before the 'initialize the optional IRQ' comment, since
> that should stay with the 'if (client->irq) {' line below.

I've swapped the order of patches 2 and 3, and moved this further down
near where we add the real cec device in a later patch.  This is
starting to get quite different from the patch series that I've tested,
and as I've already mentioned, testing is not going to happen for a
while.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 7f4dbca7f7f4..4aeac2127974 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1490,9 +1490,6 @@  static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
 	priv->cec_addr = 0x34 + (client->addr & 0x03);
 	priv->current_page = 0xff;
 	priv->hdmi = client;
-	priv->cec = i2c_new_dummy(client->adapter, priv->cec_addr);
-	if (!priv->cec)
-		return -ENODEV;
 
 	/* wake up the device: */
 	cec_write(priv, REG_CEC_ENAMODS,
@@ -1546,6 +1543,10 @@  static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
 			CEC_FRO_IM_CLK_CTRL_GHOST_DIS | CEC_FRO_IM_CLK_CTRL_IMCLK_SEL);
 
 	/* initialize the optional IRQ */
+	priv->cec = i2c_new_dummy(client->adapter, priv->cec_addr);
+	if (!priv->cec)
+		return -ENODEV;
+
 	if (client->irq) {
 		unsigned long irq_flags;