From 2c7765565402a475c9c23b1e99ec68604d78e92e Mon Sep 17 00:00:00 2001 From: Frode Isaksen Date: Thu, 24 May 2012 18:16:55 +0200 Subject: [PATCH] fmradio: set timeout 10 seconds instead of 500 jiffies in FM char driver read and remove a printk on timeout BZ: 33530 Set timeout as a multiple of HZ instead of jiffies in the FM char driver read function, since jiffies may change with the kernel. The timeout is set to 10 seconds as is done in the GPS char driver. Also, do not log an error on read timeout, since it is not an error. Change-Id: Ied50adfa56f1812d27caa671e11f8bdf08c2166e Signed-off-by: Frode Isaksen Reviewed-on: http://android.intel.com:8080/51235 Reviewed-by: Zurmely, PierreX Reviewed-by: Peix, Fabien Tested-by: Zurmely, PierreX Reviewed-by: buildbot Tested-by: buildbot --- drivers/media/radio/wl128x/fmdrv_chr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/radio/wl128x/fmdrv_chr.c b/drivers/media/radio/wl128x/fmdrv_chr.c index 78c02b5..b1d3d37 100644 --- a/drivers/media/radio/wl128x/fmdrv_chr.c +++ b/drivers/media/radio/wl128x/fmdrv_chr.c @@ -128,6 +128,9 @@ #define FM_CORE_READY 2 #define FM_ST_REGISTER_TIMEOUT msecs_to_jiffies(6000) /* 6 sec */ +/* timeout for read() */ +#define FM_READ_TIMEOUT (10*HZ) + /* List of error codes returned by the FM driver */ enum { FM_CHR_DRV_ERR_FAILURE = -1, /* check struct */ @@ -829,9 +832,9 @@ static ssize_t fm_chr_read(struct file *fil, char __user *data, size_t size, /* Wait till the data is available */ if (!wait_event_interruptible_timeout(fm_chr_dev->fm_data_q, !skb_queue_empty - (&fm_chr_dev->rx_q), 500)) { + (&fm_chr_dev->rx_q), FM_READ_TIMEOUT)) { - FM_CHR_DRV_ERR(" Read timed out "); + FM_CHR_DRV_DBG(" Read timed out "); return -EAGAIN; } FM_CHR_DRV_VER(" Completed Read wait "); -- 2.7.4