mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Martin Dalecki <dalecki@evision-ventures.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] 2.5.17 /dev/ports
Date: Wed, 22 May 2002 11:05:57 +0200	[thread overview]
Message-ID: <3CEB5F75.4000009@evision-ventures.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0205202211040.949-100000@home.transmeta.com>

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

Remove support for /dev/port altogether.

1. It is not usable with ports which require 4 byte access.

2. The same can be achieved by using capabilities and su bits and so on.

3. __m68000__ doesn't even implement it and most other non i386 archs
"implement" it but apparently don't even care about endianess issues.

4. It's not standard.

5. seek() + port access is "racy" with respect to multiple usage.

6. Nothing is using it.

... and so on and so on ...

And finally, kernel size with it:

    text    data     bss     dec     hex filename
1480587  243280  259628 1983495  1e4407 vmlinux

kernel size without it:

[root@kozaczek linux]# size vmlinux
    text    data     bss     dec     hex filename
1480229  243184  259628 1983041  1e4241 vmlinux

Which means a saving of 454 bytes :-).

[-- Attachment #2: kill-ports-2.5.17.patch --]
[-- Type: text/plain, Size: 3101 bytes --]

diff -urN linux-old/Documentation/devices.txt linux/Documentation/devices.txt
--- linux-old/Documentation/devices.txt	2002-05-21 07:07:37.000000000 +0200
+++ linux/Documentation/devices.txt	2002-05-22 11:38:47.000000000 +0200
@@ -90,7 +90,7 @@
 		  1 = /dev/mem		Physical memory access
 		  2 = /dev/kmem		Kernel virtual memory access
 		  3 = /dev/null		Null device
-		  4 = /dev/port		I/O port access
+		  4 = /dev/port		OBSOLETE - since 2.5.18
 		  5 = /dev/zero		Null byte source
 		  6 = /dev/core		OBSOLETE - replaced by /proc/kcore
 		  7 = /dev/full		Returns ENOSPC on write
diff -urN linux-old/drivers/char/mem.c linux/drivers/char/mem.c
--- linux-old/drivers/char/mem.c	2002-05-21 07:07:40.000000000 +0200
+++ linux/drivers/char/mem.c	2002-05-22 11:26:13.000000000 +0200
@@ -324,46 +324,6 @@
  	return virtr + wrote;
 }
 
-#if !defined(__mc68000__)
-static ssize_t read_port(struct file * file, char * buf,
-			 size_t count, loff_t *ppos)
-{
-	unsigned long i = *ppos;
-	char *tmp = buf;
-
-	if (verify_area(VERIFY_WRITE,buf,count))
-		return -EFAULT; 
-	while (count-- > 0 && i < 65536) {
-		if (__put_user(inb(i),tmp) < 0) 
-			return -EFAULT;  
-		i++;
-		tmp++;
-	}
-	*ppos = i;
-	return tmp-buf;
-}
-
-static ssize_t write_port(struct file * file, const char * buf,
-			  size_t count, loff_t *ppos)
-{
-	unsigned long i = *ppos;
-	const char * tmp = buf;
-
-	if (verify_area(VERIFY_READ,buf,count))
-		return -EFAULT;
-	while (count-- > 0 && i < 65536) {
-		char c;
-		if (__get_user(c, tmp)) 
-			return -EFAULT; 
-		outb(c,i);
-		i++;
-		tmp++;
-	}
-	*ppos = i;
-	return tmp-buf;
-}
-#endif
-
 static ssize_t read_null(struct file * file, char * buf,
 			 size_t count, loff_t *ppos)
 {
@@ -522,7 +482,7 @@
 	return ret;
 }
 
-static int open_port(struct inode * inode, struct file * filp)
+static int open_mem(struct inode * inode, struct file * filp)
 {
 	return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
 }
@@ -532,7 +492,6 @@
 #define full_lseek      null_lseek
 #define write_zero	write_null
 #define read_full       read_zero
-#define open_mem	open_port
 #define open_kmem	open_mem
 
 static struct file_operations mem_fops = {
@@ -557,15 +516,6 @@
 	write:		write_null,
 };
 
-#if !defined(__mc68000__)
-static struct file_operations port_fops = {
-	llseek:		memory_lseek,
-	read:		read_port,
-	write:		write_port,
-	open:		open_port,
-};
-#endif
-
 static struct file_operations zero_fops = {
 	llseek:		zero_lseek,
 	read:		read_zero,
@@ -591,11 +541,6 @@
 		case 3:
 			filp->f_op = &null_fops;
 			break;
-#if !defined(__mc68000__)
-		case 4:
-			filp->f_op = &port_fops;
-			break;
-#endif
 		case 5:
 			filp->f_op = &zero_fops;
 			break;
@@ -628,7 +573,6 @@
 	{1, "mem",     S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
 	{2, "kmem",    S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
 	{3, "null",    S_IRUGO | S_IWUGO,           &null_fops},
-	{4, "port",    S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},
 	{5, "zero",    S_IRUGO | S_IWUGO,           &zero_fops},
 	{7, "full",    S_IRUGO | S_IWUGO,           &full_fops},
 	{8, "random",  S_IRUGO | S_IWUSR,           &random_fops},

  parent reply	other threads:[~2002-05-22 10:09 UTC|newest]

Thread overview: 143+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-21  5:16 Linux-2.5.17 Linus Torvalds
2002-05-21 13:58 ` Linux-2.5.17 Roman Zippel
2002-05-21 16:06   ` Linux-2.5.17 Linus Torvalds
2002-05-21 18:36     ` Linux-2.5.17 Roman Zippel
2002-05-21 18:53       ` Linux-2.5.17 Linus Torvalds
2002-05-21 23:35         ` Linux-2.5.17 Roman Zippel
2002-05-22  0:10           ` Linux-2.5.17 Linus Torvalds
2002-05-22  0:31             ` Linux-2.5.17 Roman Zippel
2002-05-22  0:54               ` Linux-2.5.17 Linus Torvalds
2002-05-22  2:17                 ` Linux-2.5.17 David S. Miller
2002-05-22  2:40                   ` Linux-2.5.17 Linus Torvalds
2002-05-22  2:57                     ` Linux-2.5.17 David S. Miller
2002-05-22  3:21                       ` Linux-2.5.17 Linus Torvalds
2002-05-22  8:06                         ` Linux-2.5.17 David Lang
2002-05-22 14:14                         ` Linux-2.5.17 Dave McCracken
2002-05-22 16:10                           ` Linux-2.5.17 Linus Torvalds
2002-05-22 13:45                 ` Linux-2.5.17 Roman Zippel
2002-05-22 16:08                   ` Linux-2.5.17 Linus Torvalds
2002-05-21 15:32 ` [PATCH] 2.5.17 IDE 65 Martin Dalecki
2002-05-21 16:59   ` Linus Torvalds
2002-05-21 16:35     ` Martin Dalecki
2002-05-21 17:56       ` Linus Torvalds
2002-05-21 18:49         ` Alan Cox
2002-05-21 20:08         ` Vojtech Pavlik
2002-05-21 23:28           ` Linus Torvalds
2002-05-22  6:53             ` Martin Dalecki
2002-05-23  7:01               ` Kai Henningsen
2002-05-22  7:16 ` [PATCH] 2.5.17 IDE 66 Martin Dalecki
2002-05-22  7:19 ` [PATCH] 2.5.17 IDE 67 Martin Dalecki
2002-05-22 17:13   ` Tom Rini
2002-05-22 16:21     ` Martin Dalecki
2002-05-22 17:31       ` Tom Rini
2002-05-22 16:40         ` Martin Dalecki
2002-05-22 18:47           ` Tom Rini
2002-05-23  6:08             ` Martin Dalecki
2002-05-23 15:26               ` Tom Rini
2002-05-23 14:32                 ` Martin Dalecki
2002-05-23 15:40                   ` Tom Rini
2002-05-22  7:23 ` [PATCH] 2.5.16 IDE 68 Martin Dalecki
2002-05-22 10:48   ` Juan Quintela
2002-05-22  9:45     ` Martin Dalecki
2002-05-22 15:55   ` Linus Torvalds
2002-05-22 15:03     ` Martin Dalecki
2002-05-22  9:05 ` Martin Dalecki [this message]
2002-05-22 10:42   ` [PATCH] 2.5.17 /dev/ports Paul Mackerras
2002-05-22  9:46     ` Martin Dalecki
2002-05-22 10:54     ` David S. Miller
2002-05-22 10:13       ` Martin Dalecki
2002-05-22 11:26         ` Russell King
2002-05-22 10:40           ` Martin Dalecki
2002-05-22 11:58             ` Richard B. Johnson
2002-05-22 12:36             ` Russell King
2002-05-22 13:23               ` Alan Cox
2002-05-22 12:31                 ` Martin Dalecki
2002-05-22 12:44           ` Alan Cox
2002-05-22 12:32             ` Martin Dalecki
2002-05-22 15:05               ` Alan Cox
2002-05-22 13:05       ` Alan Cox
2002-05-22 12:38         ` Martin Dalecki
2002-05-22 15:04           ` Alan Cox
2002-05-22 13:53             ` Martin Dalecki
2002-05-22 15:03               ` Lars Marowsky-Bree
2002-05-22 15:07               ` Padraig Brady
2002-05-22 14:07                 ` Martin Dalecki
2002-05-22 15:21                   ` Dave Jones
2002-05-22 15:19               ` Dave Jones
2002-05-22 15:31               ` Alan Cox
2002-05-27  9:04               ` Pavel Machek
2002-05-22 14:54             ` Alexander Viro
2002-05-22 15:24               ` Alan Cox
2002-05-22 15:10                 ` Alexander Viro
2002-07-22 12:20                   ` Ruth Ivimey-Cook
2002-05-23  7:30               ` Rusty Russell
2002-05-23  6:44                 ` Martin Dalecki
2002-05-23  8:26                   ` Rusty Russell
2002-05-22 13:16   ` Padraig Brady
2002-05-22 12:30     ` Martin Dalecki
2002-05-22 13:50       ` Sebastian Droege
2002-05-22 13:52     ` Alan Cox
2002-05-22 13:49       ` Vojtech Pavlik
2002-05-22 12:51         ` Martin Dalecki
2002-05-22 13:56           ` Vojtech Pavlik
2002-05-22 14:58             ` Alan Cox
2002-05-22 13:49               ` Martin Dalecki
2002-05-22 14:42               ` Vojtech Pavlik
2002-05-22 13:59           ` Alexander Viro
2002-05-22 13:12             ` Martin Dalecki
2002-05-22 14:33               ` Alexander Viro
2002-05-22 13:40                 ` Martin Dalecki
2002-05-22 13:16             ` Martin Dalecki
2002-05-22 14:34               ` Alexander Viro
2002-05-22 16:31               ` James Simmons
2002-05-22 14:12             ` Vojtech Pavlik
2002-05-27  9:07             ` Pavel Machek
2002-05-22 15:00         ` Alan Cox
2002-05-22 14:43           ` Vojtech Pavlik
2002-05-22 16:28   ` Linus Torvalds
2002-05-22 17:22     ` Alan Cox
2002-05-22 16:17       ` Martin Dalecki
2002-05-22 17:30         ` Russell King
2002-05-22 16:36           ` Martin Dalecki
2002-05-22 17:36           ` Alexander Viro
2002-05-22 17:46         ` Alan Cox
2002-05-26 13:53         ` Riley Williams
2002-05-26 15:28           ` Vojtech Pavlik
2002-05-26 15:39             ` Riley Williams
2002-05-23 10:10     ` Martin Diehl
2002-05-22 10:54 ` Linux-2.5.17 Martin Dalecki
2002-05-22 12:04   ` Linux-2.5.17 Alexander Viro
2002-05-22 13:07     ` Linux-2.5.17 Martin Dalecki
2002-05-22 14:38       ` Linux-2.5.17 Alexander Viro
2002-05-22 13:42         ` Linux-2.5.17 Martin Dalecki
2002-05-22 16:55       ` Linux-2.5.17 Jan Kara
2002-05-22 12:14   ` Linux-2.5.17 Russell King
2002-05-22 12:36     ` Linux-2.5.17 Martin Dalecki
2002-05-22 16:02     ` Linux-2.5.17 Linus Torvalds
2002-05-22 15:04       ` Linux-2.5.17 Martin Dalecki
2002-05-22 16:58         ` Linux-2.5.17 Jan Kara
2002-05-22 16:08           ` Linux-2.5.17 Martin Dalecki
2002-05-22 17:56             ` Linux-2.5.17 Jan Kara
2002-05-22 16:56               ` Linux-2.5.17 Martin Dalecki
2002-05-22 18:17                 ` Linux-2.5.17 Jan Kara
2002-05-22 18:36                   ` Linux-2.5.17 Russell King
2002-05-22 13:06   ` Linux-2.5.17 Alan Cox
2002-05-22 11:19 ` Linux-2.5.17 Russell King
2002-05-22 11:27   ` Linux-2.5.17 David S. Miller
2002-05-22 16:23   ` Linux-2.5.17 Linus Torvalds
2002-05-22 17:31 ` [PATCH] 2.5.17 IDE 69 Martin Dalecki
2002-05-23  7:32 ` [PATCH] 2.5.17 sysvipc (AKA: spoiling oil in to the flames) Martin Dalecki
2002-05-24 13:59 ` Linux-2.5.17 Martin Dalecki
2002-05-24 14:23 ` [PATCH] 2.5.17 IDE 70 Martin Dalecki
2002-05-22 16:30 [PATCH] 2.5.17 /dev/ports James Simmons
2002-05-22 17:25 ` Alan Cox
2002-05-22 17:39   ` James Simmons
     [not found] <mailman.1022085725.386.linux-kernel2news@redhat.com>
2002-05-23 17:07 ` Pete Zaitcev
2002-05-23 18:05   ` Martin Dalecki
2002-05-23 19:54     ` Linus Torvalds
2002-05-23 19:31       ` Martin Dalecki
2002-05-23 21:22         ` Christer Weinigel
2002-05-23 21:37           ` Pete Zaitcev
2002-05-23 20:53             ` Martin Dalecki
2002-05-24  5:39           ` Robert Schwebel
2002-05-23 21:29         ` Pete Zaitcev

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=3CEB5F75.4000009@evision-ventures.com \
    --to=dalecki@evision-ventures.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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®