public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: "Dave Jones" <davej@redhat.com>,
	"Tobias Winter" <tobias@linuxdingsda.de>,
	"Bjørn Mork" <bjorn@mork.no>, "Rob Landley" <rob@landley.net>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] raise the maximum number of usb-serial devices to 512
Date: Tue, 4 Jun 2013 09:12:34 -0700	[thread overview]
Message-ID: <20130604161234.GA23637@kroah.com> (raw)
In-Reply-To: <20130604025907.GA3991@redhat.com>

On Mon, Jun 03, 2013 at 10:59:08PM -0400, Dave Jones wrote:
> On Mon, Jun 03, 2013 at 07:49:59PM -0700, Greg Kroah-Hartman wrote:
>  > On Mon, May 27, 2013 at 02:28:51PM +0200, Bjørn Mork wrote:
>  > > But, IMHO, a nicer approach would be to make the allocation completely
>  > > dynamic, using e.g. the idr subsystem. Static tables are always feel
>  > > like straight jackets to me, no matter how big they are :)
>  > 
>  > You are right, I didn't change the code to use idr (it predates idr by
>  > about a decade or so), because I thought we needed the "rage" logic that
>  > the usb-serial minor reservation does.
> 
> Rage logic sounds like my kinda code.

Late nite typo :)

>  > +static int get_free_port(struct usb_serial_port *port)
>  >  {
>  > -	unsigned int i, j;
>  > -	int good_spot;
>  > -
>  > -	dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports);
>  > +	int i;
>  >  
>  > -	*minor = 0;
>  >  	mutex_lock(&table_lock);
>  > -	for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
>  > -		if (serial_table[i])
>  > -			continue;
>  > +	i = idr_alloc(&serial_minors, port, 0, 0, GFP_KERNEL);
>  > +	if (i < 0)
>  > +		return -EEXIST;
>  > +	port->number = i;
>  > +	mutex_unlock(&table_lock);
>  > +	return i;
>  > +}
> 
> -EEXIST case misses the mutex unlock.

Thanks, now fixed.

greg k-h

  reply	other threads:[~2013-06-04 16:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <519F7195.8090306@linuxdingsda.de>
     [not found] ` <20130524172354.GA1402@kroah.com>
2013-05-27  9:30   ` [PATCH] Raise the maximum number of usb-serial devices to 256 Tobias Winter
2013-05-28  6:17     ` Rob Landley
     [not found]     ` <87obbwbo8s.fsf@nemi.mork.no>
     [not found]       ` <51A332E2.1090403@linuxdingsda.de>
2013-06-04  2:49         ` [RFC] raise the maximum number of usb-serial devices to 512 Greg KH
2013-06-04  2:59           ` Dave Jones
2013-06-04 16:12             ` Greg KH [this message]
2013-06-04 11:04           ` Johan Hovold
2013-06-04 16:31             ` Greg KH
2013-06-04 14:13           ` Alan Stern
2013-06-04 16:17             ` Greg KH
2013-06-04 17:27           ` Tobias Winter
2013-06-04 17:53             ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130604161234.GA23637@kroah.com \
    --to=greg@kroah.com \
    --cc=bjorn@mork.no \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rob@landley.net \
    --cc=tobias@linuxdingsda.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox