]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/staging/lirc/lirc_serial.c
Merge branch 'master' into tk71
[mv-sheeva.git] / drivers / staging / lirc / lirc_serial.c
index 9456f8e3f9ef37f75b71a1146ea2e1199c851fd0..1c3099b388e0acefd601621dbe05a9c6b78451b7 100644 (file)
@@ -372,12 +372,12 @@ static unsigned long conv_us_to_clocks;
 static int init_timing_params(unsigned int new_duty_cycle,
                unsigned int new_freq)
 {
-       unsigned long long loops_per_sec, work;
+       __u64 loops_per_sec, work;
 
        duty_cycle = new_duty_cycle;
        freq = new_freq;
 
-       loops_per_sec = current_cpu_data.loops_per_jiffy;
+       loops_per_sec = __this_cpu_read(cpu.info.loops_per_jiffy);
        loops_per_sec *= HZ;
 
        /* How many clocks in a microsecond?, avoiding long long divide */
@@ -398,7 +398,7 @@ static int init_timing_params(unsigned int new_duty_cycle,
        dprintk("in init_timing_params, freq=%d, duty_cycle=%d, "
                "clk/jiffy=%ld, pulse=%ld, space=%ld, "
                "conv_us_to_clocks=%ld\n",
-               freq, duty_cycle, current_cpu_data.loops_per_jiffy,
+               freq, duty_cycle, __this_cpu_read(cpu_info.loops_per_jiffy),
                pulse_width, space_width, conv_us_to_clocks);
        return 0;
 }
@@ -966,7 +966,7 @@ static ssize_t lirc_write(struct file *file, const char *buf,
        if (n % sizeof(int) || count % 2 == 0)
                return -EINVAL;
        wbuf = memdup_user(buf, n);
-       if (PTR_ERR(wbuf))
+       if (IS_ERR(wbuf))
                return PTR_ERR(wbuf);
        spin_lock_irqsave(&hardware[type].lock, flags);
        if (type == LIRC_IRDEO) {
@@ -981,14 +981,14 @@ static ssize_t lirc_write(struct file *file, const char *buf,
        }
        off();
        spin_unlock_irqrestore(&hardware[type].lock, flags);
+       kfree(wbuf);
        return n;
 }
 
 static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 {
        int result;
-       unsigned long value;
-       unsigned int ivalue;
+       __u32 value;
 
        switch (cmd) {
        case LIRC_GET_SEND_MODE:
@@ -997,7 +997,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 
                result = put_user(LIRC_SEND2MODE
                                  (hardware[type].features&LIRC_CAN_SEND_MASK),
-                                 (unsigned long *) arg);
+                                 (__u32 *) arg);
                if (result)
                        return result;
                break;
@@ -1006,7 +1006,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
                if (!(hardware[type].features&LIRC_CAN_SEND_MASK))
                        return -ENOIOCTLCMD;
 
-               result = get_user(value, (unsigned long *) arg);
+               result = get_user(value, (__u32 *) arg);
                if (result)
                        return result;
                /* only LIRC_MODE_PULSE supported */
@@ -1023,12 +1023,12 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
                if (!(hardware[type].features&LIRC_CAN_SET_SEND_DUTY_CYCLE))
                        return -ENOIOCTLCMD;
 
-               result = get_user(ivalue, (unsigned int *) arg);
+               result = get_user(value, (__u32 *) arg);
                if (result)
                        return result;
-               if (ivalue <= 0 || ivalue > 100)
+               if (value <= 0 || value > 100)
                        return -EINVAL;
-               return init_timing_params(ivalue, freq);
+               return init_timing_params(value, freq);
                break;
 
        case LIRC_SET_SEND_CARRIER:
@@ -1036,12 +1036,12 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
                if (!(hardware[type].features&LIRC_CAN_SET_SEND_CARRIER))
                        return -ENOIOCTLCMD;
 
-               result = get_user(ivalue, (unsigned int *) arg);
+               result = get_user(value, (__u32 *) arg);
                if (result)
                        return result;
-               if (ivalue > 500000 || ivalue < 20000)
+               if (value > 500000 || value < 20000)
                        return -EINVAL;
-               return init_timing_params(duty_cycle, ivalue);
+               return init_timing_params(duty_cycle, value);
                break;
 
        default:
@@ -1054,10 +1054,14 @@ static const struct file_operations lirc_fops = {
        .owner          = THIS_MODULE,
        .write          = lirc_write,
        .unlocked_ioctl = lirc_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl   = lirc_ioctl,
+#endif
        .read           = lirc_dev_fop_read,
        .poll           = lirc_dev_fop_poll,
        .open           = lirc_dev_fop_open,
        .release        = lirc_dev_fop_close,
+       .llseek         = no_llseek,
 };
 
 static struct lirc_driver driver = {