[PATCH][BUGFIX] : Megaraid patch for 2.6 2/5

From: Paul Wagland
Date: Thu Feb 19 2004 - 21:09:12 EST


Hi all,

On Linux-SCSI over the last few days I have been discussing a couple of
problems with the 2.6.2 megaraid driver. This patch fixes the problem
that the /proc files were being created in the wrong place, the reason
for this is that the /proc/megaraid directory was being created too
late, so it has been moved earlier in the initialisation sequence. There
has been one comment made about the #ifdef CONFIG_PROC_FS not being
needed, but if they are removed then I would also need to remove the
error when we can't create it, since it always "fails" to create a proc
entry when CONFIG_PROC_FS is not set. Please let me know if you would
like this re-submitted.

patch is attached and below.

diff --recursive --ignore-all-space --unified linux-2.6.2.o/drivers/scsi/megaraid.c linux-2.6.2.megaraid/drivers/scsi/megaraid.c
--- linux-2.6.2.o/drivers/scsi/megaraid.c 2004-02-20 01:32:21.000000000 +0100
+++ linux-2.6.2.megaraid/drivers/scsi/megaraid.c 2004-02-20 01:32:26.000000000 +0100
@@ -5119,10 +5119,6 @@
if (max_mbox_busy_wait > MBOX_BUSY_WAIT)
max_mbox_busy_wait = MBOX_BUSY_WAIT;

- error = pci_module_init(&megaraid_pci_driver);
- if (error)
- return error;
-
#ifdef CONFIG_PROC_FS
mega_proc_dir_entry = proc_mkdir("megaraid", &proc_root);
if (!mega_proc_dir_entry) {
@@ -5130,6 +5126,13 @@
"megaraid: failed to create megaraid root\n");
}
#endif
+ error = pci_module_init(&megaraid_pci_driver);
+ if (error) {
+#ifdef CONFIG_PROC_FS
+ remove_proc_entry("megaraid", &proc_root);
+#endif
+ return error;
+ }

/*
* Register the driver as a character device, for applications

diff --recursive --ignore-all-space --unified linux-2.6.2.o/drivers/scsi/megaraid.c linux-2.6.2.megaraid/drivers/scsi/megaraid.c
--- linux-2.6.2.o/drivers/scsi/megaraid.c 2004-02-20 01:32:21.000000000 +0100
+++ linux-2.6.2.megaraid/drivers/scsi/megaraid.c 2004-02-20 01:32:26.000000000 +0100
@@ -5119,10 +5119,6 @@
if (max_mbox_busy_wait > MBOX_BUSY_WAIT)
max_mbox_busy_wait = MBOX_BUSY_WAIT;

- error = pci_module_init(&megaraid_pci_driver);
- if (error)
- return error;
-
#ifdef CONFIG_PROC_FS
mega_proc_dir_entry = proc_mkdir("megaraid", &proc_root);
if (!mega_proc_dir_entry) {
@@ -5130,6 +5126,13 @@
"megaraid: failed to create megaraid root\n");
}
#endif
+ error = pci_module_init(&megaraid_pci_driver);
+ if (error) {
+#ifdef CONFIG_PROC_FS
+ remove_proc_entry("megaraid", &proc_root);
+#endif
+ return error;
+ }

/*
* Register the driver as a character device, for applications