Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102727125
D43361.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D43361.diff
View Options
diff --git a/sys/dev/uart/uart.h b/sys/dev/uart/uart.h
--- a/sys/dev/uart/uart.h
+++ b/sys/dev/uart/uart.h
@@ -29,6 +29,8 @@
#ifndef _DEV_UART_H_
#define _DEV_UART_H_
+#include <sys/linker_set.h>
+
/*
* Bus access structure. This structure holds the minimum information needed
* to access the UART. The rclk field, although not important to actually
@@ -99,6 +101,8 @@
*/
struct uart_class;
+SET_DECLARE(uart_class_set, struct uart_class);
+
extern struct uart_class uart_ns8250_class __attribute__((weak));
extern struct uart_class uart_quicc_class __attribute__((weak));
extern struct uart_class uart_z8530_class __attribute__((weak));
diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c
--- a/sys/dev/uart/uart_dev_ns8250.c
+++ b/sys/dev/uart/uart_dev_ns8250.c
@@ -451,6 +451,7 @@
.uc_rclk = DEFAULT_RCLK,
.uc_rshift = 0
};
+DATA_SET(uart_class_set, uart_ns8250_class);
/*
* XXX -- refactor out ACPI and FDT ifdefs
diff --git a/sys/dev/uart/uart_dev_z8530.c b/sys/dev/uart/uart_dev_z8530.c
--- a/sys/dev/uart/uart_dev_z8530.c
+++ b/sys/dev/uart/uart_dev_z8530.c
@@ -309,6 +309,7 @@
.uc_rclk = DEFAULT_RCLK,
.uc_rshift = 0
};
+DATA_SET(uart_class_set, uart_z8530_class);
#define SIGCHG(c, i, s, d) \
if (c) { \
diff --git a/sys/dev/uart/uart_subr.c b/sys/dev/uart/uart_subr.c
--- a/sys/dev/uart/uart_subr.c
+++ b/sys/dev/uart/uart_subr.c
@@ -48,11 +48,6 @@
#define UART_TAG_XO 9
#define UART_TAG_BD 10
-static struct uart_class *uart_classes[] = {
- &uart_ns8250_class,
- &uart_z8530_class,
-};
-
static bus_addr_t
uart_parse_addr(const char **p)
{
@@ -62,13 +57,12 @@
static struct uart_class *
uart_parse_class(struct uart_class *class, const char **p)
{
- struct uart_class *uc;
+ struct uart_class **puc, *uc;
const char *nm;
size_t len;
- u_int i;
- for (i = 0; i < nitems(uart_classes); i++) {
- uc = uart_classes[i];
+ SET_FOREACH(puc, uart_class_set) {
+ uc = *puc;
nm = uart_getname(uc);
if (nm == NULL || *nm == '\0')
continue;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 10:36 AM (18 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14674805
Default Alt Text
D43361.diff (1 KB)
Attached To
Mode
D43361: dev/uart: Use a linker set to find uart classes
Attached
Detach File
Event Timeline
Log In to Comment