static int rs232_serial_resume(struct platform_device *pdev) { struct rs232_serial_pdata *pdata = pdev->dev.platform_data; /* check for changes to serial that may have occurred */ serial_detect(pdata); return 0; }
int serial_con_init(void) { struct device *devp = NULL; u16 port; int i, res; if ((res = driver_reg(&serial_con_driver)) < 0) return res; for (i = 0; i < 4; i++) { switch (i) { case 0: port = 0x3F8; break; case 1: port = 0x2F8; break; case 2: port = 0x3E8; break; case 3: port = 0x2E8; break; } if (!serial_detect(port)) continue; if ((res = device_reg(MAJOR_CON, &serial_con_driver, &devp)) < 0) return res; if (!(devp->device = kmalloc(sizeof(u16)))) { res = -ENOMEM; goto err; } *((u16 *) devp->device) = port; io_outb(port + 1, 0x00); io_outb(port + 3, 0x80); io_outb(port + 0, 0x03); io_outb(port + 1, 0x00); io_outb(port + 3, 0x03); io_outb(port + 2, 0xC7); io_outb(port + 4, 0x0B); } return 0; err: if (devp) device_unreg(devp); return res; }
static int rs232_serial_probe(struct platform_device *pdev) { struct rs232_serial_pdata *pdata = pdev->dev.platform_data; int irq = gpiodev_to_irq(&pdata->detect_gpio); if (irq == -1) { printk(KERN_ERR "rs232-serial: Detection pin does not generate irqs\n"); return -EINVAL; } if (request_irq(irq, serial_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "rs232-serial", pdev) != 0) { printk(KERN_ERR "rs232-serial: Unable to configure detect irq.\n"); return -ENODEV; } INIT_DELAYED_WORK(&pdata->debounce_task, serial_change_task_handler); /* Detect current state */ serial_detect(pdata); return 0; }
static inline void avalon2_detect() { serial_detect(&avalon2_drv, avalon2_detect_one); }
static void serial_fpga_detect(bool __maybe_unused hotplug) { serial_detect(&serial_fpga_drv, serial_fpga_detect_one); }
static void serial_change_task_handler(struct work_struct *work) { struct rs232_serial_pdata *pdata = container_of(work, struct rs232_serial_pdata, debounce_task.work); serial_detect(pdata); }
static inline void avalon2_detect(bool __maybe_unused hotplug) { serial_detect(&avalon2_drv, avalon2_detect_one); }
static inline void hashratio_detect(bool __maybe_unused hotplug) { serial_detect(&hashratio_drv, hashratio_detect_one); }