CVS commit: src/sys/dev/pci

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 05:57:35 UTC 2019

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
No functional change:
- ac -> ec
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.331 -r1.332 src/sys/dev/pci/if_bge.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/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.331 src/sys/dev/pci/if_bge.c:1.332
--- src/sys/dev/pci/if_bge.c:1.331	Thu May 23 10:51:39 2019
+++ src/sys/dev/pci/if_bge.c	Fri May 24 05:57:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.331 2019/05/23 10:51:39 msaitoh Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.332 2019/05/24 05:57:35 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.331 2019/05/23 10:51:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.332 2019/05/24 05:57:35 msaitoh Exp $");
 
 #include 
 #include 
@@ -1559,8 +1559,8 @@ bge_newbuf_jumbo(struct bge_softc *sc, i
 	if (!(sc->bge_flags & BGEF_RX_ALIGNBUG))
 	m_adj(m_new, ETHER_ALIGN);
 	bus_dmamap_sync(sc->bge_dmatag, sc->bge_cdata.bge_rx_jumbo_map,
-	mtod(m_new, char *) - (char *)sc->bge_cdata.bge_jumbo_buf, BGE_JLEN,
-	BUS_DMASYNC_PREREAD);
+	mtod(m_new, char *) - (char *)sc->bge_cdata.bge_jumbo_buf,
+	BGE_JLEN, BUS_DMASYNC_PREREAD);
 	/* Set up the descriptor. */
 	r = >bge_rdata->bge_rx_jumbo_ring[i];
 	sc->bge_cdata.bge_rx_jumbo_chain[i] = m_new;
@@ -1794,8 +1794,8 @@ alloc_done:
 static void
 bge_setmulti(struct bge_softc *sc)
 {
-	struct ethercom		*ac = >ethercom;
-	struct ifnet		*ifp = >ec_if;
+	struct ethercom		*ec = >ethercom;
+	struct ifnet		*ifp = >ec_if;
 	struct ether_multi	*enm;
 	struct ether_multistep	step;
 	uint32_t		hashes[4] = { 0, 0, 0, 0 };
@@ -1806,7 +1806,7 @@ bge_setmulti(struct bge_softc *sc)
 		goto allmulti;
 
 	/* Now program new ones. */
-	ETHER_FIRST_MULTI(step, ac, enm);
+	ETHER_FIRST_MULTI(step, ec, enm);
 	while (enm != NULL) {
 		if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
 			/*
@@ -2317,8 +2317,7 @@ bge_blockinit(struct bge_softc *sc)
 	if (!BGE_IS_5705_PLUS(sc)) {
 		/* 57XX step 33 */
 		/* Configure mbuf memory pool */
-		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_BASEADDR,
-		BGE_BUFFPOOL_1);
+		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_BASEADDR, BGE_BUFFPOOL_1);
 
 		if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5704)
 			CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_LEN, 0x1);
@@ -4452,9 +4451,8 @@ bge_rxeof(struct bge_softc *sc)
 		 * If we received a packet with a vlan tag, pass it
 		 * to vlan_input() instead of ether_input().
 		 */
-		if (cur_rx->bge_flags & BGE_RXBDFLAG_VLAN_TAG) {
+		if (cur_rx->bge_flags & BGE_RXBDFLAG_VLAN_TAG)
 			vlan_set_tag(m, cur_rx->bge_vlan_tag);
-		}
 
 		if_percpuq_enqueue(ifp->if_percpuq, m);
 	}
@@ -4927,8 +4925,7 @@ bge_compact_dma_runt(struct mbuf *pkt)
 			prev->m_next = m_free(m);
 			m = prev;
 			continue;
-		}
-		else if (m->m_next != NULL &&
+		} else if (m->m_next != NULL &&
 			 M_TRAILINGSPACE(m) >= shortfall &&
 			 m->m_next->m_len >= (8 + shortfall)) {
 		/* m is writable and have enough data in next, pull up. */
@@ -4938,15 +4935,17 @@ bge_compact_dma_runt(struct mbuf *pkt)
 			m->m_len += shortfall;
 			m->m_next->m_len -= shortfall;
 			m->m_next->m_data += shortfall;
-		}
-		else if (m->m_next == NULL || 1) {
+		} else if (m->m_next == NULL || 1) {
 			/* Got a runt at the very end of the packet.
 			 * borrow data from the tail of the preceding mbuf and
-			 * update its length in-place. (The original data is still
-			 * valid, so we can do this even if prev is not writable.)
+			 * update its length in-place. (The original data is
+			 * still valid, so we can do this even if prev is not
+			 * writable.)
 			 */
 
-			/* if we'd make prev a runt, just move all of its data. */
+			/*
+			 * If we'd make prev a runt, just move all of its data.
+			 */
 			KASSERT(prev != NULL /*, ("runt but null PREV")*/);
 			KASSERT(prev->m_len >= 8 /*, ("runt prev")*/);
 
@@ -4958,10 +4957,11 @@ bge_compact_dma_runt(struct mbuf *pkt)
 if (M_LEADINGSPACE(m) < shorfall) {
 	void *m_dat;
 	m_dat = (m->m_flags & M_PKTHDR) ?
-	  m->m_pktdat : m->dat;
-	memmove(m_dat, mtod(m, void*), m->m_len);
+	m->m_pktdat : m->dat;
+	memmove(m_dat, mtod(m, void*),
+	m->m_len);
 	m->m_data = m_dat;
-}
+}
 			} else
 #endif	/* just do the safe slow thing */
 			{
@@ -5198,12 +5198,10 @@ doit:
 			txbd_tso_flags |=
 			((bge_hlen & 0xF8) << 7) | ((bge_hlen & 0x4) << 2);
 		} else if (BGE_IS_5705_PLUS(sc)) {
-			tcp_seg_flags =
-bge_hlen << 11;
+			tcp_seg_flags = bge_hlen << 11;
 		} else {
 			/* XXX iptcp_opt_words or bge_hlen ? */
-			txbd_tso_flags |=
-iptcp_opt_words << 12;
+			txbd_tso_flags |= iptcp_opt_words << 12;
 		}
 		maxsegsize = mss | 

CVS commit: src/sys/dev/pci

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 05:57:35 UTC 2019

Modified Files:
src/sys/dev/pci: if_bge.c

Log Message:
No functional change:
- ac -> ec
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.331 -r1.332 src/sys/dev/pci/if_bge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/include

2019-05-23 Thread Kamil Rytarowski
On 23.05.2019 16:09, m...@netbsd.org wrote:
> On Thu, May 23, 2019 at 09:05:00AM +0200, Martin Husemann wrote:
>> On Thu, May 23, 2019 at 12:03:33AM +0200, Kamil Rytarowski wrote:
> -#if ((__cplusplus - 0) < 201103L)
> +#if defined(_ISOC11_SOURCE) || (__STDC_VERSION__ - 0) >= 201101L
>>
>> Am I missing something or does this (in addition to the intended change)
>> make the macro invisible for C++ compilations? Is that intended? If so,
>> shouldn't it be explained in the log message?
>>
>> Martin
> 
> Per the standards:
> static_assert / _Static_assert is meaningful for >=C11
> static_assert is meaningful for >=C++11
> 
>  >= C++11 : handled by libstdc++ / libc++
>  >= C11   : handled by us, in this case and before.
> 
> Should it mean something for:
>  < C++11
>  < C11
> 
> The older version attempted to provide < C++11 and < C11 static_assert,
> too.
> 
> This is causing problems because g++ does not provide _Static_assert in
> the case of building older C++ code.
> 
> Kamil argued you should just not use it if it doesn't work.
> My argument was that we shouldn't provide a broken definition.
> 
> The code from the bug report did:
> #if defined(static_assert)
> .. fallback definition ..
> #endif
> 
> I think it is reasonable for this to work.
> 
> We can probably keep providing it for all C standards, I guess. that was
> the "that's so solaris" argument. GCC does not cause problems with that.
> 

The solaris case is that we need to define very precise set of
POSIX_SOURCE/XOPEN/C_SOURCE/etc namespace, and it's difficult sometimes
to get some programs to build cleanly as there are occurrences of
missing prototypes as something is protected by a different version of
namespace. Personally, I was trying to improve SmartOS support for qemu
and fix missing prototypes, but I gave up with the maze of ifdefs.

The following patch makes static_assert functional for me for all C and
C++ standards with GCC/G++:

http://netbsd.org/~kamil/patch-00113-static_assert.txt]

It removes usage of the message command, but in practice it probably
doesn't matter. In C++17 this message argument is optional.

173 kamil@chieftec /tmp $ g++ -std=c++11 test.c
test.c: In function ‘int main(int, char**)’:
test.c:6:2: error: static assertion failed: Hello
  static_assert(sizeof(argc) == 1, "Hello");
  ^
174 kamil@chieftec /tmp $ g++ -std=c++17 test.c
test.c: In function ‘int main(int, char**)’:
test.c:6:2: error: static assertion failed: Hello
  static_assert(sizeof(argc) == 1, "Hello");
  ^
175 kamil@chieftec /tmp $ g++ -std=c++98 test.c
In file included from /usr/include/assert.h:44:0,
 from test.c:1:
test.c: In function ‘int main(int, char**)’:
test.c:6:2: error: size of array ‘__ctassert0’ is negative
  static_assert(sizeof(argc) == 1, "Hello");

If this is fine, I will add ATF test for a combination of C and C++
standards.



signature.asc
Description: OpenPGP digital signature


CVS commit: src/sys/arch/arm/imx

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 00:13:25 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c

Log Message:
 Fix compile error.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/imx/if_enet.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/arm/imx/if_enet.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.21 src/sys/arch/arm/imx/if_enet.c:1.22
--- src/sys/arch/arm/imx/if_enet.c:1.21	Thu May 23 13:10:50 2019
+++ src/sys/arch/arm/imx/if_enet.c	Fri May 24 00:13:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.21 2019/05/23 13:10:50 msaitoh Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.22 2019/05/24 00:13:25 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.21 2019/05/23 13:10:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.22 2019/05/24 00:13:25 msaitoh Exp $");
 
 #include "vlan.h"
 
@@ -174,11 +174,10 @@ void
 enet_attach_common(device_t self, bus_space_tag_t iot,
 bus_dma_tag_t dmat, bus_addr_t addr, bus_size_t size, int irq)
 {
-	struct enet_softc *sc;
+	struct enet_softc *sc = device_private(self);
 	struct ifnet *ifp;
 	struct mii_data * const mii = >sc_mii;
 
-	sc = device_private(self);
 	sc->sc_dev = self;
 	sc->sc_iot = iot;
 	sc->sc_addr = addr;



CVS commit: src/sys/arch/arm/imx

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 24 00:13:25 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c

Log Message:
 Fix compile error.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/imx/if_enet.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip

2019-05-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu May 23 21:37:55 UTC 2019

Modified Files:
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip:
rk3328-rock64.dts

Log Message:
Merge the following commits from upstream:

arm64: dts: rockchip: enable usb-host regulators at boot on rk3328-rock64
https://github.com/torvalds/linux/commit/26e2d7b03ea7ff254bf78305aa44dda62e70b78e

arm64: dts: rockchip: Fix vcc_host1_5v GPIO polarity on rk3328-rock64
https://github.com/torvalds/linux/commit/a8772e5d826d0f61f8aa9c284b3ab49035d5273d


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 \

src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
diff -u src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts:1.1.1.3 src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts:1.2
--- src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts:1.1.1.3	Tue Jan 22 14:57:03 2019
+++ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts	Thu May 23 21:37:55 2019
@@ -40,17 +40,18 @@
 		pinctrl-0 = <_host_drv>;
 		regulator-name = "vcc_host_5v";
 		regulator-always-on;
+		regulator-boot-on;
 		vin-supply = <_sys>;
 	};
 
 	vcc_host1_5v: vcc_otg_5v: vcc-host1-5v-regulator {
 		compatible = "regulator-fixed";
-		enable-active-high;
-		gpio = < RK_PA2 GPIO_ACTIVE_HIGH>;
+		gpio = < RK_PA2 GPIO_ACTIVE_LOW>;
 		pinctrl-names = "default";
 		pinctrl-0 = <_host_drv>;
 		regulator-name = "vcc_host1_5v";
 		regulator-always-on;
+		regulator-boot-on;
 		vin-supply = <_sys>;
 	};
 



CVS commit: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip

2019-05-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu May 23 21:37:55 UTC 2019

Modified Files:
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip:
rk3328-rock64.dts

Log Message:
Merge the following commits from upstream:

arm64: dts: rockchip: enable usb-host regulators at boot on rk3328-rock64
https://github.com/torvalds/linux/commit/26e2d7b03ea7ff254bf78305aa44dda62e70b78e

arm64: dts: rockchip: Fix vcc_host1_5v GPIO polarity on rk3328-rock64
https://github.com/torvalds/linux/commit/a8772e5d826d0f61f8aa9c284b3ab49035d5273d


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 \

src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/fdt

2019-05-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu May 23 21:36:26 UTC 2019

Modified Files:
src/sys/dev/fdt: fixedregulator.c

Log Message:
Revert previous


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/fixedregulator.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/fdt/fixedregulator.c
diff -u src/sys/dev/fdt/fixedregulator.c:1.7 src/sys/dev/fdt/fixedregulator.c:1.8
--- src/sys/dev/fdt/fixedregulator.c:1.7	Thu May 23 20:49:44 2019
+++ src/sys/dev/fdt/fixedregulator.c	Thu May 23 21:36:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fixedregulator.c,v 1.7 2019/05/23 20:49:44 jmcneill Exp $ */
+/* $NetBSD: fixedregulator.c,v 1.8 2019/05/23 21:36:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fixedregulator.c,v 1.7 2019/05/23 20:49:44 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fixedregulator.c,v 1.8 2019/05/23 21:36:26 jmcneill Exp $");
 
 #include 
 #include 
@@ -164,13 +164,13 @@ fixedregulator_enable(device_t dev, bool
 
 	if (enable) {
 		if (sc->sc_pin != NULL)
-			fdtbus_gpio_write(sc->sc_pin, sc->sc_enable_val);
+			fdtbus_gpio_write_raw(sc->sc_pin, sc->sc_enable_val);
 		if (sc->sc_delay > 0)
 			delay(sc->sc_delay);
 	} else {
 		if (sc->sc_always_on)
 			return EIO;
-		fdtbus_gpio_write(sc->sc_pin, !sc->sc_enable_val);
+		fdtbus_gpio_write_raw(sc->sc_pin, !sc->sc_enable_val);
 	}
 	return 0;
 }



CVS commit: src/sys/dev/fdt

2019-05-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu May 23 21:36:26 UTC 2019

Modified Files:
src/sys/dev/fdt: fixedregulator.c

Log Message:
Revert previous


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/fixedregulator.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/dts

2019-05-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu May 23 20:50:30 UTC 2019

Modified Files:
src/sys/arch/arm/dts: rk3328-rock64.dts

Log Message:
Remove vcc_host1_5v hack now that fixedregulator honours pin polarity


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/dts/rk3328-rock64.dts

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/dts

2019-05-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu May 23 20:50:30 UTC 2019

Modified Files:
src/sys/arch/arm/dts: rk3328-rock64.dts

Log Message:
Remove vcc_host1_5v hack now that fixedregulator honours pin polarity


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/dts/rk3328-rock64.dts

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/arm/dts/rk3328-rock64.dts
diff -u src/sys/arch/arm/dts/rk3328-rock64.dts:1.3 src/sys/arch/arm/dts/rk3328-rock64.dts:1.4
--- src/sys/arch/arm/dts/rk3328-rock64.dts:1.3	Wed May 22 23:22:24 2019
+++ src/sys/arch/arm/dts/rk3328-rock64.dts	Thu May 23 20:50:29 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3328-rock64.dts,v 1.3 2019/05/22 23:22:24 jmcneill Exp $ */
+/* $NetBSD: rk3328-rock64.dts,v 1.4 2019/05/23 20:50:29 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -36,7 +36,3 @@
 	snps,dis-u2-freeclk-exists-quirk;
 	snps,dis_u2_susphy_quirk;
 };
-
-_host1_5v {
-	/delete-property/ enable-active-high;
-};



CVS commit: src/sys/dev/fdt

2019-05-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu May 23 20:49:44 UTC 2019

Modified Files:
src/sys/dev/fdt: fixedregulator.c

Log Message:
Honour the polarity of the pin xref


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fixedregulator.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/fdt/fixedregulator.c
diff -u src/sys/dev/fdt/fixedregulator.c:1.6 src/sys/dev/fdt/fixedregulator.c:1.7
--- src/sys/dev/fdt/fixedregulator.c:1.6	Sun Jan 28 18:21:52 2018
+++ src/sys/dev/fdt/fixedregulator.c	Thu May 23 20:49:44 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fixedregulator.c,v 1.6 2018/01/28 18:21:52 jmcneill Exp $ */
+/* $NetBSD: fixedregulator.c,v 1.7 2019/05/23 20:49:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fixedregulator.c,v 1.6 2018/01/28 18:21:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fixedregulator.c,v 1.7 2019/05/23 20:49:44 jmcneill Exp $");
 
 #include 
 #include 
@@ -164,13 +164,13 @@ fixedregulator_enable(device_t dev, bool
 
 	if (enable) {
 		if (sc->sc_pin != NULL)
-			fdtbus_gpio_write_raw(sc->sc_pin, sc->sc_enable_val);
+			fdtbus_gpio_write(sc->sc_pin, sc->sc_enable_val);
 		if (sc->sc_delay > 0)
 			delay(sc->sc_delay);
 	} else {
 		if (sc->sc_always_on)
 			return EIO;
-		fdtbus_gpio_write_raw(sc->sc_pin, !sc->sc_enable_val);
+		fdtbus_gpio_write(sc->sc_pin, !sc->sc_enable_val);
 	}
 	return 0;
 }



CVS commit: src/sys/dev/fdt

2019-05-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu May 23 20:49:44 UTC 2019

Modified Files:
src/sys/dev/fdt: fixedregulator.c

Log Message:
Honour the polarity of the pin xref


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fixedregulator.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/at91

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 23 16:05:01 UTC 2019

Modified Files:
src/sys/arch/arm/at91: at91emac.c

Log Message:
- Fix compile error (remove unused variable).
- KNF.
- ac -> ec
- Remove extra RCS Id.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/at91/at91emac.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/arm/at91/at91emac.c
diff -u src/sys/arch/arm/at91/at91emac.c:1.27 src/sys/arch/arm/at91/at91emac.c:1.28
--- src/sys/arch/arm/at91/at91emac.c:1.27	Thu May 23 13:10:50 2019
+++ src/sys/arch/arm/at91/at91emac.c	Thu May 23 16:05:01 2019
@@ -1,5 +1,4 @@
-/*	$Id: at91emac.c,v 1.27 2019/05/23 13:10:50 msaitoh Exp $	*/
-/*	$NetBSD: at91emac.c,v 1.27 2019/05/23 13:10:50 msaitoh Exp $	*/
+/*	$NetBSD: at91emac.c,v 1.28 2019/05/23 16:05:01 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2007 Embedtronics Oy
@@ -33,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: at91emac.c,v 1.27 2019/05/23 13:10:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91emac.c,v 1.28 2019/05/23 16:05:01 msaitoh Exp $");
 
 #include 
 #include 
@@ -608,7 +607,6 @@ emac_tick(void *arg)
 static int
 emac_ifioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
-	struct emac_softc *sc = ifp->if_softc;
 	int s, error;
 
 	s = splnet();
@@ -786,7 +784,7 @@ static void
 emac_setaddr(struct ifnet *ifp)
 {
 	struct emac_softc *sc = ifp->if_softc;
-	struct ethercom *ac = >sc_ec;
+	struct ethercom *ec = >sc_ec;
 	struct ether_multi *enm;
 	struct ether_multistep step;
 	uint8_t ias[3][ETHER_ADDR_LEN];
@@ -809,7 +807,7 @@ emac_setaddr(struct ifnet *ifp)
 
 	ifp->if_flags &= ~IFF_ALLMULTI;
 
-	ETHER_FIRST_MULTI(step, ac, enm);
+	ETHER_FIRST_MULTI(step, ec, enm);
 	while (enm != NULL) {
 		if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
 			/*
@@ -858,9 +856,10 @@ emac_setaddr(struct ifnet *ifp)
 	EMAC_WRITE(ETH_SA1H, (sc->sc_enaddr[5] << 8)
 		   | (sc->sc_enaddr[4]));
 	if (nma > 1) {
-		DPRINTFN(1,("%s: en1 %02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,
-		   ias[0][0], ias[0][1], ias[0][2],
-		   ias[0][3], ias[0][4], ias[0][5]));
+		DPRINTFN(1,("%s: en1 %02x:%02x:%02x:%02x:%02x:%02x\n",
+			__FUNCTION__,
+			ias[0][0], ias[0][1], ias[0][2],
+			ias[0][3], ias[0][4], ias[0][5]));
 		EMAC_WRITE(ETH_SA2L, (ias[0][3] << 24)
 			   | (ias[0][2] << 16) | (ias[0][1] << 8)
 			   | (ias[0][0]));
@@ -868,9 +867,10 @@ emac_setaddr(struct ifnet *ifp)
 			   | (ias[0][5]));
 	}
 	if (nma > 2) {
-		DPRINTFN(1,("%s: en2 %02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,
-		   ias[1][0], ias[1][1], ias[1][2],
-		   ias[1][3], ias[1][4], ias[1][5]));
+		DPRINTFN(1,("%s: en2 %02x:%02x:%02x:%02x:%02x:%02x\n",
+			__FUNCTION__,
+			ias[1][0], ias[1][1], ias[1][2],
+			ias[1][3], ias[1][4], ias[1][5]));
 		EMAC_WRITE(ETH_SA3L, (ias[1][3] << 24)
 			   | (ias[1][2] << 16) | (ias[1][1] << 8)
 			   | (ias[1][0]));
@@ -878,9 +878,10 @@ emac_setaddr(struct ifnet *ifp)
 			   | (ias[1][5]));
 	}
 	if (nma > 3) {
-		DPRINTFN(1,("%s: en3 %02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,
-		   ias[2][0], ias[2][1], ias[2][2],
-		   ias[2][3], ias[2][4], ias[2][5]));
+		DPRINTFN(1,("%s: en3 %02x:%02x:%02x:%02x:%02x:%02x\n",
+			__FUNCTION__,
+			ias[2][0], ias[2][1], ias[2][2],
+			ias[2][3], ias[2][4], ias[2][5]));
 		EMAC_WRITE(ETH_SA3L, (ias[2][3] << 24)
 			   | (ias[2][2] << 16) | (ias[2][1] << 8)
 			   | (ias[2][0]));



CVS commit: src/sys/arch/arm/at91

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 23 16:05:01 UTC 2019

Modified Files:
src/sys/arch/arm/at91: at91emac.c

Log Message:
- Fix compile error (remove unused variable).
- KNF.
- ac -> ec
- Remove extra RCS Id.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/at91/at91emac.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/acpi

2019-05-23 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu May 23 15:54:28 UTC 2019

Modified Files:
src/sys/arch/arm/acpi: acpi_platform.c cpu_acpi.c

Log Message:
fix build without options MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/acpi/acpi_platform.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/acpi/cpu_acpi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/acpi

2019-05-23 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu May 23 15:54:28 UTC 2019

Modified Files:
src/sys/arch/arm/acpi: acpi_platform.c cpu_acpi.c

Log Message:
fix build without options MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/acpi/acpi_platform.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/acpi/cpu_acpi.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/arm/acpi/acpi_platform.c
diff -u src/sys/arch/arm/acpi/acpi_platform.c:1.11 src/sys/arch/arm/acpi/acpi_platform.c:1.12
--- src/sys/arch/arm/acpi/acpi_platform.c:1.11	Fri Dec 21 14:50:18 2018
+++ src/sys/arch/arm/acpi/acpi_platform.c	Thu May 23 15:54:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_platform.c,v 1.11 2018/12/21 14:50:18 jmcneill Exp $ */
+/* $NetBSD: acpi_platform.c,v 1.12 2019/05/23 15:54:28 ryo Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,9 +32,10 @@
 #include "com.h"
 #include "plcom.h"
 #include "opt_efi.h"
+#include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.11 2018/12/21 14:50:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.12 2019/05/23 15:54:28 ryo Exp $");
 
 #include 
 #include 
@@ -113,7 +114,9 @@ acpi_platform_startup(void)
 {
 	ACPI_TABLE_SPCR *spcr;
 	ACPI_TABLE_FADT *fadt;
+#ifdef MULTIPROCESSOR
 	ACPI_TABLE_MADT *madt;
+#endif
 	int baud_rate;
 
 	/*
@@ -198,6 +201,7 @@ acpi_platform_startup(void)
 		acpi_table_unmap((ACPI_TABLE_HEADER *)fadt);
 	}
 
+#ifdef MULTIPROCESSOR
 	/*
 	 * Count CPUs
 	 */
@@ -212,6 +216,7 @@ acpi_platform_startup(void)
 		}
 		acpi_table_unmap((ACPI_TABLE_HEADER *)madt);
 	}
+#endif /* MULTIPROCESSOR */
 }
 
 static void

Index: src/sys/arch/arm/acpi/cpu_acpi.c
diff -u src/sys/arch/arm/acpi/cpu_acpi.c:1.5 src/sys/arch/arm/acpi/cpu_acpi.c:1.6
--- src/sys/arch/arm/acpi/cpu_acpi.c:1.5	Wed Dec  5 22:42:55 2018
+++ src/sys/arch/arm/acpi/cpu_acpi.c	Thu May 23 15:54:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_acpi.c,v 1.5 2018/12/05 22:42:55 jmcneill Exp $ */
+/* $NetBSD: cpu_acpi.c,v 1.6 2019/05/23 15:54:28 ryo Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
  */
 
 #include "tprof.h"
+#include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_acpi.c,v 1.5 2018/12/05 22:42:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_acpi.c,v 1.6 2019/05/23 15:54:28 ryo Exp $");
 
 #include 
 #include 
@@ -66,12 +67,14 @@ static void	cpu_acpi_tprof_init(device_t
 
 CFATTACH_DECL_NEW(cpu_acpi, 0, cpu_acpi_match, cpu_acpi_attach, NULL, NULL);
 
+#ifdef MULTIPROCESSOR
 static register_t
 cpu_acpi_mpstart_pa(void)
 {
 
 	return (register_t)KERN_VTOPHYS((vaddr_t)cpu_mpstart);
 }
+#endif /* MULTIPROCESSOR */
 
 static int
 cpu_acpi_match(device_t parent, cfdata_t cf, void *aux)
@@ -94,10 +97,11 @@ cpu_acpi_attach(device_t parent, device_
 	const uint64_t mpidr = gicc->ArmMpidr;
 	const int unit = device_unit(self);
 	struct cpu_info *ci = _info_store[unit];
-	int error;
 
+#ifdef MULTIPROCESSOR
 	if (cpu_mpidr_aff_read() != mpidr) {
 		const u_int cpuindex = device_unit(self);
+		int error;
 
 		cpu_mpidr[cpuindex] = mpidr;
 		cpu_dcache_wb_range((vaddr_t)_mpidr[cpuindex], sizeof(cpu_mpidr[cpuindex]));
@@ -117,6 +121,7 @@ cpu_acpi_attach(device_t parent, device_
 break;
 		}
 	}
+#endif /* MULTIPROCESSOR */
 
 	/* Store the ACPI Processor UID in cpu_info */
 	ci->ci_acpiid = gicc->Uid;



Re: audio2

2019-05-23 Thread Valery Ushakov
On Thu, May 23, 2019 at 21:28:51 +0900, Tetsuya Isaki wrote:

> +/*
> + * AUDIO_ASR() does Arithmetic Shift Right operation.
> + * This macro should be used for audio wave data only.
> + *
> + * Division by power of two is replaced with shift operation in the most
> + * compiler, but even then rounding-to-zero occurs on negative value.
> + * What we handle here is the audio wave data that human hear, so we can
> + * ignore the rounding difference.  Therefore we want to use faster
> + * arithmetic shift right operation.  But the right shift operator ('>>')
> + * for negative integer is "implementation defined" behavior in C (note
> + * that it's not "undefined" behavior).  So if implementation defines '>>'
> + * as ASR, we use it.
> + *
> + * Using ASR is 1.9 times faster than division on my amd64, and 1.3 times
> + * faster on my m68k.  -- isaki 201801.
> + */
> +#if defined(__GNUC__)
> +/* gcc defines '>>' as ASR. */
> +#define AUDIO_ASR(value, shift)  ((value) >> (shift))
> +#else
> +#define AUDIO_ASR(value, shift)  ((value) / (1 << (shift)))
> +#endif

This feels inverted.  The mathematically correct operation required
here is symmetric division (that rounds towards zero).  Arithmetic
shift is flooring division (that rounds towards minus infinity).  So
it feels confusing and wrong to *name* the operation the opposite of
what it really is.

-uwe


Re: CVS commit: src/include

2019-05-23 Thread Joerg Sonnenberger
On Thu, May 23, 2019 at 09:05:00AM +0200, Martin Husemann wrote:
> On Thu, May 23, 2019 at 12:03:33AM +0200, Kamil Rytarowski wrote:
> > >> -#if ((__cplusplus - 0) < 201103L)
> > >> +#if defined(_ISOC11_SOURCE) || (__STDC_VERSION__ - 0) >= 201101L
> 
> Am I missing something or does this (in addition to the intended change)
> make the macro invisible for C++ compilations? Is that intended? If so,
> shouldn't it be explained in the log message?

static_assert is a keyword in C++11.

Joerg


CVS commit: src/sys

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 23 13:10:53 UTC 2019

Modified Files:
src/sys/arch/arm/at91: at91emac.c
src/sys/arch/arm/ep93xx: epe.c
src/sys/arch/arm/gemini: if_gmc.c
src/sys/arch/arm/imx: if_enet.c
src/sys/arch/arm/sunxi: sun4i_emac.c
src/sys/arch/mips/atheros/dev: if_ae.c
src/sys/arch/mips/sibyte/dev: sbmac.c
src/sys/arch/sgimips/hpc: if_sq.c
src/sys/arch/sun3/dev: if_ie.c
src/sys/dev/bi: if_ni.c
src/sys/dev/cadence: if_cemac.c
src/sys/dev/ic: ath.c atw.c dm9000.c dwc_gmac.c elinkxl.c hme.c
i82586.c lan9118.c mb86950.c pdq_ifsubr.c rtw.c seeq8005.c sgec.c
smc83c170.c tulip.c wi.c
src/sys/dev/isa: if_iy.c
src/sys/dev/marvell: if_gfe.c if_mvgbe.c if_mvxpe.c
src/sys/dev/pci: if_age.c if_alc.c if_ale.c if_bnx.c if_cas.c if_jme.c
if_lii.c if_msk.c if_pcn.c if_ste.c if_tl.c if_vge.c if_vioif.c
if_vr.c if_vte.c if_wm.c
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c
src/sys/dev/pcmcia: if_xi.c
src/sys/dev/qbus: if_il.c
src/sys/dev/sbus: qe.c
src/sys/dev/scsipi: if_se.c
src/sys/dev/usb: if_aue.c if_axe.c if_axen.c if_cue.c if_kue.c if_mue.c
if_otus.c if_smsc.c if_ure.c

Log Message:
 Whitespace fix (mainly tabify).


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/at91/at91emac.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/arm/ep93xx/epe.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/gemini/if_gmc.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sun4i_emac.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/mips/atheros/dev/if_ae.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/mips/sibyte/dev/sbmac.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/sgimips/hpc/if_sq.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/sun3/dev/if_ie.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/bi/if_ni.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/cadence/if_cemac.c
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/ic/ath.c
cvs rdiff -u -r1.166 -r1.167 src/sys/dev/ic/atw.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/dm9000.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/ic/dwc_gmac.c
cvs rdiff -u -r1.129 -r1.130 src/sys/dev/ic/elinkxl.c
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/ic/hme.c
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/ic/i82586.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/lan9118.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/mb86950.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/ic/pdq_ifsubr.c
cvs rdiff -u -r1.131 -r1.132 src/sys/dev/ic/rtw.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/ic/seeq8005.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/ic/sgec.c
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/ic/smc83c170.c
cvs rdiff -u -r1.194 -r1.195 src/sys/dev/ic/tulip.c
cvs rdiff -u -r1.251 -r1.252 src/sys/dev/ic/wi.c
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/isa/if_iy.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/marvell/if_gfe.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/marvell/if_mvxpe.c
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/pci/if_age.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/if_alc.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pci/if_ale.c
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/if_cas.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/if_jme.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/if_lii.c
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/if_pcn.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/pci/if_ste.c
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/pci/if_tl.c
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/if_vge.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/pci/if_vioif.c
cvs rdiff -u -r1.128 -r1.129 src/sys/dev/pci/if_vr.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/if_vte.c
cvs rdiff -u -r1.637 -r1.638 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.185 -r1.186 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/ixgbe/ixv.c
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/pcmcia/if_xi.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/qbus/if_il.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/sbus/qe.c
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/scsipi/if_se.c
cvs rdiff -u -r1.152 -r1.153 src/sys/dev/usb/if_aue.c
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/if_axen.c
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/usb/if_cue.c
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/usb/if_kue.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/usb/if_mue.c src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/usb/if_otus.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/if_ure.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: audio2

2019-05-23 Thread Tetsuya Isaki
At Wed, 8 May 2019 18:14:28 +,
m...@netbsd.org wrote:
> Is there some scenario where this made a difference?
> it sounds like an optimization that a compiler should already do
> 
> 5234:#if defined(AUDIO_USE_C_IMPLEMENTATION_DEFINED_BEHAVIOR) && 
> defined(__GNUC__)
> 5235- *d++ += ((aint2_t)*s++) * track->volume >> 8;
> 5236-#else
> 5237- *d++ += ((aint2_t)*s++) * track->volume / 256;
> 5238-#endif

It's signed integer so these two output different code.

 Here is the fragment of amd64 asm of "(x * vol >> 8)"
96a5:   0f af d1imul   %ecx,%edx
96a8:   c1 fa 08sar$0x8,%edx
96ab:   66 89 14 07 mov%dx,(%rdi,%rax,1)

 Here is "(x * vol / 256)"
96a5:   0f af c1imul   %ecx,%eax
96a8:   85 c0   test   %eax,%eax
96aa:   79 05   jns96b1 
96ac:   05 ff 00 00 00  add$0xff,%eax
96b1:   c1 f8 08sar$0x8,%eax
96b4:   66 89 04 17 mov%ax,(%rdi,%rdx,1)

I evaluated these (a year ago).  The former is 1.9 times faster on
my old amd64 than the later, 1.3 times faster on m68k, at that point.
# Although, above code is from current but evaluation is a year ago.

Let's consider about (-1 / 2).  The mathematical answer is -0.5 so
it's 0 for integers.  And (-1 >> 1) is -1.  These two answers are
different but this value is audio wave that human hear.  I took
performance.

However, I understand that my code looks strange.
How about this?

Index: sys/dev/audio/audio.c
===
RCS file: /cvsroot/src/sys/dev/audio/audio.c,v
retrieving revision 1.8
diff -u -r1.8 audio.c
--- sys/dev/audio/audio.c   21 May 2019 12:52:57 -  1.8
+++ sys/dev/audio/audio.c   23 May 2019 03:31:36 -
@@ -465,6 +465,29 @@
 #define SPECIFIED(x)   ((x) != ~0)
 #define SPECIFIED_CH(x)((x) != (u_char)~0)
 
+/*
+ * AUDIO_ASR() does Arithmetic Shift Right operation.
+ * This macro should be used for audio wave data only.
+ *
+ * Division by power of two is replaced with shift operation in the most
+ * compiler, but even then rounding-to-zero occurs on negative value.
+ * What we handle here is the audio wave data that human hear, so we can
+ * ignore the rounding difference.  Therefore we want to use faster
+ * arithmetic shift right operation.  But the right shift operator ('>>')
+ * for negative integer is "implementation defined" behavior in C (note
+ * that it's not "undefined" behavior).  So if implementation defines '>>'
+ * as ASR, we use it.
+ *
+ * Using ASR is 1.9 times faster than division on my amd64, and 1.3 times
+ * faster on my m68k.  -- isaki 201801.
+ */
+#if defined(__GNUC__)
+/* gcc defines '>>' as ASR. */
+#define AUDIO_ASR(value, shift)((value) >> (shift))
+#else
+#define AUDIO_ASR(value, shift)((value) / (1 << (shift)))
+#endif
+
 /* Device timeout in msec */
 #define AUDIO_TIMEOUT  (3000)
 
@@ -3304,11 +3327,7 @@
for (ch = 0; ch < channels; ch++) {
aint2_t val;
val = *s++;
-#if defined(AUDIO_USE_C_IMPLEMENTATION_DEFINED_BEHAVIOR) && defined(__GNUC__)
-   val = val * ch_volume[ch] >> 8;
-#else
-   val = val * ch_volume[ch] / 256;
-#endif
+   val = AUDIO_ASR(val * ch_volume[ch], 8);
*d++ = (aint_t)val;
}
}
@@ -3330,11 +3349,7 @@
d = arg->dst;
 
for (i = 0; i < arg->count; i++) {
-#if defined(AUDIO_USE_C_IMPLEMENTATION_DEFINED_BEHAVIOR) && defined(__GNUC__)
-   *d++ = (s[0] >> 1) + (s[1] >> 1);
-#else
-   *d++ = (s[0] / 2) + (s[1] / 2);
-#endif
+   *d++ = AUDIO_ASR(s[0], 1) + AUDIO_ASR(s[1], 1);
s += arg->srcfmt->channels;
}
 }
@@ -5131,11 +5146,7 @@
if (vol != 256) {
m = mixer->mixsample;
for (i = 0; i < sample_count; i++) {
-#if defined(AUDIO_USE_C_IMPLEMENTATION_DEFINED_BEHAVIOR) && defined(__GNUC__)
-   *m = *m * vol >> 8;
-#else
-   *m = *m * vol / 256;
-#endif
+   *m = AUDIO_ASR(*m * vol, 8);
m++;
}
}
@@ -5223,11 +5234,9 @@
 #if defined(AUDIO_SUPPORT_TRACK_VOLUME)
if (track->volume != 256) {
for (i = 0; i < sample_count; i++) {
-#if defined(AUDIO_USE_C_IMPLEMENTATION_DEFINED_BEHAVIOR) && defined(__GNUC__)
-   *d++ = ((aint2_t)*s++) * track->volume >> 8;
-#else
-   *d++ = ((aint2_t)*s++) * track->volume / 256;
-#endif
+   aint2_t v;
+   v = *s++;
+ 

CVS commit: src/sys/dev/audio

2019-05-23 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu May 23 12:20:27 UTC 2019

Modified Files:
src/sys/dev/audio: audio.c audiodef.h

Log Message:
Remove unnecessary file lock.
It has been introduced to prevent multiple syscalls entering
simultaneously.  But it's completely unnecessary.
It fixes firefox problem in PR kern/54177.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/audio/audiodef.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.8 src/sys/dev/audio/audio.c:1.9
--- src/sys/dev/audio/audio.c:1.8	Tue May 21 12:52:57 2019
+++ src/sys/dev/audio/audio.c	Thu May 23 12:20:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.8 2019/05/21 12:52:57 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.9 2019/05/23 12:20:27 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -131,14 +131,7 @@
  *   neither lock were necessary.  Currently, on the other hand, since
  *   these may be also called after attach, the thread lock is required.
  *
- * In addition, there are two additional locks.
- *
- * - file->lock.  This is a variable protected by sc_lock and is similar
- *   to the "thread lock".  This is one for each file.  If any thread
- *   context and software interrupt context who want to access the file
- *   structure, they must acquire this lock before.  It protects
- *   descriptor's consistency among multithreaded accesses.  Since this
- *   lock uses sc_lock, don't acquire from hardware interrupt context.
+ * In addition, there is an additional lock.
  *
  * - track->lock.  This is an atomic variable and is similar to the
  *   "interrupt lock".  This is one for each track.  If any thread context
@@ -149,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.8 2019/05/21 12:52:57 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.9 2019/05/23 12:20:27 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -507,8 +500,6 @@ static void audio_softintr_wr(void *);
 static int  audio_enter_exclusive(struct audio_softc *);
 static void audio_exit_exclusive(struct audio_softc *);
 static int audio_track_waitio(struct audio_softc *, audio_track_t *);
-static int audio_file_acquire(struct audio_softc *, audio_file_t *);
-static void audio_file_release(struct audio_softc *, audio_file_t *);
 
 static int audioclose(struct file *);
 static int audioread(struct file *, off_t *, struct uio *, kauth_cred_t, int);
@@ -1431,57 +1422,6 @@ audio_track_waitio(struct audio_softc *s
 }
 
 /*
- * Acquire the file lock.
- * If file is acquired successfully, returns 0.  Otherwise returns errno.
- * In both case, sc_lock is released.
- */
-static int
-audio_file_acquire(struct audio_softc *sc, audio_file_t *file)
-{
-	int error;
-
-	KASSERT(!mutex_owned(sc->sc_lock));
-
-	mutex_enter(sc->sc_lock);
-	if (sc->sc_dying) {
-		mutex_exit(sc->sc_lock);
-		return EIO;
-	}
-
-	while (__predict_false(file->lock != 0)) {
-		error = cv_wait_sig(>sc_exlockcv, sc->sc_lock);
-		if (sc->sc_dying)
-			error = EIO;
-		if (error) {
-			mutex_exit(sc->sc_lock);
-			return error;
-		}
-	}
-
-	/* Mark this file locked */
-	file->lock = 1;
-	mutex_exit(sc->sc_lock);
-
-	return 0;
-}
-
-/*
- * Release the file lock.
- */
-static void
-audio_file_release(struct audio_softc *sc, audio_file_t *file)
-{
-
-	KASSERT(!mutex_owned(sc->sc_lock));
-
-	mutex_enter(sc->sc_lock);
-	KASSERT(file->lock);
-	file->lock = 0;
-	cv_broadcast(>sc_exlockcv);
-	mutex_exit(sc->sc_lock);
-}
-
-/*
  * Try to acquire track lock.
  * It doesn't block if the track lock is already aquired.
  * Returns true if the track lock was acquired, or false if the track
@@ -1563,11 +1503,7 @@ audioclose(struct file *fp)
 	sc = file->sc;
 	dev = file->dev;
 
-	/* Acquire file lock and exlock */
-	/* XXX what should I do when an error occurs? */
-	error = audio_file_acquire(sc, file);
-	if (error)
-		return error;
+	/* audio_{enter,exit}_exclusive() is called by lower audio_close() */
 
 	device_active(sc->sc_dev, DVA_SYSTEM);
 	switch (AUDIODEV(dev)) {
@@ -1590,11 +1526,6 @@ audioclose(struct file *fp)
 		fp->f_audioctx = NULL;
 	}
 
-	/*
-	 * Since file has already been destructed,
-	 * audio_file_release() is not necessary.
-	 */
-
 	return error;
 }
 
@@ -1612,10 +1543,6 @@ audioread(struct file *fp, off_t *offp, 
 	sc = file->sc;
 	dev = file->dev;
 
-	error = audio_file_acquire(sc, file);
-	if (error)
-		return error;
-
 	if (fp->f_flag & O_NONBLOCK)
 		ioflag |= IO_NDELAY;
 
@@ -1632,7 +1559,6 @@ audioread(struct file *fp, off_t *offp, 
 		error = ENXIO;
 		break;
 	}
-	audio_file_release(sc, file);
 
 	return error;
 }
@@ -1651,10 +1577,6 @@ audiowrite(struct file *fp, off_t *offp,
 	sc = file->sc;
 	dev = file->dev;
 
-	error = audio_file_acquire(sc, file);
-	if (error)
-		return error;
-
 	if (fp->f_flag & 

CVS commit: src/sys/dev/audio

2019-05-23 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu May 23 12:20:27 UTC 2019

Modified Files:
src/sys/dev/audio: audio.c audiodef.h

Log Message:
Remove unnecessary file lock.
It has been introduced to prevent multiple syscalls entering
simultaneously.  But it's completely unnecessary.
It fixes firefox problem in PR kern/54177.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/audio/audiodef.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/mount_portal

2019-05-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu May 23 11:13:17 UTC 2019

Modified Files:
src/sbin/mount_portal: pt_file.c puffs_portal.c

Log Message:
PR bin/54222

Don't use portal_node_reclaim() inappropriately.   It frees data we
did not allocate, but which might have been allocated by someone else.

While here, various other cleanups (avoid losing fd's if fork fails,
don't compose mangled st_mode S_IFMT values - puffs or's in what it
thinks is correct to the value we set, one case I saw was producing
0110600 for the mode, the 011 isn't any defined type at all - I'd
never seen ls print a '?' as the first char of ls -l output before!

This is still not really correct, but is I believe, better than before.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sbin/mount_portal/pt_file.c
cvs rdiff -u -r1.9 -r1.10 src/sbin/mount_portal/puffs_portal.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/mount_portal/pt_file.c
diff -u src/sbin/mount_portal/pt_file.c:1.19 src/sbin/mount_portal/pt_file.c:1.20
--- src/sbin/mount_portal/pt_file.c:1.19	Wed May 10 13:58:25 2017
+++ src/sbin/mount_portal/pt_file.c	Thu May 23 11:13:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pt_file.c,v 1.19 2017/05/10 13:58:25 christos Exp $	*/
+/*	$NetBSD: pt_file.c,v 1.20 2019/05/23 11:13:17 kre Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: pt_file.c,v 1.19 2017/05/10 13:58:25 christos Exp $");
+__RCSID("$NetBSD: pt_file.c,v 1.20 2019/05/23 11:13:17 kre Exp $");
 #endif /* not lint */
 
 #include 
@@ -154,7 +154,7 @@ portal_file(struct portal_cred *pcr, cha
 	fd = open(pbuf, O_RDWR | O_CREAT, 0666);
 	if (fd < 0) {
 		error = errno;
-		if (error == EACCES) {
+		if (error == EACCES || error == EISDIR) {
 			DEBUG_SYSLOG(LOG_DEBUG, "Error:  could not open '%s' "
 			"read/write with create flag.  "
 			"Trying read-only open...", pbuf);

Index: src/sbin/mount_portal/puffs_portal.c
diff -u src/sbin/mount_portal/puffs_portal.c:1.9 src/sbin/mount_portal/puffs_portal.c:1.10
--- src/sbin/mount_portal/puffs_portal.c:1.9	Wed May 10 16:35:18 2017
+++ src/sbin/mount_portal/puffs_portal.c	Thu May 23 11:13:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs_portal.c,v 1.9 2017/05/10 16:35:18 christos Exp $	*/
+/*	$NetBSD: puffs_portal.c,v 1.10 2019/05/23 11:13:17 kre Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: puffs_portal.c,v 1.9 2017/05/10 16:35:18 christos Exp $");
+__RCSID("$NetBSD: puffs_portal.c,v 1.10 2019/05/23 11:13:17 kre Exp $");
 #endif /* !lint */
 
 #include 
@@ -344,17 +344,19 @@ provide(struct puffs_usermount *pu, stru
 
 	switch (fork()) {
 	case -1:
+		close(s[0]); close(s[1]);
 		goto bad;
 	case 0:
+		close(s[0]);
 		error = activate_argv(portc, portn->path, v, );
 		sendfd(s[1], fd, error);
 		exit(0);
 	default:
+		close(s[1]);
 		puffs_framev_addfd(pu, s[0], PUFFS_FBIO_READ);
 		puffs_framev_enqueue_directreceive(pcc, s[0], pufbuf, 0);
 		puffs_framev_removefd(pu, s[0], 0);
 		close(s[0]);
-		close(s[1]);
 
 		if (puffs_framebuf_tellsize(pufbuf) < sizeof(int)) {
 			errno = EIO;
@@ -535,7 +537,7 @@ portal_node_lookup(struct puffs_usermoun
 	return 0;
 }
 
-int fakeid = 3;
+unsigned int fakeid = 3;
 
 /* XXX: libpuffs'ize */
 int
@@ -544,6 +546,7 @@ portal_node_getattr(struct puffs_usermou
 {
 	struct timeval tv;
 	struct timespec ts;
+	int res = 0;
 
 	puffs_vattr_null(va);
 	if (opc == PORTAL_ROOT) {
@@ -551,7 +554,11 @@ portal_node_getattr(struct puffs_usermou
 		va->va_mode = 0777;
 		va->va_nlink = 2;
 		va->va_uid = va->va_gid = 0;
+#if 0	/* XXX Huh? */
 		va->va_fileid = fakeid++;
+#else
+		va->va_fileid = 2;	/*XXX; ROOTINO*/
+#endif
 		va->va_size = va->va_bytes = 0;
 		va->va_gen = 0;
 		va->va_rdev = PUFFS_VNOVAL;
@@ -564,36 +571,55 @@ portal_node_getattr(struct puffs_usermou
 	} else {
 		/* cheat for now */
 		int error;
+		int newfd;
 		struct stat st;
 		struct portal_node *portn = opc;
 		struct portal_cred portc;
 		char **v = conf_match(, portn->path);
+
 		if (v == NULL)
 			return ENOENT;
-		credtr(, pcr, 0777);
-		error = provide(pu, portn, , v);
-		if (error)
-			return error;
+		if (portn->fd == -1) {
+			credtr(, pcr, 0777);
+			error = provide(pu, portn, , v);
+			if (error)
+return error;
+			newfd = 1;
+		} else
+			newfd = 0;
+
 		if (fstat(portn->fd, ) == -1)
-			return errno;
-		va->va_type = S_ISDIR(st.st_mode) ? VDIR : VREG; /* XXX */
-		va->va_mode = st.st_mode;
-		va->va_nlink = st.st_nlink;
-		va->va_uid = st.st_uid;
-		va->va_gid = st.st_gid;
-		va->va_fileid = st.st_ino;
-		va->va_size = va->va_bytes = st.st_size;
-		va->va_gen = 0;
-		va->va_rdev = st.st_rdev;
-		va->va_blocksize = st.st_blksize;
-		va->va_atime = st.st_atim;
-		va->va_ctime = st.st_ctim;
-		va->va_mtime = st.st_mtim;
-		va->va_birthtime = 

CVS commit: src/sys

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 23 10:57:29 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sun4i_emac.c
src/sys/arch/macppc/dev: if_bm.c if_gm.c
src/sys/arch/mips/adm5120/dev: if_admsw.c
src/sys/arch/powerpc/ibm4xx/dev: if_emac.c
src/sys/arch/sgimips/hpc: if_sq.c
src/sys/arch/sgimips/mace: if_mec.c
src/sys/arch/sun3/dev: if_ie.c
src/sys/arch/x86/pci: if_vmx.c
src/sys/dev/ic: ath.c atw.c awi.c cs89x0.c dm9000.c dp83932.c
dwc_gmac.c lan9118.c lemac.c mb86960.c pdq_ifsubr.c rtw.c sgec.c
wi.c
src/sys/dev/isa: if_iy.c
src/sys/dev/pci: if_cas.c if_de.c if_dge.c if_jme.c if_lii.c if_sk.c
if_wm.c if_xge.c
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c
src/sys/dev/pcmcia: if_ray.c
src/sys/dev/qbus: if_il.c if_qe.c
src/sys/dev/sbus: qe.c
src/sys/dev/usb: if_aue.c if_axe.c if_axen.c if_cue.c if_kue.c if_mue.c
if_otus.c if_udav.c if_ure.c if_url.c

Log Message:
-No functional change:
  - KNF
  - u_int*_t -> uint*_t.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/sunxi/sun4i_emac.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/macppc/dev/if_bm.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/macppc/dev/if_gm.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/mips/adm5120/dev/if_admsw.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sgimips/hpc/if_sq.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/sgimips/mace/if_mec.c
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/sun3/dev/if_ie.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/x86/pci/if_vmx.c
cvs rdiff -u -r1.124 -r1.125 src/sys/dev/ic/ath.c
cvs rdiff -u -r1.165 -r1.166 src/sys/dev/ic/atw.c
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/ic/awi.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/ic/cs89x0.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/dm9000.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ic/dp83932.c
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/ic/dwc_gmac.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ic/lan9118.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/ic/lemac.c
cvs rdiff -u -r1.90 -r1.91 src/sys/dev/ic/mb86960.c
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/ic/pdq_ifsubr.c
cvs rdiff -u -r1.130 -r1.131 src/sys/dev/ic/rtw.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ic/sgec.c
cvs rdiff -u -r1.250 -r1.251 src/sys/dev/ic/wi.c
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/isa/if_iy.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/if_cas.c
cvs rdiff -u -r1.160 -r1.161 src/sys/dev/pci/if_de.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/pci/if_dge.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/if_jme.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/if_lii.c
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/pci/if_sk.c
cvs rdiff -u -r1.636 -r1.637 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pci/if_xge.c
cvs rdiff -u -r1.184 -r1.185 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/pci/ixgbe/ixv.c
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/pcmcia/if_ray.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/qbus/if_il.c
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/qbus/if_qe.c
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/sbus/qe.c
cvs rdiff -u -r1.151 -r1.152 src/sys/dev/usb/if_aue.c
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/usb/if_axen.c
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/usb/if_cue.c
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/usb/if_kue.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/if_mue.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/if_otus.c
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/usb/if_udav.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/if_ure.c
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/usb/if_url.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 23 10:51:39 UTC 2019

Modified Files:
src/sys/arch/arm/at91: at91emac.c
src/sys/arch/arm/gemini: if_gmc.c
src/sys/arch/mips/alchemy/dev: if_aumac.c
src/sys/arch/mips/atheros/dev: if_ae.c
src/sys/arch/powerpc/booke/dev: pq3etsec.c
src/sys/dev/ic: aic6915.c elinkxl.c gem.c hme.c i82557.c rtl81x9.c
smc83c170.c tulip.c
src/sys/dev/marvell: if_mvgbe.c if_mvxpe.c
src/sys/dev/pci: if_age.c if_alc.c if_ale.c if_bge.c if_bnx.c if_et.c
if_msk.c if_nfe.c if_pcn.c if_sip.c if_ste.c if_stge.c if_tl.c
if_vte.c
src/sys/dev/pcmcia: if_xi.c

Log Message:
No functional change:
 - Simplify MII structure initialization and reference.
 - u_int*_t -> uint*_t.
 - KNF


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/at91/at91emac.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/gemini/if_gmc.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/mips/alchemy/dev/if_aumac.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/mips/atheros/dev/if_ae.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/powerpc/booke/dev/pq3etsec.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/aic6915.c
cvs rdiff -u -r1.128 -r1.129 src/sys/dev/ic/elinkxl.c
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/ic/gem.c
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/ic/hme.c
cvs rdiff -u -r1.151 -r1.152 src/sys/dev/ic/i82557.c
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/ic/rtl81x9.c
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/ic/smc83c170.c
cvs rdiff -u -r1.193 -r1.194 src/sys/dev/ic/tulip.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/marvell/if_mvxpe.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/pci/if_age.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/if_alc.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/if_ale.c
cvs rdiff -u -r1.330 -r1.331 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.82 -r1.83 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/if_et.c
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/if_nfe.c src/sys/dev/pci/if_pcn.c
cvs rdiff -u -r1.171 -r1.172 src/sys/dev/pci/if_sip.c
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/if_ste.c
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/pci/if_stge.c
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/if_tl.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/if_vte.c
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/pcmcia/if_xi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 23 10:40:40 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c
src/sys/arch/arm/sunxi: sunxi_emac.c
src/sys/arch/arm/xscale: ixp425_if_npe.c
src/sys/arch/mips/sibyte/dev: sbmac.c
src/sys/dev/ic: i82586.c mtd803.c seeq8005.c
src/sys/dev/marvell: if_gfe.c
src/sys/dev/pci: if_kse.c if_ti.c if_vge.c if_vioif.c if_vr.c
src/sys/dev/usb: if_smsc.c

Log Message:
-No functional change:
  - Simplify struct ethercom's pointer near ETHER_FIRST_MULTI().
  - Simplify MII structure initialization.
  - u_int*_t -> uint*_t.
  - KNF


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/sunxi/sunxi_emac.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/arm/xscale/ixp425_if_npe.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/mips/sibyte/dev/sbmac.c
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/ic/i82586.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/mtd803.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/ic/seeq8005.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/marvell/if_gfe.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/if_kse.c
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/pci/if_ti.c
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/if_vge.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pci/if_vioif.c
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/pci/if_vr.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/if_smsc.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/arm/imx/if_enet.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.19 src/sys/arch/arm/imx/if_enet.c:1.20
--- src/sys/arch/arm/imx/if_enet.c:1.19	Wed Apr 24 11:18:20 2019
+++ src/sys/arch/arm/imx/if_enet.c	Thu May 23 10:40:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.19 2019/04/24 11:18:20 msaitoh Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.20 2019/05/23 10:40:39 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.19 2019/04/24 11:18:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.20 2019/05/23 10:40:39 msaitoh Exp $");
 
 #include "vlan.h"
 
@@ -176,6 +176,7 @@ enet_attach_common(device_t self, bus_sp
 {
 	struct enet_softc *sc;
 	struct ifnet *ifp;
+	struct mii_data * const mii = >sc_mii;
 
 	sc = device_private(self);
 	sc->sc_dev = self;
@@ -283,23 +284,20 @@ enet_attach_common(device_t self, bus_sp
 	IFQ_SET_READY(>if_snd);
 
 	/* setup MII */
-	sc->sc_ethercom.ec_mii = >sc_mii;
-	sc->sc_mii.mii_ifp = ifp;
-	sc->sc_mii.mii_readreg = enet_miibus_readreg;
-	sc->sc_mii.mii_writereg = enet_miibus_writereg;
-	sc->sc_mii.mii_statchg = enet_miibus_statchg;
-	ifmedia_init(>sc_mii.mii_media, 0, ether_mediachange,
-	enet_mediastatus);
+	sc->sc_ethercom.ec_mii = mii;
+	mii->mii_ifp = ifp;
+	mii->mii_readreg = enet_miibus_readreg;
+	mii->mii_writereg = enet_miibus_writereg;
+	mii->mii_statchg = enet_miibus_statchg;
+	ifmedia_init(>mii_media, 0, ether_mediachange, enet_mediastatus);
 
 	/* try to attach PHY */
-	mii_attach(self, >sc_mii, 0x, MII_PHY_ANY,
-	MII_OFFSET_ANY, 0);
-	if (LIST_FIRST(>sc_mii.mii_phys) == NULL) {
-		ifmedia_add(>sc_mii.mii_media, IFM_ETHER | IFM_MANUAL,
-		0, NULL);
-		ifmedia_set(>sc_mii.mii_media, IFM_ETHER | IFM_MANUAL);
+	mii_attach(self, mii, 0x, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (LIST_FIRST(>mii_phys) == NULL) {
+		ifmedia_add(>mii_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
+		ifmedia_set(>mii_media, IFM_ETHER | IFM_MANUAL);
 	} else {
-		ifmedia_set(>sc_mii.mii_media, IFM_ETHER | IFM_AUTO);
+		ifmedia_set(>mii_media, IFM_ETHER | IFM_AUTO);
 	}
 
 	if_attach(ifp);
@@ -460,9 +458,9 @@ enet_intr(void *arg)
 	status = ENET_REG_READ(sc, ENET_EIR);
 
 	if (sc->sc_imxtype == 7) {
-		if (status & (ENET_EIR_TXF|ENET_EIR_TXF1|ENET_EIR_TXF2))
+		if (status & (ENET_EIR_TXF | ENET_EIR_TXF1 | ENET_EIR_TXF2))
 			enet_tx_intr(arg);
-		if (status & (ENET_EIR_RXF|ENET_EIR_RXF1|ENET_EIR_RXF2))
+		if (status & (ENET_EIR_RXF | ENET_EIR_RXF1 | ENET_EIR_RXF2))
 			enet_rx_intr(arg);
 	} else {
 		if (status & ENET_EIR_TXF)
@@ -761,17 +759,16 @@ enet_rx_csum(struct enet_softc *sc, stru
 static void
 enet_setmulti(struct enet_softc *sc)
 {
-	struct ifnet *ifp;
+	struct ethercom *ec = >sc_ethercom;
+	struct ifnet *ifp = >ec_if;
 	struct ether_multi *enm;
 	struct ether_multistep step;
 	int promisc;
 	uint32_t crc;
 	uint32_t gaddr[2];
 
-	ifp = >sc_ethercom.ec_if;
-
 	promisc = 0;
-	if ((ifp->if_flags & IFF_PROMISC) || sc->sc_ethercom.ec_multicnt > 0) {
+	if ((ifp->if_flags & IFF_PROMISC) || ec->ec_multicnt > 0) {
 		ifp->if_flags |= IFF_ALLMULTI;
 		if (ifp->if_flags & IFF_PROMISC)
 			promisc = 1;
@@ -779,7 +776,7 @@ enet_setmulti(struct enet_softc *sc)
 	} else {
 		gaddr[0] = gaddr[1] = 0;
 
-		ETHER_FIRST_MULTI(step, >sc_ethercom, enm);
+		ETHER_FIRST_MULTI(step, ec, enm);
 		while (enm 

CVS commit: src/sys

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 23 10:40:40 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c
src/sys/arch/arm/sunxi: sunxi_emac.c
src/sys/arch/arm/xscale: ixp425_if_npe.c
src/sys/arch/mips/sibyte/dev: sbmac.c
src/sys/dev/ic: i82586.c mtd803.c seeq8005.c
src/sys/dev/marvell: if_gfe.c
src/sys/dev/pci: if_kse.c if_ti.c if_vge.c if_vioif.c if_vr.c
src/sys/dev/usb: if_smsc.c

Log Message:
-No functional change:
  - Simplify struct ethercom's pointer near ETHER_FIRST_MULTI().
  - Simplify MII structure initialization.
  - u_int*_t -> uint*_t.
  - KNF


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/sunxi/sunxi_emac.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/arm/xscale/ixp425_if_npe.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/mips/sibyte/dev/sbmac.c
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/ic/i82586.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ic/mtd803.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/ic/seeq8005.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/marvell/if_gfe.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/if_kse.c
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/pci/if_ti.c
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/if_vge.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pci/if_vioif.c
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/pci/if_vr.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/if_smsc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/bi

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 23 10:34:44 UTC 2019

Modified Files:
src/sys/dev/bi: if_ni.c

Log Message:
- Use aprint_*().
- KNF
- u_int*_t -> uint*_t


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/bi/if_ni.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/bi

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 23 10:34:44 UTC 2019

Modified Files:
src/sys/dev/bi: if_ni.c

Log Message:
- Use aprint_*().
- KNF
- u_int*_t -> uint*_t


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/bi/if_ni.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/bi/if_ni.c
diff -u src/sys/dev/bi/if_ni.c:1.46 src/sys/dev/bi/if_ni.c:1.47
--- src/sys/dev/bi/if_ni.c:1.46	Tue Jun 26 06:48:00 2018
+++ src/sys/dev/bi/if_ni.c	Thu May 23 10:34:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ni.c,v 1.46 2018/06/26 06:48:00 msaitoh Exp $ */
+/*	$NetBSD: if_ni.c,v 1.47 2019/05/23 10:34:44 msaitoh Exp $ */
 /*
  * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
  *
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ni.c,v 1.46 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ni.c,v 1.47 2019/05/23 10:34:44 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -130,7 +130,7 @@ struct	ni_softc {
 	struct ni_gvppqb *sc_pgvppqb;	/* Phys address of PQB		*/
 	struct ni_fqb	*sc_fqb;	/* Free Queue block		*/
 	struct ni_bbd	*sc_bbd;	/* Buffer descriptors		*/
-	u_int8_t	sc_enaddr[ETHER_ADDR_LEN];
+	uint8_t	sc_enaddr[ETHER_ADDR_LEN];
 };
 
 static	int	nimatch(device_t, cfdata_t, void *);
@@ -143,8 +143,8 @@ static	int	ni_add_rxbuf(struct ni_softc 
 static	void	ni_setup(struct ni_softc *);
 static	void	nitimeout(struct ifnet *);
 static	void	ni_shutdown(void *);
-static	void ni_getpgs(struct ni_softc *sc, int size, void **v, paddr_t *p);
-static	int failtest(struct ni_softc *, int, int, int, const char *);
+static	void	ni_getpgs(struct ni_softc *, int, void **, paddr_t *);
+static	int	failtest(struct ni_softc *, int, int, int, const char *);
 
 volatile int endwait, retry;	/* Used during autoconfig */
 
@@ -192,7 +192,7 @@ ni_getpgs(struct ni_softc *sc, int size,
 		panic(" unable to allocate memory: error %d", error);
 
 	if ((error = bus_dmamem_map(sc->sc_dmat, , nsegs, size, v,
-	BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0)
+	BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0)
 		panic(" unable to map memory: error %d", error);
 
 	if (p)
@@ -237,8 +237,8 @@ niattach(device_t parent, device_t self,
 	sc->sc_dev = self;
 
 	type = bus_space_read_2(ba->ba_iot, ba->ba_ioh, BIREG_DTYPE);
-	printf(": DEBN%c\n", type == BIDT_DEBNA ? 'A' : type == BIDT_DEBNT ?
-	'T' : 'K');
+	aprint_normal(": DEBN%c\n", type == BIDT_DEBNA ? 'A'
+	: type == BIDT_DEBNT ? 'T' : 'K');
 	sc->sc_iot = ba->ba_iot;
 	sc->sc_ioh = ba->ba_ioh;
 	sc->sc_dmat = ba->ba_dmat;
@@ -259,7 +259,7 @@ niattach(device_t parent, device_t self,
 
 	nipqb->np_veclvl = (ba->ba_ivec << 2) + 2;
 	nipqb->np_node = ba->ba_intcpu;
-	nipqb->np_vpqb = (u_int32_t)gvp;
+	nipqb->np_vpqb = (uint32_t)gvp;
 #ifdef __vax__
 	nipqb->np_spt = nipqb->np_gpt = mfpr(PR_SBR);
 	nipqb->np_sptlen = nipqb->np_gptlen = mfpr(PR_SLR);
@@ -267,8 +267,8 @@ niattach(device_t parent, device_t self,
 #error Must fix support for non-vax.
 #endif
 	nipqb->np_bvplvl = 1;
-	nipqb->np_vfqb = (u_int32_t)fqb;
-	nipqb->np_vbdt = (u_int32_t)bbd;
+	nipqb->np_vfqb = (uint32_t)fqb;
+	nipqb->np_vbdt = (uint32_t)bbd;
 	nipqb->np_nbdr = NBDESCS;
 
 	/* Free queue block */
@@ -296,7 +296,7 @@ niattach(device_t parent, device_t self,
 	while ((NI_RREG(BIREG_VAXBICSR) & BICSR_BROKE) && --i)
 		DELAY(50);
 	if (i == 0) {
-		printf("%s: BROKE bit set after reset\n", device_xname(self));
+		aprint_error_dev(self, "BROKE bit set after reset\n");
 		return;
 	}
 
@@ -309,7 +309,7 @@ niattach(device_t parent, device_t self,
 	NI_WREG(NI_PCR, NI_RREG(NI_PCR) & ~PCR_OWN);
 
 	/* kick off init */
-	NI_WREG(NI_PCR, (u_int32_t)sc->sc_pgvppqb | PCR_INIT | PCR_OWN);
+	NI_WREG(NI_PCR, (uint32_t)sc->sc_pgvppqb | PCR_INIT | PCR_OWN);
 	while (NI_RREG(NI_PCR) & PCR_OWN)
 		DELAY(10);
 
@@ -320,7 +320,7 @@ niattach(device_t parent, device_t self,
 	NI_WREG(NI_PSR, NI_RREG(NI_PSR) & ~PSR_OWN);
 
 	WAITREG(NI_PCR, PCR_OWN);
-	NI_WREG(NI_PCR, PCR_OWN|PCR_ENABLE);
+	NI_WREG(NI_PCR, PCR_OWN | PCR_ENABLE);
 	WAITREG(NI_PCR, PCR_OWN);
 	WAITREG(NI_PSR, PSR_OWN);
 
@@ -347,7 +347,7 @@ niattach(device_t parent, device_t self,
 		INSQTI(msg, >nf_mforw);
 	}
 	WAITREG(NI_PCR, PCR_OWN);
-	NI_WREG(NI_PCR, PCR_FREEQNE|PCR_MFREEQ|PCR_OWN);
+	NI_WREG(NI_PCR, PCR_FREEQNE | PCR_MFREEQ | PCR_OWN);
 	WAITREG(NI_PCR, PCR_OWN);
 
 	/* Set up xmit queue */
@@ -370,7 +370,7 @@ niattach(device_t parent, device_t self,
 		INSQTI(data, >nf_dforw);
 	}
 	WAITREG(NI_PCR, PCR_OWN);
-	NI_WREG(NI_PCR, PCR_FREEQNE|PCR_DFREEQ|PCR_OWN);
+	NI_WREG(NI_PCR, PCR_FREEQNE | PCR_DFREEQ | PCR_OWN);
 	WAITREG(NI_PCR, PCR_OWN);
 
 	/* recv buffers */
@@ -392,7 +392,7 @@ niattach(device_t parent, device_t self,
 		INSQTI(data, >nf_rforw);
 	}
 	WAITREG(NI_PCR, PCR_OWN);
-	NI_WREG(NI_PCR, PCR_FREEQNE|PCR_RFREEQ|PCR_OWN);
+	NI_WREG(NI_PCR, PCR_FREEQNE | 

CVS commit: src/sys

2019-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 23 10:30:36 UTC 2019

Modified Files:
src/sys/arch/arm/ep93xx: epe.c
src/sys/arch/mac68k/dev: if_mc.c
src/sys/arch/macppc/dev: am79c950.c
src/sys/dev/cadence: if_cemac.c
src/sys/dev/ic: lance.c
src/sys/dev/pci: if_txp.c
src/sys/dev/scsipi: if_se.c

Log Message:
No functional change:
 - Change ac(was arpcom) to ec(ethercom)
 - Simplify MII structure initialization.
 - u_int*_t -> uint*_t.
 - KNF


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/ep93xx/epe.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/mac68k/dev/if_mc.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/macppc/dev/am79c950.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/cadence/if_cemac.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/ic/lance.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/pci/if_txp.c
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/scsipi/if_se.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/mount_portal

2019-05-23 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu May 23 09:15:45 UTC 2019

Modified Files:
src/sbin/mount_portal: mount_portal.8

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sbin/mount_portal/mount_portal.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet

2019-05-23 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu May 23 08:32:31 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: arc.c dbuf.c dnode.c
sa.c zfs_znode.c
src/external/cddl/osnet/sys/kern: kmem.c
src/external/cddl/osnet/sys/sys: kmem.h

Log Message:
Update the kmem_cache emulation to run its callbacks with
Solaris argument order.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/sa.c
cvs rdiff -u -r1.26 -r1.27 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/kern/kmem.c
cvs rdiff -u -r1.10 -r1.11 src/external/cddl/osnet/sys/sys/kmem.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/cddl/osnet

2019-05-23 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu May 23 08:32:31 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: arc.c dbuf.c dnode.c
sa.c zfs_znode.c
src/external/cddl/osnet/sys/kern: kmem.c
src/external/cddl/osnet/sys/sys: kmem.h

Log Message:
Update the kmem_cache emulation to run its callbacks with
Solaris argument order.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/sa.c
cvs rdiff -u -r1.26 -r1.27 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/osnet/sys/kern/kmem.c
cvs rdiff -u -r1.10 -r1.11 src/external/cddl/osnet/sys/sys/kmem.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.12 src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.13
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c:1.12	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c	Thu May 23 08:32:30 2019
@@ -1578,9 +1578,6 @@ hdr_full_cons(void *vbuf, void *unused, 
 {
 	arc_buf_hdr_t *hdr = vbuf;
 
-#ifdef __NetBSD__
-	hdr = unused;
-#endif
 	bzero(hdr, HDR_FULL_SIZE);
 	cv_init(>b_l1hdr.b_cv, NULL, CV_DEFAULT, NULL);
 	refcount_create(>b_l1hdr.b_refcnt);
@@ -1597,9 +1594,6 @@ hdr_l2only_cons(void *vbuf, void *unused
 {
 	arc_buf_hdr_t *hdr = vbuf;
 
-#ifdef __NetBSD__
-	hdr = unused;
-#endif
 	bzero(hdr, HDR_L2ONLY_SIZE);
 	arc_space_consume(HDR_L2ONLY_SIZE, ARC_SPACE_L2HDRS);
 
@@ -1612,9 +1606,6 @@ buf_cons(void *vbuf, void *unused, int k
 {
 	arc_buf_t *buf = vbuf;
 
-#ifdef __NetBSD__
-	buf = unused;
-#endif
 	bzero(buf, sizeof (arc_buf_t));
 	mutex_init(>b_evict_lock, NULL, MUTEX_DEFAULT, NULL);
 	arc_space_consume(sizeof (arc_buf_t), ARC_SPACE_HDRS);

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c:1.6	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dbuf.c	Thu May 23 08:32:30 2019
@@ -138,9 +138,6 @@ dbuf_cons(void *vdb, void *unused, int k
 {
 	dmu_buf_impl_t *db = vdb;
 
-#ifdef __NetBSD__
-	db = unused;
-#endif
 	bzero(db, sizeof (dmu_buf_impl_t));
 	mutex_init(>db_mtx, NULL, MUTEX_DEFAULT, NULL);
 	cv_init(>db_changed, NULL, CV_DEFAULT, NULL);

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c:1.5 src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c:1.6
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c:1.5	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dnode.c	Thu May 23 08:32:30 2019
@@ -107,9 +107,6 @@ dnode_cons(void *arg, void *unused, int 
 	dnode_t *dn = arg;
 	int i;
 
-#ifdef __NetBSD__
-	dn = unused;
-#endif
 	rw_init(>dn_struct_rwlock, NULL, RW_DEFAULT, NULL);
 	mutex_init(>dn_mtx, NULL, MUTEX_DEFAULT, NULL);
 	mutex_init(>dn_dbufs_mtx, NULL, MUTEX_DEFAULT, NULL);

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/sa.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/sa.c:1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/sa.c:1.3
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/sa.c:1.2	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/sa.c	Thu May 23 08:32:30 2019
@@ -212,9 +212,6 @@ sa_cache_constructor(void *buf, void *un
 {
 	sa_handle_t *hdl = buf;
 
-#ifdef __NetBSD__
-	hdl = unused;
-#endif
 	mutex_init(>sa_lock, NULL, MUTEX_DEFAULT, NULL);
 	return (0);
 }

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c:1.26 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c:1.27
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c:1.26	Mon Apr 15 12:59:38 2019
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_znode.c	Thu May 23 08:32:30 2019
@@ -130,9 +130,6 @@ zfs_znode_cache_constructor(void *buf, v
 {
 	znode_t *zp = buf;
 
-#ifdef __NetBSD__
-	zp = arg;
-#endif
 	POINTER_INVALIDATE(>z_zfsvfs);
 
 	list_link_init(>z_link_node);

Index: src/external/cddl/osnet/sys/kern/kmem.c
diff -u src/external/cddl/osnet/sys/kern/kmem.c:1.1 src/external/cddl/osnet/sys/kern/kmem.c:1.2
--- src/external/cddl/osnet/sys/kern/kmem.c:1.1	Mon May 28 21:05:09 2018
+++ src/external/cddl/osnet/sys/kern/kmem.c	Thu May 23 08:32:30 2019
@@ -1,4 +1,4 @@
-/*	

Re: CVS commit: src/include

2019-05-23 Thread Martin Husemann
On Thu, May 23, 2019 at 12:03:33AM +0200, Kamil Rytarowski wrote:
> >> -#if ((__cplusplus - 0) < 201103L)
> >> +#if defined(_ISOC11_SOURCE) || (__STDC_VERSION__ - 0) >= 201101L

Am I missing something or does this (in addition to the intended change)
make the macro invisible for C++ compilations? Is that intended? If so,
shouldn't it be explained in the log message?

Martin