* [patch 05/13] MegaRAID driver management char device moved to misc
@ 2008-02-05 7:53 akpm
2008-02-08 0:40 ` James Bottomley
0 siblings, 1 reply; 4+ messages in thread
From: akpm @ 2008-02-05 7:53 UTC (permalink / raw)
To: James.Bottomley
Cc: linux-scsi, akpm, thomas, Neela.Kolli, Seokmann.Ju,
thomas.horsten
From: Thomas Horsten <thomas@horsten.com>
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).
Cc: <thomas.horsten@gmail.com>
Cc: Neela Syam Kolli <Neela.Kolli@engenio.com>
Cc: "Ju, Seokmann" <Seokmann.Ju@lsil.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/scsi/megaraid/megaraid_mm.c | 20 +++++++++++++-------
drivers/scsi/megaraid/megaraid_mm.h | 1 +
2 files changed, 14 insertions(+), 7 deletions(-)
diff -puN drivers/scsi/megaraid/megaraid_mm.c~megaraid-driver-management-char-device-moved-to-misc drivers/scsi/megaraid/megaraid_mm.c
--- a/drivers/scsi/megaraid/megaraid_mm.c~megaraid-driver-management-char-device-moved-to-misc
+++ a/drivers/scsi/megaraid/megaraid_mm.c
@@ -59,7 +59,6 @@ EXPORT_SYMBOL(mraid_mm_register_adp);
EXPORT_SYMBOL(mraid_mm_unregister_adp);
EXPORT_SYMBOL(mraid_mm_adapter_app_handle);
-static int majorno;
static uint32_t drvr_ver = 0x02200207;
static int adapters_count_g;
@@ -76,6 +75,12 @@ static const struct file_operations lsi_
.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_
static int __init
mraid_mm_init(void)
{
+ int err;
+
// Announce the driver version
con_log(CL_ANN, (KERN_INFO "megaraid cmm: %s %s\n",
LSI_COMMON_MOD_VERSION, LSI_COMMON_MOD_EXT_VERSION));
- 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 device\n"));
+ return err;
}
init_waitqueue_head(&wait_q);
@@ -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);
}
module_init(mraid_mm_init);
diff -puN drivers/scsi/megaraid/megaraid_mm.h~megaraid-driver-management-char-device-moved-to-misc drivers/scsi/megaraid/megaraid_mm.h
--- a/drivers/scsi/megaraid/megaraid_mm.h~megaraid-driver-management-char-device-moved-to-misc
+++ a/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"
_
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch 05/13] MegaRAID driver management char device moved to misc
2008-02-05 7:53 [patch 05/13] MegaRAID driver management char device moved to misc akpm
@ 2008-02-08 0:40 ` James Bottomley
2008-02-08 2:47 ` [patch 05/13] MegaRAID driver management char device moved tomisc Patro, Sumant
0 siblings, 1 reply; 4+ messages in thread
From: James Bottomley @ 2008-02-08 0:40 UTC (permalink / raw)
To: akpm
Cc: linux-scsi, thomas, Neela.Kolli, Seokmann.Ju, thomas.horsten,
Patro, Sumant
On Mon, 2008-02-04 at 23:53 -0800, akpm@linux-foundation.org wrote:
> From: Thomas Horsten <thomas@horsten.com>
>
> 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).
>
> Cc: <thomas.horsten@gmail.com>
> Cc: Neela Syam Kolli <Neela.Kolli@engenio.com>
> Cc: "Ju, Seokmann" <Seokmann.Ju@lsil.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Neela and Sekomann or Sumant, can I ping on this ... I've no idea what
this will do to the raid management tools, so I really need someone to
sign off on this.
James
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [patch 05/13] MegaRAID driver management char device moved tomisc
2008-02-08 0:40 ` James Bottomley
@ 2008-02-08 2:47 ` Patro, Sumant
2008-02-08 3:09 ` James Bottomley
0 siblings, 1 reply; 4+ messages in thread
From: Patro, Sumant @ 2008-02-08 2:47 UTC (permalink / raw)
To: James Bottomley, akpm
Cc: linux-scsi, thomas, Kolli, Neela, Seokmann.Ju, thomas.horsten
James, I acked this patch on 11/28.
We are fine with the change proposed.
Regards,
Sumant
-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@HansenPartnership.com]
Sent: Thursday, February 07, 2008 4:41 PM
To: akpm@linux-foundation.org
Cc: linux-scsi@vger.kernel.org; thomas@horsten.com; Kolli, Neela;
Seokmann.Ju@lsil.com; thomas.horsten@gmail.com; Patro, Sumant
Subject: Re: [patch 05/13] MegaRAID driver management char device moved
tomisc
On Mon, 2008-02-04 at 23:53 -0800, akpm@linux-foundation.org wrote:
> From: Thomas Horsten <thomas@horsten.com>
>
> 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).
>
> Cc: <thomas.horsten@gmail.com>
> Cc: Neela Syam Kolli <Neela.Kolli@engenio.com>
> Cc: "Ju, Seokmann" <Seokmann.Ju@lsil.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Neela and Sekomann or Sumant, can I ping on this ... I've no idea what
this will do to the raid management tools, so I really need someone to
sign off on this.
James
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [patch 05/13] MegaRAID driver management char device moved tomisc
2008-02-08 2:47 ` [patch 05/13] MegaRAID driver management char device moved tomisc Patro, Sumant
@ 2008-02-08 3:09 ` James Bottomley
0 siblings, 0 replies; 4+ messages in thread
From: James Bottomley @ 2008-02-08 3:09 UTC (permalink / raw)
To: Patro, Sumant
Cc: akpm, linux-scsi, thomas, Kolli, Neela, Seokmann.Ju,
thomas.horsten
On Thu, 2008-02-07 at 19:47 -0700, Patro, Sumant wrote:
> James, I acked this patch on 11/28.
Sorry about that ... that's in the window where my server dropped of the
internet while I was on holiday, so I didn't get the email, I'm afraid
> We are fine with the change proposed.
Great, will add it.
James
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-08 3:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-05 7:53 [patch 05/13] MegaRAID driver management char device moved to misc akpm
2008-02-08 0:40 ` James Bottomley
2008-02-08 2:47 ` [patch 05/13] MegaRAID driver management char device moved tomisc Patro, Sumant
2008-02-08 3:09 ` James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).