* [PATCH] staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done
@ 2014-03-29 12:58 Emil Renner Berthing
2014-03-29 18:37 ` Troy Kisky
2014-03-29 23:21 ` [PATCH v2] " Emil Renner Berthing
0 siblings, 2 replies; 4+ messages in thread
From: Emil Renner Berthing @ 2014-03-29 12:58 UTC (permalink / raw)
To: linux-arm-kernel
Simplify hdmi_phy_wait_i2c_done so the call to hdmi_readb is
only done in one place. This also fixes a checkpatch warning.
Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
---
drivers/staging/imx-drm/imx-hdmi.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c
index da71d8d..cc8d232 100644
--- a/drivers/staging/imx-drm/imx-hdmi.c
+++ b/drivers/staging/imx-drm/imx-hdmi.c
@@ -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;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done
2014-03-29 12:58 [PATCH] staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done Emil Renner Berthing
@ 2014-03-29 18:37 ` Troy Kisky
2014-03-29 23:17 ` Emil Renner Berthing
2014-03-29 23:21 ` [PATCH v2] " Emil Renner Berthing
1 sibling, 1 reply; 4+ messages in thread
From: Troy Kisky @ 2014-03-29 18:37 UTC (permalink / raw)
To: linux-arm-kernel
On 3/29/2014 5:58 AM, Emil Renner Berthing wrote:
> Simplify hdmi_phy_wait_i2c_done so the call to hdmi_readb is
> only done in one place. This also fixes a checkpatch warning.
>
> Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
> ---
> drivers/staging/imx-drm/imx-hdmi.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c
> index da71d8d..cc8d232 100644
> --- a/drivers/staging/imx-drm/imx-hdmi.c
> +++ b/drivers/staging/imx-drm/imx-hdmi.c
> @@ -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;
> }
>
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done
2014-03-29 18:37 ` Troy Kisky
@ 2014-03-29 23:17 ` Emil Renner Berthing
0 siblings, 0 replies; 4+ messages in thread
From: Emil Renner Berthing @ 2014-03-29 23:17 UTC (permalink / raw)
To: linux-arm-kernel
On 29 March 2014 19:37, Troy Kisky <troy.kisky@boundarydevices.com> wrote:
> On 3/29/2014 5:58 AM, Emil Renner Berthing wrote:
>> Simplify hdmi_phy_wait_i2c_done so the call to hdmi_readb is
>> only done in one place. This also fixes a checkpatch warning.
>>
>> Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
>> ---
>> drivers/staging/imx-drm/imx-hdmi.c | 5 +----
>> 1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c
>> index da71d8d..cc8d232 100644
>> --- a/drivers/staging/imx-drm/imx-hdmi.c
>> +++ b/drivers/staging/imx-drm/imx-hdmi.c
>> @@ -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;
>> }
>>
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done
2014-03-29 12:58 [PATCH] staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done Emil Renner Berthing
2014-03-29 18:37 ` Troy Kisky
@ 2014-03-29 23:21 ` Emil Renner Berthing
1 sibling, 0 replies; 4+ messages in thread
From: Emil Renner Berthing @ 2014-03-29 23:21 UTC (permalink / raw)
To: linux-arm-kernel
Simplify 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.
Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
---
drivers/staging/imx-drm/imx-hdmi.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c
index da71d8d..6178ffc 100644
--- a/drivers/staging/imx-drm/imx-hdmi.c
+++ b/drivers/staging/imx-drm/imx-hdmi.c
@@ -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;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-29 23:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-29 12:58 [PATCH] staging: imx-drm: imx-hdmi: clean up hdmi_phy_wait_i2c_done Emil Renner Berthing
2014-03-29 18:37 ` Troy Kisky
2014-03-29 23:17 ` Emil Renner Berthing
2014-03-29 23:21 ` [PATCH v2] " Emil Renner Berthing
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.