diff mbox

[02/11] ASoC: Intel: Skylake: Fix delay wrap condition

Message ID 1454502594-21700-3-git-send-email-vinod.koul@intel.com (mailing list archive)
State Accepted
Commit ee564d489cc47b1b6043bbe7e95464306d112cf5
Headers show

Commit Message

Vinod Koul Feb. 3, 2016, 12:29 p.m. UTC
From: Guneshwor Singh <guneshwor.o.singh@intel.com>

When delay reported by HW is equal to buffersize, it means the
value is wrapped so we should report as 0. So add the condition
to check this while reporting the delay from LPIB.

Signed-off-by: Guneshwor Singh <guneshwor.o.singh@intel.com>
Signed-off-by: Dharageswari.R <dharageswari.r@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 sound/soc/intel/skylake/skl-pcm.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mark Brown Feb. 4, 2016, 11:24 a.m. UTC | #1
On Wed, Feb 03, 2016 at 05:59:45PM +0530, Vinod Koul wrote:

> +	delay = (hstream->bufsize == delay) ? 0 : delay;

Please don't abuse the ternery operator, if you're not inserting it into
the middle of another expression there's no reason not to use a normal
if statement.
Vinod Koul Feb. 4, 2016, 3:03 p.m. UTC | #2
On Thu, Feb 04, 2016 at 11:24:36AM +0000, Mark Brown wrote:
> On Wed, Feb 03, 2016 at 05:59:45PM +0530, Vinod Koul wrote:
> 
> > +	delay = (hstream->bufsize == delay) ? 0 : delay;
> 
> Please don't abuse the ternery operator, if you're not inserting it into
> the middle of another expression there's no reason not to use a normal
> if statement.

Ah okay. Sure I will send an update to modify this

Thanks
diff mbox

Patch

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index f3553258091a..b6e6b61d10ec 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -863,6 +863,7 @@  static int skl_get_delay_from_lpib(struct hdac_ext_bus *ebus,
 		else
 			delay += hstream->bufsize;
 	}
+	delay = (hstream->bufsize == delay) ? 0 : delay;
 
 	if (delay >= hstream->period_bytes) {
 		dev_info(bus->dev,