[PATCH] no_pci_mem

From: Milan Svoboda
Date: Fri Jun 16 2006 - 09:21:38 EST


From: Milan Svoboda <msvoboda@xxxxxxxxxxxxxxx>

This patch disables port subdevice when pci or isa bus is not selected.
Current behaviour is that port is disabled only when there is no isa bus.

Feedback and comments are highly appreciated.

This patch is against 2.6.17-rc5.

Please CC me, I'm not subscribed to the mailing list.

Signed-off-by: Milan Svoboda <msvoboda@xxxxxxxxxxxxxxx>
---

diff -uprN -X orig.bak.never.touch/Documentation/dontdiff orig.bak.never.touch/drivers/char/mem.c new_gadget.newest/drivers/char/mem.c
--- orig.bak.never.touch/drivers/char/mem.c 2006-05-30 09:37:37.000000000 +0000
+++ new_gadget.newest/drivers/char/mem.c 2006-06-14 12:14:42.000000000 +0000
@@ -524,7 +524,7 @@ static ssize_t write_kmem(struct file *
return virtr + wrote;
}

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

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