staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done
Subsystems (2)
PATCH 1/1 staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done
Simplify hdmi_phy_wait_i2c_done so the call to hdmi_readb is only done in one place. This also fixes a checkpatch warning.
--- drivers/staging/imx-drm/imx-hdmi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/imx-drm/imx-hdmi.c +1 -4
@@ -660,13 +660,10 @@ static inline void hdmi_phy_test_dout(struct imx_hdmi *hdmi,static bool hdmi_phy_wait_i2c_done (struct imx_hdmi *hdmi,int msec) { -unsigned char val =0 ; - val =hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ; -while (!val) { +while ((hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ) ==0 ) {udelay (1000 );if (msec-- ==0 )return false; - val =hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ; }return true; }
Signature · 1 line
1.9.1
PATCH 1/1 staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done
Quoted 18 lines · Emil Renner Berthing
Simplify
hdmi_phy_wait_i2c_doneso the call tohdmi_readbis only done in one place. This also fixes a checkpatch warning.Signed-off-by Emil Renner Berthing <[email protected]>--- drivers/staging/imx-drm/imx-hdmi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/staging/imx-drm/imx-hdmi.c +0
-1@@ -660,13 +660,10 @@ static inline void hdmi_phy_test_dout(struct imx_hdmi *hdmi,static bool hdmi_phy_wait_i2c_done (struct imx_hdmi *hdmi,int msec) { -unsigned char val =0 ;
drivers/staging/imx-drm/imx-hdmi.c static inline void hdmi_phy_test_dout(struct imx_hdmi *hdmi, · line 669
Quoted 10 lines
drivers/staging/imx-drm/imx-hdmi.c +1
-3- val =hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ; -while (!val) { +while ((hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ) ==0 ) {udelay (1000 );if (msec-- ==0 )return false; - val =hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ; }return true; }
I'd prefer to have the msec check before the delay, not your fault, but while your in the area anyway. That way a wait of 0 ms doesn't wait at all and just checks if it is done.
Troy
PATCH 1/1 staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done
Quoted 25 lines · Troy Kisky
Quoted 24 lines · Emil Renner Berthing
Simplify
hdmi_phy_wait_i2c_doneso the call tohdmi_readbis only done in one place. This also fixes a checkpatch warning.Signed-off-by Emil Renner Berthing <[email protected]>--- drivers/staging/imx-drm/imx-hdmi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/staging/imx-drm/imx-hdmi.c +1
-4@@ -660,13 +660,10 @@ static inline void hdmi_phy_test_dout(struct imx_hdmi *hdmi,static bool hdmi_phy_wait_i2c_done (struct imx_hdmi *hdmi,int msec) { -unsigned char val =0 ; - val =hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ; -while (!val) { +while ((hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ) ==0 ) {udelay (1000 );if (msec-- ==0 )return false; - val =hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ;
Quoted 8 lines
drivers/staging/imx-drm/imx-hdmi.c static inline void hdmi_phy_test_dout(struct imx_hdmi *hdmi, · line 669
Quoted 4 lines
drivers/staging/imx-drm/imx-hdmi.c +0
-0}return true; }I'd prefer to have the msec check before the delay, not your fault, but while your in the area anyway. That way a wait of 0 ms doesn't wait at all and just checks if it is done.
Makes perfect sense. I'll resend the patch although this was mostly to make the Eudyptula scripts happy ;)
/Emil
PATCH v2 1/1 staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done
In reply to Emil Renner BerthingSimplify hdmi_phy_wait_i2c_done so the call to hdmi_readb is only done in one place. Also check for timout before waiting as suggested by Troy Kisky.
This also fixes a checkpatch warning.
--- drivers/staging/imx-drm/imx-hdmi.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/imx-drm/imx-hdmi.c +2 -5
@@ -660,13 +660,10 @@ static inline void hdmi_phy_test_dout(struct imx_hdmi *hdmi,static bool hdmi_phy_wait_i2c_done (struct imx_hdmi *hdmi,int msec) { -unsigned char val =0 ; - val =hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ; -while (!val) { -udelay (1000 ); +while ((hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ) ==0 ) {if (msec-- ==0 )return false; - val =hdmi_readb (hdmi,HDMI_IH_I2CMPHY_STAT0 ) &0x3 ; +udelay (1000 ); }return true; }
Signature · 1 line
1.9.1