mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jean Tourrilhes <jt@bougret.hpl.hp.com>
To: "David S. Miller" <davem@redhat.com>,
	Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.6 IrDA] 2/11: actisys-sir: dongle api change
Date: Fri, 23 Jan 2004 18:19:38 -0800	[thread overview]
Message-ID: <20040124021938.GC22410@bougret.hpl.hp.com> (raw)

ir262_dongles-2_actisys-sir.diff :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		<Patch from Martin Diehl>
* convert to de-virtualized sirdev helpers
* improve error path during speed change


diff -u -p linux/drivers/net/irda.d6/actisys-sir.c  linux/drivers/net/irda/actisys-sir.c
--- linux/drivers/net/irda.d6/actisys-sir.c	Wed Dec 17 18:58:57 2003
+++ linux/drivers/net/irda/actisys-sir.c	Thu Jan 22 16:43:16 2004
@@ -65,7 +65,7 @@ static int actisys_reset(struct sir_dev 
 
 /* These are the baudrates supported, in the order available */
 /* Note : the 220L doesn't support 38400, but we will fix that below */
-static __u32 baud_rates[] = { 9600, 19200, 57600, 115200, 38400 };
+static unsigned baud_rates[] = { 9600, 19200, 57600, 115200, 38400 };
 
 #define MAX_SPEEDS (sizeof(baud_rates)/sizeof(baud_rates[0]))
 
@@ -118,7 +118,7 @@ static int actisys_open(struct sir_dev *
 {
 	struct qos_info *qos = &dev->qos;
 
-	dev->set_dtr_rts(dev, TRUE, TRUE);
+	sirdev_set_dtr_rts(dev, TRUE, TRUE);
 
 	/* Set the speeds we can accept */
 	qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200;
@@ -130,13 +130,15 @@ static int actisys_open(struct sir_dev *
 	qos->min_turn_time.bits = 0x7f; /* Needs 0.01 ms */
 	irda_qos_bits_to_value(qos);
 
+	/* irda thread waits 50 msec for power settling */
+
 	return 0;
 }
 
 static int actisys_close(struct sir_dev *dev)
 {
 	/* Power off the dongle */
-	dev->set_dtr_rts(dev, FALSE, FALSE);
+	sirdev_set_dtr_rts(dev, FALSE, FALSE);
 
 	return 0;
 }
@@ -174,23 +176,25 @@ static int actisys_change_speed(struct s
 	 * Now, we can set the speed requested. Send RTS pulses until we
          * reach the target speed 
 	 */
-	for (i=0; i<MAX_SPEEDS; i++) {
+	for (i = 0; i < MAX_SPEEDS; i++) {
 		if (speed == baud_rates[i]) {
-			dev->speed = baud_rates[i];
+			dev->speed = speed;
 			break;
 		}
 		/* Set RTS low for 10 us */
-		dev->set_dtr_rts(dev, TRUE, FALSE);
+		sirdev_set_dtr_rts(dev, TRUE, FALSE);
 		udelay(MIN_DELAY);
 
 		/* Set RTS high for 10 us */
-		dev->set_dtr_rts(dev, TRUE, TRUE);
+		sirdev_set_dtr_rts(dev, TRUE, TRUE);
 		udelay(MIN_DELAY);
 	}
 
 	/* Check if life is sweet... */
-	if (i >= MAX_SPEEDS)
-		ret = -1;  /* This should not happen */
+	if (i >= MAX_SPEEDS) {
+		actisys_reset(dev);
+		ret = -EINVAL;  /* This should not happen */
+	}
 
 	/* Basta lavoro, on se casse d'ici... */
 	return ret;
@@ -221,11 +225,11 @@ static int actisys_change_speed(struct s
 static int actisys_reset(struct sir_dev *dev)
 {
 	/* Reset the dongle : set DTR low for 10 us */
-	dev->set_dtr_rts(dev, FALSE, TRUE);
+	sirdev_set_dtr_rts(dev, FALSE, TRUE);
 	udelay(MIN_DELAY);
 
 	/* Go back to normal mode */
-	dev->set_dtr_rts(dev, TRUE, TRUE);
+	sirdev_set_dtr_rts(dev, TRUE, TRUE);
 	
 	dev->speed = 9600;	/* That's the default */
 

                 reply	other threads:[~2004-01-24  2:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040124021938.GC22410@bougret.hpl.hp.com \
    --to=jt@bougret.hpl.hp.com \
    --cc=davem@redhat.com \
    --cc=jt@hpl.hp.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®