Skip to content

Commit

Permalink
Make /dev/port conditional on config symbol
Browse files Browse the repository at this point in the history
Instead of having /dev/port support dependent in multiple places on a
string of preprocessor symbols, define a new configuration directive for
it.  This ensures that all four places remain consistent with each other.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Russell King authored and Linus Torvalds committed May 8, 2007
1 parent 6245672 commit 4f911d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions drivers/char/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1071,5 +1071,11 @@ config TELCLOCK
/sys/devices/platform/telco_clock, with a number of files for
controlling the behavior of this hardware.

config DEVPORT
bool
depends on !M68K
depends on ISA || PCI
default y

endmenu

8 changes: 4 additions & 4 deletions drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
return virtr + wrote;
}

#if (defined(CONFIG_ISA) || defined(CONFIG_PCI)) && !defined(__mc68000__)
#ifdef CONFIG_DEVPORT
static ssize_t read_port(struct file * file, char __user * buf,
size_t count, loff_t *ppos)
{
Expand Down Expand Up @@ -834,7 +834,7 @@ static const struct file_operations null_fops = {
.splice_write = splice_write_null,
};

#if (defined(CONFIG_ISA) || defined(CONFIG_PCI)) && !defined(__mc68000__)
#ifdef CONFIG_DEVPORT
static const struct file_operations port_fops = {
.llseek = memory_lseek,
.read = read_port,
Expand Down Expand Up @@ -912,7 +912,7 @@ static int memory_open(struct inode * inode, struct file * filp)
case 3:
filp->f_op = &null_fops;
break;
#if (defined(CONFIG_ISA) || defined(CONFIG_PCI)) && !defined(__mc68000__)
#ifdef CONFIG_DEVPORT
case 4:
filp->f_op = &port_fops;
break;
Expand Down Expand Up @@ -959,7 +959,7 @@ static const struct {
{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},
#if (defined(CONFIG_ISA) || defined(CONFIG_PCI)) && !defined(__mc68000__)
#ifdef CONFIG_DEVPORT
{4, "port", S_IRUSR | S_IWUSR | S_IRGRP, &port_fops},
#endif
{5, "zero", S_IRUGO | S_IWUGO, &zero_fops},
Expand Down

0 comments on commit 4f911d6

Please sign in to comment.