On Wed, 18 Jul 2012, loody wrote: > hi all: > > 2012/7/18 loody <miloody@xxxxxxxxx>: > > hi: > > > > 2012/7/18 Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>: > >> On Wed, Jul 18, 2012 at 11:22:49AM +0800, loody wrote: > >>> Dear all: > >>> in usb_serial_probe, we create tty_port based on max_endpoints. > >> > >> Or based on the number that the driver said to create. > >> > >>> My questions are: > >>> 1. some callback functions, such serial_hangup, serial_carrier_raised, > >>> etc. will called by tty layer with different tty_ports. > >>> how tty layer know these tty_ports? > >> > >> They were registered with the tty layer. > >> > >>> I only found tty_port_init to initial these tty_ports, but where we > >>> register these tty_ports to tty layer? > >> > >> When we register the tty device. > > Would you mind to tell me which function it is? > after tracing source code, usb_serial_device_probe seems where we > register tty device. > But we only let tty know, tty_driver, index and struct device. > it seems we don't let tty know how many tty_ports we created. > Thanks for your help in advance, You didn't look at usb_serial_probe. At the end of that function there is a loop which runs over all the ports and registers them one at a time with the device layer. When it is registered, the port is passed to usb_serial_device_probe, which then registers the port with the tty layer. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html