diff options
Diffstat (limited to 'drivers/staging/media/lirc')
-rw-r--r-- | drivers/staging/media/lirc/lirc_bt829.c | 6 | ||||
-rw-r--r-- | drivers/staging/media/lirc/lirc_igorplugusb.c | 30 | ||||
-rw-r--r-- | drivers/staging/media/lirc/lirc_parallel.c | 26 | ||||
-rw-r--r-- | drivers/staging/media/lirc/lirc_serial.c | 92 | ||||
-rw-r--r-- | drivers/staging/media/lirc/lirc_sir.c | 33 | ||||
-rw-r--r-- | drivers/staging/media/lirc/lirc_zilog.c | 23 |
6 files changed, 59 insertions, 151 deletions
diff --git a/drivers/staging/media/lirc/lirc_bt829.c b/drivers/staging/media/lirc/lirc_bt829.c index 30edc740ac25..fe010542ab4b 100644 --- a/drivers/staging/media/lirc/lirc_bt829.c +++ b/drivers/staging/media/lirc/lirc_bt829.c @@ -64,7 +64,7 @@ static bool debug; static int atir_minor; static phys_addr_t pci_addr_phys; -static unsigned char *pci_addr_lin; +static unsigned char __iomem *pci_addr_lin; static struct lirc_driver atir_driver; @@ -382,7 +382,7 @@ static unsigned char do_get_bits(void) static unsigned int read_index(unsigned char index) { - unsigned char *addr; + unsigned char __iomem *addr; unsigned int value; /* addr = pci_addr_lin + DATA_PCI_OFF + ((index & 0xFF) << 2); */ addr = pci_addr_lin + ((index & 0xFF) << 2); @@ -392,7 +392,7 @@ static unsigned int read_index(unsigned char index) static void write_index(unsigned char index, unsigned int reg_val) { - unsigned char *addr; + unsigned char __iomem *addr; addr = pci_addr_lin + ((index & 0xFF) << 2); writel(reg_val, addr); } diff --git a/drivers/staging/media/lirc/lirc_igorplugusb.c b/drivers/staging/media/lirc/lirc_igorplugusb.c index f508a1372ad8..44b0d0766084 100644 --- a/drivers/staging/media/lirc/lirc_igorplugusb.c +++ b/drivers/staging/media/lirc/lirc_igorplugusb.c @@ -60,19 +60,6 @@ #define DRIVER_DESC "Igorplug USB remote driver for LIRC" #define DRIVER_NAME "lirc_igorplugusb" -/* debugging support */ -#ifdef CONFIG_USB_DEBUG -static bool debug = true; -#else -static bool debug; -#endif - -#define dprintk(fmt, args...) \ - do { \ - if (debug) \ - printk(KERN_DEBUG fmt, ## args); \ - } while (0) - /* One mode2 pulse/space has 4 bytes. */ #define CODE_LENGTH sizeof(int) @@ -237,7 +224,7 @@ static int unregister_from_lirc(struct igorplug *ir) return -EINVAL; } - dprintk(DRIVER_NAME "[%d]: calling lirc_unregister_driver\n", devnum); + dev_dbg(&ir->usbdev->dev, "calling lirc_unregister_driver\n"); lirc_unregister_driver(d->minor); return devnum; @@ -252,7 +239,7 @@ static int set_use_inc(void *data) return -EIO; } - dprintk(DRIVER_NAME "[%d]: set use inc\n", ir->devnum); + dev_dbg(&ir->usbdev->dev, "set use inc\n"); if (!ir->usbdev) return -ENODEV; @@ -269,7 +256,7 @@ static void set_use_dec(void *data) return; } - dprintk(DRIVER_NAME "[%d]: set use dec\n", ir->devnum); + dev_dbg(&ir->usbdev->dev, "set use dec\n"); } static void send_fragment(struct igorplug *ir, struct lirc_buffer *buf, @@ -321,7 +308,7 @@ static int igorplugusb_remote_poll(void *data, struct lirc_buffer *buf) if (ret < DEVICE_HEADERLEN) return -ENODATA; - dprintk(DRIVER_NAME ": Got %d bytes. Header: %*ph\n", + dev_dbg(&ir->usbdev->dev, "Got %d bytes. Header: %*ph\n", ret, 3, ir->buf_in); do_gettimeofday(&now); @@ -385,7 +372,7 @@ static int igorplugusb_remote_probe(struct usb_interface *intf, char buf[63], name[128] = ""; int ret; - dprintk(DRIVER_NAME ": usb probe called.\n"); + dev_dbg(&intf->dev, "%s: usb probe called.\n", __func__); dev = interface_to_usbdev(intf); @@ -405,8 +392,8 @@ static int igorplugusb_remote_probe(struct usb_interface *intf, devnum = dev->devnum; maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe)); - dprintk(DRIVER_NAME "[%d]: bytes_in_key=%zu maxp=%d\n", - devnum, CODE_LENGTH, maxp); + dev_dbg(&intf->dev, "%s: bytes_in_key=%zu maxp=%d\n", + __func__, CODE_LENGTH, maxp); ir = devm_kzalloc(&intf->dev, sizeof(*ir), GFP_KERNEL); if (!ir) @@ -525,6 +512,3 @@ MODULE_DEVICE_TABLE(usb, igorplugusb_remote_id_table); module_param(sample_rate, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(sample_rate, "Sampling rate in Hz (default: 100)"); - -module_param(debug, bool, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(debug, "Debug enabled or not"); diff --git a/drivers/staging/media/lirc/lirc_parallel.c b/drivers/staging/media/lirc/lirc_parallel.c index 62f5137b947b..1394f020e46b 100644 --- a/drivers/staging/media/lirc/lirc_parallel.c +++ b/drivers/staging/media/lirc/lirc_parallel.c @@ -324,7 +324,8 @@ static loff_t lirc_lseek(struct file *filep, loff_t offset, int orig) return -ESPIPE; } -static ssize_t lirc_read(struct file *filep, char *buf, size_t n, loff_t *ppos) +static ssize_t lirc_read(struct file *filep, char __user *buf, size_t n, + loff_t *ppos) { int result = 0; int count = 0; @@ -362,7 +363,7 @@ static ssize_t lirc_read(struct file *filep, char *buf, size_t n, loff_t *ppos) return count ? count : result; } -static ssize_t lirc_write(struct file *filep, const char *buf, size_t n, +static ssize_t lirc_write(struct file *filep, const char __user *buf, size_t n, loff_t *ppos) { int count; @@ -463,43 +464,44 @@ static unsigned int lirc_poll(struct file *file, poll_table *wait) static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { int result; - __u32 features = LIRC_CAN_SET_TRANSMITTER_MASK | - LIRC_CAN_SEND_PULSE | LIRC_CAN_REC_MODE2; - __u32 mode; - __u32 value; + u32 __user *uptr = (u32 __user *)arg; + u32 features = LIRC_CAN_SET_TRANSMITTER_MASK | + LIRC_CAN_SEND_PULSE | LIRC_CAN_REC_MODE2; + u32 mode; + u32 value; switch (cmd) { case LIRC_GET_FEATURES: - result = put_user(features, (__u32 *) arg); + result = put_user(features, uptr); if (result) return result; break; case LIRC_GET_SEND_MODE: - result = put_user(LIRC_MODE_PULSE, (__u32 *) arg); + result = put_user(LIRC_MODE_PULSE, uptr); if (result) return result; break; case LIRC_GET_REC_MODE: - result = put_user(LIRC_MODE_MODE2, (__u32 *) arg); + result = put_user(LIRC_MODE_MODE2, uptr); if (result) return result; break; case LIRC_SET_SEND_MODE: - result = get_user(mode, (__u32 *) arg); + result = get_user(mode, uptr); if (result) return result; if (mode != LIRC_MODE_PULSE) return -EINVAL; break; case LIRC_SET_REC_MODE: - result = get_user(mode, (__u32 *) arg); + result = get_user(mode, uptr); if (result) return result; if (mode != LIRC_MODE_MODE2) return -ENOSYS; break; case LIRC_SET_TRANSMITTER_MASK: - result = get_user(value, (__u32 *) arg); + result = get_user(value, uptr); if (result) return result; if ((value & LIRC_PARALLEL_TRANSMITTER_MASK) != value) diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 10c685d5de7c..efe561cd0935 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c @@ -73,9 +73,6 @@ #include <linux/fcntl.h> #include <linux/spinlock.h> -#ifdef CONFIG_LIRC_SERIAL_NSLU2 -#include <asm/hardware.h> -#endif /* From Intel IXP42X Developer's Manual (#252480-005): */ /* ftp://download.intel.com/design/network/manuals/25248005.pdf */ #define UART_IE_IXP42X_UUE 0x40 /* IXP42X UART Unit enable */ @@ -198,33 +195,6 @@ static struct lirc_serial hardware[] = { .features = LIRC_CAN_REC_MODE2 #endif }, - -#ifdef CONFIG_LIRC_SERIAL_NSLU2 - /* - * Modified Linksys Network Storage Link USB 2.0 (NSLU2): - * We receive on CTS of the 2nd serial port (R142,LHS), we - * transmit with a IR diode between GPIO[1] (green status LED), - * and ground (Matthias Goebl <matthias.goebl@goebl.net>). - * See also http://www.nslu2-linux.org for this device - */ - [LIRC_NSLU2] = { - .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_NSLU2].lock), - .signal_pin = UART_MSR_CTS, - .signal_pin_change = UART_MSR_DCTS, - .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR), - .off = (UART_MCR_RTS | UART_MCR_OUT2), - .send_pulse = send_pulse_homebrew, - .send_space = send_space_homebrew, -#ifdef CONFIG_LIRC_SERIAL_TRANSMITTER - .features = (LIRC_CAN_SET_SEND_DUTY_CYCLE | - LIRC_CAN_SET_SEND_CARRIER | - LIRC_CAN_SEND_PULSE | LIRC_CAN_REC_MODE2) -#else - .features = LIRC_CAN_REC_MODE2 -#endif - }, -#endif - }; #define RS_ISR_PASS_LIMIT 256 @@ -315,16 +285,6 @@ static void soutp(int offset, u8 value) static void on(void) { -#ifdef CONFIG_LIRC_SERIAL_NSLU2 - /* - * On NSLU2, we put the transmit diode between the output of the green - * status LED and ground - */ - if (type == LIRC_NSLU2) { - gpio_set_value(NSLU2_LED_GRN, 0); - return; - } -#endif if (txsense) soutp(UART_MCR, hardware[type].off); else @@ -333,12 +293,6 @@ static void on(void) static void off(void) { -#ifdef CONFIG_LIRC_SERIAL_NSLU2 - if (type == LIRC_NSLU2) { - gpio_set_value(NSLU2_LED_GRN, 1); - return; - } -#endif if (txsense) soutp(UART_MCR, hardware[type].on); else @@ -793,20 +747,6 @@ static int hardware_init_port(void) sinp(UART_IIR); sinp(UART_MSR); -#ifdef CONFIG_LIRC_SERIAL_NSLU2 - if (type == LIRC_NSLU2) { - /* Setup NSLU2 UART */ - - /* Enable UART */ - soutp(UART_IER, sinp(UART_IER) | UART_IE_IXP42X_UUE); - /* Disable Receiver data Time out interrupt */ - soutp(UART_IER, sinp(UART_IER) & ~UART_IE_IXP42X_RTOIE); - /* set out2 = interrupt unmask; off() doesn't set MCR - on NSLU2 */ - soutp(UART_MCR, UART_MCR_RTS|UART_MCR_OUT2); - } -#endif - /* Set line for power source */ off(); @@ -842,16 +782,6 @@ static int lirc_serial_probe(struct platform_device *dev) { int i, nlow, nhigh, result; -#ifdef CONFIG_LIRC_SERIAL_NSLU2 - /* This GPIO is used for a LED on the NSLU2 */ - result = devm_gpio_request(dev, NSLU2_LED_GRN, "lirc-serial"); - if (result) - return result; - result = gpio_direction_output(NSLU2_LED_GRN, 0); - if (result) - return result; -#endif - result = request_irq(irq, lirc_irq_handler, (share_irq ? IRQF_SHARED : 0), LIRC_DRIVER_NAME, (void *)&hardware); @@ -1011,7 +941,8 @@ static ssize_t lirc_write(struct file *file, const char __user *buf, static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { int result; - __u32 value; + u32 __user *uptr = (u32 __user *)arg; + u32 value; switch (cmd) { case LIRC_GET_SEND_MODE: @@ -1020,7 +951,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), - (__u32 *) arg); + uptr); if (result) return result; break; @@ -1029,7 +960,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, (__u32 *) arg); + result = get_user(value, uptr); if (result) return result; /* only LIRC_MODE_PULSE supported */ @@ -1046,7 +977,7 @@ 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(value, (__u32 *) arg); + result = get_user(value, uptr); if (result) return result; if (value <= 0 || value > 100) @@ -1059,7 +990,7 @@ 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(value, (__u32 *) arg); + result = get_user(value, uptr); if (result) return result; if (value > 500000 || value < 20000) @@ -1216,14 +1147,6 @@ static int __init lirc_serial_init_module(void) io = io ? io : 0x3f8; irq = irq ? irq : 4; break; -#ifdef CONFIG_LIRC_SERIAL_NSLU2 - case LIRC_NSLU2: - io = io ? io : IRQ_IXP4XX_UART2; - irq = irq ? irq : (IXP4XX_UART2_BASE_VIRT + REG_OFFSET); - iommap = iommap ? iommap : IXP4XX_UART2_BASE_PHYS; - ioshift = ioshift ? ioshift : 2; - break; -#endif default: return -EINVAL; } @@ -1231,9 +1154,6 @@ static int __init lirc_serial_init_module(void) switch (type) { case LIRC_HOMEBREW: case LIRC_IGOR: -#ifdef CONFIG_LIRC_SERIAL_NSLU2 - case LIRC_NSLU2: -#endif hardware[type].features &= ~(LIRC_CAN_SET_SEND_DUTY_CYCLE| LIRC_CAN_SET_SEND_CARRIER); diff --git a/drivers/staging/media/lirc/lirc_sir.c b/drivers/staging/media/lirc/lirc_sir.c index f781c532b3c4..e31cbb81f059 100644 --- a/drivers/staging/media/lirc/lirc_sir.c +++ b/drivers/staging/media/lirc/lirc_sir.c @@ -187,10 +187,10 @@ static bool debug; /* Communication with user-space */ static unsigned int lirc_poll(struct file *file, poll_table *wait); -static ssize_t lirc_read(struct file *file, char *buf, size_t count, - loff_t *ppos); -static ssize_t lirc_write(struct file *file, const char *buf, size_t n, - loff_t *pos); +static ssize_t lirc_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos); +static ssize_t lirc_write(struct file *file, const char __user *buf, size_t n, + loff_t *pos); static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); static void add_read_queue(int flag, unsigned long val); static int init_chrdev(void); @@ -252,8 +252,8 @@ static unsigned int lirc_poll(struct file *file, poll_table *wait) return 0; } -static ssize_t lirc_read(struct file *file, char *buf, size_t count, - loff_t *ppos) +static ssize_t lirc_read(struct file *file, char __user *buf, size_t count, + loff_t *ppos) { int n = 0; int retval = 0; @@ -266,9 +266,9 @@ static ssize_t lirc_read(struct file *file, char *buf, size_t count, set_current_state(TASK_INTERRUPTIBLE); while (n < count) { if (rx_head != rx_tail) { - if (copy_to_user((void *) buf + n, - (void *) (rx_buf + rx_head), - sizeof(int))) { + if (copy_to_user(buf + n, + rx_buf + rx_head, + sizeof(int))) { retval = -EFAULT; break; } @@ -291,8 +291,8 @@ static ssize_t lirc_read(struct file *file, char *buf, size_t count, set_current_state(TASK_RUNNING); return n ? n : retval; } -static ssize_t lirc_write(struct file *file, const char *buf, size_t n, - loff_t *pos) +static ssize_t lirc_write(struct file *file, const char __user *buf, size_t n, + loff_t *pos) { unsigned long flags; int i, count; @@ -338,8 +338,9 @@ static ssize_t lirc_write(struct file *file, const char *buf, size_t n, static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { + u32 __user *uptr = (u32 __user *)arg; int retval = 0; - __u32 value = 0; + u32 value = 0; #ifdef LIRC_ON_SA1100 if (cmd == LIRC_GET_FEATURES) @@ -364,16 +365,16 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) case LIRC_GET_FEATURES: case LIRC_GET_SEND_MODE: case LIRC_GET_REC_MODE: - retval = put_user(value, (__u32 *) arg); + retval = put_user(value, uptr); break; case LIRC_SET_SEND_MODE: case LIRC_SET_REC_MODE: - retval = get_user(value, (__u32 *) arg); + retval = get_user(value, uptr); break; #ifdef LIRC_ON_SA1100 case LIRC_SET_SEND_DUTY_CYCLE: - retval = get_user(value, (__u32 *) arg); + retval = get_user(value, uptr); if (retval) return retval; if (value <= 0 || value > 100) @@ -388,7 +389,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) space_width -= LIRC_ON_SA1100_TRANSMITTER_LATENCY; break; case LIRC_SET_SEND_CARRIER: - retval = get_user(value, (__u32 *) arg); + retval = get_user(value, uptr); if (retval) return retval; if (value > 500000 || value < 20000) diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index e1feb6164593..3259aacfd350 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -892,7 +892,8 @@ out: } /* copied from lirc_dev */ -static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos) +static ssize_t read(struct file *filep, char __user *outbuf, size_t n, + loff_t *ppos) { struct IR *ir = filep->private_data; struct IR_rx *rx; @@ -954,7 +955,7 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos) } m = lirc_buffer_read(rbuf, buf); if (m == rbuf->chunk_size) { - ret = copy_to_user((void *)outbuf+written, buf, + ret = copy_to_user(outbuf + written, buf, rbuf->chunk_size); written += rbuf->chunk_size; } else { @@ -1094,8 +1095,8 @@ static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key) * sent to the device. We have a spin lock as per i2c documentation to prevent * multiple concurrent sends which would probably cause the device to explode. */ -static ssize_t write(struct file *filep, const char *buf, size_t n, - loff_t *ppos) +static ssize_t write(struct file *filep, const char __user *buf, size_t n, + loff_t *ppos) { struct IR *ir = filep->private_data; struct IR_tx *tx; @@ -1237,6 +1238,7 @@ static unsigned int poll(struct file *filep, poll_table *wait) static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) { struct IR *ir = filep->private_data; + unsigned long __user *uptr = (unsigned long __user *)arg; int result; unsigned long mode, features; @@ -1244,11 +1246,10 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) switch (cmd) { case LIRC_GET_LENGTH: - result = put_user((unsigned long)13, - (unsigned long *)arg); + result = put_user(13UL, uptr); break; case LIRC_GET_FEATURES: - result = put_user(features, (unsigned long *) arg); + result = put_user(features, uptr); break; case LIRC_GET_REC_MODE: if (!(features&LIRC_CAN_REC_MASK)) @@ -1256,13 +1257,13 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) result = put_user(LIRC_REC2MODE (features&LIRC_CAN_REC_MASK), - (unsigned long *)arg); + uptr); break; case LIRC_SET_REC_MODE: if (!(features&LIRC_CAN_REC_MASK)) return -ENOSYS; - result = get_user(mode, (unsigned long *)arg); + result = get_user(mode, uptr); if (!result && !(LIRC_MODE2REC(mode) & features)) result = -EINVAL; break; @@ -1270,13 +1271,13 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg) if (!(features&LIRC_CAN_SEND_MASK)) return -ENOSYS; - result = put_user(LIRC_MODE_PULSE, (unsigned long *) arg); + result = put_user(LIRC_MODE_PULSE, uptr); break; case LIRC_SET_SEND_MODE: if (!(features&LIRC_CAN_SEND_MASK)) return -ENOSYS; - result = get_user(mode, (unsigned long *) arg); + result = get_user(mode, uptr); if (!result && mode != LIRC_MODE_PULSE) return -EINVAL; break; |