NET: sa11x0-ir: factor out speed checks

Whenever we complete a transmit, we always check for a speed change.
This check was open coded in several places.  Provide a helper
function to do this instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c
index 32ac4a4..bfae34f 100644
--- a/drivers/net/irda/sa1100_ir.c
+++ b/drivers/net/irda/sa1100_ir.c
@@ -70,6 +70,8 @@
 	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 @@
 	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 @@
 			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 @@
 	 * 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 @@
 	 * 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;
 	}