dev_err(&serial_ir.pdev->dev, "Trapped in interrupt");
break;
}
- if ((status & hardware[type].signal_pin_change)
- && sense != -1) {
+ if ((status & hardware[type].signal_pin_change) &&
+ sense != -1) {
/* get current time */
kt = ktime_get();
delkt = ktime_sub(kt, serial_ir.lastkt);
if (ktime_compare(delkt, ktime_set(15, 0)) > 0) {
data = IR_MAX_DURATION; /* really long time */
- if (!(dcd^sense)) {
+ if (!(dcd ^ sense)) {
/* sanity check */
dev_err(&serial_ir.pdev->dev,
"dcd unexpected: %d %d %lldns %lldns\n",
*/
sense = sense ? 0 : 1;
}
- } else
+ } else {
data = ktime_to_ns(delkt);
+ }
frbwrite(data, !(dcd ^ sense));
serial_ir.lastkt = kt;
last_dcd = dcd;
return IRQ_HANDLED;
}
-
static int hardware_init_port(void)
{
u8 scratch, scratch2, scratch3;
/* First of all, disable all interrupts */
soutp(UART_IER, sinp(UART_IER) &
- (~(UART_IER_MSI|UART_IER_RLSI|UART_IER_THRI|UART_IER_RDI)));
+ (~(UART_IER_MSI | UART_IER_RLSI | UART_IER_THRI | UART_IER_RDI)));
/* Clear registers. */
sinp(UART_LSR);
}
/* Reserve io region. */
- if (((iommap)
- && (devm_request_mem_region(&dev->dev, iommap, 8 << ioshift,
- KBUILD_MODNAME) == NULL))
- || ((!iommap)
- && (devm_request_region(&dev->dev, io, 8,
- KBUILD_MODNAME) == NULL))) {
+ if ((iommap &&
+ (devm_request_mem_region(&dev->dev, iommap, 8 << ioshift,
+ KBUILD_MODNAME) == NULL)) ||
+ (!iommap && (devm_request_region(&dev->dev, io, 8,
+ KBUILD_MODNAME) == NULL))) {
dev_err(&dev->dev, "port %04x already in use\n", io);
dev_warn(&dev->dev, "use 'setserial /dev/ttySX uart none'\n");
dev_warn(&dev->dev,
/* Set DLAB 0. */
soutp(UART_LCR, sinp(UART_LCR) & (~UART_LCR_DLAB));
- soutp(UART_IER, sinp(UART_IER)|UART_IER_MSI);
+ soutp(UART_IER, sinp(UART_IER) | UART_IER_MSI);
spin_unlock_irqrestore(&hardware[type].lock, flags);
/* First of all, disable all interrupts */
soutp(UART_IER, sinp(UART_IER) &
- (~(UART_IER_MSI|UART_IER_RLSI|UART_IER_THRI|UART_IER_RDI)));
+ (~(UART_IER_MSI | UART_IER_RLSI | UART_IER_THRI | UART_IER_RDI)));
spin_unlock_irqrestore(&hardware[type].lock, flags);
}
edge = ktime_get();
for (i = 0; i < count; i++) {
- if (i%2)
+ if (i % 2)
hardware[type].send_space();
else
hardware[type].send_pulse(txbuf[i], edge);
spin_unlock_irqrestore(&hardware[type].lock, flags);
usleep_range(delta - 25, delta + 25);
spin_lock_irqsave(&hardware[type].lock, flags);
- }
- else if (delta > 0)
+ } else if (delta > 0) {
udelay(delta);
+ }
}
off();
spin_unlock_irqrestore(&hardware[type].lock, flags);
/* Disable all interrupts */
soutp(UART_IER, sinp(UART_IER) &
- (~(UART_IER_MSI|UART_IER_RLSI|UART_IER_THRI|UART_IER_RDI)));
+ (~(UART_IER_MSI | UART_IER_RLSI | UART_IER_THRI | UART_IER_RDI)));
/* Clear registers. */
sinp(UART_LSR);
spin_lock_irqsave(&hardware[type].lock, flags);
/* Enable Interrupt */
serial_ir.lastkt = ktime_get();
- soutp(UART_IER, sinp(UART_IER)|UART_IER_MSI);
+ soutp(UART_IER, sinp(UART_IER) | UART_IER_MSI);
off();
spin_unlock_irqrestore(&hardware[type].lock, flags);