diff options
author | Finn Thain <fthain@telegraphics.com.au> | 2018-01-13 17:37:13 -0500 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2018-01-16 16:47:29 +0100 |
commit | 41b848160eabb22957652936b66ccafd95ab5ad8 (patch) | |
tree | f38449c4f4a4694f6c3215262919dc45c92aeb24 /include/linux/nubus.h | |
parent | 189e19e8cbb49f5bf483e55bdbd1e56d3d6bcf75 (diff) |
nubus: Adopt standard linked list implementation
This increases code re-use and improves readability.
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'include/linux/nubus.h')
-rw-r--r-- | include/linux/nubus.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/include/linux/nubus.h b/include/linux/nubus.h index 4a481610ad38..2cbc7a199bca 100644 --- a/include/linux/nubus.h +++ b/include/linux/nubus.h @@ -33,7 +33,6 @@ struct nubus_dirent { struct nubus_board { struct nubus_board *next; - struct nubus_rsrc *first_func_rsrc; /* Only 9-E actually exist, though 0-8 are also theoretically possible, and 0 is a special case which represents the @@ -63,8 +62,7 @@ struct nubus_board { }; struct nubus_rsrc { - /* Next link in list */ - struct nubus_rsrc *next; + struct list_head list; /* The functional resource ID */ unsigned char resid; @@ -82,7 +80,7 @@ struct nubus_rsrc { }; /* This is all NuBus functional resources (used to find devices later on) */ -extern struct nubus_rsrc *nubus_func_rsrcs; +extern struct list_head nubus_func_rsrcs; /* This is all NuBus cards */ extern struct nubus_board *nubus_boards; @@ -115,12 +113,11 @@ static inline void nubus_proc_add_rsrc(struct proc_dir_entry *procdir, const struct nubus_dirent *ent) {} #endif -struct nubus_rsrc *nubus_find_type(unsigned short category, - unsigned short type, - const struct nubus_rsrc *from); +struct nubus_rsrc *nubus_first_rsrc_or_null(void); +struct nubus_rsrc *nubus_next_rsrc_or_null(struct nubus_rsrc *from); -struct nubus_rsrc *nubus_find_slot(unsigned int slot, - const struct nubus_rsrc *from); +#define for_each_func_rsrc(f) \ + for (f = nubus_first_rsrc_or_null(); f; f = nubus_next_rsrc_or_null(f)) /* These are somewhat more NuBus-specific. They all return 0 for success and -1 for failure, as you'd expect. */ |