if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):%s open(), old ref count = %d\n",
- __FILE__,__LINE__,tty->driver->name, info->port.count);
+ __FILE__,__LINE__,tty->driver->name, atomic_read(&info->port.count));
/* If port is closing, signal caller to try again */
if (info->port.flags & ASYNC_CLOSING){
spin_unlock_irqrestore(&info->netlock, flags);
goto cleanup;
}
- info->port.count++;
+ atomic_inc(&info->port.count);
spin_unlock_irqrestore(&info->netlock, flags);
- if (info->port.count == 1) {
+ if (atomic_read(&info->port.count) == 1) {
/* 1st open on this device, init hardware */
retval = startup(info);
if (retval < 0)
if (retval) {
if (tty->count == 1)
info->port.tty = NULL; /* tty layer will release tty struct */
- if(info->port.count)
- info->port.count--;
+ if(atomic_read(&info->port.count))
+ atomic_dec(&info->port.count);
}
return retval;
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):%s close() entry, count=%d\n",
- __FILE__,__LINE__, info->device_name, info->port.count);
+ __FILE__,__LINE__, info->device_name, atomic_read(&info->port.count));
if (tty_port_close_start(&info->port, tty, filp) == 0)
goto cleanup;
cleanup:
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):%s close() exit, count=%d\n", __FILE__,__LINE__,
- tty->driver->name, info->port.count);
+ tty->driver->name, atomic_read(&info->port.count));
}
/* Called by tty_hangup() when a hangup is signaled.
shutdown(info);
spin_lock_irqsave(&info->port.lock, flags);
- info->port.count = 0;
+ atomic_set(&info->port.count, 0);
info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
info->port.tty = NULL;
spin_unlock_irqrestore(&info->port.lock, flags);
unsigned short new_crctype;
/* return error if TTY interface open */
- if (info->port.count)
+ if (atomic_read(&info->port.count))
return -EBUSY;
switch (encoding)
/* arbitrate between network and tty opens */
spin_lock_irqsave(&info->netlock, flags);
- if (info->port.count != 0 || info->netcount != 0) {
+ if (atomic_read(&info->port.count) != 0 || info->netcount != 0) {
printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name);
spin_unlock_irqrestore(&info->netlock, flags);
return -EBUSY;
printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name);
/* return error if TTY interface open */
- if (info->port.count)
+ if (atomic_read(&info->port.count))
return -EBUSY;
if (cmd != SIOCWANDEV)
* do not request bottom half processing if the
* device is not open in a normal mode.
*/
- if ( port && (port->port.count || port->netcount) &&
+ if ( port && (atomic_read(&port->port.count) || port->netcount) &&
port->pending_bh && !port->bh_running &&
!port->bh_requested ) {
if ( debug_level >= DEBUG_LEVEL_ISR )
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):%s block_til_ready() before block, count=%d\n",
- __FILE__,__LINE__, tty->driver->name, port->count );
+ __FILE__,__LINE__, tty->driver->name, atomic_read(&port->count));
spin_lock_irqsave(&info->lock, flags);
- port->count--;
+ atomic_dec(&port->count);
spin_unlock_irqrestore(&info->lock, flags);
port->blocked_open++;
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):%s block_til_ready() count=%d\n",
- __FILE__,__LINE__, tty->driver->name, port->count );
+ __FILE__,__LINE__, tty->driver->name, atomic_read(&port->count));
tty_unlock(tty);
schedule();
set_current_state(TASK_RUNNING);
remove_wait_queue(&port->open_wait, &wait);
if (!tty_hung_up_p(filp))
- port->count++;
+ atomic_inc(&port->count);
port->blocked_open--;
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):%s block_til_ready() after, count=%d\n",
- __FILE__,__LINE__, tty->driver->name, port->count );
+ __FILE__,__LINE__, tty->driver->name, atomic_read(&port->count));
if (!retval)
port->flags |= ASYNC_NORMAL_ACTIVE;