On Tue, Apr 05, 2011 at 05:45:13PM +0300, Ilkka Koskinen wrote:Signed-off-by: Ilkka Koskinen <ilkka.koskinen@xxxxxxxxx>
---
drivers/misc/lis3lv02d/lis3lv02d.c | 237 ++++++++++++++++++++----------------
drivers/misc/lis3lv02d/lis3lv02d.h | 3 +
2 files changed, 135 insertions(+), 105 deletions(-)
@@ -980,14 +1003,18 @@ int lis3lv02d_init_device(struct lis3lv02d *lis3)
thread_fn,
IRQF_TRIGGER_RISING | IRQF_ONESHOT |
irq_flags,
- DRIVER_NAME, &lis3_dev);
+ DRIVER_NAME, lis3);
if (err < 0) {
pr_err("Cannot get IRQ\n");
goto out;
}
- if (misc_register(&lis3lv02d_misc_device))
+ lis3->miscdev.minor = MISC_DYNAMIC_MINOR;
+ lis3->miscdev.name = "freefall";
+ lis3->miscdev.fops = &lis3lv02d_misc_fops;
+
+ if (misc_register(&lis3->miscdev))
pr_err("misc_register failed\n");
You should not use miscdevice in case there will be multiple devices.
First, it will fail. There cannot be more than one device with the same
name. Second, current dynamic minor devices is restricted to 64 devices.
Since this is reserved to one-shot devices, freefall was OK as a misc
device until you fixed it to allow multiple freefall devices. :-)
So, I'd recommend switching to a new device class, and have freefall0,
freefall1, etc.
Anyway, good job on this.
Regards,
Cascardo.