uart_subr.c (279724) | uart_subr.c (298411) |
---|---|
1/*- 2 * Copyright (c) 2004 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_subr.c 279724 2015-03-07 15:24:15Z ian $"); | 28__FBSDID("$FreeBSD: head/sys/dev/uart/uart_subr.c 298411 2016-04-21 15:38:28Z pfg $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33 34#include <machine/bus.h> 35#include <machine/vmparam.h> 36 --- 14 unchanged lines hidden (view full) --- 51static struct uart_class *uart_classes[] = { 52 &uart_ns8250_class, 53 &uart_sab82532_class, 54 &uart_z8530_class, 55#if defined(__arm__) 56 &uart_s3c2410_class, 57#endif 58}; | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/bus.h> 33 34#include <machine/bus.h> 35#include <machine/vmparam.h> 36 --- 14 unchanged lines hidden (view full) --- 51static struct uart_class *uart_classes[] = { 52 &uart_ns8250_class, 53 &uart_sab82532_class, 54 &uart_z8530_class, 55#if defined(__arm__) 56 &uart_s3c2410_class, 57#endif 58}; |
59static size_t uart_nclasses = sizeof(uart_classes) / sizeof(uart_classes[0]); | |
60 61static bus_addr_t 62uart_parse_addr(const char **p) 63{ 64 return (strtoul(*p, (char**)(uintptr_t)p, 0)); 65} 66 67static struct uart_class * 68uart_parse_class(struct uart_class *class, const char **p) 69{ 70 struct uart_class *uc; 71 const char *nm; 72 size_t len; 73 u_int i; 74 | 59 60static bus_addr_t 61uart_parse_addr(const char **p) 62{ 63 return (strtoul(*p, (char**)(uintptr_t)p, 0)); 64} 65 66static struct uart_class * 67uart_parse_class(struct uart_class *class, const char **p) 68{ 69 struct uart_class *uc; 70 const char *nm; 71 size_t len; 72 u_int i; 73 |
75 for (i = 0; i < uart_nclasses; i++) { | 74 for (i = 0; i < nitems(uart_classes); i++) { |
76 uc = uart_classes[i]; 77 nm = uart_getname(uc); 78 if (nm == NULL || *nm == '\0') 79 continue; 80 len = strlen(nm); 81 if (strncmp(nm, *p, len) == 0) { 82 *p += len; 83 return (uc); --- 238 unchanged lines hidden --- | 75 uc = uart_classes[i]; 76 nm = uart_getname(uc); 77 if (nm == NULL || *nm == '\0') 78 continue; 79 len = strlen(nm); 80 if (strncmp(nm, *p, len) == 0) { 81 *p += len; 82 return (uc); --- 238 unchanged lines hidden --- |