diff options
Diffstat (limited to 'drivers/char/ds1620.c')
| -rw-r--r-- | drivers/char/ds1620.c | 42 | 
1 files changed, 23 insertions, 19 deletions
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c index aab9605f0b4..0fae5296e31 100644 --- a/drivers/char/ds1620.c +++ b/drivers/char/ds1620.c @@ -6,6 +6,7 @@  #include <linux/miscdevice.h>  #include <linux/delay.h>  #include <linux/proc_fs.h> +#include <linux/seq_file.h>  #include <linux/capability.h>  #include <linux/init.h>  #include <linux/mutex.h> @@ -74,21 +75,21 @@ static inline void netwinder_ds1620_reset(void)  static inline void netwinder_lock(unsigned long *flags)  { -	spin_lock_irqsave(&nw_gpio_lock, *flags); +	raw_spin_lock_irqsave(&nw_gpio_lock, *flags);  }  static inline void netwinder_unlock(unsigned long *flags)  { -	spin_unlock_irqrestore(&nw_gpio_lock, *flags); +	raw_spin_unlock_irqrestore(&nw_gpio_lock, *flags);  }  static inline void netwinder_set_fan(int i)  {  	unsigned long flags; -	spin_lock_irqsave(&nw_gpio_lock, flags); +	raw_spin_lock_irqsave(&nw_gpio_lock, flags);  	nw_gpio_modify_op(GPIO_FAN, i ? GPIO_FAN : 0); -	spin_unlock_irqrestore(&nw_gpio_lock, flags); +	raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);  }  static inline int netwinder_get_fan(void) @@ -329,9 +330,7 @@ ds1620_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)  }  #ifdef THERM_USE_PROC -static int -proc_therm_ds1620_read(char *buf, char **start, off_t offset, -		       int len, int *eof, void *unused) +static int ds1620_proc_therm_show(struct seq_file *m, void *v)  {  	struct therm th;  	int temp; @@ -339,17 +338,25 @@ proc_therm_ds1620_read(char *buf, char **start, off_t offset,  	ds1620_read_state(&th);  	temp =  cvt_9_to_int(ds1620_in(THERM_READ_TEMP, 9)); -	len = sprintf(buf, "Thermostat: HI %i.%i, LOW %i.%i; " -		      "temperature: %i.%i C, fan %s\n", -		      th.hi >> 1, th.hi & 1 ? 5 : 0, -		      th.lo >> 1, th.lo & 1 ? 5 : 0, -		      temp  >> 1, temp  & 1 ? 5 : 0, -		      fan_state[netwinder_get_fan()]); +	seq_printf(m, "Thermostat: HI %i.%i, LOW %i.%i; temperature: %i.%i C, fan %s\n", +		   th.hi >> 1, th.hi & 1 ? 5 : 0, +		   th.lo >> 1, th.lo & 1 ? 5 : 0, +		   temp  >> 1, temp  & 1 ? 5 : 0, +		   fan_state[netwinder_get_fan()]); +	return 0; +} -	return len; +static int ds1620_proc_therm_open(struct inode *inode, struct file *file) +{ +	return single_open(file, ds1620_proc_therm_show, NULL);  } -static struct proc_dir_entry *proc_therm_ds1620; +static const struct file_operations ds1620_proc_therm_fops = { +	.open		= ds1620_proc_therm_open, +	.read		= seq_read, +	.llseek		= seq_lseek, +	.release	= single_release, +};  #endif  static const struct file_operations ds1620_fops = { @@ -397,10 +404,7 @@ static int __init ds1620_init(void)  		return ret;  #ifdef THERM_USE_PROC -	proc_therm_ds1620 = create_proc_entry("therm", 0, NULL); -	if (proc_therm_ds1620) -		proc_therm_ds1620->read_proc = proc_therm_ds1620_read; -	else +	if (!proc_create("therm", 0, NULL, &ds1620_proc_therm_fops))  		printk(KERN_ERR "therm: unable to register /proc/therm\n");  #endif  | 
