Commit:     90a95af85f22c82f87e5fb714bac7ee06673b0ff
Parent:     7d5d408c77cee95d1380511de46b7a4c8dc2211d
Author:     Thomas Horsten <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 4 23:53:18 2008 -0800
Committer:  James Bottomley <[EMAIL PROTECTED]>
CommitDate: Mon Feb 11 10:20:53 2008 -0600

    [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" <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
 drivers/scsi/megaraid/megaraid_mm.c |   20 +++++++++++++-------
 drivers/scsi/megaraid/megaraid_mm.h |    1 +
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_mm.c 
index b6587a6..0ad215e 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);
-static int majorno;
 static uint32_t drvr_ver       = 0x02200207;
 static int adapters_count_g;
@@ -76,6 +75,12 @@ static const struct file_operations lsi_fops = {
        .owner  = THIS_MODULE,
+static struct miscdevice megaraid_mm_dev = {
+       .minor  = MISC_DYNAMIC_MINOR,
+       .name   = "megadev0",
+       .fops   = &lsi_fops,
  * mraid_mm_open - open routine for char node interface
  * @inode      : unused
@@ -1184,15 +1189,16 @@ mraid_mm_teardown_dma_pools(mraid_mmadp_t *adp)
 static int __init
+       int err;
        // Announce the driver version
        con_log(CL_ANN, (KERN_INFO "megaraid cmm: %s %s\n",
-       majorno = register_chrdev(0, "megadev", &lsi_fops);
-       if (majorno < 0) {
-               con_log(CL_ANN, ("megaraid cmm: cannot get major\n"));
-               return majorno;
+       err = misc_register(&megaraid_mm_dev);
+       if (err < 0) {
+               con_log(CL_ANN, ("megaraid cmm: cannot register misc 
+               return err;
@@ -1230,7 +1236,7 @@ mraid_mm_exit(void)
        con_log(CL_DLEVEL1 , ("exiting common mod\n"));
-       unregister_chrdev(majorno, "megadev");
+       misc_deregister(&megaraid_mm_dev);
diff --git a/drivers/scsi/megaraid/megaraid_mm.h 
index c8762b2..55b425c 100644
--- a/drivers/scsi/megaraid/megaraid_mm.h
+++ b/drivers/scsi/megaraid/megaraid_mm.h
@@ -22,6 +22,7 @@
 #include <linux/moduleparam.h>
 #include <linux/pci.h>
 #include <linux/list.h>
+#include <linux/miscdevice.h>
 #include "mbox_defs.h"
 #include "megaraid_ioctl.h"
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to