From 5147fa7a4a832fdc7238309ab80b3ba36a4e2696 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 8 Jan 2012 16:30:44 +0000 Subject: [PATCH] --- yaml --- r: 296321 b: refs/heads/master c: 0e888ee31566c3f5071474ddd68457a7ad2ae5ac h: refs/heads/master i: 296319: b09588aceac5e751d4293da22cb257265f917f3b v: v3 --- [refs] | 2 +- trunk/drivers/net/irda/sa1100_ir.c | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index fb403784f14c..5d0afae6e736 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cbe1d24fb70751ef14801338aa945e807ba63a90 +refs/heads/master: 0e888ee31566c3f5071474ddd68457a7ad2ae5ac diff --git a/trunk/drivers/net/irda/sa1100_ir.c b/trunk/drivers/net/irda/sa1100_ir.c index 32ac4a44ce76..bfae34fa7a9e 100644 --- a/trunk/drivers/net/irda/sa1100_ir.c +++ b/trunk/drivers/net/irda/sa1100_ir.c @@ -70,6 +70,8 @@ struct sa1100_irda { iobuff_t rx_buff; }; +static int sa1100_irda_set_speed(struct sa1100_irda *, int); + #define IS_FIR(si) ((si)->speed >= 4000000) #define HPSIR_MAX_RXLEN 2047 @@ -129,6 +131,14 @@ static void sa1100_irda_rx_dma_start(struct sa1100_irda *si) Ser2HSCR0 = si->hscr0 | HSCR0_HSSP | HSCR0_RXE; } +static void sa1100_irda_check_speed(struct sa1100_irda *si) +{ + if (si->newspeed) { + sa1100_irda_set_speed(si, si->newspeed); + si->newspeed = 0; + } +} + /* * Set the IrDA communications speed. */ @@ -318,10 +328,7 @@ static void sa1100_irda_hpsir_irq(struct net_device *dev) Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID; Ser2UTCR3 = UTCR3_RIE | UTCR3_RXE | UTCR3_TXE; - if (si->newspeed) { - sa1100_irda_set_speed(si, si->newspeed); - si->newspeed = 0; - } + sa1100_irda_check_speed(si); /* I'm hungry! */ netif_wake_queue(dev); @@ -492,10 +499,7 @@ static void sa1100_irda_txdma_irq(void *id) * here - we don't free the old dma_rx.skb. We don't need * to allocate a buffer either. */ - if (si->newspeed) { - sa1100_irda_set_speed(si, si->newspeed); - si->newspeed = 0; - } + sa1100_irda_check_speed(si); /* * Start reception. This disables the transmitter for @@ -538,10 +542,7 @@ static int sa1100_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev) * If this is an empty frame, we can bypass a lot. */ if (skb->len == 0) { - if (si->newspeed) { - si->newspeed = 0; - sa1100_irda_set_speed(si, speed); - } + sa1100_irda_check_speed(si); dev_kfree_skb(skb); return NETDEV_TX_OK; }