CVS commit: src/sys/arch/landisk/dev

2023-09-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Sep 21 09:24:09 UTC 2023

Modified Files:
src/sys/arch/landisk/dev: rs5c313_landisk.c

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/landisk/dev/rs5c313_landisk.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/landisk/dev/rs5c313_landisk.c
diff -u src/sys/arch/landisk/dev/rs5c313_landisk.c:1.5 src/sys/arch/landisk/dev/rs5c313_landisk.c:1.6
--- src/sys/arch/landisk/dev/rs5c313_landisk.c:1.5	Tue Apr  6 15:29:19 2010
+++ src/sys/arch/landisk/dev/rs5c313_landisk.c	Thu Sep 21 09:24:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rs5c313_landisk.c,v 1.5 2010/04/06 15:29:19 nonaka Exp $	*/
+/*	$NetBSD: rs5c313_landisk.c,v 1.6 2023/09/21 09:24:09 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rs5c313_landisk.c,v 1.5 2010/04/06 15:29:19 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rs5c313_landisk.c,v 1.6 2023/09/21 09:24:09 msaitoh Exp $");
 
 #include 
 #include 
@@ -123,7 +123,7 @@ rtc_ce(struct rs5c313_softc *sc, int ono
 
 
 /*
- * SCLK pin is connnected to SPB0DT.
+ * SCLK pin is connected to SPB0DT.
  * SPB0DT is always in output mode, we set SPB0IO in rtc_begin.
  */
 static void



CVS commit: src/sys/arch/landisk/dev

2023-09-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Sep 21 09:24:09 UTC 2023

Modified Files:
src/sys/arch/landisk/dev: rs5c313_landisk.c

Log Message:
Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/landisk/dev/rs5c313_landisk.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/landisk/dev

2021-09-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep 29 15:17:01 UTC 2021

Modified Files:
src/sys/arch/landisk/dev: button.c

Log Message:
Confirm to the NOTE_SUBMIT protocol.  With this, btn_read_filtops is MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/landisk/dev/button.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/landisk/dev/button.c
diff -u src/sys/arch/landisk/dev/button.c:1.14 src/sys/arch/landisk/dev/button.c:1.15
--- src/sys/arch/landisk/dev/button.c:1.14	Sun Sep 26 16:36:18 2021
+++ src/sys/arch/landisk/dev/button.c	Wed Sep 29 15:17:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: button.c,v 1.14 2021/09/26 16:36:18 thorpej Exp $	*/
+/*	$NetBSD: button.c,v 1.15 2021/09/29 15:17:01 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.14 2021/09/26 16:36:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.15 2021/09/29 15:17:01 thorpej Exp $");
 
 #include 
 #include 
@@ -297,16 +297,26 @@ filt_btn_rdetach(struct knote *kn)
 static int
 filt_btn_read(struct knote *kn, long hint)
 {
+	int rv;
+
+	if (hint & NOTE_SUBMIT) {
+		KASSERT(mutex_owned(&btn_event_queue_lock));
+	} else {
+		mutex_enter(&btn_event_queue_lock);
+	}
 
-	mutex_enter(&btn_event_queue_lock);
 	kn->kn_data = btn_event_queue_count;
-	mutex_exit(&btn_event_queue_lock);
+	rv = kn->kn_data > 0;
+
+	if ((hint & NOTE_SUBMIT) == 0) {
+		mutex_exit(&btn_event_queue_lock);
+	}
 
-	return (kn->kn_data > 0);
+	return rv;
 }
 
 static const struct filterops btn_read_filtops = {
-.f_flags = FILTEROP_ISFD,
+.f_flags = FILTEROP_ISFD | FILTEROP_MPSAFE,
 .f_attach = NULL,
 .f_detach = filt_btn_rdetach,
 .f_event = filt_btn_read,
@@ -399,6 +409,6 @@ btn_event_send(struct btn_event *bev, in
 		btn_event_queue_flags &= ~BEVQ_F_WAITING;
 		cv_broadcast(&btn_event_queue_cv);
 	}
-	selnotify(&btn_event_queue_selinfo, 0, 0);
+	selnotify(&btn_event_queue_selinfo, POLLIN | POLLRDNORM, NOTE_SUBMIT);
 	mutex_exit(&btn_event_queue_lock);
 }



CVS commit: src/sys/arch/landisk/dev

2021-09-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep 29 15:17:01 UTC 2021

Modified Files:
src/sys/arch/landisk/dev: button.c

Log Message:
Confirm to the NOTE_SUBMIT protocol.  With this, btn_read_filtops is MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/landisk/dev/button.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/landisk/dev

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 14:32:02 UTC 2021

Modified Files:
src/sys/arch/landisk/dev: button.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/landisk/dev/button.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/landisk/dev/button.c
diff -u src/sys/arch/landisk/dev/button.c:1.12 src/sys/arch/landisk/dev/button.c:1.13
--- src/sys/arch/landisk/dev/button.c:1.12	Sun Sep 26 01:16:07 2021
+++ src/sys/arch/landisk/dev/button.c	Sun Sep 26 14:32:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: button.c,v 1.12 2021/09/26 01:16:07 thorpej Exp $	*/
+/*	$NetBSD: button.c,v 1.13 2021/09/26 14:32:02 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.12 2021/09/26 01:16:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.13 2021/09/26 14:32:02 thorpej Exp $");
 
 #include 
 #include 
@@ -312,13 +312,6 @@ static const struct filterops btn_read_f
 .f_event = filt_btn_read,
 };
 
-static const struct filterops btn_write_filtops = {
-.f_flags = FILTEROP_ISFD,
-.f_attach = NULL,
-.f_detach = filt_btn_rdetach,
-.f_event = filt_seltrue,
-};
-
 int
 btnkqfilter(dev_t dev, struct knote *kn)
 {
@@ -330,20 +323,19 @@ btnkqfilter(dev_t dev, struct knote *kn)
 	switch (kn->kn_filter) {
 	case EVFILT_READ:
 		kn->kn_fop = &btn_read_filtops;
+		mutex_enter(&btn_event_queue_lock);
+		selrecord_knote(&btn_event_queue_selinfo, kn);
+		mutex_exit(&btn_event_queue_lock);
 		break;
 
 	case EVFILT_WRITE:
-		kn->kn_fop = &btn_write_filtops;
+		kn->kn_fop = &seltrue_filtops;
 		break;
 
 	default:
 		return (1);
 	}
 
-	mutex_enter(&btn_event_queue_lock);
-	selrecord_knote(&btn_event_queue_selinfo, kn);
-	mutex_exit(&btn_event_queue_lock);
-
 	return (0);
 }
 



CVS commit: src/sys/arch/landisk/dev

2021-09-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 26 14:32:02 UTC 2021

Modified Files:
src/sys/arch/landisk/dev: button.c

Log Message:
Use seltrue_filtops rather than rolling our own with filt_seltrue.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/landisk/dev/button.c

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