aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Horsten <thomas@horsten.com>2008-02-05 02:53:18 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-02-11 11:20:53 -0500
commit90a95af85f22c82f87e5fb714bac7ee06673b0ff (patch)
tree4211b482478654df9d33a1d1c44ceef2d59ba010
parent7d5d408c77cee95d1380511de46b7a4c8dc2211d (diff)
[SCSI] MegaRAID driver management char device moved to misc
The MegaRAID driver's common management module (megaraid_mm.c) creates a char device used by the management tool "megarc" from LSI Logic (and possibly other management tools). In 2.6 with udev, this device doesn't get created because it is not registered in sysfs. I first fixed this by registering a class "megaraid_mm", but realized that this should probably be moved to misc devices, instead of taking up a char major. This is because only 1 device is used, even if there are multiple adapters - the minor is never used (the adapter info is in the ioctl block sent to the driver, not detected based on the minor number as one might think). So it is a complete waste to have an entire major taken by this. So it now uses a misc device which I named "megadev0" (the name that megarc expects), and has a dynamic minor (previoulsy a dynamic major was used). I have tested this on my own system with the megarc tool, and it works just as fine as before (only now the device gets created correctly by udev). Acked-by: "Patro, Sumant" <Sumant.Patro@lsi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--drivers/scsi/megaraid/megaraid_mm.c20
-rw-r--r--drivers/scsi/megaraid/megaraid_mm.h1
2 files changed, 14 insertions, 7 deletions
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
index b6587a6d8486..0ad215e27b83 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -59,7 +59,6 @@ EXPORT_SYMBOL(mraid_mm_register_adp);
59EXPORT_SYMBOL(mraid_mm_unregister_adp); 59EXPORT_SYMBOL(mraid_mm_unregister_adp);
60EXPORT_SYMBOL(mraid_mm_adapter_app_handle); 60EXPORT_SYMBOL(mraid_mm_adapter_app_handle);
61 61
62static int majorno;
63static uint32_t drvr_ver = 0x02200207; 62static uint32_t drvr_ver = 0x02200207;
64 63
65static int adapters_count_g; 64static int adapters_count_g;
@@ -76,6 +75,12 @@ static const struct file_operations lsi_fops = {
76 .owner = THIS_MODULE, 75 .owner = THIS_MODULE,
77}; 76};
78 77
78static struct miscdevice megaraid_mm_dev = {
79 .minor = MISC_DYNAMIC_MINOR,
80 .name = "megadev0",
81 .fops = &lsi_fops,
82};
83
79/** 84/**
80 * mraid_mm_open - open routine for char node interface 85 * mraid_mm_open - open routine for char node interface
81 * @inode : unused 86 * @inode : unused
@@ -1184,15 +1189,16 @@ mraid_mm_teardown_dma_pools(mraid_mmadp_t *adp)
1184static int __init 1189static int __init
1185mraid_mm_init(void) 1190mraid_mm_init(void)
1186{ 1191{
1192 int err;
1193
1187 // Announce the driver version 1194 // Announce the driver version
1188 con_log(CL_ANN, (KERN_INFO "megaraid cmm: %s %s\n", 1195 con_log(CL_ANN, (KERN_INFO "megaraid cmm: %s %s\n",
1189 LSI_COMMON_MOD_VERSION, LSI_COMMON_MOD_EXT_VERSION)); 1196 LSI_COMMON_MOD_VERSION, LSI_COMMON_MOD_EXT_VERSION));
1190 1197
1191 majorno = register_chrdev(0, "megadev", &lsi_fops); 1198 err = misc_register(&megaraid_mm_dev);
1192 1199 if (err < 0) {
1193 if (majorno < 0) { 1200 con_log(CL_ANN, ("megaraid cmm: cannot register misc device\n"));
1194 con_log(CL_ANN, ("megaraid cmm: cannot get major\n")); 1201 return err;
1195 return majorno;
1196 } 1202 }
1197 1203
1198 init_waitqueue_head(&wait_q); 1204 init_waitqueue_head(&wait_q);
@@ -1230,7 +1236,7 @@ mraid_mm_exit(void)
1230{ 1236{
1231 con_log(CL_DLEVEL1 , ("exiting common mod\n")); 1237 con_log(CL_DLEVEL1 , ("exiting common mod\n"));
1232 1238
1233 unregister_chrdev(majorno, "megadev"); 1239 misc_deregister(&megaraid_mm_dev);
1234} 1240}
1235 1241
1236module_init(mraid_mm_init); 1242module_init(mraid_mm_init);
diff --git a/drivers/scsi/megaraid/megaraid_mm.h b/drivers/scsi/megaraid/megaraid_mm.h
index c8762b2b8ed1..55b425c0a654 100644
--- a/drivers/scsi/megaraid/megaraid_mm.h
+++ b/drivers/scsi/megaraid/megaraid_mm.h
@@ -22,6 +22,7 @@
22#include <linux/moduleparam.h> 22#include <linux/moduleparam.h>
23#include <linux/pci.h> 23#include <linux/pci.h>
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/miscdevice.h>
25 26
26#include "mbox_defs.h" 27#include "mbox_defs.h"
27#include "megaraid_ioctl.h" 28#include "megaraid_ioctl.h"