diff options
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/i8k.c | 6 | ||||
-rw-r--r-- | drivers/char/mmtimer.c | 24 | ||||
-rw-r--r-- | drivers/char/synclink.c | 16 |
3 files changed, 24 insertions, 22 deletions
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index f49037b..b60d425 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c @@ -77,6 +77,10 @@ static int power_status; module_param(power_status, bool, 0600); MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k"); +static int fan_mult = I8K_FAN_MULT; +module_param(fan_mult, int, 0); +MODULE_PARM_DESC(fan_mult, "Factor to multiply fan speed with"); + static int i8k_open_fs(struct inode *inode, struct file *file); static int i8k_ioctl(struct inode *, struct file *, unsigned int, unsigned long); @@ -239,7 +243,7 @@ static int i8k_get_fan_speed(int fan) struct smm_regs regs = { .eax = I8K_SMM_GET_SPEED, }; regs.ebx = fan & 0xff; - return i8k_smm(®s) ? : (regs.eax & 0xffff) * I8K_FAN_MULT; + return i8k_smm(®s) ? : (regs.eax & 0xffff) * fan_mult; } /* diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index d83db5d..192961f 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c @@ -30,6 +30,8 @@ #include <linux/miscdevice.h> #include <linux/posix-timers.h> #include <linux/interrupt.h> +#include <linux/time.h> +#include <linux/math64.h> #include <asm/uaccess.h> #include <asm/sn/addrs.h> @@ -472,8 +474,8 @@ static int sgi_clock_get(clockid_t clockid, struct timespec *tp) nsec = rtc_time() * sgi_clock_period + sgi_clock_offset.tv_nsec; - tp->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tp->tv_nsec) - + sgi_clock_offset.tv_sec; + *tp = ns_to_timespec(nsec); + tp->tv_sec += sgi_clock_offset.tv_sec; return 0; }; @@ -481,11 +483,11 @@ static int sgi_clock_set(clockid_t clockid, struct timespec *tp) { u64 nsec; - u64 rem; + u32 rem; nsec = rtc_time() * sgi_clock_period; - sgi_clock_offset.tv_sec = tp->tv_sec - div_long_long_rem(nsec, NSEC_PER_SEC, &rem); + sgi_clock_offset.tv_sec = tp->tv_sec - div_u64_rem(nsec, NSEC_PER_SEC, &rem); if (rem <= tp->tv_nsec) sgi_clock_offset.tv_nsec = tp->tv_sec - rem; @@ -644,9 +646,6 @@ static int sgi_timer_del(struct k_itimer *timr) return 0; } -#define timespec_to_ns(x) ((x).tv_nsec + (x).tv_sec * NSEC_PER_SEC) -#define ns_to_timespec(ts, nsec) (ts).tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &(ts).tv_nsec) - /* Assumption: it_lock is already held with irq's disabled */ static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) { @@ -659,9 +658,8 @@ static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) return; } - ns_to_timespec(cur_setting->it_interval, timr->it.mmtimer.incr * sgi_clock_period); - ns_to_timespec(cur_setting->it_value, (timr->it.mmtimer.expires - rtc_time())* sgi_clock_period); - return; + cur_setting->it_interval = ns_to_timespec(timr->it.mmtimer.incr * sgi_clock_period); + cur_setting->it_value = ns_to_timespec((timr->it.mmtimer.expires - rtc_time()) * sgi_clock_period); } @@ -679,8 +677,8 @@ static int sgi_timer_set(struct k_itimer *timr, int flags, sgi_timer_get(timr, old_setting); sgi_timer_del(timr); - when = timespec_to_ns(new_setting->it_value); - period = timespec_to_ns(new_setting->it_interval); + when = timespec_to_ns(&new_setting->it_value); + period = timespec_to_ns(&new_setting->it_interval); if (when == 0) /* Clear timer */ @@ -695,7 +693,7 @@ static int sgi_timer_set(struct k_itimer *timr, int flags, unsigned long now; getnstimeofday(&n); - now = timespec_to_ns(n); + now = timespec_to_ns(&n); if (when > now) when -= now; else diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 513b7c2..ac5080d 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -2028,13 +2028,13 @@ static void mgsl_change_params(struct mgsl_struct *info) */ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) { - struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; + struct mgsl_struct *info = tty->driver_data; unsigned long flags; - int ret; + int ret = 0; - if ( debug_level >= DEBUG_LEVEL_INFO ) { - printk( "%s(%d):mgsl_put_char(%d) on %s\n", - __FILE__,__LINE__,ch,info->device_name); + if (debug_level >= DEBUG_LEVEL_INFO) { + printk(KERN_DEBUG "%s(%d):mgsl_put_char(%d) on %s\n", + __FILE__, __LINE__, ch, info->device_name); } if (mgsl_paranoia_check(info, tty->name, "mgsl_put_char")) @@ -2043,9 +2043,9 @@ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) if (!tty || !info->xmit_buf) return 0; - spin_lock_irqsave(&info->irq_spinlock,flags); + spin_lock_irqsave(&info->irq_spinlock, flags); - if ( (info->params.mode == MGSL_MODE_ASYNC ) || !info->tx_active ) { + if ((info->params.mode == MGSL_MODE_ASYNC ) || !info->tx_active) { if (info->xmit_cnt < SERIAL_XMIT_SIZE - 1) { info->xmit_buf[info->xmit_head++] = ch; info->xmit_head &= SERIAL_XMIT_SIZE-1; @@ -2053,7 +2053,7 @@ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) ret = 1; } } - spin_unlock_irqrestore(&info->irq_spinlock,flags); + spin_unlock_irqrestore(&info->irq_spinlock, flags); return ret; } /* end of mgsl_put_char() */ |