speedtch usbatm.c,1.20,1.21 usbatm.h,1.13,1.14

Duncan Sands baldrick at free.fr
Tue Apr 26 17:39:02 EDT 2005


Hi Roman, the channel initialization in usbatm_usb_probe seems messy.
Near the start, you do:

        instance->rx_channel.endpoint = usb_rcvbulkpipe(usb_dev, driver->in);
        instance->tx_channel.endpoint = usb_sndbulkpipe(usb_dev, driver->out);
        instance->rx_channel.stride = ATM_CELL_SIZE + driver->rx_padding;
        instance->tx_channel.stride = ATM_CELL_SIZE + driver->tx_padding;
        instance->rx_channel.buf_size = rcv_buf_size * instance->rx_channel.stride;
        instance->tx_channel.buf_size = snd_buf_size * instance->tx_channel.stride;

This is before calling bind.  After bind you do:

        tasklet_init(&instance->rx_channel.tasklet, usbatm_rx_process, (unsigned long)instance);
        tasklet_init(&instance->tx_channel.tasklet, usbatm_tx_process, (unsigned long)instance);
        usbatm_init_channel(&instance->rx_channel);
        usbatm_init_channel(&instance->tx_channel);
        instance->rx_channel.usbatm = instance->tx_channel.usbatm = instance;

Why do these in different places?  Also, you'd expect something called usbatm_init_channel
to initialize the whole thing, but in fact it only initializes a bit of it (just as well,
since otherwise it would wipe out the fields you already initialized).  Why group this
particular bit of initialization in a procedure, and not all, or other bits - what is the
logic?

Thanks,

D.




More information about the Usbatm mailing list