lkml.org 
[lkml]   [2008]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] ISDN: make ICN not auto-grab port 0x320
Hi Andrew.

Stop Breaking Ingo's Randconfig Testing, Part II.

Rene.
From 6f6a39c8dbc42d69d6dd654821cae8214ec382d5 Mon Sep 17 00:00:00 2001
From: Rene Herman <rene.herman@gmail.com>
Date: Sat, 9 Aug 2008 18:12:12 +0200
Subject: [PATCH] ISDN: make ICN not auto-grab port 0x320

Grabbing ISA bus resources without anything or anyone telling us we
should can break boot on randconfig/allyesconfig builds by keeping
resources that are in fact owned by different hardware busy and does
as reported by Ingo Molnar.

Generally it's also dangerous to just poke at random I/O ports and
especially those in the range where other old easily confused ISA
hardware might live.

For this old I4L ISA ISDN driver, insist that the user specify the
port before grabbing it.

Users of this driver are nonexistent or howling mad and a one time

echo "options icn baseport=0x320" >> /etc/modprobe.conf

away from the old behaviour.

This is a deprecated driver (stack, even) but as long as it's in the
tree, might as well fix it I guess.

Signed-off-by: Rene Herman <rene.herman@gmail.com>
---
drivers/isdn/icn/icn.c | 41 ++++++++++++++++++++++++++++++++++++++---
1 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index bf7997a..56fc1bd 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -13,8 +13,9 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
+#include <linux/isa.h>

-static int portbase = ICN_BASEADDR;
+static int portbase;
static unsigned long membase = ICN_MEMADDR;
static char *icn_id = "\0";
static char *icn_id2 = "\0";
@@ -1623,7 +1624,20 @@ icn_setup(char *line)
__setup("icn=", icn_setup);
#endif /* MODULE */

-static int __init icn_init(void)
+static int __devinit icn_isa_match(struct device *isa_dev, unsigned int id)
+{
+ int match = portbase != 0;
+
+ if (match)
+ dev_info(isa_dev, "portbase = %#x, membase = %#lx\n",
+ portbase, membase);
+ else
+ dev_err(isa_dev, "please specify portbase\n");
+
+ return match;
+}
+
+static int __devinit icn_isa_probe(struct device *isa_dev, unsigned int id)
{
char *p;
char rev[10];
@@ -1646,7 +1660,7 @@ static int __init icn_init(void)
return (icn_addcard(portbase, icn_id, icn_id2));
}

-static void __exit icn_exit(void)
+static int __devexit icn_isa_remove(struct device *isa_dev, unsigned int id)
{
isdn_ctrl cmd;
icn_card *card = cards;
@@ -1685,6 +1699,27 @@ static void __exit icn_exit(void)
iounmap(dev.shmem);
release_mem_region(dev.memaddr, 0x4000);
}
+ return 0;
+}
+
+static struct isa_driver icn_isa_driver = {
+ .match = icn_isa_match,
+ .probe = icn_isa_probe,
+ .remove = __devexit_p(icn_isa_remove),
+
+ .driver = {
+ .name = "icn"
+ }
+};
+
+static int __init icn_init(void)
+{
+ return isa_register_driver(&icn_isa_driver, 1);
+}
+
+static void __exit icn_exit(void)
+{
+ isa_unregister_driver(&icn_isa_driver);
printk(KERN_NOTICE "ICN-ISDN-driver unloaded\n");
}

--
1.5.5
\
 
 \ /
  Last update: 2008-08-09 19:43    [W:1.050 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site