Skip to content

Commit

Permalink
lis3: fix misc device unregistering and printk
Browse files Browse the repository at this point in the history
Can only unregister the misc device if it was registered before.  Also
remove debugging messages, which in addition were not properly formated.

Signed-off-by: Eric Piel <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
pieleric authored and torvalds committed Jun 17, 2009
1 parent 4b32412 commit c288424
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/hwmon/lis3lv02d.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ static int lis3lv02d_misc_open(struct inode *inode, struct file *file)
return -EBUSY;
}
lis3lv02d_increase_use(&lis3_dev);
printk("lis3: registered interrupt %d\n", lis3_dev.irq);
return 0;
}

Expand Down Expand Up @@ -378,7 +377,8 @@ void lis3lv02d_joystick_disable(void)
if (!lis3_dev.idev)
return;

misc_deregister(&lis3lv02d_misc_device);
if (lis3_dev.irq)
misc_deregister(&lis3lv02d_misc_device);
input_unregister_device(lis3_dev.idev);
lis3_dev.idev = NULL;
}
Expand Down Expand Up @@ -493,16 +493,13 @@ int lis3lv02d_init_device(struct lis3lv02d *dev)
if (lis3lv02d_joystick_enable())
printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n");

printk("lis3_init_device: irq %d\n", dev->irq);

/* bail if we did not get an IRQ from the bus layer */
if (!dev->irq) {
printk(KERN_ERR DRIVER_NAME
": No IRQ. Disabling /dev/freefall\n");
goto out;
}

printk("lis3: registering device\n");
if (misc_register(&lis3lv02d_misc_device))
printk(KERN_ERR DRIVER_NAME ": misc_register failed\n");
out:
Expand Down

0 comments on commit c288424

Please sign in to comment.