Skip to contentSkip to conversation

use misc dynamic minor for sonypi driver

PATCH In review Olaf Hering 2 participants 2 messages Jan 27, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 use misc dynamic minor for sonypi driver

Whats the reason for using -1 as minor number?
No idea if that works well, it probably does.
Maybe add a comment if -1 is supposed to work.

drivers/char/sonypi.c renamed from linux-2.6.11-rc2/drivers/char/sonypi.c +1 -1
@@ -649,7 +649,7 @@
 };
 
 struct miscdevice sonypi_misc_device = {
-	.minor		= -1,
+	.minor		= MISC_DYNAMIC_MINOR,
 	.name		= "sonypi",
 	.fops		= &sonypi_misc_fops,
 };
#1 lore raw
Quoted 9 lines · Olaf Hering

Whats the reason for using -1 as minor number?
No idea if that works well, it probably does.
Maybe add a comment if -1 is supposed to work.

drivers/char/sonypi.c line 655

Quoted 8 lines
drivers/char/sonypi.c renamed from linux-2.6.11-rc2/drivers/char/sonypi.c +1 -1
@@ -649,7 +649,7 @@
 };
 
 struct miscdevice sonypi_misc_device = {
-	.minor		= -1,
+	.minor		= MISC_DYNAMIC_MINOR,
 	.name		= "sonypi",
 	.fops		= &sonypi_misc_fops,
 };

It works because sonypi_misc_device.minor get overridden later:

662 sonypi_misc_device.minor = (minor == -1) ?
663 MISC_DYNAMIC_MINOR : minor;

This test could be simplified too in addition to your patch.

Stelian.

Signature · 1 line
Stelian Pop <[email protected]>