aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/i8k.c6
-rw-r--r--drivers/char/mmtimer.c24
-rw-r--r--drivers/char/synclink.c16
3 files changed, 24 insertions, 22 deletions
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
index f49037b744f9..b60d425ce8d1 100644
--- a/drivers/char/i8k.c
+++ b/drivers/char/i8k.c
@@ -77,6 +77,10 @@ static int power_status;
77module_param(power_status, bool, 0600); 77module_param(power_status, bool, 0600);
78MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k"); 78MODULE_PARM_DESC(power_status, "Report power status in /proc/i8k");
79 79
80static int fan_mult = I8K_FAN_MULT;
81module_param(fan_mult, int, 0);
82MODULE_PARM_DESC(fan_mult, "Factor to multiply fan speed with");
83
80static int i8k_open_fs(struct inode *inode, struct file *file); 84static int i8k_open_fs(struct inode *inode, struct file *file);
81static int i8k_ioctl(struct inode *, struct file *, unsigned int, 85static int i8k_ioctl(struct inode *, struct file *, unsigned int,
82 unsigned long); 86 unsigned long);
@@ -239,7 +243,7 @@ static int i8k_get_fan_speed(int fan)
239 struct smm_regs regs = { .eax = I8K_SMM_GET_SPEED, }; 243 struct smm_regs regs = { .eax = I8K_SMM_GET_SPEED, };
240 244
241 regs.ebx = fan & 0xff; 245 regs.ebx = fan & 0xff;
242 return i8k_smm(&regs) ? : (regs.eax & 0xffff) * I8K_FAN_MULT; 246 return i8k_smm(&regs) ? : (regs.eax & 0xffff) * fan_mult;
243} 247}
244 248
245/* 249/*
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index d83db5d880e0..192961fd7173 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -30,6 +30,8 @@
30#include <linux/miscdevice.h> 30#include <linux/miscdevice.h>
31#include <linux/posix-timers.h> 31#include <linux/posix-timers.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/time.h>
34#include <linux/math64.h>
33 35
34#include <asm/uaccess.h> 36#include <asm/uaccess.h>
35#include <asm/sn/addrs.h> 37#include <asm/sn/addrs.h>
@@ -472,8 +474,8 @@ static int sgi_clock_get(clockid_t clockid, struct timespec *tp)
472 474
473 nsec = rtc_time() * sgi_clock_period 475 nsec = rtc_time() * sgi_clock_period
474 + sgi_clock_offset.tv_nsec; 476 + sgi_clock_offset.tv_nsec;
475 tp->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tp->tv_nsec) 477 *tp = ns_to_timespec(nsec);
476 + sgi_clock_offset.tv_sec; 478 tp->tv_sec += sgi_clock_offset.tv_sec;
477 return 0; 479 return 0;
478}; 480};
479 481
@@ -481,11 +483,11 @@ static int sgi_clock_set(clockid_t clockid, struct timespec *tp)
481{ 483{
482 484
483 u64 nsec; 485 u64 nsec;
484 u64 rem; 486 u32 rem;
485 487
486 nsec = rtc_time() * sgi_clock_period; 488 nsec = rtc_time() * sgi_clock_period;
487 489
488 sgi_clock_offset.tv_sec = tp->tv_sec - div_long_long_rem(nsec, NSEC_PER_SEC, &rem); 490 sgi_clock_offset.tv_sec = tp->tv_sec - div_u64_rem(nsec, NSEC_PER_SEC, &rem);
489 491
490 if (rem <= tp->tv_nsec) 492 if (rem <= tp->tv_nsec)
491 sgi_clock_offset.tv_nsec = tp->tv_sec - rem; 493 sgi_clock_offset.tv_nsec = tp->tv_sec - rem;
@@ -644,9 +646,6 @@ static int sgi_timer_del(struct k_itimer *timr)
644 return 0; 646 return 0;
645} 647}
646 648
647#define timespec_to_ns(x) ((x).tv_nsec + (x).tv_sec * NSEC_PER_SEC)
648#define ns_to_timespec(ts, nsec) (ts).tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &(ts).tv_nsec)
649
650/* Assumption: it_lock is already held with irq's disabled */ 649/* Assumption: it_lock is already held with irq's disabled */
651static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) 650static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
652{ 651{
@@ -659,9 +658,8 @@ static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
659 return; 658 return;
660 } 659 }
661 660
662 ns_to_timespec(cur_setting->it_interval, timr->it.mmtimer.incr * sgi_clock_period); 661 cur_setting->it_interval = ns_to_timespec(timr->it.mmtimer.incr * sgi_clock_period);
663 ns_to_timespec(cur_setting->it_value, (timr->it.mmtimer.expires - rtc_time())* sgi_clock_period); 662 cur_setting->it_value = ns_to_timespec((timr->it.mmtimer.expires - rtc_time()) * sgi_clock_period);
664 return;
665} 663}
666 664
667 665
@@ -679,8 +677,8 @@ static int sgi_timer_set(struct k_itimer *timr, int flags,
679 sgi_timer_get(timr, old_setting); 677 sgi_timer_get(timr, old_setting);
680 678
681 sgi_timer_del(timr); 679 sgi_timer_del(timr);
682 when = timespec_to_ns(new_setting->it_value); 680 when = timespec_to_ns(&new_setting->it_value);
683 period = timespec_to_ns(new_setting->it_interval); 681 period = timespec_to_ns(&new_setting->it_interval);
684 682
685 if (when == 0) 683 if (when == 0)
686 /* Clear timer */ 684 /* Clear timer */
@@ -695,7 +693,7 @@ static int sgi_timer_set(struct k_itimer *timr, int flags,
695 unsigned long now; 693 unsigned long now;
696 694
697 getnstimeofday(&n); 695 getnstimeofday(&n);
698 now = timespec_to_ns(n); 696 now = timespec_to_ns(&n);
699 if (when > now) 697 if (when > now)
700 when -= now; 698 when -= now;
701 else 699 else
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 513b7c2f3e26..ac5080df2565 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -2028,13 +2028,13 @@ static void mgsl_change_params(struct mgsl_struct *info)
2028 */ 2028 */
2029static int mgsl_put_char(struct tty_struct *tty, unsigned char ch) 2029static int mgsl_put_char(struct tty_struct *tty, unsigned char ch)
2030{ 2030{
2031 struct mgsl_struct *info = (struct mgsl_struct *)tty->driver_data; 2031 struct mgsl_struct *info = tty->driver_data;
2032 unsigned long flags; 2032 unsigned long flags;
2033 int ret; 2033 int ret = 0;
2034 2034
2035 if ( debug_level >= DEBUG_LEVEL_INFO ) { 2035 if (debug_level >= DEBUG_LEVEL_INFO) {
2036 printk( "%s(%d):mgsl_put_char(%d) on %s\n", 2036 printk(KERN_DEBUG "%s(%d):mgsl_put_char(%d) on %s\n",
2037 __FILE__,__LINE__,ch,info->device_name); 2037 __FILE__, __LINE__, ch, info->device_name);
2038 } 2038 }
2039 2039
2040 if (mgsl_paranoia_check(info, tty->name, "mgsl_put_char")) 2040 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)
2043 if (!tty || !info->xmit_buf) 2043 if (!tty || !info->xmit_buf)
2044 return 0; 2044 return 0;
2045 2045
2046 spin_lock_irqsave(&info->irq_spinlock,flags); 2046 spin_lock_irqsave(&info->irq_spinlock, flags);
2047 2047
2048 if ( (info->params.mode == MGSL_MODE_ASYNC ) || !info->tx_active ) { 2048 if ((info->params.mode == MGSL_MODE_ASYNC ) || !info->tx_active) {
2049 if (info->xmit_cnt < SERIAL_XMIT_SIZE - 1) { 2049 if (info->xmit_cnt < SERIAL_XMIT_SIZE - 1) {
2050 info->xmit_buf[info->xmit_head++] = ch; 2050 info->xmit_buf[info->xmit_head++] = ch;
2051 info->xmit_head &= SERIAL_XMIT_SIZE-1; 2051 info->xmit_head &= SERIAL_XMIT_SIZE-1;
@@ -2053,7 +2053,7 @@ static int mgsl_put_char(struct tty_struct *tty, unsigned char ch)
2053 ret = 1; 2053 ret = 1;
2054 } 2054 }
2055 } 2055 }
2056 spin_unlock_irqrestore(&info->irq_spinlock,flags); 2056 spin_unlock_irqrestore(&info->irq_spinlock, flags);
2057 return ret; 2057 return ret;
2058 2058
2059} /* end of mgsl_put_char() */ 2059} /* end of mgsl_put_char() */