public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@fs.tum.de>
To: Andrew Morton <akpm@osdl.org>, Scott_Kilau@digi.com
Cc: linux-kernel@vger.kernel.org
Subject: 2.6.0-test5-mm2: dgap driver looks ugly
Date: Tue, 16 Sep 2003 00:08:29 +0200	[thread overview]
Message-ID: <20030915220828.GA17690@fs.tum.de> (raw)
In-Reply-To: <20030914234843.20cea5b3.akpm@osdl.org>

On Sun, Sep 14, 2003 at 11:48:43PM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.0-test5-mm1:
>...
> +dgap.patch
> 
>  Digi Acceleport driver
>...

This driver seems to need a serious cleanup.

The patch below does:
- remove MIN/MAN
- remove (unused) userspace program/conffile locations
- remove a check that compares an ushort witha value it never has on 
  Linux

There seem to be more cleanups needed, these should only be some 
examples.

cu
Adrian

--- linux-2.6.0-test5-mm2-no-smp/drivers/char/digi/dgap/dgap_driver.h.old	2003-09-15 17:52:47.000000000 +0200
+++ linux-2.6.0-test5-mm2-no-smp/drivers/char/digi/dgap/dgap_driver.h	2003-09-15 23:57:28.000000000 +0200
@@ -215,7 +215,6 @@
 #define MYFLIPLEN		N_TTY_BUF_SIZE
 
 #define SBREAK_TIME 0x25
-#define USHRT_MAX   65535
 #define U2BSIZE 0x400
 #define dgap_jiffies_from_ms(a) (((a) * HZ) / 1000)
 
@@ -231,10 +230,6 @@
 # define DIGI_DGAP_MAJOR         22
 #endif
 
-/* The default location of the config script. */
-#define DGAP_CONFIG_PROGRAM	"/usr/sbin/dgap_config"
-#define DGAP_CONFIG_FILE	"/etc/dgap.conf"
-
 /*
  * The parameters we use to define the periods of the moving averages.
  */
@@ -274,20 +269,6 @@
 #endif
 
 /*
- * Only define these in case they are not present in the kernel headers.
- * A grep of /usr/src/linux-<version>/include/linux
- * show others worry about this as well.
- */
-#if !defined(MIN)
-# define MIN(a,b)	((a) < (b) ? (a) : (b))
-#endif
-
-#if !defined(MAX)
-# define MAX(a,b)	((a) > (b) ? (a) : (b))
-#endif
-
-
-/*
  * All the possible states the driver can be while being loaded.
  */
 enum {
--- linux-2.6.0-test5-mm2-no-smp/drivers/char/digi/dgap/dgap_tty.c.old	2003-09-15 23:47:21.000000000 +0200
+++ linux-2.6.0-test5-mm2-no-smp/drivers/char/digi/dgap/dgap_tty.c	2003-09-15 23:50:54.000000000 +0200
@@ -1278,8 +1278,8 @@
 		flip_len = TTY_FLIPBUF_SIZE - tp->flip.count;
 	}
 
-	len = MIN(data_len, flip_len);
-	len = MIN(len, (N_TTY_BUF_SIZE - 1) - tp->read_cnt);
+	len = min(data_len, flip_len);
+	len = min(len, (N_TTY_BUF_SIZE - 1) - tp->read_cnt);
 
 	if (len <= 0) {
 		writeb(1, &(bs->idata));
@@ -1315,7 +1315,7 @@
 	while (n) {
 
 		s = ((head >= tail) ? head : ch->ch_rsize) - tail;
-		s = MIN(s, n);
+		s = min(s, n);
 
 		if (s <= 0)
 			break;
@@ -2513,7 +2513,7 @@
 			cps_limit = 0;
 		}
 
-		bytes_available = MIN(cps_limit, bytes_available);
+		bytes_available = min(cps_limit, bytes_available);
 	}
 
 	return (bytes_available);
@@ -2705,7 +2705,7 @@
 	 * Take minimum of what the user wants to send, and the
 	 * space available in the FEP buffer.
 	 */
-	count = MIN(count, bufcount);
+	count = min(count, bufcount);
 
 	/*
 	 * Bail if no space left.
@@ -2743,7 +2743,7 @@
 			goto out;
 		}
 
-		count = MIN(count, WRITEBUFLEN);
+		count = min(count, WRITEBUFLEN);
 
 		/*
 		 * copy_from_user() returns the number
@@ -3230,9 +3230,6 @@
 	if (ch->ch_digi.digi_bufsize < 10)
 		ch->ch_digi.digi_bufsize = 10;
 
-	if (ch->ch_digi.digi_bufsize > 100000)
-		ch->ch_digi.digi_bufsize = MIN(100000, USHRT_MAX);
-
 	if (ch->ch_digi.digi_maxchar < 1)
 		ch->ch_digi.digi_maxchar = 1;
 

  parent reply	other threads:[~2003-09-15 22:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-15  6:48 2.6.0-test5-mm2 Andrew Morton
2003-09-15 14:19 ` 2.6.0-test5-mm2 Claas Langbehn
2003-09-15 14:34 ` 2.6.0-test5-mm2 Luiz Capitulino
2003-09-15 16:03   ` 2.6.0-test5-mm2 Rusty Russell
2003-09-15 16:59   ` 2.6.0-test5-mm2 Arnaldo Carvalho de Melo
2003-09-15 16:20 ` [patch] 2.6.0-test5-mm2: let PM_DISK_PARTITION depend on PM_DISK Adrian Bunk
2003-09-15 16:19   ` Patrick Mochel
2003-09-15 17:19 ` 2.6.0-test5-mm2 Felipe Alfaro Solana
2003-09-17 19:48   ` 2.6.0-test5-mm2 Sam Ravnborg
2003-09-15 19:26 ` 2.6.0-test5-mm2 Marek Habersack
2003-09-15 19:24   ` 2.6.0-test5-mm2 Andrew Morton
2003-09-15 22:08 ` Adrian Bunk [this message]
2003-09-16  2:02 ` 2.6.0-test5-mm2 Ramón Rey Vicente
2003-09-16 10:23   ` 2.6.0-test5-mm2 Felipe Alfaro Solana
2003-09-16 11:51 ` 2.6.0-test5-mm2: i4l coompile error Adrian Bunk
2003-09-16 19:54 ` [patch] 2.6.0-test5-mm2: ISTALLION UP compile is fixed Adrian Bunk
2003-09-17 13:51 ` 2.6.0-test5-mm2 Sean Neakums
2003-09-20 19:34 ` Process in D state (was Re: 2.6.0-test5-mm2) Rob Landley
2003-09-20 21:49   ` Andrew Morton
2003-09-21 18:30     ` Rob Landley
2003-09-21 20:30     ` Rob Landley

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=20030915220828.GA17690@fs.tum.de \
    --to=bunk@fs.tum.de \
    --cc=Scott_Kilau@digi.com \
    --cc=akpm@osdl.org \
    --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