Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 266853
b: refs/heads/master
c: 28bd204
h: refs/heads/master
i:
  266851: 0cbe114
v: v3
  • Loading branch information
Dmitry Tarnyagin authored and David S. Miller committed Oct 19, 2011
1 parent c0290c2 commit 72a038c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ca63f8c7512acbd1171bbabefc7a7765ce117939
refs/heads/master: 28bd2049428202cb3bc982536ed3de3c69ae120a
28 changes: 23 additions & 5 deletions trunk/drivers/net/caif/caif_hsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ MODULE_DESCRIPTION("CAIF HSI driver");
#define PAD_POW2(x, pow) ((((x)&((pow)-1)) == 0) ? 0 :\
(((pow)-((x)&((pow)-1)))))

static int inactivity_timeout = 1000;
module_param(inactivity_timeout, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(inactivity_timeout, "Inactivity timeout on HSI, ms.");

/*
* HSI padding options.
* Warning: must be a base of 2 (& operation used) and can not be zero !
Expand Down Expand Up @@ -98,7 +102,8 @@ static void cfhsi_abort_tx(struct cfhsi *cfhsi)
}
cfhsi->tx_state = CFHSI_TX_STATE_IDLE;
if (!test_bit(CFHSI_SHUTDOWN, &cfhsi->bits))
mod_timer(&cfhsi->timer, jiffies + CFHSI_INACTIVITY_TOUT);
mod_timer(&cfhsi->timer,
jiffies + cfhsi->inactivity_timeout);
spin_unlock_bh(&cfhsi->lock);
}

Expand Down Expand Up @@ -312,7 +317,7 @@ static void cfhsi_tx_done(struct cfhsi *cfhsi)
cfhsi->tx_state = CFHSI_TX_STATE_IDLE;
/* Start inactivity timer. */
mod_timer(&cfhsi->timer,
jiffies + CFHSI_INACTIVITY_TOUT);
jiffies + cfhsi->inactivity_timeout);
spin_unlock_bh(&cfhsi->lock);
goto done;
}
Expand Down Expand Up @@ -534,7 +539,8 @@ static void cfhsi_rx_done(struct cfhsi *cfhsi)

/* Update inactivity timer if pending. */
spin_lock_bh(&cfhsi->lock);
mod_timer_pending(&cfhsi->timer, jiffies + CFHSI_INACTIVITY_TOUT);
mod_timer_pending(&cfhsi->timer,
jiffies + cfhsi->inactivity_timeout);
spin_unlock_bh(&cfhsi->lock);

if (cfhsi->rx_state.state == CFHSI_RX_STATE_DESC) {
Expand Down Expand Up @@ -715,7 +721,7 @@ static void cfhsi_wake_up(struct work_struct *work)
__func__);
/* Start inactivity timer. */
mod_timer(&cfhsi->timer,
jiffies + CFHSI_INACTIVITY_TOUT);
jiffies + cfhsi->inactivity_timeout);
spin_unlock_bh(&cfhsi->lock);
return;
}
Expand Down Expand Up @@ -989,7 +995,19 @@ int cfhsi_probe(struct platform_device *pdev)
goto err_alloc_rx;
}

/* Initialize receive variables. */
/* Pre-calculate inactivity timeout. */
if (inactivity_timeout != -1) {
cfhsi->inactivity_timeout =
inactivity_timeout * HZ / 1000;
if (!cfhsi->inactivity_timeout)
cfhsi->inactivity_timeout = 1;
else if (cfhsi->inactivity_timeout > NEXT_TIMER_MAX_DELTA)
cfhsi->inactivity_timeout = NEXT_TIMER_MAX_DELTA;
} else {
cfhsi->inactivity_timeout = NEXT_TIMER_MAX_DELTA;
}

/* Initialize recieve vaiables. */
cfhsi->rx_ptr = cfhsi->rx_buf;
cfhsi->rx_len = CFHSI_DESC_SZ;

Expand Down
1 change: 1 addition & 0 deletions trunk/include/net/caif/caif_hsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ struct cfhsi {
struct cfhsi_dev *dev;
int tx_state;
struct cfhsi_rx_state rx_state;
unsigned long inactivity_timeout;
int rx_len;
u8 *rx_ptr;
u8 *tx_buf;
Expand Down

0 comments on commit 72a038c

Please sign in to comment.