On Thu, Sep 17, 2015 at 04:31:56PM +0800, Zhaoyang Huang wrote: > +struct uart_match { > + struct uart_port *port; > + struct uart_driver *driver; > +}; > + > +static int match_uart_port(struct device *dev, void *data) > +{ > + struct uart_match *match = data; > + > + dev_t devt = MKDEV(match->driver->major, match->driver->minor) + > + match->port->line; > + > + pr_info("the match data of ttyAMA0 is %d %d\n", > + (int)devt, (int)dev->devt); > + > + return dev->devt == devt; /* Actually, only one tty per port */ > +} ... > + ret = pl011_register_port(uap); > + > + if (!of_find_property(dev->dev.of_node, "linux,wakeup", NULL)) { > + uart_dev = NULL; > + return ret; > + } > + > + match.port = &uap->port; > + match.driver = &amba_reg; > + > + uart_dev = device_find_child(&dev->dev, &match, match_uart_port); > + > + if (uart_dev) { > + device_init_wakeup(uart_dev, true); > + dev_pm_set_wake_irq(uart_dev, uap->port.irq); > + } > + > + return ret; I can only describe this code as a hack. This looks like something which should be handled by generic infrastructure at an appropriate point (somewhere inside uart_add_one_port()), not by hacky code in each driver. -- FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html