sr100: Confirm the read timeout only for read operations

The read timeout calculation is added in common transaction
where its not required for write operation, So on V35 it moved
to read specific areas...

Propagate_From (CR)

Change-Id: I295d41b15ef7830f4967ee99bc86081c0a1923e8
Signed-off-by: Srihari Sathyanarayana <sriharis@motorola.com>
Reviewed-on: https://gerrit.mot.com/2468573
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Vijayakumar Gn <vijaygn@motorola.com>
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
kalathik 2022-05-05 18:10:49 +05:30 • committed by Srihari Sathyanarayana
commit ab156b6336

View file

@ -392,8 +392,6 @@ static int sr100_dev_transceive(struct sr100_dev* sr100_dev, int op_mode, int co
sr100_dev->IsExtndLenIndication = 0;
ret = -1;
retry_count = 0;
/*500ms timeout in jiffies*/
sr100_dev->timeOutInMs = ((500*HZ)/1000);
switch(sr100_dev->mode){
case SR100_WRITE_MODE:
@ -612,11 +610,26 @@ write_end:
****************************************************************************/
static ssize_t sr100_hbci_read(struct sr100_dev *sr100_dev,char* buf, size_t count){
int ret = -EIO;
ret = wait_event_interruptible(sr100_dev->read_wq, sr100_dev->irq_received);
if (ret) {
printk("wait_event_interruptible() : Failed.\n");
if(count > SR100_RXBUF_SIZE) {
SR100_ERR_MSG("count(%lu) out of range(0-%d)\n", count, SR100_RXBUF_SIZE);
ret = -EINVAL;
goto hbci_fail;
}
/* wait for inetrrupt upto 500ms after that timeout will happen and returns read fail */
ret = wait_event_interruptible_timeout(sr100_dev->read_wq, sr100_dev->irq_received, sr100_dev->timeOutInMs);
if (ret == 0) {
printk("wait_event_interruptible() : Failed.\n");
ret = -1;
goto hbci_fail;
}
if (read_abort_requested) {
read_abort_requested = false;
printk("HBCI Abort Read pending......");
return ret;
}
if(!gpio_get_value(sr100_dev->irq_gpio)){
printk("IRQ is low during firmware download");
goto hbci_fail;
@ -660,6 +673,8 @@ static ssize_t sr100_dev_read(struct file* filp, char* buf, size_t count,
loff_t* offset) {
struct sr100_dev* sr100_dev = filp->private_data;
int ret = -EIO;
/*500ms timeout in jiffies*/
sr100_dev->timeOutInMs = ((500*HZ)/1000);
memset(sr100_dev->rx_buffer, 0x00, SR100_RXBUF_SIZE);
if (!gpio_get_value(sr100_dev->irq_gpio)) {
if (filp->f_flags & O_NONBLOCK) {