From: "Juergen E. Fischer" <fischer@linux-buechse.de>
To: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: Kernel oops in 2.6.1 when loading aha152x_cs.ko
Date: Sat, 10 Jan 2004 18:35:42 +0100 [thread overview]
Message-ID: <20040110173542.GA24288@linux-buechse.de> (raw)
In-Reply-To: <1073747000.1945.5.camel@mulgrave>
[-- Attachment #1: Type: text/plain, Size: 611 bytes --]
Hi James,
On Sat, Jan 10, 2004 at 10:03:20 -0500, James Bottomley wrote:
> On Sat, 2004-01-10 at 01:38, Eric Kerin wrote:
> > Let's try this again, with the proper check. This one even compiles!
>
> Actually, you're still on slightly the wrong track. The quick fix, as I
> told Russell on this list is in aha152x_stub.c.
>
> If you want to code that up as a patch and test it, I'll apply it.
Attached patch removed the references to the legacy stuff from the
driver.
I'm not sure if that is all that needs to be done though, and I could
only test it for the non-pcmcia case, but that works here.
Jürgen
[-- Attachment #2: aha152x.diff --]
[-- Type: text/plain, Size: 3968 bytes --]
--- orig/linux-2.6.0/drivers/scsi/aha152x.c 2004-01-10 18:25:53.000000000 +0100
+++ linux-2.6.0/drivers/scsi/aha152x.c 2004-01-10 18:28:30.000000000 +0100
@@ -860,9 +860,6 @@
{
int i;
- if (check_region(io_port, IO_RANGE))
- return 0;
-
SETPORT(io_port + O_DMACNTRL1, 0); /* reset stack pointer */
for (i = 0; i < 16; i++)
SETPORT(io_port + O_STACK, i);
@@ -878,9 +875,6 @@
{
int i;
- if (check_region(io_port, IO_RANGE))
- return 0;
-
SETPORT(io_port + O_TC_DMACNTRL1, 0); /* reset stack pointer */
for (i = 0; i < 16; i++)
SETPORT(io_port + O_STACK, i);
@@ -903,13 +897,20 @@
if (i == ARRAY_SIZE(ports))
return 0;
#endif
+ if (!request_region(setup->io_port, IO_RANGE, "aha152x"))
+ return 0;
if(aha152x_porttest(setup->io_port)) {
- setup->tc1550=0;
+ setup->tc1550=0;
} else if(tc1550_porttest(setup->io_port)) {
- setup->tc1550=1;
- } else
- return 0;
+ setup->tc1550=1;
+ } else {
+ release_region(setup->io_port, IO_RANGE);
+ return 0;
+ }
+
+ release_region(setup->io_port, IO_RANGE);
+
if ((setup->irq < IRQ_MIN) || (setup->irq > IRQ_MAX))
return 0;
@@ -965,7 +966,7 @@
{
struct Scsi_Host *shpnt;
- shpnt = scsi_register(&aha152x_driver_template, sizeof(struct aha152x_hostdata));
+ shpnt = scsi_host_alloc(&aha152x_driver_template, sizeof(struct aha152x_hostdata));
if (!shpnt) {
printk(KERN_ERR "aha152x: scsi_register failed\n");
return NULL;
@@ -1080,6 +1081,9 @@
printk(KERN_ERR "aha152x%d: failed to reassign interrupt.\n", shpnt->host_no);
goto out_unregister_host;
}
+
+ scsi_add_host(shpnt, 0);
+ scsi_scan_host(shpnt);
return shpnt; /* the pcmcia stub needs the return value; */
out_unregister_host:
@@ -1087,11 +1091,11 @@
out_release_region:
release_region(shpnt->io_port, IO_RANGE);
out_unregister:
- scsi_unregister(shpnt);
+ scsi_host_put(shpnt);
return NULL;
}
-static int aha152x_detect(Scsi_Host_Template * tpnt)
+static int __init aha152x_init(void)
{
int i, j, ok;
#if defined(AUTOCONF)
@@ -1360,7 +1364,6 @@
return registered_count>0;
}
-
static int aha152x_release(struct Scsi_Host *shpnt)
{
if (shpnt->irq)
@@ -1374,11 +1377,25 @@
pnp_device_detach(HOSTDATA(shpnt)->pnpdev);
#endif
- scsi_unregister(shpnt);
+ scsi_host_put(shpnt);
return 0;
}
+static void __exit aha152x_exit(void)
+{
+ int i;
+
+ for(i=0; i<ARRAY_SIZE(setup); i++) {
+ if(aha152x_host[i]) {
+ scsi_remove_host(aha152x_host[i]);
+ aha152x_release(aha152x_host[i]);
+ aha152x_host[i]=0;
+ }
+ }
+}
+
+
/*
* setup controller to generate interrupts depending
* on current state (lock has to be acquired)
@@ -3880,26 +3897,22 @@
}
static Scsi_Host_Template aha152x_driver_template = {
- .module = THIS_MODULE,
- .name = AHA152X_REVID,
- .proc_name = "aha152x",
- .proc_info = aha152x_proc_info,
- .detect = aha152x_detect,
- .queuecommand = aha152x_queue,
- .eh_abort_handler = aha152x_abort,
- .eh_device_reset_handler = aha152x_device_reset,
- .eh_bus_reset_handler = aha152x_bus_reset,
- .eh_host_reset_handler = aha152x_host_reset,
- .release = aha152x_release,
- .bios_param = aha152x_biosparam,
- .can_queue = 1,
- .this_id = 7,
- .sg_tablesize = SG_ALL,
- .cmd_per_lun = 1,
- .use_clustering = DISABLE_CLUSTERING,
+ .module = THIS_MODULE,
+ .name = AHA152X_REVID,
+ .proc_name = "aha152x",
+ .proc_info = aha152x_proc_info,
+ .queuecommand = aha152x_queue,
+ .eh_abort_handler = aha152x_abort,
+ .eh_device_reset_handler = aha152x_device_reset,
+ .eh_bus_reset_handler = aha152x_bus_reset,
+ .eh_host_reset_handler = aha152x_host_reset,
+ .bios_param = aha152x_biosparam,
+ .can_queue = 1,
+ .this_id = 7,
+ .sg_tablesize = SG_ALL,
+ .cmd_per_lun = 1,
+ .use_clustering = DISABLE_CLUSTERING,
};
-#ifndef PCMCIA
-#define driver_template aha152x_driver_template
-#include "scsi_module.c"
-#endif
+module_init(aha152x_init);
+module_exit(aha152x_exit);
next prev parent reply other threads:[~2004-01-10 17:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-09 20:14 Kernel oops in 2.6.1 when loading aha152x_cs.ko Larry W. Finger
2004-01-10 1:37 ` Eric Kerin
2004-01-10 5:27 ` Larry W. Finger
2004-01-10 6:38 ` Eric Kerin
2004-01-10 15:03 ` James Bottomley
2004-01-10 17:09 ` Larry W. Finger
2004-01-10 17:35 ` Juergen E. Fischer [this message]
2004-01-10 19:11 ` Eric Kerin
2004-01-10 20:43 ` James Bottomley
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=20040110173542.GA24288@linux-buechse.de \
--to=fischer@linux-buechse.de \
--cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.