Re: [PATCH v3 2/3] USB: serial: make minor allocation dynamic

From: Johan Hovold
Date: Tue Jun 18 2013 - 06:30:11 EST


> > > @@ -123,8 +116,9 @@ static void return_serial(struct usb_ser
> > >
> > > mutex_lock(&table_lock);
> > > for (i = 0; i < serial->num_ports; ++i)
> > > - serial_table[serial->minor + i] = NULL;
> > > + idr_remove(&serial_minors, serial->port[i]->minor);
> > > mutex_unlock(&table_lock);
> > > + serial->minors_reserved = 0;
> >
> > This isn't strictly needed as the serial struct release_serial is only
> > called once when the struct is about to be freed.
>
> Really? Why were we doing this type of thing before with the "not
> allocated" flag? It seems that we were protecting some path that I
> can't remember at the moment. So to be safe, I'll leave it for now...

It was and is only used when releasing the serial struct to check
whether minors had been allocated or not at probe and if return_serial
(release_minors) should be called. This in done in destroy_serial just
before freeing the struct, so clearing the flag is redundant, but
doesn't hurt anyone, I guess. ;)

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/