Re: [PATCH v7 2/2] usb-serial: Moxa UPORT 12XX/14XX/16XX driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 19, 2013 at 08:59:49PM +0100, Andrew Lunn wrote:
> > > +	 * endpoint, with a multiplex header. The second bulk in is
> > > +	 * used for events. Throw away all but the first two bulk in
> > > +	 * urbs.
> > > +	 */
> > > +	for (i = 2; i < serial->num_bulk_in; ++i) {
> > > +		port = serial->port[i];
> > > +		for (j = 0; j < ARRAY_SIZE(port->read_urbs); ++j) {
> > > +			usb_free_urb(port->read_urbs[j]);
> > > +			kfree(port->bulk_in_buffers[j]);
> > > +			port->read_urbs[j] = NULL;
> > > +			port->bulk_in_buffers[j] = NULL;
> > > +			port->bulk_in_size = 0;
> > > +		}
> > > +	}
> > 
> > Is this really necessary? Why not simple leave these urbs and buffers
> > allocated (if there are any devices with more than to bulk-in
> > endpoints at all)? You never submit them (and neither does usb-serial
> > core since you override resume) so could be left allocated.
> 
> Hi Johan
> 
> It is not really necessary. The hardware i have has 4 bulk-in
> endpoints, of which the driver only uses the first two. I've no idea
> what the other two are used for. Freeing the buffers does save a
> little bit of memory, but i could drop this code block and skip the
> memory saved?

The saved amount of memory is really small and it's better to avoid
messing with port internals if we can, so just remove it. But please
keep the informative comment preceding it. Just removing it's last
sentence should make it applicable to the submit_read_urbs calls just
after, right?

Thanks,
Johan
--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux