Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67857
b: refs/heads/master
c: 04ea02f
h: refs/heads/master
i:
  67855: 8a412a1
v: v3
  • Loading branch information
Stanislaw Gruszka authored and Greg Kroah-Hartman committed Oct 12, 2007
1 parent 60ce59c commit 8856793
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 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: 503add467d4dd2355fe16ebffa7f6d5e9fcd10a8
refs/heads/master: 04ea02f5746a2e01a38edae2de3eafc40eac17aa
31 changes: 20 additions & 11 deletions trunk/drivers/usb/atm/ueagle-atm.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ struct uea_softc {
union cmv_dsc cmv_dsc;

struct work_struct task;
struct workqueue_struct *work_q;
u16 pageno;
u16 ovl;

Expand Down Expand Up @@ -1830,7 +1831,7 @@ static int uea_start_reset(struct uea_softc *sc)
/* start loading DSP */
sc->pageno = 0;
sc->ovl = 0;
schedule_work(&sc->task);
queue_work(sc->work_q, &sc->task);

/* wait for modem ready CMV */
ret = wait_cmv_ack(sc);
Expand Down Expand Up @@ -2038,13 +2039,13 @@ static void uea_schedule_load_page_e1(struct uea_softc *sc, struct intr_pkt *int
{
sc->pageno = intr->e1_bSwapPageNo;
sc->ovl = intr->e1_bOvl >> 4 | intr->e1_bOvl << 4;
schedule_work(&sc->task);
queue_work(sc->work_q, &sc->task);
}

static void uea_schedule_load_page_e4(struct uea_softc *sc, struct intr_pkt *intr)
{
sc->pageno = intr->e4_bSwapPageNo;
schedule_work(&sc->task);
queue_work(sc->work_q, &sc->task);
}

/*
Expand Down Expand Up @@ -2117,21 +2118,27 @@ static int uea_boot(struct uea_softc *sc)
init_waitqueue_head(&sc->sync_q);
init_waitqueue_head(&sc->cmv_ack_wait);

sc->work_q = create_workqueue("ueagle-dsp");
if (!sc->work_q) {
uea_err(INS_TO_USBDEV(sc), "cannot allocate workqueue\n");
uea_leaves(INS_TO_USBDEV(sc));
return -ENOMEM;
}

if (UEA_CHIP_VERSION(sc) == ADI930)
load_XILINX_firmware(sc);

intr = kmalloc(size, GFP_KERNEL);
if (!intr) {
uea_err(INS_TO_USBDEV(sc),
"cannot allocate interrupt package\n");
uea_leaves(INS_TO_USBDEV(sc));
return -ENOMEM;
goto err0;
}

sc->urb_int = usb_alloc_urb(0, GFP_KERNEL);
if (!sc->urb_int) {
uea_err(INS_TO_USBDEV(sc), "cannot allocate interrupt URB\n");
goto err;
goto err1;
}

usb_fill_int_urb(sc->urb_int, sc->usb_dev,
Expand All @@ -2144,7 +2151,7 @@ static int uea_boot(struct uea_softc *sc)
if (ret < 0) {
uea_err(INS_TO_USBDEV(sc),
"urb submition failed with error %d\n", ret);
goto err;
goto err1;
}

sc->kthread = kthread_run(uea_kthread, sc, "ueagle-atm");
Expand All @@ -2158,10 +2165,12 @@ static int uea_boot(struct uea_softc *sc)

err2:
usb_kill_urb(sc->urb_int);
err:
err1:
usb_free_urb(sc->urb_int);
sc->urb_int = NULL;
kfree(intr);
err0:
destroy_workqueue(sc->work_q);
uea_leaves(INS_TO_USBDEV(sc));
return -ENOMEM;
}
Expand All @@ -2176,15 +2185,15 @@ static void uea_stop(struct uea_softc *sc)
ret = kthread_stop(sc->kthread);
uea_dbg(INS_TO_USBDEV(sc), "kthread finish with status %d\n", ret);

/* stop any pending boot process */
flush_scheduled_work();

uea_request(sc, UEA_SET_MODE, UEA_LOOPBACK_ON, 0, NULL);

usb_kill_urb(sc->urb_int);
kfree(sc->urb_int->transfer_buffer);
usb_free_urb(sc->urb_int);

/* stop any pending boot process, when no one can schedule work */
destroy_workqueue(sc->work_q);

if (sc->dsp_firm)
release_firmware(sc->dsp_firm);
uea_leaves(INS_TO_USBDEV(sc));
Expand Down

0 comments on commit 8856793

Please sign in to comment.