Module Name: src Committed By: tnn Date: Sat Nov 2 22:55:58 UTC 2019
Modified Files: src/sys/dev/spi: ssdfb_spi.c Log Message: add fdt device_compatible_entry To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/spi/ssdfb_spi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/spi/ssdfb_spi.c diff -u src/sys/dev/spi/ssdfb_spi.c:1.2 src/sys/dev/spi/ssdfb_spi.c:1.3 --- src/sys/dev/spi/ssdfb_spi.c:1.2 Sat Nov 2 17:13:20 2019 +++ src/sys/dev/spi/ssdfb_spi.c Sat Nov 2 22:55:57 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb_spi.c,v 1.2 2019/11/02 17:13:20 tnn Exp $ */ +/* $NetBSD: ssdfb_spi.c,v 1.3 2019/11/02 22:55:57 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.2 2019/11/02 17:13:20 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.3 2019/11/02 22:55:57 tnn Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -73,18 +73,28 @@ static void ssdfb_bitstream_final(struct CFATTACH_DECL_NEW(ssdfb_spi, sizeof(struct ssdfb_spi_softc), ssdfb_spi_match, ssdfb_spi_attach, NULL, NULL); +static const struct device_compatible_entry compat_data[] = { + { "solomon,ssd1322", 0 }, + { NULL, 0 } +}; + static int ssdfb_spi_match(device_t parent, cfdata_t match, void *aux) { struct spi_attach_args *sa = aux; + int res; + + res = spi_compatible_match(sa, match, compat_data); + if (!res) + return res; /* * SSD1306 and SSD1322 data sheets specify 100ns cycle time. */ if (spi_configure(sa->sa_handle, SPI_MODE_0, 10000000)) - return 0; + res = 0; - return 1; + return res; } static void