Commit 43371f6b authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

[media] staging: sir: fix checkpatch strict warnings

Make the code more readable and clean up the includes list.
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 402e7b63
...@@ -8,52 +8,28 @@ ...@@ -8,52 +8,28 @@
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/sched/signal.h>
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/fs.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <linux/ktime.h> #include <linux/ktime.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/wait.h>
#include <linux/mm.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/poll.h>
#include <linux/io.h>
#include <asm/irq.h>
#include <linux/fcntl.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/timer.h>
#include <media/rc-core.h> #include <media/rc-core.h>
/* SECTION: Definitions */ /* SECTION: Definitions */
#define PULSE '[' #define PULSE '['
/* 9bit * 1s/115200bit in milli seconds = 78.125ms*/ /* 9bit * 1s/115200bit in milli seconds = 78.125ms*/
#define TIME_CONST (9000000ul/115200ul) #define TIME_CONST (9000000ul / 115200ul)
/* timeout for sequences in jiffies (=5/100s), must be longer than TIME_CONST */ /* timeout for sequences in jiffies (=5/100s), must be longer than TIME_CONST */
#define SIR_TIMEOUT (HZ*5/100) #define SIR_TIMEOUT (HZ * 5 / 100)
/* onboard sir ports are typically com3 */ /* onboard sir ports are typically com3 */
static int io = 0x3e8; static int io = 0x3e8;
...@@ -103,7 +79,7 @@ static inline void soutp(int offset, int value) ...@@ -103,7 +79,7 @@ static inline void soutp(int offset, int value)
#ifndef MAX_UDELAY_MS #ifndef MAX_UDELAY_MS
#define MAX_UDELAY_US 5000 #define MAX_UDELAY_US 5000
#else #else
#define MAX_UDELAY_US (MAX_UDELAY_MS*1000) #define MAX_UDELAY_US (MAX_UDELAY_MS * 1000)
#endif #endif
static void safe_udelay(unsigned long usecs) static void safe_udelay(unsigned long usecs)
...@@ -227,18 +203,13 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id) ...@@ -227,18 +203,13 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id)
int iir, lsr; int iir, lsr;
while ((iir = inb(io + UART_IIR) & UART_IIR_ID)) { while ((iir = inb(io + UART_IIR) & UART_IIR_ID)) {
switch (iir&UART_IIR_ID) { /* FIXME toto treba preriedit */ switch (iir & UART_IIR_ID) { /* FIXME toto treba preriedit */
case UART_IIR_MSI: case UART_IIR_MSI:
(void) inb(io + UART_MSR); (void)inb(io + UART_MSR);
break; break;
case UART_IIR_RLSI: case UART_IIR_RLSI:
(void) inb(io + UART_LSR);
break;
case UART_IIR_THRI: case UART_IIR_THRI:
#if 0 (void)inb(io + UART_LSR);
if (lsr & UART_LSR_THRE) /* FIFO is empty */
outb(data, io + UART_TX)
#endif
break; break;
case UART_IIR_RDI: case UART_IIR_RDI:
/* avoid interference with timer */ /* avoid interference with timer */
...@@ -279,7 +250,7 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id) ...@@ -279,7 +250,7 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id)
* the other case is timeout * the other case is timeout
*/ */
add_read_queue(last_value, add_read_queue(last_value,
delt-TIME_CONST); delt - TIME_CONST);
last_value = data; last_value = data;
last = curr_time; last = curr_time;
last = ktime_sub_us(last, last = ktime_sub_us(last,
...@@ -348,7 +319,7 @@ static int init_hardware(void) ...@@ -348,7 +319,7 @@ static int init_hardware(void)
/* outb(UART_IER_RLSI|UART_IER_RDI|UART_IER_THRI, io + UART_IER); */ /* outb(UART_IER_RLSI|UART_IER_RDI|UART_IER_THRI, io + UART_IER); */
outb(UART_IER_RDI, io + UART_IER); outb(UART_IER_RDI, io + UART_IER);
/* turn on UART */ /* turn on UART */
outb(UART_MCR_DTR|UART_MCR_RTS|UART_MCR_OUT2, io + UART_MCR); outb(UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2, io + UART_MCR);
spin_unlock_irqrestore(&hardware_lock, flags); spin_unlock_irqrestore(&hardware_lock, flags);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment