Commit 35cc1fac authored by Wim Van Sebroeck's avatar Wim Van Sebroeck

[WATCHDOG] 2.6.0-rc1 - iminor(inode).patch

get rid of unnecessary iminor(inode) code in watchdog's open and close functions.
parent f73e9f0f
...@@ -134,23 +134,15 @@ static int cpu5wdt_stop(void) ...@@ -134,23 +134,15 @@ static int cpu5wdt_stop(void)
static int cpu5wdt_open(struct inode *inode, struct file *file) static int cpu5wdt_open(struct inode *inode, struct file *file)
{ {
switch(iminor(inode)) {
case WATCHDOG_MINOR:
if ( test_and_set_bit(0, &cpu5wdt_device.inuse) ) if ( test_and_set_bit(0, &cpu5wdt_device.inuse) )
return -EBUSY; return -EBUSY;
break;
default:
return -ENODEV;
}
return 0; return 0;
} }
static int cpu5wdt_release(struct inode *inode, struct file *file) static int cpu5wdt_release(struct inode *inode, struct file *file)
{ {
if(iminor(inode)==WATCHDOG_MINOR) {
clear_bit(0, &cpu5wdt_device.inuse); clear_bit(0, &cpu5wdt_device.inuse);
}
return 0; return 0;
} }
......
...@@ -217,7 +217,6 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -217,7 +217,6 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static int static int
ibwdt_open(struct inode *inode, struct file *file) ibwdt_open(struct inode *inode, struct file *file)
{ {
if (iminor(inode) == WATCHDOG_MINOR) {
spin_lock(&ibwdt_lock); spin_lock(&ibwdt_lock);
if (ibwdt_is_open) { if (ibwdt_is_open) {
spin_unlock(&ibwdt_lock); spin_unlock(&ibwdt_lock);
...@@ -231,15 +230,11 @@ ibwdt_open(struct inode *inode, struct file *file) ...@@ -231,15 +230,11 @@ ibwdt_open(struct inode *inode, struct file *file)
ibwdt_ping(); ibwdt_ping();
spin_unlock(&ibwdt_lock); spin_unlock(&ibwdt_lock);
return 0; return 0;
} else {
return -ENODEV;
}
} }
static int static int
ibwdt_close(struct inode *inode, struct file *file) ibwdt_close(struct inode *inode, struct file *file)
{ {
if (iminor(inode) == WATCHDOG_MINOR) {
spin_lock(&ibwdt_lock); spin_lock(&ibwdt_lock);
if (expect_close) if (expect_close)
outb_p(wd_times[wd_margin], WDT_STOP); outb_p(wd_times[wd_margin], WDT_STOP);
...@@ -248,7 +243,6 @@ ibwdt_close(struct inode *inode, struct file *file) ...@@ -248,7 +243,6 @@ ibwdt_close(struct inode *inode, struct file *file)
ibwdt_is_open = 0; ibwdt_is_open = 0;
spin_unlock(&ibwdt_lock); spin_unlock(&ibwdt_lock);
}
return 0; return 0;
} }
......
...@@ -376,8 +376,6 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -376,8 +376,6 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static int zf_open(struct inode *inode, struct file *file) static int zf_open(struct inode *inode, struct file *file)
{ {
switch(iminor(inode)){
case WATCHDOG_MINOR:
spin_lock(&zf_lock); spin_lock(&zf_lock);
if(zf_is_open){ if(zf_is_open){
spin_unlock(&zf_lock); spin_unlock(&zf_lock);
...@@ -394,15 +392,10 @@ static int zf_open(struct inode *inode, struct file *file) ...@@ -394,15 +392,10 @@ static int zf_open(struct inode *inode, struct file *file)
zf_timer_on(); zf_timer_on();
return 0; return 0;
default:
return -ENODEV;
}
} }
static int zf_close(struct inode *inode, struct file *file) static int zf_close(struct inode *inode, struct file *file)
{ {
if(iminor(inode) == WATCHDOG_MINOR){
if(zf_expect_close){ if(zf_expect_close){
zf_timer_off(); zf_timer_off();
} else { } else {
...@@ -415,7 +408,6 @@ static int zf_close(struct inode *inode, struct file *file) ...@@ -415,7 +408,6 @@ static int zf_close(struct inode *inode, struct file *file)
spin_unlock(&zf_lock); spin_unlock(&zf_lock);
zf_expect_close = 0; zf_expect_close = 0;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment