Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Add a device_lookup() macro which encapsulates a sma...



details:   https://anonhg.NetBSD.org/src/rev/e3635117d7fa
branches:  trunk
changeset: 494363:e3635117d7fa
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jul 06 00:42:35 2000 +0000

description:
Add a device_lookup() macro which encapsulates a small snippet of code
that tons and tons of files all over the tree duplicate, many in slightly
different ways.

diffstat:

 sys/sys/device.h |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r 5a4253a0565d -r e3635117d7fa sys/sys/device.h
--- a/sys/sys/device.h  Wed Jul 05 23:45:05 2000 +0000
+++ b/sys/sys/device.h  Thu Jul 06 00:42:35 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.42 2000/06/13 22:36:16 cgd Exp $ */
+/* $NetBSD: device.h,v 1.43 2000/07/06 00:42:35 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -254,6 +254,7 @@
 void config_interrupts(struct device *, void (*)(struct device *));
 void config_pending_incr(void);
 void config_pending_decr(void);
+
 #ifdef __HAVE_DEVICE_REGISTER
 void device_register(struct device *, void *);
 #endif
@@ -266,6 +267,10 @@
 /* compatibility definitions */
 #define config_found(d, a, p)  config_found_sm((d), (a), (p), NULL)
 
+/* convenience definitions */
+#define        device_lookup(cfd, unit)                                        \
+       (((unit) < (cfd)->cd_ndevs) ? (cfd)->cd_devs[(unit)] : NULL)
+
 #endif /* _KERNEL */
 
 #endif /* !_SYS_DEVICE_H_ */



Home | Main Index | Thread Index | Old Index