Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 63204
b: refs/heads/master
c: 3ddad82
h: refs/heads/master
v: v3
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Jul 30, 2007
1 parent a7cb957 commit c99bf8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f42449003114cc17cda0458c14f2deadfadf9f63
refs/heads/master: 3ddad8232c3802f7a602d1ea24938a8067114479
17 changes: 8 additions & 9 deletions trunk/drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ static struct usb_driver usb_serial_driver = {

static int debug;
static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */
static spinlock_t table_lock;
static DEFINE_MUTEX(table_lock);
static LIST_HEAD(usb_serial_driver_list);

struct usb_serial *usb_serial_get_by_index(unsigned index)
{
struct usb_serial *serial;

spin_lock(&table_lock);
mutex_lock(&table_lock);
serial = serial_table[index];

if (serial)
kref_get(&serial->kref);
spin_unlock(&table_lock);
mutex_unlock(&table_lock);
return serial;
}

Expand All @@ -84,7 +84,7 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
dbg("%s %d", __FUNCTION__, num_ports);

*minor = 0;
spin_lock(&table_lock);
mutex_lock(&table_lock);
for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
if (serial_table[i])
continue;
Expand All @@ -106,10 +106,10 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
serial_table[i] = serial;
serial->port[j++]->number = i;
}
spin_unlock(&table_lock);
mutex_unlock(&table_lock);
return serial;
}
spin_unlock(&table_lock);
mutex_unlock(&table_lock);
return NULL;
}

Expand Down Expand Up @@ -172,9 +172,9 @@ static void destroy_serial(struct kref *kref)

void usb_serial_put(struct usb_serial *serial)
{
spin_lock(&table_lock);
mutex_lock(&table_lock);
kref_put(&serial->kref, destroy_serial);
spin_unlock(&table_lock);
mutex_unlock(&table_lock);
}

/*****************************************************************************
Expand Down Expand Up @@ -1129,7 +1129,6 @@ static int __init usb_serial_init(void)
return -ENOMEM;

/* Initialize our global data */
spin_lock_init(&table_lock);
for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
serial_table[i] = NULL;
}
Expand Down

0 comments on commit c99bf8f

Please sign in to comment.