Commit 9d4bee2b authored by Tilman Schmidt's avatar Tilman Schmidt Committed by Linus Torvalds

gigaset: atomic cleanup

Convert atomic_t variables that don't actually use atomic_t functionality
to int.
Signed-off-by: default avatarTilman Schmidt <tilman@imap.cc>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1ff0a529
...@@ -350,8 +350,8 @@ void gigaset_m10x_input(struct inbuf_t *inbuf) ...@@ -350,8 +350,8 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
unsigned char *src, c; unsigned char *src, c;
int procbytes; int procbytes;
head = atomic_read(&inbuf->head); head = inbuf->head;
tail = atomic_read(&inbuf->tail); tail = inbuf->tail;
gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail); gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
if (head != tail) { if (head != tail) {
...@@ -361,7 +361,7 @@ void gigaset_m10x_input(struct inbuf_t *inbuf) ...@@ -361,7 +361,7 @@ void gigaset_m10x_input(struct inbuf_t *inbuf)
gig_dbg(DEBUG_INTR, "processing %u bytes", numbytes); gig_dbg(DEBUG_INTR, "processing %u bytes", numbytes);
while (numbytes) { while (numbytes) {
if (atomic_read(&cs->mstate) == MS_LOCKED) { if (cs->mstate == MS_LOCKED) {
procbytes = lock_loop(src, numbytes, inbuf); procbytes = lock_loop(src, numbytes, inbuf);
src += procbytes; src += procbytes;
numbytes -= procbytes; numbytes -= procbytes;
...@@ -436,7 +436,7 @@ nextbyte: ...@@ -436,7 +436,7 @@ nextbyte:
} }
gig_dbg(DEBUG_INTR, "setting head to %u", head); gig_dbg(DEBUG_INTR, "setting head to %u", head);
atomic_set(&inbuf->head, head); inbuf->head = head;
} }
} }
EXPORT_SYMBOL_GPL(gigaset_m10x_input); EXPORT_SYMBOL_GPL(gigaset_m10x_input);
......
...@@ -113,7 +113,7 @@ struct bas_cardstate { ...@@ -113,7 +113,7 @@ struct bas_cardstate {
unsigned char int_in_buf[3]; unsigned char int_in_buf[3];
spinlock_t lock; /* locks all following */ spinlock_t lock; /* locks all following */
atomic_t basstate; /* bitmap (BS_*) */ int basstate; /* bitmap (BS_*) */
int pending; /* uncompleted base request */ int pending; /* uncompleted base request */
wait_queue_head_t waitqueue; wait_queue_head_t waitqueue;
int rcvbuf_size; /* size of AT receive buffer */ int rcvbuf_size; /* size of AT receive buffer */
...@@ -370,27 +370,27 @@ static void check_pending(struct bas_cardstate *ucs) ...@@ -370,27 +370,27 @@ static void check_pending(struct bas_cardstate *ucs)
case 0: case 0:
break; break;
case HD_OPEN_ATCHANNEL: case HD_OPEN_ATCHANNEL:
if (atomic_read(&ucs->basstate) & BS_ATOPEN) if (ucs->basstate & BS_ATOPEN)
ucs->pending = 0; ucs->pending = 0;
break; break;
case HD_OPEN_B1CHANNEL: case HD_OPEN_B1CHANNEL:
if (atomic_read(&ucs->basstate) & BS_B1OPEN) if (ucs->basstate & BS_B1OPEN)
ucs->pending = 0; ucs->pending = 0;
break; break;
case HD_OPEN_B2CHANNEL: case HD_OPEN_B2CHANNEL:
if (atomic_read(&ucs->basstate) & BS_B2OPEN) if (ucs->basstate & BS_B2OPEN)
ucs->pending = 0; ucs->pending = 0;
break; break;
case HD_CLOSE_ATCHANNEL: case HD_CLOSE_ATCHANNEL:
if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) if (!(ucs->basstate & BS_ATOPEN))
ucs->pending = 0; ucs->pending = 0;
break; break;
case HD_CLOSE_B1CHANNEL: case HD_CLOSE_B1CHANNEL:
if (!(atomic_read(&ucs->basstate) & BS_B1OPEN)) if (!(ucs->basstate & BS_B1OPEN))
ucs->pending = 0; ucs->pending = 0;
break; break;
case HD_CLOSE_B2CHANNEL: case HD_CLOSE_B2CHANNEL:
if (!(atomic_read(&ucs->basstate) & BS_B2OPEN)) if (!(ucs->basstate & BS_B2OPEN))
ucs->pending = 0; ucs->pending = 0;
break; break;
case HD_DEVICE_INIT_ACK: /* no reply expected */ case HD_DEVICE_INIT_ACK: /* no reply expected */
...@@ -456,8 +456,8 @@ inline static int update_basstate(struct bas_cardstate *ucs, ...@@ -456,8 +456,8 @@ inline static int update_basstate(struct bas_cardstate *ucs,
int state; int state;
spin_lock_irqsave(&ucs->lock, flags); spin_lock_irqsave(&ucs->lock, flags);
state = atomic_read(&ucs->basstate); state = ucs->basstate;
atomic_set(&ucs->basstate, (state & ~clear) | set); ucs->basstate = (state & ~clear) | set;
spin_unlock_irqrestore(&ucs->lock, flags); spin_unlock_irqrestore(&ucs->lock, flags);
return state; return state;
} }
...@@ -832,7 +832,7 @@ static void read_iso_callback(struct urb *urb) ...@@ -832,7 +832,7 @@ static void read_iso_callback(struct urb *urb)
urb->iso_frame_desc[i].status = 0; urb->iso_frame_desc[i].status = 0;
urb->iso_frame_desc[i].actual_length = 0; urb->iso_frame_desc[i].actual_length = 0;
} }
if (likely(atomic_read(&ubc->running))) { if (likely(ubc->running)) {
/* urb->dev is clobbered by USB subsystem */ /* urb->dev is clobbered by USB subsystem */
urb->dev = bcs->cs->hw.bas->udev; urb->dev = bcs->cs->hw.bas->udev;
urb->transfer_flags = URB_ISO_ASAP; urb->transfer_flags = URB_ISO_ASAP;
...@@ -909,7 +909,7 @@ static int starturbs(struct bc_state *bcs) ...@@ -909,7 +909,7 @@ static int starturbs(struct bc_state *bcs)
bcs->inputstate |= INS_flag_hunt; bcs->inputstate |= INS_flag_hunt;
/* submit all isochronous input URBs */ /* submit all isochronous input URBs */
atomic_set(&ubc->running, 1); ubc->running = 1;
for (k = 0; k < BAS_INURBS; k++) { for (k = 0; k < BAS_INURBS; k++) {
urb = ubc->isoinurbs[k]; urb = ubc->isoinurbs[k];
if (!urb) { if (!urb) {
...@@ -992,7 +992,7 @@ static void stopurbs(struct bas_bc_state *ubc) ...@@ -992,7 +992,7 @@ static void stopurbs(struct bas_bc_state *ubc)
{ {
int k, rc; int k, rc;
atomic_set(&ubc->running, 0); ubc->running = 0;
for (k = 0; k < BAS_INURBS; ++k) { for (k = 0; k < BAS_INURBS; ++k) {
rc = usb_unlink_urb(ubc->isoinurbs[k]); rc = usb_unlink_urb(ubc->isoinurbs[k]);
...@@ -1068,7 +1068,7 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx) ...@@ -1068,7 +1068,7 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx)
} }
break; break;
} }
ucx->limit = atomic_read(&ubc->isooutbuf->nextread); ucx->limit = ubc->isooutbuf->nextread;
ifd->status = 0; ifd->status = 0;
ifd->actual_length = 0; ifd->actual_length = 0;
} }
...@@ -1115,7 +1115,7 @@ static void write_iso_tasklet(unsigned long data) ...@@ -1115,7 +1115,7 @@ static void write_iso_tasklet(unsigned long data)
/* loop while completed URBs arrive in time */ /* loop while completed URBs arrive in time */
for (;;) { for (;;) {
if (unlikely(!(atomic_read(&ubc->running)))) { if (unlikely(!(ubc->running))) {
gig_dbg(DEBUG_ISO, "%s: not running", __func__); gig_dbg(DEBUG_ISO, "%s: not running", __func__);
return; return;
} }
...@@ -1220,7 +1220,7 @@ static void write_iso_tasklet(unsigned long data) ...@@ -1220,7 +1220,7 @@ static void write_iso_tasklet(unsigned long data)
/* mark the write buffer area covered by this URB as free */ /* mark the write buffer area covered by this URB as free */
if (done->limit >= 0) if (done->limit >= 0)
atomic_set(&ubc->isooutbuf->read, done->limit); ubc->isooutbuf->read = done->limit;
/* mark URB as free */ /* mark URB as free */
spin_lock_irqsave(&ubc->isooutlock, flags); spin_lock_irqsave(&ubc->isooutlock, flags);
...@@ -1294,7 +1294,7 @@ static void read_iso_tasklet(unsigned long data) ...@@ -1294,7 +1294,7 @@ static void read_iso_tasklet(unsigned long data)
} }
spin_unlock_irqrestore(&ubc->isoinlock, flags); spin_unlock_irqrestore(&ubc->isoinlock, flags);
if (unlikely(!(atomic_read(&ubc->running)))) { if (unlikely(!(ubc->running))) {
gig_dbg(DEBUG_ISO, gig_dbg(DEBUG_ISO,
"%s: channel not running, " "%s: channel not running, "
"dropped URB with status: %s", "dropped URB with status: %s",
...@@ -1488,7 +1488,7 @@ static void write_ctrl_callback(struct urb *urb) ...@@ -1488,7 +1488,7 @@ static void write_ctrl_callback(struct urb *urb)
default: /* any failure */ default: /* any failure */
/* don't retry if suspend requested */ /* don't retry if suspend requested */
if (++ucs->retry_ctrl > BAS_RETRY || if (++ucs->retry_ctrl > BAS_RETRY ||
(atomic_read(&ucs->basstate) & BS_SUSPEND)) { (ucs->basstate & BS_SUSPEND)) {
dev_err(&ucs->interface->dev, dev_err(&ucs->interface->dev,
"control request 0x%02x failed: %s\n", "control request 0x%02x failed: %s\n",
ucs->dr_ctrl.bRequest, ucs->dr_ctrl.bRequest,
...@@ -1603,7 +1603,7 @@ static int gigaset_init_bchannel(struct bc_state *bcs) ...@@ -1603,7 +1603,7 @@ static int gigaset_init_bchannel(struct bc_state *bcs)
return -ENODEV; return -ENODEV;
} }
if (atomic_read(&cs->hw.bas->basstate) & BS_SUSPEND) { if (cs->hw.bas->basstate & BS_SUSPEND) {
dev_notice(cs->dev, dev_notice(cs->dev,
"not starting isochronous I/O, " "not starting isochronous I/O, "
"suspend in progress\n"); "suspend in progress\n");
...@@ -1658,8 +1658,7 @@ static int gigaset_close_bchannel(struct bc_state *bcs) ...@@ -1658,8 +1658,7 @@ static int gigaset_close_bchannel(struct bc_state *bcs)
return -ENODEV; return -ENODEV;
} }
if (!(atomic_read(&cs->hw.bas->basstate) & if (!(cs->hw.bas->basstate & (bcs->channel ? BS_B2OPEN : BS_B1OPEN))) {
(bcs->channel ? BS_B2OPEN : BS_B1OPEN))) {
/* channel not running: just signal common.c */ /* channel not running: just signal common.c */
spin_unlock_irqrestore(&cs->lock, flags); spin_unlock_irqrestore(&cs->lock, flags);
gigaset_bchannel_down(bcs); gigaset_bchannel_down(bcs);
...@@ -1747,7 +1746,7 @@ static void write_command_callback(struct urb *urb) ...@@ -1747,7 +1746,7 @@ static void write_command_callback(struct urb *urb)
ucs->retry_cmd_out); ucs->retry_cmd_out);
break; break;
} }
if (atomic_read(&ucs->basstate) & BS_SUSPEND) { if (ucs->basstate & BS_SUSPEND) {
dev_warn(cs->dev, dev_warn(cs->dev,
"command write: %s, " "command write: %s, "
"won't retry - suspend requested\n", "won't retry - suspend requested\n",
...@@ -1863,13 +1862,13 @@ static int start_cbsend(struct cardstate *cs) ...@@ -1863,13 +1862,13 @@ static int start_cbsend(struct cardstate *cs)
int retval = 0; int retval = 0;
/* check if suspend requested */ /* check if suspend requested */
if (atomic_read(&ucs->basstate) & BS_SUSPEND) { if (ucs->basstate & BS_SUSPEND) {
gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "suspending"); gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "suspending");
return -EHOSTUNREACH; return -EHOSTUNREACH;
} }
/* check if AT channel is open */ /* check if AT channel is open */
if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) { if (!(ucs->basstate & BS_ATOPEN)) {
gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open"); gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open");
rc = req_submit(cs->bcs, HD_OPEN_ATCHANNEL, 0, BAS_TIMEOUT); rc = req_submit(cs->bcs, HD_OPEN_ATCHANNEL, 0, BAS_TIMEOUT);
if (rc < 0) { if (rc < 0) {
...@@ -1885,8 +1884,7 @@ static int start_cbsend(struct cardstate *cs) ...@@ -1885,8 +1884,7 @@ static int start_cbsend(struct cardstate *cs)
/* try to send first command in queue */ /* try to send first command in queue */
spin_lock_irqsave(&cs->cmdlock, flags); spin_lock_irqsave(&cs->cmdlock, flags);
while ((cb = cs->cmdbuf) != NULL && while ((cb = cs->cmdbuf) != NULL && (ucs->basstate & BS_ATREADY)) {
atomic_read(&ucs->basstate) & BS_ATREADY) {
ucs->retry_cmd_out = 0; ucs->retry_cmd_out = 0;
rc = atwrite_submit(cs, cb->buf, cb->len); rc = atwrite_submit(cs, cb->buf, cb->len);
if (unlikely(rc)) { if (unlikely(rc)) {
...@@ -1924,7 +1922,7 @@ static int gigaset_write_cmd(struct cardstate *cs, ...@@ -1924,7 +1922,7 @@ static int gigaset_write_cmd(struct cardstate *cs,
unsigned long flags; unsigned long flags;
int rc; int rc;
gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ? gigaset_dbg_buffer(cs->mstate != MS_LOCKED ?
DEBUG_TRANSCMD : DEBUG_LOCKCMD, DEBUG_TRANSCMD : DEBUG_LOCKCMD,
"CMD Transmit", len, buf); "CMD Transmit", len, buf);
...@@ -2039,7 +2037,7 @@ static int gigaset_freebcshw(struct bc_state *bcs) ...@@ -2039,7 +2037,7 @@ static int gigaset_freebcshw(struct bc_state *bcs)
return 0; return 0;
/* kill URBs and tasklets before freeing - better safe than sorry */ /* kill URBs and tasklets before freeing - better safe than sorry */
atomic_set(&ubc->running, 0); ubc->running = 0;
gig_dbg(DEBUG_INIT, "%s: killing iso URBs", __func__); gig_dbg(DEBUG_INIT, "%s: killing iso URBs", __func__);
for (i = 0; i < BAS_OUTURBS; ++i) { for (i = 0; i < BAS_OUTURBS; ++i) {
usb_kill_urb(ubc->isoouturbs[i].urb); usb_kill_urb(ubc->isoouturbs[i].urb);
...@@ -2074,7 +2072,7 @@ static int gigaset_initbcshw(struct bc_state *bcs) ...@@ -2074,7 +2072,7 @@ static int gigaset_initbcshw(struct bc_state *bcs)
return 0; return 0;
} }
atomic_set(&ubc->running, 0); ubc->running = 0;
atomic_set(&ubc->corrbytes, 0); atomic_set(&ubc->corrbytes, 0);
spin_lock_init(&ubc->isooutlock); spin_lock_init(&ubc->isooutlock);
for (i = 0; i < BAS_OUTURBS; ++i) { for (i = 0; i < BAS_OUTURBS; ++i) {
...@@ -2119,7 +2117,7 @@ static void gigaset_reinitbcshw(struct bc_state *bcs) ...@@ -2119,7 +2117,7 @@ static void gigaset_reinitbcshw(struct bc_state *bcs)
{ {
struct bas_bc_state *ubc = bcs->hw.bas; struct bas_bc_state *ubc = bcs->hw.bas;
atomic_set(&bcs->hw.bas->running, 0); bcs->hw.bas->running = 0;
atomic_set(&bcs->hw.bas->corrbytes, 0); atomic_set(&bcs->hw.bas->corrbytes, 0);
bcs->hw.bas->numsub = 0; bcs->hw.bas->numsub = 0;
spin_lock_init(&ubc->isooutlock); spin_lock_init(&ubc->isooutlock);
...@@ -2150,7 +2148,7 @@ static int gigaset_initcshw(struct cardstate *cs) ...@@ -2150,7 +2148,7 @@ static int gigaset_initcshw(struct cardstate *cs)
spin_lock_init(&ucs->lock); spin_lock_init(&ucs->lock);
ucs->pending = 0; ucs->pending = 0;
atomic_set(&ucs->basstate, 0); ucs->basstate = 0;
init_timer(&ucs->timer_ctrl); init_timer(&ucs->timer_ctrl);
init_timer(&ucs->timer_atrdy); init_timer(&ucs->timer_atrdy);
init_timer(&ucs->timer_cmd_in); init_timer(&ucs->timer_cmd_in);
...@@ -2307,7 +2305,7 @@ static int gigaset_probe(struct usb_interface *interface, ...@@ -2307,7 +2305,7 @@ static int gigaset_probe(struct usb_interface *interface,
/* tell common part that the device is ready */ /* tell common part that the device is ready */
if (startmode == SM_LOCKED) if (startmode == SM_LOCKED)
atomic_set(&cs->mstate, MS_LOCKED); cs->mstate = MS_LOCKED;
/* save address of controller structure */ /* save address of controller structure */
usb_set_intfdata(interface, cs); usb_set_intfdata(interface, cs);
...@@ -2342,7 +2340,7 @@ static void gigaset_disconnect(struct usb_interface *interface) ...@@ -2342,7 +2340,7 @@ static void gigaset_disconnect(struct usb_interface *interface)
dev_info(cs->dev, "disconnecting Gigaset base\n"); dev_info(cs->dev, "disconnecting Gigaset base\n");
/* mark base as not ready, all channels disconnected */ /* mark base as not ready, all channels disconnected */
atomic_set(&ucs->basstate, 0); ucs->basstate = 0;
/* tell LL all channels are down */ /* tell LL all channels are down */
for (j = 0; j < BAS_CHANNELS; ++j) for (j = 0; j < BAS_CHANNELS; ++j)
...@@ -2374,7 +2372,6 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) ...@@ -2374,7 +2372,6 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)
{ {
struct cardstate *cs = usb_get_intfdata(intf); struct cardstate *cs = usb_get_intfdata(intf);
struct bas_cardstate *ucs = cs->hw.bas; struct bas_cardstate *ucs = cs->hw.bas;
int basstate;
int rc; int rc;
/* set suspend flag; this stops AT command/response traffic */ /* set suspend flag; this stops AT command/response traffic */
...@@ -2385,29 +2382,28 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message) ...@@ -2385,29 +2382,28 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)
/* wait a bit for blocking conditions to go away */ /* wait a bit for blocking conditions to go away */
rc = wait_event_timeout(ucs->waitqueue, rc = wait_event_timeout(ucs->waitqueue,
!(atomic_read(&ucs->basstate) & !(ucs->basstate &
(BS_B1OPEN|BS_B2OPEN|BS_ATRDPEND|BS_ATWRPEND)), (BS_B1OPEN|BS_B2OPEN|BS_ATRDPEND|BS_ATWRPEND)),
BAS_TIMEOUT*HZ/10); BAS_TIMEOUT*HZ/10);
gig_dbg(DEBUG_SUSPEND, "wait_event_timeout() -> %d", rc); gig_dbg(DEBUG_SUSPEND, "wait_event_timeout() -> %d", rc);
/* check for conditions preventing suspend */ /* check for conditions preventing suspend */
basstate = atomic_read(&ucs->basstate); if (ucs->basstate & (BS_B1OPEN|BS_B2OPEN|BS_ATRDPEND|BS_ATWRPEND)) {
if (basstate & (BS_B1OPEN|BS_B2OPEN|BS_ATRDPEND|BS_ATWRPEND)) {
dev_warn(cs->dev, "cannot suspend:\n"); dev_warn(cs->dev, "cannot suspend:\n");
if (basstate & BS_B1OPEN) if (ucs->basstate & BS_B1OPEN)
dev_warn(cs->dev, " B channel 1 open\n"); dev_warn(cs->dev, " B channel 1 open\n");
if (basstate & BS_B2OPEN) if (ucs->basstate & BS_B2OPEN)
dev_warn(cs->dev, " B channel 2 open\n"); dev_warn(cs->dev, " B channel 2 open\n");
if (basstate & BS_ATRDPEND) if (ucs->basstate & BS_ATRDPEND)
dev_warn(cs->dev, " receiving AT reply\n"); dev_warn(cs->dev, " receiving AT reply\n");
if (basstate & BS_ATWRPEND) if (ucs->basstate & BS_ATWRPEND)
dev_warn(cs->dev, " sending AT command\n"); dev_warn(cs->dev, " sending AT command\n");
update_basstate(ucs, 0, BS_SUSPEND); update_basstate(ucs, 0, BS_SUSPEND);
return -EBUSY; return -EBUSY;
} }
/* close AT channel if open */ /* close AT channel if open */
if (basstate & BS_ATOPEN) { if (ucs->basstate & BS_ATOPEN) {
gig_dbg(DEBUG_SUSPEND, "closing AT channel"); gig_dbg(DEBUG_SUSPEND, "closing AT channel");
rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, 0); rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, 0);
if (rc) { if (rc) {
...@@ -2546,25 +2542,25 @@ static void __exit bas_gigaset_exit(void) ...@@ -2546,25 +2542,25 @@ static void __exit bas_gigaset_exit(void)
/* from now on, no isdn callback should be possible */ /* from now on, no isdn callback should be possible */
/* close all still open channels */ /* close all still open channels */
if (atomic_read(&ucs->basstate) & BS_B1OPEN) { if (ucs->basstate & BS_B1OPEN) {
gig_dbg(DEBUG_INIT, "closing B1 channel"); gig_dbg(DEBUG_INIT, "closing B1 channel");
usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0), usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0),
HD_CLOSE_B1CHANNEL, OUT_VENDOR_REQ, 0, 0, HD_CLOSE_B1CHANNEL, OUT_VENDOR_REQ, 0, 0,
NULL, 0, BAS_TIMEOUT); NULL, 0, BAS_TIMEOUT);
} }
if (atomic_read(&ucs->basstate) & BS_B2OPEN) { if (ucs->basstate & BS_B2OPEN) {
gig_dbg(DEBUG_INIT, "closing B2 channel"); gig_dbg(DEBUG_INIT, "closing B2 channel");
usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0), usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0),
HD_CLOSE_B2CHANNEL, OUT_VENDOR_REQ, 0, 0, HD_CLOSE_B2CHANNEL, OUT_VENDOR_REQ, 0, 0,
NULL, 0, BAS_TIMEOUT); NULL, 0, BAS_TIMEOUT);
} }
if (atomic_read(&ucs->basstate) & BS_ATOPEN) { if (ucs->basstate & BS_ATOPEN) {
gig_dbg(DEBUG_INIT, "closing AT channel"); gig_dbg(DEBUG_INIT, "closing AT channel");
usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0), usb_control_msg(ucs->udev, usb_sndctrlpipe(ucs->udev, 0),
HD_CLOSE_ATCHANNEL, OUT_VENDOR_REQ, 0, 0, HD_CLOSE_ATCHANNEL, OUT_VENDOR_REQ, 0, 0,
NULL, 0, BAS_TIMEOUT); NULL, 0, BAS_TIMEOUT);
} }
atomic_set(&ucs->basstate, 0); ucs->basstate = 0;
/* deregister this driver with the USB subsystem */ /* deregister this driver with the USB subsystem */
usb_deregister(&gigaset_usb_driver); usb_deregister(&gigaset_usb_driver);
......
...@@ -501,11 +501,11 @@ static void gigaset_inbuf_init(struct inbuf_t *inbuf, struct bc_state *bcs, ...@@ -501,11 +501,11 @@ static void gigaset_inbuf_init(struct inbuf_t *inbuf, struct bc_state *bcs,
struct cardstate *cs, int inputstate) struct cardstate *cs, int inputstate)
/* inbuf->read must be allocated before! */ /* inbuf->read must be allocated before! */
{ {
atomic_set(&inbuf->head, 0); inbuf->head = 0;
atomic_set(&inbuf->tail, 0); inbuf->tail = 0;
inbuf->cs = cs; inbuf->cs = cs;
inbuf->bcs = bcs; /*base driver: NULL*/ inbuf->bcs = bcs; /*base driver: NULL*/
inbuf->rcvbuf = NULL; //FIXME inbuf->rcvbuf = NULL;
inbuf->inputstate = inputstate; inbuf->inputstate = inputstate;
} }
...@@ -521,8 +521,8 @@ int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, ...@@ -521,8 +521,8 @@ int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
return 0; return 0;
bytesleft = numbytes; bytesleft = numbytes;
tail = atomic_read(&inbuf->tail); tail = inbuf->tail;
head = atomic_read(&inbuf->head); head = inbuf->head;
gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail); gig_dbg(DEBUG_INTR, "buffer state: %u -> %u", head, tail);
while (bytesleft) { while (bytesleft) {
...@@ -546,7 +546,7 @@ int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src, ...@@ -546,7 +546,7 @@ int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
src += n; src += n;
} }
gig_dbg(DEBUG_INTR, "setting tail to %u", tail); gig_dbg(DEBUG_INTR, "setting tail to %u", tail);
atomic_set(&inbuf->tail, tail); inbuf->tail = tail;
return numbytes != bytesleft; return numbytes != bytesleft;
} }
EXPORT_SYMBOL_GPL(gigaset_fill_inbuf); EXPORT_SYMBOL_GPL(gigaset_fill_inbuf);
...@@ -668,7 +668,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, ...@@ -668,7 +668,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
tasklet_init(&cs->event_tasklet, &gigaset_handle_event, tasklet_init(&cs->event_tasklet, &gigaset_handle_event,
(unsigned long) cs); (unsigned long) cs);
atomic_set(&cs->commands_pending, 0); cs->commands_pending = 0;
cs->cur_at_seq = 0; cs->cur_at_seq = 0;
cs->gotfwver = -1; cs->gotfwver = -1;
cs->open_count = 0; cs->open_count = 0;
...@@ -688,8 +688,8 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels, ...@@ -688,8 +688,8 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
init_waitqueue_head(&cs->waitqueue); init_waitqueue_head(&cs->waitqueue);
cs->waiting = 0; cs->waiting = 0;
atomic_set(&cs->mode, M_UNKNOWN); cs->mode = M_UNKNOWN;
atomic_set(&cs->mstate, MS_UNINITIALIZED); cs->mstate = MS_UNINITIALIZED;
for (i = 0; i < channels; ++i) { for (i = 0; i < channels; ++i) {
gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i); gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i);
...@@ -806,8 +806,8 @@ static void cleanup_cs(struct cardstate *cs) ...@@ -806,8 +806,8 @@ static void cleanup_cs(struct cardstate *cs)
spin_lock_irqsave(&cs->lock, flags); spin_lock_irqsave(&cs->lock, flags);
atomic_set(&cs->mode, M_UNKNOWN); cs->mode = M_UNKNOWN;
atomic_set(&cs->mstate, MS_UNINITIALIZED); cs->mstate = MS_UNINITIALIZED;