CVS commit: src/external/bsd/nvi/dist/regex
Module Name:src Committed By: rin Date: Mon May 17 04:01:58 UTC 2021 Modified Files: src/external/bsd/nvi/dist/regex: regcomp.c Log Message: Fix search for collating symbols in form of [[.foo.]], as in a similar manner as already done for POSIX character classes by upstream: https://github.com/visrc/nvi/commit/fd5795cc9890581b9783a0ff96e0b44d6b38e26a#diff-42d58222b328681b9923634991312932089876a0242f78cf488157aa24969c1a (We already have this change since initial import to external/bsd/nvi.) Found by tnozaki. Thanks! To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/external/bsd/nvi/dist/regex/regcomp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/nvi/dist/regex/regcomp.c diff -u src/external/bsd/nvi/dist/regex/regcomp.c:1.7 src/external/bsd/nvi/dist/regex/regcomp.c:1.8 --- src/external/bsd/nvi/dist/regex/regcomp.c:1.7 Sun Nov 12 16:33:31 2017 +++ src/external/bsd/nvi/dist/regex/regcomp.c Mon May 17 04:01:57 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: regcomp.c,v 1.7 2017/11/12 16:33:31 christos Exp $ */ +/* $NetBSD: regcomp.c,v 1.8 2021/05/17 04:01:57 rin Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 Henry Spencer. * Copyright (c) 1992, 1993, 1994 @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)regcomp.c 8.4 (Berkeley) 3/19/94"; #endif /* LIBC_SCCS and not lint */ #else -__RCSID("$NetBSD: regcomp.c,v 1.7 2017/11/12 16:33:31 christos Exp $"); +__RCSID("$NetBSD: regcomp.c,v 1.8 2021/05/17 04:01:57 rin Exp $"); #endif #include @@ -934,7 +934,7 @@ p_b_coll_elem(struct parse *p, int endc) } len = p->next - sp; for (cp = cnames; cp->name != NULL; cp++) - if (STRLEN(cp->name) == len && MEMCMP(cp->name, sp, len)) + if (STRLEN(cp->name) == len && !MEMCMP(cp->name, sp, len)) return(cp->code); /* known name */ if (len == 1) return(*sp); /* single character */
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Mon May 17 00:05:56 UTC 2021 Modified Files: src/sys/dev/i2c [thorpej-i2c-spi-conf]: i2c.c i2cvar.h Log Message: Remove "count" from the device enumeration callback arguments. To generate a diff of this commit: cvs rdiff -u -r1.78.2.5 -r1.78.2.6 src/sys/dev/i2c/i2c.c cvs rdiff -u -r1.24.2.4 -r1.24.2.5 src/sys/dev/i2c/i2cvar.h 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/i2c/i2c.c diff -u src/sys/dev/i2c/i2c.c:1.78.2.5 src/sys/dev/i2c/i2c.c:1.78.2.6 --- src/sys/dev/i2c/i2c.c:1.78.2.5 Sun May 16 21:04:59 2021 +++ src/sys/dev/i2c/i2c.c Mon May 17 00:05:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: i2c.c,v 1.78.2.5 2021/05/16 21:04:59 thorpej Exp $ */ +/* $NetBSD: i2c.c,v 1.78.2.6 2021/05/17 00:05:56 thorpej Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.78.2.5 2021/05/16 21:04:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.78.2.6 2021/05/17 00:05:56 thorpej Exp $"); #include #include @@ -618,8 +618,6 @@ iic_enumerate_devices_callback(device_t device_t newdev; bool rv __diagused; - args->count++; - loc[IICCF_ADDR] = args->ia->ia_addr; if (args->ia->ia_addr > I2C_MAX_ADDR) { Index: src/sys/dev/i2c/i2cvar.h diff -u src/sys/dev/i2c/i2cvar.h:1.24.2.4 src/sys/dev/i2c/i2cvar.h:1.24.2.5 --- src/sys/dev/i2c/i2cvar.h:1.24.2.4 Fri May 14 01:08:53 2021 +++ src/sys/dev/i2c/i2cvar.h Mon May 17 00:05:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: i2cvar.h,v 1.24.2.4 2021/05/14 01:08:53 thorpej Exp $ */ +/* $NetBSD: i2cvar.h,v 1.24.2.5 2021/05/17 00:05:56 thorpej Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -170,7 +170,6 @@ struct i2c_attach_args { struct i2c_enumerate_devices_args { struct i2c_attach_args *ia; bool (*callback)(device_t, struct i2c_enumerate_devices_args *); - unsigned int count; }; /*
CVS commit: [thorpej-i2c-spi-conf] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: thorpej Date: Sun May 16 23:45:12 UTC 2021 Modified Files: src/sys/arch/sparc64/sparc64 [thorpej-i2c-spi-conf]: ofw_patch.c Log Message: - i2c_fixup_enumerate_devices(): handle getting a NULL "compatible" property. - sparcle_smbus_fixup(): remove bogus place-holder compatible properties for the SPD entries. To generate a diff of this commit: cvs rdiff -u -r1.7.4.2 -r1.7.4.3 src/sys/arch/sparc64/sparc64/ofw_patch.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/arch/sparc64/sparc64/ofw_patch.c diff -u src/sys/arch/sparc64/sparc64/ofw_patch.c:1.7.4.2 src/sys/arch/sparc64/sparc64/ofw_patch.c:1.7.4.3 --- src/sys/arch/sparc64/sparc64/ofw_patch.c:1.7.4.2 Sat May 15 21:19:46 2021 +++ src/sys/arch/sparc64/sparc64/ofw_patch.c Sun May 16 23:45:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ofw_patch.c,v 1.7.4.2 2021/05/15 21:19:46 thorpej Exp $ */ +/* $NetBSD: ofw_patch.c,v 1.7.4.3 2021/05/16 23:45:12 thorpej Exp $ */ /*- * Copyright (c) 2020, 2021 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.7.4.2 2021/05/15 21:19:46 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ofw_patch.c,v 1.7.4.3 2021/05/16 23:45:12 thorpej Exp $"); #include #include @@ -153,7 +153,9 @@ i2c_fixup_enumerate_devices(device_t dev args->ia->ia_addr = i2c_adds[i].addr; args->ia->ia_name = i2c_adds[i].name; args->ia->ia_clist = i2c_adds[i].compat; - args->ia->ia_clist_size = strlen(i2c_adds[i].compat) + 1; + args->ia->ia_clist_size = args->ia->ia_clist != NULL + ? strlen(i2c_adds[i].compat) + 1 + : 0; args->ia->ia_prop = props; if (fixup->i2c_phandle != 0) { args->ia->ia_devhandle = @@ -697,10 +699,8 @@ static void sparcle_smbus_fixup(device_t dev, void *aux) { static const struct i2c_addition i2c_adds[] = { - { .name = "dimm-spd", - .compat = "netbsd,dimm-spd", .addr = 0x50 }, - { .name = "dimm-spd", - .compat = "netbsd,dimm-spd", .addr = 0x51 }, + { .name = "dimm-spd", .addr = 0x50 }, + { .name = "dimm-spd", .addr = 0x51 }, }; devhandle_t devhandle = device_handle(dev); KASSERT(devhandle_type(devhandle) == DEVHANDLE_TYPE_OF);
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Sun May 16 22:56:48 UTC 2021 Modified Files: src/sys/dev/i2c [thorpej-i2c-spi-conf]: spdmem_i2c.c Log Message: Tweak previous to deal better with "device tree node describes empty DIMM slot" problem. To generate a diff of this commit: cvs rdiff -u -r1.21.4.4 -r1.21.4.5 src/sys/dev/i2c/spdmem_i2c.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/i2c/spdmem_i2c.c diff -u src/sys/dev/i2c/spdmem_i2c.c:1.21.4.4 src/sys/dev/i2c/spdmem_i2c.c:1.21.4.5 --- src/sys/dev/i2c/spdmem_i2c.c:1.21.4.4 Sun May 16 22:53:57 2021 +++ src/sys/dev/i2c/spdmem_i2c.c Sun May 16 22:56:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: spdmem_i2c.c,v 1.21.4.4 2021/05/16 22:53:57 thorpej Exp $ */ +/* $NetBSD: spdmem_i2c.c,v 1.21.4.5 2021/05/16 22:56:47 thorpej Exp $ */ /* * Copyright (c) 2007 Nicolas Joly @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.21.4.4 2021/05/16 22:53:57 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.21.4.5 2021/05/16 22:56:47 thorpej Exp $"); #include #include @@ -243,7 +243,7 @@ spdmem_i2c_match(device_t parent, cfdata sc.sc_page0 = SPDCTL_SPA0; sc.sc_page1 = SPDCTL_SPA1; sc.sc_base.sc_read = spdmem_i2c_read; - match_result = SPDMEM_HIGH_CONFIDENCE_MATCH; + match_result = 0; do_probe: /* Check the bank and reset to the page 0 */ @@ -254,8 +254,6 @@ spdmem_i2c_match(device_t parent, cfdata if (match_result < SPDMEM_HIGH_CONFIDENCE_MATCH) { match_result = SPDMEM_HIGH_CONFIDENCE_MATCH; } - } else { - match_result = 0; } return match_result;
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Sun May 16 22:53:57 UTC 2021 Modified Files: src/sys/dev/i2c [thorpej-i2c-spi-conf]: spdmem_i2c.c Log Message: Go back to probing in the direct config case, and return a high confidence match value if the SPD probe succeeds. This ensures that we beat a generic i2c serial eeprom driver if the contents looks like they contain SPD data. To generate a diff of this commit: cvs rdiff -u -r1.21.4.3 -r1.21.4.4 src/sys/dev/i2c/spdmem_i2c.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/i2c/spdmem_i2c.c diff -u src/sys/dev/i2c/spdmem_i2c.c:1.21.4.3 src/sys/dev/i2c/spdmem_i2c.c:1.21.4.4 --- src/sys/dev/i2c/spdmem_i2c.c:1.21.4.3 Sun May 16 15:40:20 2021 +++ src/sys/dev/i2c/spdmem_i2c.c Sun May 16 22:53:57 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: spdmem_i2c.c,v 1.21.4.3 2021/05/16 15:40:20 thorpej Exp $ */ +/* $NetBSD: spdmem_i2c.c,v 1.21.4.4 2021/05/16 22:53:57 thorpej Exp $ */ /* * Copyright (c) 2007 Nicolas Joly @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.21.4.3 2021/05/16 15:40:20 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.21.4.4 2021/05/16 22:53:57 thorpej Exp $"); #include #include @@ -190,6 +190,8 @@ static const struct device_compatible_en DEVICE_COMPAT_EOL }; +#define SPDMEM_HIGH_CONFIDENCE_MATCH (I2C_MATCH_DIRECT_COMPATIBLE + 20) + static bool spdmem_i2c_use_name_match(const struct i2c_attach_args *ia, int *match_resultp) { @@ -197,7 +199,7 @@ spdmem_i2c_use_name_match(const struct i if (name != NULL) { *match_resultp = device_compatible_match(, 1, name_data) - ? I2C_MATCH_DIRECT_COMPATIBLE + ? SPDMEM_HIGH_CONFIDENCE_MATCH : 0; return true; } @@ -209,9 +211,6 @@ spdmem_i2c_use_direct_match(const struct const struct device_compatible_entry *cdata, int *match_resultp) { - if (iic_use_direct_match(ia, cf, cdata, match_resultp)) - return true; - /* * Matching by name is not ideal, but some device trees only * have a name and no "compatible" property. @@ -219,6 +218,9 @@ spdmem_i2c_use_direct_match(const struct if (spdmem_i2c_use_name_match(ia, match_resultp)) return true; + if (iic_use_direct_match(ia, cf, cdata, match_resultp)) + return true; + return false; } @@ -230,7 +232,7 @@ spdmem_i2c_match(device_t parent, cfdata int match_result; if (spdmem_i2c_use_direct_match(ia, match, compat_data, _result)) - return match_result; + goto do_probe; /* Filter out by address when not using direct config. */ if ((ia->ia_addr & SPDMEM_I2C_ADDRMASK) != SPDMEM_I2C_ADDR) @@ -241,14 +243,22 @@ spdmem_i2c_match(device_t parent, cfdata sc.sc_page0 = SPDCTL_SPA0; sc.sc_page1 = SPDCTL_SPA1; sc.sc_base.sc_read = spdmem_i2c_read; + match_result = SPDMEM_HIGH_CONFIDENCE_MATCH; + do_probe: /* Check the bank and reset to the page 0 */ if (spdmem_reset_page() != 0) return 0; - return spdmem_common_probe(_base) - ? I2C_MATCH_ADDRESS_AND_PROBE - : 0; + if (spdmem_common_probe(_base)) { + if (match_result < SPDMEM_HIGH_CONFIDENCE_MATCH) { + match_result = SPDMEM_HIGH_CONFIDENCE_MATCH; + } + } else { + match_result = 0; + } + + return match_result; } static void
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Sun May 16 21:04:59 UTC 2021 Modified Files: src/sys/dev/i2c [thorpej-i2c-spi-conf]: i2c.c Log Message: Check for errors from iic_acquire_bus() in iic_ioctl_exec(). To generate a diff of this commit: cvs rdiff -u -r1.78.2.4 -r1.78.2.5 src/sys/dev/i2c/i2c.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/i2c/i2c.c diff -u src/sys/dev/i2c/i2c.c:1.78.2.4 src/sys/dev/i2c/i2c.c:1.78.2.5 --- src/sys/dev/i2c/i2c.c:1.78.2.4 Sun May 16 21:03:38 2021 +++ src/sys/dev/i2c/i2c.c Sun May 16 21:04:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: i2c.c,v 1.78.2.4 2021/05/16 21:03:38 thorpej Exp $ */ +/* $NetBSD: i2c.c,v 1.78.2.5 2021/05/16 21:04:59 thorpej Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.78.2.4 2021/05/16 21:03:38 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.78.2.5 2021/05/16 21:04:59 thorpej Exp $"); #include #include @@ -1005,7 +1005,9 @@ iic_ioctl_exec(struct iic_softc *sc, i2c goto out; } - iic_acquire_bus(ic, 0); + if ((error = iic_acquire_bus(ic, 0)) != 0) { + goto out; + } error = iic_exec(ic, iie->iie_op, iie->iie_addr, cmd, iie->iie_cmdlen, buf, iie->iie_buflen, 0); iic_release_bus(ic, 0);
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Sun May 16 21:03:38 UTC 2021 Modified Files: src/sys/dev/i2c [thorpej-i2c-spi-conf]: i2c.c Log Message: - Set D_MCLOSE in the iic_cdevsw so that we get a d_close call for each close so that the module ref counting works properly. - Rearrange things a little to avoid holding the iic_mtx a long as previously done. To generate a diff of this commit: cvs rdiff -u -r1.78.2.3 -r1.78.2.4 src/sys/dev/i2c/i2c.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/i2c/i2c.c diff -u src/sys/dev/i2c/i2c.c:1.78.2.3 src/sys/dev/i2c/i2c.c:1.78.2.4 --- src/sys/dev/i2c/i2c.c:1.78.2.3 Sun May 16 04:40:08 2021 +++ src/sys/dev/i2c/i2c.c Sun May 16 21:03:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: i2c.c,v 1.78.2.3 2021/05/16 04:40:08 thorpej Exp $ */ +/* $NetBSD: i2c.c,v 1.78.2.4 2021/05/16 21:03:38 thorpej Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.78.2.3 2021/05/16 04:40:08 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.78.2.4 2021/05/16 21:03:38 thorpej Exp $"); #include #include @@ -115,13 +115,6 @@ static dev_type_open(iic_open); static dev_type_close(iic_close); static dev_type_ioctl(iic_ioctl); -int iic_init(void); - -kmutex_t iic_mtx; -int iic_refcnt; - -ONCE_DECL(iic_once); - const struct cdevsw iic_cdevsw = { .d_open = iic_open, .d_close = iic_close, @@ -134,11 +127,16 @@ const struct cdevsw iic_cdevsw = { .d_mmap = nommap, .d_kqfilter = nokqfilter, .d_discard = nodiscard, - .d_flag = D_OTHER + .d_flag = D_OTHER | D_MCLOSE, }; static void iic_smbus_intr_thread(void *); +static kmutex_t iic_mtx; +static int iic_refcnt; +static bool iic_unloading; +static ONCE_DECL(iic_once); + static struct i2c_device_link * iic_devslot_lookup(struct iic_softc *sc, i2c_addr_t addr) { @@ -928,22 +926,43 @@ iic_use_direct_match(const struct i2c_at static int iic_open(dev_t dev, int flag, int fmt, lwp_t *l) { - struct iic_softc *sc = device_lookup_private(_cd, minor(dev)); + struct iic_softc *sc; mutex_enter(_mtx); - if (sc == NULL) { + + if (iic_unloading) { mutex_exit(_mtx); return ENXIO; } + + /* Hold a refrence while we look up the softc. */ + if (iic_refcnt == INT_MAX) { + mutex_exit(_mtx); + return EBUSY; + } iic_refcnt++; + mutex_exit(_mtx); + sc = device_lookup_private(_cd, minor(dev)); + + if (sc == NULL) { + mutex_enter(_mtx); + iic_refcnt--; + mutex_exit(_mtx); + return ENXIO; + } + return 0; } static int iic_close(dev_t dev, int flag, int fmt, lwp_t *l) { + struct iic_softc *sc = device_lookup_private(_cd, minor(dev));; + + KASSERT(iic_refcnt != 0); + KASSERT(sc != NULL); mutex_enter(_mtx); iic_refcnt--; @@ -1037,7 +1056,7 @@ MODULE(MODULE_CLASS_DRIVER, iic, "i2cexe #include "ioconf.c" #endif -int +static int iic_init(void) { @@ -1084,19 +1103,26 @@ iic_modcmd(modcmd_t cmd, void *opaque) mutex_exit(_mtx); return EBUSY; } + iic_unloading = true; + mutex_exit(_mtx); #ifdef _MODULE error = config_fini_component(cfdriver_ioconf_iic, cfattach_ioconf_iic, cfdata_ioconf_iic); if (error != 0) { + mutex_enter(_mtx); + iic_unloading = false; mutex_exit(_mtx); break; } error = devsw_detach(NULL, _cdevsw); - if (error != 0) + if (error != 0) { config_init_component(cfdriver_ioconf_iic, cfattach_ioconf_iic, cfdata_ioconf_iic); + mutex_enter(_mtx); + iic_unloading = false; + mutex_exit(_mtx); + } #endif - mutex_exit(_mtx); break; default: error = ENOTTY;
CVS commit: src/lib/libutil
Module Name:src Committed By: kre Date: Sun May 16 19:42:35 UTC 2021 Modified Files: src/lib/libutil: parsedate.3 Log Message: PR bin/56042 Fix typos (2nd acst should have been acdt), 0550 for ist should be 0530 (5.5 hours is not 5 hours and 50 minutes...). Comment out the zp4 zp5 and zp6 zone names. They are supposedly supported by the source (they're in the table) but cannot work, as the parsedate lexer doesn't allow a "word" to start with an alpha and also contain digits. Maybe (just maybe) that could be fixed sometime, but since these have never worked, and no-one has ever seemed to miss them, and they're the only words which are of that form, for now, just stop pretending they work. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/lib/libutil/parsedate.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libutil/parsedate.3 diff -u src/lib/libutil/parsedate.3:1.25 src/lib/libutil/parsedate.3:1.26 --- src/lib/libutil/parsedate.3:1.25 Mon Oct 19 15:08:39 2020 +++ src/lib/libutil/parsedate.3 Sun May 16 19:42:35 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: parsedate.3,v 1.25 2020/10/19 15:08:39 kre Exp $ +.\" $NetBSD: parsedate.3,v 1.26 2021/05/16 19:42:35 kre Exp $ .\" .\" Copyright (c) 2006 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd October 19, 2020 +.Dd May 16, 2021 .Dt PARSEDATE 3 .Os .Sh NAME @@ -239,10 +239,10 @@ Timezone names: .Dv eet (+0200) , .Dv bt (+0300) , .Dv it (+0330) , -.Dv zp4 (+0400) , -.Dv zp5 (+0500) , -.Dv ist (+0550) , -.Dv zp6 (+0600) , +.\".Dv zp4 (+0400) , +.\".Dv zp5 (+0500) , +.Dv ist (+0530) , +.\".Dv zp6 (+0600) , .Dv ict (+0700) , .Dv wast (+0800) , .Dv wadt (+0900) , @@ -255,7 +255,7 @@ Timezone names: .Dv cast (+0930) , .Dv cadt (+1030) , .Dv acst (+0930) , -.Dv acst (+1030) , +.Dv acdt (+1030) , .Dv east (+1000) , .Dv eadt (+1100) , .Dv aest (+1000) ,
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Sun May 16 15:40:20 UTC 2021 Modified Files: src/sys/dev/i2c [thorpej-i2c-spi-conf]: spdmem_i2c.c Log Message: Check for errors from iic_acquire_bus(). To generate a diff of this commit: cvs rdiff -u -r1.21.4.2 -r1.21.4.3 src/sys/dev/i2c/spdmem_i2c.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/i2c/spdmem_i2c.c diff -u src/sys/dev/i2c/spdmem_i2c.c:1.21.4.2 src/sys/dev/i2c/spdmem_i2c.c:1.21.4.3 --- src/sys/dev/i2c/spdmem_i2c.c:1.21.4.2 Sun May 16 15:27:12 2021 +++ src/sys/dev/i2c/spdmem_i2c.c Sun May 16 15:40:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: spdmem_i2c.c,v 1.21.4.2 2021/05/16 15:27:12 thorpej Exp $ */ +/* $NetBSD: spdmem_i2c.c,v 1.21.4.3 2021/05/16 15:40:20 thorpej Exp $ */ /* * Copyright (c) 2007 Nicolas Joly @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.21.4.2 2021/05/16 15:27:12 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.21.4.3 2021/05/16 15:40:20 thorpej Exp $"); #include #include @@ -107,7 +107,9 @@ spdmem_reset_page(struct spdmem_i2c_soft reg = 0; - iic_acquire_bus(sc->sc_tag, 0); + if ((rv = iic_acquire_bus(sc->sc_tag, 0)) != 0) { + return rv; + } /* * Try to read byte 0 and 2. If it failed, it's not spdmem or a device @@ -306,7 +308,8 @@ spdmem_i2c_read(struct spdmem_softc *sof reg = addr & 0xff; - iic_acquire_bus(sc->sc_tag, 0); + if ((rv = iic_acquire_bus(sc->sc_tag, 0)) != 0) + return rv; if (addr & 0x100) { rv = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_page1,
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Sun May 16 15:27:12 UTC 2021 Modified Files: src/sys/dev/i2c [thorpej-i2c-spi-conf]: spdmem_i2c.c Log Message: The last change had an unfortunate side-effect on empty DIMM slots, so roll that back. Instead, if we used direct config, then probe for the module in the attach routine and report if the module is not present, rather than assuming that it is. Encapsulate the direct config logic for SPD into one place for clarity. To generate a diff of this commit: cvs rdiff -u -r1.21.4.1 -r1.21.4.2 src/sys/dev/i2c/spdmem_i2c.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/i2c/spdmem_i2c.c diff -u src/sys/dev/i2c/spdmem_i2c.c:1.21.4.1 src/sys/dev/i2c/spdmem_i2c.c:1.21.4.2 --- src/sys/dev/i2c/spdmem_i2c.c:1.21.4.1 Sun May 16 05:16:21 2021 +++ src/sys/dev/i2c/spdmem_i2c.c Sun May 16 15:27:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: spdmem_i2c.c,v 1.21.4.1 2021/05/16 05:16:21 thorpej Exp $ */ +/* $NetBSD: spdmem_i2c.c,v 1.21.4.2 2021/05/16 15:27:12 thorpej Exp $ */ /* * Copyright (c) 2007 Nicolas Joly @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.21.4.1 2021/05/16 05:16:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.21.4.2 2021/05/16 15:27:12 thorpej Exp $"); #include #include @@ -178,6 +178,48 @@ static const struct device_compatible_en DEVICE_COMPAT_EOL }; +/* + * Some device trees don't have real "compatible" entries, so we + * end up having to match by name. + */ +static const struct device_compatible_entry name_data[] = { + { .compat = "dimm-spd" }, + { .compat = "dimm" }, + DEVICE_COMPAT_EOL +}; + +static bool +spdmem_i2c_use_name_match(const struct i2c_attach_args *ia, int *match_resultp) +{ + const char *name = ia->ia_name; + + if (name != NULL) { + *match_resultp = device_compatible_match(, 1, name_data) + ? I2C_MATCH_DIRECT_COMPATIBLE + : 0; + return true; + } + return false; +} + +static bool +spdmem_i2c_use_direct_match(const struct i2c_attach_args *ia, const cfdata_t cf, + const struct device_compatible_entry *cdata, + int *match_resultp) +{ + if (iic_use_direct_match(ia, cf, cdata, match_resultp)) + return true; + + /* + * Matching by name is not ideal, but some device trees only + * have a name and no "compatible" property. + */ + if (spdmem_i2c_use_name_match(ia, match_resultp)) + return true; + + return false; +} + static int spdmem_i2c_match(device_t parent, cfdata_t match, void *aux) { @@ -185,45 +227,13 @@ spdmem_i2c_match(device_t parent, cfdata struct spdmem_i2c_softc sc; int match_result; - /* - * SPD stands for "Serial Presence Detect". This implies that - * if we're using direct configuration that we should treat - * that as a *hint*... it's entirely possible that a device - * tree lists locations where SPD memory can be found, not - * necessarily where memory is known to be present. - * - * Accordingly, if we get a direct configuration match based - * on compatible data or device name, we still check to see - * if the device is there. - */ - - if (iic_use_direct_match(ia, match, compat_data, _result)) { - if (match_result != 0) { - goto do_probe; - } - return 0; - } + if (spdmem_i2c_use_direct_match(ia, match, compat_data, _result)) + return match_result; - if (ia->ia_name) { - /* add other names as we find more firmware variations */ - if (strcmp(ia->ia_name, "dimm-spd") == 0 || - strcmp(ia->ia_name, "dimm") == 0) { - match_result = I2C_MATCH_DIRECT_SPECIFIC; - goto do_probe; - } + /* Filter out by address when not using direct config. */ + if ((ia->ia_addr & SPDMEM_I2C_ADDRMASK) != SPDMEM_I2C_ADDR) return 0; - } - /* As a last resort, filter out invalid addresses. */ - if ((ia->ia_addr & SPDMEM_I2C_ADDRMASK) == SPDMEM_I2C_ADDR) { - match_result = I2C_MATCH_ADDRESS_AND_PROBE; - goto do_probe; - } - - /* Not a candidate address. */ - return 0; - - do_probe: sc.sc_tag = ia->ia_tag; sc.sc_addr = ia->ia_addr; sc.sc_page0 = SPDCTL_SPA0; @@ -234,10 +244,9 @@ spdmem_i2c_match(device_t parent, cfdata if (spdmem_reset_page() != 0) return 0; - if (spdmem_common_probe(_base)) { - return match_result; - } - return 0; + return spdmem_common_probe(_base) + ? I2C_MATCH_ADDRESS_AND_PROBE + : 0; } static void @@ -245,6 +254,7 @@ spdmem_i2c_attach(device_t parent, devic { struct spdmem_i2c_softc *sc = device_private(self); struct i2c_attach_args *ia = aux; + int match_result; sc->sc_tag = ia->ia_tag; sc->sc_addr = ia->ia_addr; @@ -252,10 +262,28 @@ spdmem_i2c_attach(device_t parent, devic sc->sc_page1 = SPDCTL_SPA1; sc->sc_base.sc_read = spdmem_i2c_read; - if (!pmf_device_register(self, NULL, NULL)) - aprint_error_dev(self, "couldn't establish power handler\n"); + /* + * SPD stands for "Serial Presence Detect". If we're using + * direct
CVS commit: src
Module Name:src Committed By: rillig Date: Sun May 16 11:11:37 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/xlint/lint1: Makefile msg_034.c msg_034.exp msg_166.c msg_166.exp t_integration.sh src/usr.bin/xlint/lint1: decl.c err.c Added Files: src/tests/usr.bin/xlint/lint1: msg_344.c msg_344.exp Log Message: lint: add more specific warning for bit-field of type plain 'int' Previously, declaring a bit-field of type plain 'int' resulted in this warning: warning: nonportable bit-field type 'int' [34] This warning was too unspecific to be actionable, and until yesterday it didn't even include the type. In order to allow this warning to be understood and properly fixed, describe the actual nonportability more precisely: warning: bit-field of type plain 'int' has implementation-defined signedness [344] To generate a diff of this commit: cvs rdiff -u -r1.1051 -r1.1052 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.57 -r1.58 src/tests/usr.bin/xlint/lint1/Makefile cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/msg_034.c cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_034.exp \ src/tests/usr.bin/xlint/lint1/msg_166.exp cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_166.c cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_344.c \ src/tests/usr.bin/xlint/lint1/msg_344.exp cvs rdiff -u -r1.49 -r1.50 src/tests/usr.bin/xlint/lint1/t_integration.sh cvs rdiff -u -r1.181 -r1.182 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.118 -r1.119 src/usr.bin/xlint/lint1/err.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1051 src/distrib/sets/lists/tests/mi:1.1052 --- src/distrib/sets/lists/tests/mi:1.1051 Sun May 16 00:09:49 2021 +++ src/distrib/sets/lists/tests/mi Sun May 16 11:11:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1051 2021/05/16 00:09:49 rillig Exp $ +# $NetBSD: mi,v 1.1052 2021/05/16 11:11:36 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -6891,6 +6891,8 @@ ./usr/tests/usr.bin/xlint/lint1/msg_342.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_343.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/msg_343.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_344.c tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/xlint/lint1/msg_344.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/op_colon.c tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/op_colon.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/xlint/lint1/t_integration tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/xlint/lint1/Makefile diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.57 src/tests/usr.bin/xlint/lint1/Makefile:1.58 --- src/tests/usr.bin/xlint/lint1/Makefile:1.57 Sat May 15 19:12:14 2021 +++ src/tests/usr.bin/xlint/lint1/Makefile Sun May 16 11:11:37 2021 @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.57 2021/05/15 19:12:14 rillig Exp $ +# $NetBSD: Makefile,v 1.58 2021/05/16 11:11:37 rillig Exp $ NOMAN= # defined -MAX_MESSAGE= 343 # see lint1/err.c +MAX_MESSAGE= 344 # see lint1/err.c .include Index: src/tests/usr.bin/xlint/lint1/msg_034.c diff -u src/tests/usr.bin/xlint/lint1/msg_034.c:1.4 src/tests/usr.bin/xlint/lint1/msg_034.c:1.5 --- src/tests/usr.bin/xlint/lint1/msg_034.c:1.4 Sun May 16 10:34:19 2021 +++ src/tests/usr.bin/xlint/lint1/msg_034.c Sun May 16 11:11:37 2021 @@ -1,11 +1,28 @@ -/* $NetBSD: msg_034.c,v 1.4 2021/05/16 10:34:19 rillig Exp $ */ +/* $NetBSD: msg_034.c,v 1.5 2021/05/16 11:11:37 rillig Exp $ */ # 3 "msg_034.c" // Test for message: nonportable bit-field type '%s' [34] -/* lint1-flags: -S -g -p -w */ +/* No -g since GCC allows all integer types as bit-fields. */ +/* lint1-flags: -S -p -w */ +/* + * C90 3.5.2.1 allows 'int', 'signed int', 'unsigned int' as bit-field types. + * + * C99 6.7.2.1 significantly changed the wording of the allowable types for + * bit-fields. For example, 6.7.2.1p4 does not mention plain 'int' at all. + * The rationale for C99 6.7.2.1 mentions plain int though, and it would have + * broken a lot of existing code to disallow plain 'int' as a bit-field type. + * Footnote 104 explicitly mentions plain 'int' as well and it even allows + * typedef-types for bit-fields. + */ struct example { - int nonportable: 1; /* expect: 34 */ + /* expect+1: 34 */ + unsigned short ushort: 1; + + /* expect+1: 344 */ + int plain_int: 1; + + signed int signed_int: 1; unsigned int portable: 1; }; Index: src/tests/usr.bin/xlint/lint1/msg_034.exp diff -u src/tests/usr.bin/xlint/lint1/msg_034.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_034.exp:1.4 ---
CVS commit: src
Module Name:src Committed By: rillig Date: Sun May 16 10:34:19 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_034.c msg_034.exp msg_166.exp src/usr.bin/xlint/lint1: decl.c err.c Log Message: lint: add type information to unportable bit-field type Seeing the message "unportable bit-field type 'int'" may sound strange at first, but that's a strict interpretation of the wording in C99 6.7.2.1p4, which requires that the bit-field type is "'_Bool', 'unsigned int' or 'signed int', or some other implementation-defined type". The rationale for C99 6.7.2.1 explicitly lists plain 'int' among the allowed types for bit-fields, regardless of any additional implementation-defined types. This means that lint had interpreted this paragraph wrong, and it should be fixed to allow plain int as well. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_034.c cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_034.exp \ src/tests/usr.bin/xlint/lint1/msg_166.exp cvs rdiff -u -r1.180 -r1.181 src/usr.bin/xlint/lint1/decl.c cvs rdiff -u -r1.117 -r1.118 src/usr.bin/xlint/lint1/err.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_034.c diff -u src/tests/usr.bin/xlint/lint1/msg_034.c:1.3 src/tests/usr.bin/xlint/lint1/msg_034.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_034.c:1.3 Sun Jan 31 11:12:07 2021 +++ src/tests/usr.bin/xlint/lint1/msg_034.c Sun May 16 10:34:19 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_034.c,v 1.3 2021/01/31 11:12:07 rillig Exp $ */ +/* $NetBSD: msg_034.c,v 1.4 2021/05/16 10:34:19 rillig Exp $ */ # 3 "msg_034.c" -// Test for message: nonportable bit-field type [34] +// Test for message: nonportable bit-field type '%s' [34] /* lint1-flags: -S -g -p -w */ Index: src/tests/usr.bin/xlint/lint1/msg_034.exp diff -u src/tests/usr.bin/xlint/lint1/msg_034.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_034.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_034.exp:1.2 Sun Jan 3 15:35:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_034.exp Sun May 16 10:34:19 2021 @@ -1 +1 @@ -msg_034.c(9): warning: nonportable bit-field type [34] +msg_034.c(9): warning: nonportable bit-field type 'int' [34] Index: src/tests/usr.bin/xlint/lint1/msg_166.exp diff -u src/tests/usr.bin/xlint/lint1/msg_166.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_166.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_166.exp:1.2 Sun Jan 31 13:11:08 2021 +++ src/tests/usr.bin/xlint/lint1/msg_166.exp Sun May 16 10:34:19 2021 @@ -1,5 +1,5 @@ -msg_166.c(25): warning: nonportable bit-field type [34] -msg_166.c(26): warning: nonportable bit-field type [34] +msg_166.c(25): warning: nonportable bit-field type 'int' [34] +msg_166.c(26): warning: nonportable bit-field type 'int' [34] msg_166.c(35): warning: precision lost in bit-field assignment [166] msg_166.c(38): warning: precision lost in bit-field assignment [166] msg_166.c(39): warning: precision lost in bit-field assignment [166] Index: src/usr.bin/xlint/lint1/decl.c diff -u src/usr.bin/xlint/lint1/decl.c:1.180 src/usr.bin/xlint/lint1/decl.c:1.181 --- src/usr.bin/xlint/lint1/decl.c:1.180 Sun May 2 22:07:49 2021 +++ src/usr.bin/xlint/lint1/decl.c Sun May 16 10:34:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: decl.c,v 1.180 2021/05/02 22:07:49 rillig Exp $ */ +/* $NetBSD: decl.c,v 1.181 2021/05/16 10:34:19 rillig Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved. @@ -38,7 +38,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: decl.c,v 1.180 2021/05/02 22:07:49 rillig Exp $"); +__RCSID("$NetBSD: decl.c,v 1.181 2021/05/16 10:34:19 rillig Exp $"); #endif #include @@ -1106,14 +1106,14 @@ check_bit_field_type(sym_t *dsym, type_ /* bit-field type '%s' invalid in ANSI C */ warning(273, type_name(tp)); } else if (pflag) { -/* nonportable bit-field type */ -warning(34); +/* nonportable bit-field type '%s' */ +warning(34, type_name(tp)); } } } else if (t == INT && dcs->d_sign_mod == NOTSPEC) { if (pflag && !bitfieldtype_ok) { - /* nonportable bit-field type */ - warning(34); + /* nonportable bit-field type '%s' */ + warning(34, type_name(tp)); } } else if (t != INT && t != UINT && t != BOOL) { /* Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.117 src/usr.bin/xlint/lint1/err.c:1.118 --- src/usr.bin/xlint/lint1/err.c:1.117 Sun May 16 10:18:24 2021 +++ src/usr.bin/xlint/lint1/err.c Sun May 16 10:34:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.117 2021/05/16 10:18:24 rillig Exp $ */ +/* $NetBSD: err.c,v 1.118 2021/05/16 10:34:19 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: err.c,v 1.117 2021/05/16 10:18:24 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.118
CVS commit: src
Module Name:src Committed By: rillig Date: Sun May 16 10:18:25 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_309.c msg_309.exp src/usr.bin/xlint/lint1: err.c Log Message: lint: add quotes to message 309 about constant conversion To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_309.c \ src/tests/usr.bin/xlint/lint1/msg_309.exp cvs rdiff -u -r1.116 -r1.117 src/usr.bin/xlint/lint1/err.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_309.c diff -u src/tests/usr.bin/xlint/lint1/msg_309.c:1.3 src/tests/usr.bin/xlint/lint1/msg_309.c:1.4 --- src/tests/usr.bin/xlint/lint1/msg_309.c:1.3 Sun May 16 10:08:01 2021 +++ src/tests/usr.bin/xlint/lint1/msg_309.c Sun May 16 10:18:25 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: msg_309.c,v 1.3 2021/05/16 10:08:01 rillig Exp $ */ +/* $NetBSD: msg_309.c,v 1.4 2021/05/16 10:18:25 rillig Exp $ */ # 3 "msg_309.c" -// Test for message: extra bits set to 0 in conversion of '%s' to '%s', op %s [309] +// Test for message: extra bits set to 0 in conversion of '%s' to '%s', op '%s' [309] int scale(unsigned long long x) { Index: src/tests/usr.bin/xlint/lint1/msg_309.exp diff -u src/tests/usr.bin/xlint/lint1/msg_309.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_309.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_309.exp:1.3 Sun May 16 10:08:01 2021 +++ src/tests/usr.bin/xlint/lint1/msg_309.exp Sun May 16 10:18:25 2021 @@ -1 +1 @@ -msg_309.c(23): warning: extra bits set to 0 in conversion of 'unsigned int' to 'unsigned long long', op & [309] +msg_309.c(23): warning: extra bits set to 0 in conversion of 'unsigned int' to 'unsigned long long', op '&' [309] Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.116 src/usr.bin/xlint/lint1/err.c:1.117 --- src/usr.bin/xlint/lint1/err.c:1.116 Sun Apr 18 17:36:18 2021 +++ src/usr.bin/xlint/lint1/err.c Sun May 16 10:18:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: err.c,v 1.116 2021/04/18 17:36:18 rillig Exp $ */ +/* $NetBSD: err.c,v 1.117 2021/05/16 10:18:24 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: err.c,v 1.116 2021/04/18 17:36:18 rillig Exp $"); +__RCSID("$NetBSD: err.c,v 1.117 2021/05/16 10:18:24 rillig Exp $"); #endif #include @@ -363,7 +363,7 @@ const char *const msgs[] = { "constant truncated by conversion, op %s", /* 306 */ "static variable %s set but not used", /* 307 */ "invalid type for _Complex", /* 308 */ - "extra bits set to 0 in conversion of '%s' to '%s', op %s", /* 309 */ + "extra bits set to 0 in conversion of '%s' to '%s', op '%s'", /* 309 */ "symbol renaming can't be used on function arguments", /* 310 */ "symbol renaming can't be used on automatic variables", /* 311 */ "%s C does not support // comments", /* 312 */
CVS commit: src/tests/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Sun May 16 10:08:02 UTC 2021 Modified Files: src/tests/usr.bin/xlint/lint1: msg_309.c msg_309.exp Log Message: tests/lint: add test for warning about zero-bits in '&' To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_309.c \ src/tests/usr.bin/xlint/lint1/msg_309.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_309.c diff -u src/tests/usr.bin/xlint/lint1/msg_309.c:1.2 src/tests/usr.bin/xlint/lint1/msg_309.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_309.c:1.2 Sun Feb 21 09:07:58 2021 +++ src/tests/usr.bin/xlint/lint1/msg_309.c Sun May 16 10:08:01 2021 @@ -1,7 +1,39 @@ -/* $NetBSD: msg_309.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */ +/* $NetBSD: msg_309.c,v 1.3 2021/05/16 10:08:01 rillig Exp $ */ # 3 "msg_309.c" // Test for message: extra bits set to 0 in conversion of '%s' to '%s', op %s [309] -TODO: "Add example code that triggers the above message." /* expect: 249 */ -TODO: "Add example code that almost triggers the above message." +int +scale(unsigned long long x) { + + /* + * Both operands of '&' have the same type, therefore no conversion + * is necessary and no bits can get lost. + */ + if ((x & 0xULL) != 0) + return 32; + + /* + * The constant has type 'unsigned 32-bit'. The usual arithmetic + * conversions of '&' convert this constant to unsigned 64-bit. + * The programmer may or may not have intended to sign-extend the + * bit mask here. This situation may occur during migration from a + * 32-bit to a 64-bit platform. + */ + if ((x & 0x) != 0) /* expect: 309 */ + return 16; + + /* + * In the remaining cases, the constant does not have its most + * significant bit set, therefore there is no ambiguity. + */ + if ((x & 0xff00) != 0) + return 8; + if ((x & 0xf0) != 0) + return 4; + if ((x & 0xc) != 0) + return 2; + if ((x & 0x2) != 0) + return 1; + return (int)(x & 0x1); +} Index: src/tests/usr.bin/xlint/lint1/msg_309.exp diff -u src/tests/usr.bin/xlint/lint1/msg_309.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_309.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_309.exp:1.2 Sun Mar 21 20:45:00 2021 +++ src/tests/usr.bin/xlint/lint1/msg_309.exp Sun May 16 10:08:01 2021 @@ -1 +1 @@ -msg_309.c(6): error: syntax error ':' [249] +msg_309.c(23): warning: extra bits set to 0 in conversion of 'unsigned int' to 'unsigned long long', op & [309]
CVS commit: src/common/lib/libc/string
Module Name:src Committed By: rillig Date: Sun May 16 09:43:39 UTC 2021 Modified Files: src/common/lib/libc/string: memmem.c Log Message: memmem: remove unreachable return statement To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/string/memmem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/string/memmem.c diff -u src/common/lib/libc/string/memmem.c:1.3 src/common/lib/libc/string/memmem.c:1.4 --- src/common/lib/libc/string/memmem.c:1.3 Mon Oct 15 19:32:48 2018 +++ src/common/lib/libc/string/memmem.c Sun May 16 09:43:39 2021 @@ -25,7 +25,7 @@ #if 0 __FBSDID("$FreeBSD: head/lib/libc/string/memmem.c 315468 2017-03-18 00:53:24Z emaste $"); #else -__RCSID("$NetBSD: memmem.c,v 1.3 2018/10/15 19:32:48 christos Exp $"); +__RCSID("$NetBSD: memmem.c,v 1.4 2021/05/16 09:43:39 rillig Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -63,7 +63,6 @@ static char *fourbyte_memmem(const unsig for (h += 4, k -= 4; k; k--, hw = hw << 8 | *h++) if (hw == nw) return __UNCONST(h - 4); return hw == nw ? __UNCONST(h - 4) : 0; - return 0; } #define MAX(a,b) ((a)>(b)?(a):(b))
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun May 16 09:17:23 UTC 2021 Modified Files: src/sys/dev/usb: uvideo.c Log Message: close pipe before freeing frame length array. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/usb/uvideo.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/usb/uvideo.c diff -u src/sys/dev/usb/uvideo.c:1.59 src/sys/dev/usb/uvideo.c:1.60 --- src/sys/dev/usb/uvideo.c:1.59 Mon Aug 10 19:27:27 2020 +++ src/sys/dev/usb/uvideo.c Sun May 16 09:17:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uvideo.c,v 1.59 2020/08/10 19:27:27 rjs Exp $ */ +/* $NetBSD: uvideo.c,v 1.60 2021/05/16 09:17:23 mlelstv Exp $ */ /* * Copyright (c) 2008 Patrick Mahoney @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.59 2020/08/10 19:27:27 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.60 2021/05/16 09:17:23 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1659,7 +1659,15 @@ uvideo_stream_stop_xfer(struct uvideo_st usbd_destroy_xfer(isoc->i_xfer); isoc->i_xfer = NULL; } + } + + if (ix->ix_pipe != NULL) { + usbd_close_pipe(ix->ix_pipe); + ix->ix_pipe = NULL; + } + for (i = 0; i < UVIDEO_NXFERS; i++) { + struct uvideo_isoc *isoc = >ix_i[i]; if (isoc->i_frlengths != NULL) { kmem_free(isoc->i_frlengths, sizeof(isoc->i_frlengths[0]) * @@ -1668,10 +1676,6 @@ uvideo_stream_stop_xfer(struct uvideo_st } } - if (ix->ix_pipe != NULL) { - usbd_close_pipe(ix->ix_pipe); - ix->ix_pipe = NULL; - } /* Give it some time to settle */ usbd_delay_ms(vs->vs_parent->sc_udev, 1000);
CVS commit: src/sys/arch/riscv/riscv
Module Name:src Committed By: skrll Date: Sun May 16 09:02:04 UTC 2021 Modified Files: src/sys/arch/riscv/riscv: locore.S Log Message: s/ENTRY/ENTRY_NP/ in a few places To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/riscv/riscv/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/riscv/riscv/locore.S diff -u src/sys/arch/riscv/riscv/locore.S:1.21 src/sys/arch/riscv/riscv/locore.S:1.22 --- src/sys/arch/riscv/riscv/locore.S:1.21 Sat May 1 07:10:34 2021 +++ src/sys/arch/riscv/riscv/locore.S Sun May 16 09:02:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.21 2021/05/01 07:10:34 skrll Exp $ */ +/* $NetBSD: locore.S,v 1.22 2021/05/16 09:02:04 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -479,7 +479,7 @@ END(cpu_exception_handler) // int cpu_set_onfault(struct faultbuf *fb, register_t retval) // -ENTRY(cpu_set_onfault) +ENTRY_NP(cpu_set_onfault) REG_S ra, FB_RA(a0) REG_S s0, FB_S0(a0) REG_S s1, FB_S1(a0) @@ -500,7 +500,7 @@ ENTRY(cpu_set_onfault) ret END(cpu_set_onfault) -ENTRY(setjmp) +ENTRY_NP(setjmp) REG_S ra, FB_RA(a0) REG_S s0, FB_S0(a0) REG_S s1, FB_S1(a0) @@ -519,7 +519,7 @@ ENTRY(setjmp) ret END(setjmp) -ENTRY(longjmp) +ENTRY_NP(longjmp) REG_L ra, FB_RA(a0) REG_L s0, FB_S0(a0) REG_L s1, FB_S1(a0)
CVS commit: src/sys/dev/spi
Module Name:src Committed By: mlelstv Date: Sun May 16 08:48:20 UTC 2021 Modified Files: src/sys/dev/spi: spi.c Log Message: Protect ioctl and declare MPSAFE. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/spi/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/spi.c diff -u src/sys/dev/spi/spi.c:1.17 src/sys/dev/spi/spi.c:1.18 --- src/sys/dev/spi/spi.c:1.17 Sat Apr 24 23:36:59 2021 +++ src/sys/dev/spi/spi.c Sun May 16 08:48:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: spi.c,v 1.17 2021/04/24 23:36:59 thorpej Exp $ */ +/* $NetBSD: spi.c,v 1.18 2021/05/16 08:48:20 mlelstv Exp $ */ /*- * Copyright (c) 2006 Urbana-Champaign Independent Media Center. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.17 2021/04/24 23:36:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.18 2021/05/16 08:48:20 mlelstv Exp $"); #include "locators.h" @@ -70,6 +70,7 @@ struct spi_softc { struct spi_handle *sc_slaves; kmutex_t sc_lock; kcondvar_t sc_cv; + kmutex_t sc_dev_lock; int sc_flags; #define SPIC_BUSY 1 }; @@ -90,7 +91,7 @@ const struct cdevsw spi_cdevsw = { .d_mmap = nommap, .d_kqfilter = nokqfilter, .d_discard = nodiscard, - .d_flag = D_OTHER + .d_flag = D_OTHER | D_MPSAFE }; /* @@ -287,6 +288,7 @@ spi_attach(device_t parent, device_t sel aprint_naive(": SPI bus\n"); aprint_normal(": SPI bus\n"); + mutex_init(>sc_dev_lock, MUTEX_DEFAULT, IPL_NONE); mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_VM); cv_init(>sc_cv, "spictl"); @@ -350,6 +352,8 @@ spi_ioctl(dev_t dev, u_long cmd, void *d if (sc == NULL) return ENXIO; + mutex_enter(>sc_dev_lock); + switch (cmd) { case SPI_IOCTL_CONFIGURE: sic = (spi_ioctl_configure_t *)data; @@ -408,6 +412,8 @@ spi_ioctl(dev_t dev, u_long cmd, void *d break; } + mutex_exit(>sc_dev_lock); + return error; }
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sun May 16 08:46:38 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: Try to guess attributes better. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.52 src/sys/dev/wscons/wsdisplay_vcons.c:1.53 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.52 Sun May 16 08:44:26 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun May 16 08:46:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.53 2021/05/16 08:46:38 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.53 2021/05/16 08:46:38 mlelstv Exp $"); #include #include @@ -1404,6 +1404,7 @@ vcons_getwschar(struct vcons_screen *scr int offset; long attr; struct rasops_info *ri; + int fg, bg, ul; KASSERT(scr != NULL && wsc != NULL); @@ -1433,18 +1434,38 @@ vcons_getwschar(struct vcons_screen *scr wsc->letter = scr->scr_chars[offset]; attr = scr->scr_attrs[offset]; +#ifdef VCONS_DEBUG + printf("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row, + wsc->col, wsc->letter, attr); +#endif + /* * this is ugly. We need to break up an attribute into colours and * flags but there's no rasops method to do that so we must rely on * the 'canonical' encoding. */ -#ifdef VCONS_DEBUG - printf("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row, - wsc->col, wsc->letter, attr); -#endif - wsc->foreground = (attr >> 24) & 0xff; - wsc->background = (attr >> 16) & 0xff; - wsc->flags = attr & 0xff; + + /* only fetches underline attribute */ + /* rasops_unpack_attr(attr, , , ); */ + fg = (attr >> 24) & 0xf; + bg = (attr >> 16) & 0xf; + ul = (attr & 1); + + wsc->foreground = fg; + wsc->background = bg; + + /* clear trashed bits and restore underline flag */ + attr &= ~(WSATTR_HILIT | WSATTR_BLINK | WSATTR_UNDERLINE); + if (ul) + attr |= WSATTR_UNDERLINE; + + /* restore highlight boost */ + if (attr & WSATTR_HILIT) + if (wsc->foreground >= 8) + wsc->foreground -= 8; + + /* we always use colors, even when not stored */ + attr |= WSATTR_WSCOLORS; return 0; }
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sun May 16 08:44:26 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: No need to check cell count. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.51 src/sys/dev/wscons/wsdisplay_vcons.c:1.52 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.51 Thu Jan 28 17:40:00 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun May 16 08:44:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $"); #include #include @@ -1630,9 +1630,6 @@ vcons_invalidate_cache(struct vcons_data { int i; - if (vd->cells == 0) - return; - for (i = 0; i < vd->cells; i++) { vd->chars[i] = -1; vd->attrs[i] = -1;
CVS commit: othersrc/usr.bin/tnftp
Module Name:othersrc Committed By: lukem Date: Sun May 16 08:28:50 UTC 2021 Modified Files: othersrc/usr.bin/tnftp: COPYING Log Message: copyright 2021 To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 othersrc/usr.bin/tnftp/COPYING Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/tnftp/COPYING diff -u othersrc/usr.bin/tnftp/COPYING:1.8 othersrc/usr.bin/tnftp/COPYING:1.9 --- othersrc/usr.bin/tnftp/COPYING:1.8 Sun Jul 5 11:13:12 2020 +++ othersrc/usr.bin/tnftp/COPYING Sun May 16 08:28:50 2021 @@ -1,6 +1,6 @@ -$NetBSD: COPYING,v 1.8 2020/07/05 11:13:12 lukem Exp $ +$NetBSD: COPYING,v 1.9 2021/05/16 08:28:50 lukem Exp $ -Copyright (c) 2001-2020 The NetBSD Foundation, Inc. +Copyright (c) 2001-2021 The NetBSD Foundation, Inc. All rights reserved. This code is derived from software contributed to The NetBSD Foundation
CVS commit: othersrc/usr.bin/tnftp
Module Name:othersrc Committed By: lukem Date: Sun May 16 08:28:01 UTC 2021 Modified Files: othersrc/usr.bin/tnftp: ChangeLog INSTALL Log Message: update INSTALL notes To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 othersrc/usr.bin/tnftp/ChangeLog cvs rdiff -u -r1.6 -r1.7 othersrc/usr.bin/tnftp/INSTALL Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: othersrc/usr.bin/tnftp/ChangeLog diff -u othersrc/usr.bin/tnftp/ChangeLog:1.75 othersrc/usr.bin/tnftp/ChangeLog:1.76 --- othersrc/usr.bin/tnftp/ChangeLog:1.75 Sun Apr 25 09:29:43 2021 +++ othersrc/usr.bin/tnftp/ChangeLog Sun May 16 08:28:01 2021 @@ -1,4 +1,9 @@ -$NetBSD: ChangeLog,v 1.75 2021/04/25 09:29:43 lukem Exp $ +$NetBSD: ChangeLog,v 1.76 2021/05/16 08:28:01 lukem Exp $ + + +Sun May 16 08:25:55 UTC 2021 lukem + + * Update INSTALL notes to reflect current configure. Sun Apr 25 09:24:51 UTC 2021 lukem Index: othersrc/usr.bin/tnftp/INSTALL diff -u othersrc/usr.bin/tnftp/INSTALL:1.6 othersrc/usr.bin/tnftp/INSTALL:1.7 --- othersrc/usr.bin/tnftp/INSTALL:1.6 Mon Aug 6 01:58:04 2007 +++ othersrc/usr.bin/tnftp/INSTALL Sun May 16 08:28:01 2021 @@ -3,58 +3,48 @@ INSTALLATION INTRODUCTION This file describes how to compile and install tnftp on your system. - - = = - = NOTE: You will need an ANSI C compiler. = - = = - - +NOTE: You will need an ANSI C compiler. For most systems, execute the following to compile and install tnftp: ./configure make make install -A preformatted manual page (src/ftp.cat1) is also installed. -If you wish to install the source (src/ftp.1), ensure that your system -has up-to-date mandoc macros, such as those that are shipped with groff. - CONFIGURATION OPTIONS - -tnftp is configured using an `autoconf' generated `configure' -script. `configure' supports the following options: +tnftp is configured using an `autoconf' generated `configure' script. + +`configure' supports various options including: * The standard `autoconf configure' options, including: + -h, --help display this help and exit --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --srcdir=DIRfind the sources in DIR [configure dir or ..] - BSD or GNU make may be required for this to work. + [PREFIX] * Specific options: - --enable-editcomplete Turn on command line editing and completion. - (default: enabled) - --enable-ipv6 Enable IPv6 support (if your OS supports it). - (default: enabled) - --disable-largefile omit support for large files + --enable-editcomplete turn on command line editing and completion + (requires system or local libedit) [default=enabled] + --enable-ipv6 enable IPv6 support (if your OS supports it) + [default=enabled] + --enable-sslenable SSL support (requires --with-openssl) + [default=auto] + --with-local-libedituse local libedit instead of system library: yes; + auto (try system, fallback to local); no + [default=auto] --with-socksenable support for (Dante) SOCKS5 proxy + [default=auto] + --with-openssl=DIR root of the OpenSSL directory The following environment variables can be set to override various compiler related settings. - CC=compiler specify name of the C compiler (default: gcc or cc) - CFLAGS=flags specify flags to C compiler (default: -O -g or just -O) - LDFLAGS=flags specify flags to linker (default: none) + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory This can be achieved with: env CC="compiler" CFLAGS="flags" LDFLAGS="flags" ./configure - - - - = = - = NOTE: You will need an ANSI C compiler. = - = = - -