[parisc-linux-cvs] linux-2.4.18-pa43: (new) HIL drivers working as modules and built-into kernel
Matthew Wilcox
willy@debian.org
Fri, 28 Jun 2002 00:33:51 +0100
On Thu, Jun 27, 2002 at 11:48:12PM +0200, Helge Deller wrote:
> @@ -694,11 +697,12 @@ static int hilse_donode (hil_mlc *mlc) {
>
> /******************** tasklet context functions **************************/
> static void hil_mlcs_process(unsigned long unused) {
> - hil_mlc *mlc;
> + struct list_head *tmp;
>
> read_lock(&hil_mlcs_lock);
> - mlc = hil_mlcs;
> - while (mlc != NULL) {
> + if (!list_empty(&hil_mlcs))
> + list_for_each(tmp, &hil_mlcs) {
> + struct hil_mlc *mlc = list_entry(tmp, hil_mlc, list);
> while (hilse_donode(mlc) == 0) {
> #ifdef HIL_MLC_DEBUG
> if (mlc->seidx != 41 &&
The list_empty check isn't required -- list_for_each is safe to do on
an empty list.
> @@ -886,38 +888,37 @@ int hil_mlc_register(hil_mlc *mlc) {
> mlc->tasklet = &hil_mlcs_tasklet;
>
> write_lock_irqsave(&hil_mlcs_lock, flags);
> - ptr = hil_mlcs;
> - hil_mlcs = mlc;
> - mlc->next = ptr;
> + INIT_LIST_HEAD(&mlc->list);
> + list_add_tail(&mlc->list, &hil_mlcs);
> mlc->seidx = HILSEN_START;
> write_unlock_irqrestore(&hil_mlcs_lock, flags);
The INIT_LIST_HEAD is unnecessary here -- list_add_tail initialises the
list_head you pass to it.
--
Revolutions do not require corporate support.