Instead of using a define, put `seltrue' directly in the custom
cdev_*_init() macro.  This is the approach taken by various MI
macros in sys/conf.h.

While here use the kqfilter equivalent to `seltrue' to ensure both
interfaces are coherent.  Without this spec_kqfilter() returns an
error while spec_poll() returns success.

ok?

Index: arch/amd64/amd64/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/conf.c,v
retrieving revision 1.68
diff -u -p -r1.68 conf.c
--- arch/amd64/amd64/conf.c     24 Jan 2020 05:14:51 -0000      1.68
+++ arch/amd64/amd64/conf.c     11 May 2020 08:39:54 -0000
@@ -86,21 +86,21 @@ int nblkdev = nitems(bdevsw);
        dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
        (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
        (dev_type_stop((*))) enodev, 0, seltrue, \
-       (dev_type_mmap((*))) enodev }
+       (dev_type_mmap((*))) enodev, 0, 0, seltrue_kqfilter }
 
-/* open, close, ioctl, select -- XXX should be a generic device */
+/* open, close, ioctl, seltrue, seltrue_kqfilter */
 #define cdev_ocis_init(c,n) { \
         dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
         (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
-        (dev_type_stop((*))) enodev, 0,  dev_init(c,n,poll), \
-        (dev_type_mmap((*))) enodev, 0 }
+        (dev_type_stop((*))) enodev, 0,  seltrue, \
+        (dev_type_mmap((*))) enodev, 0, 0, seltrue_kqfilter }
 
 /* open, close, read */
 #define cdev_nvram_init(c,n) { \
        dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
        (dev_type_write((*))) enodev, (dev_type_ioctl((*))) enodev, \
        (dev_type_stop((*))) enodev, 0, seltrue, \
-       (dev_type_mmap((*))) enodev, 0 }
+       (dev_type_mmap((*))) enodev, 0, 0, seltrue_kqfilter }
 
 /* open, close, ioctl */
 #define cdev_vmm_init(c,n) { \
@@ -109,7 +109,7 @@ int nblkdev = nitems(bdevsw);
        (dev_type_write((*))) enodev, \
         dev_init(c,n,ioctl), \
        (dev_type_stop((*))) enodev, 0, seltrue, \
-       (dev_type_mmap((*))) enodev }
+       (dev_type_mmap((*))) enodev, 0, 0, seltrue_kqfilter }
 
 #define        mmread  mmrw
 #define        mmwrite mmrw
Index: arch/amd64/include/conf.h
===================================================================
RCS file: /cvs/src/sys/arch/amd64/include/conf.h,v
retrieving revision 1.7
diff -u -p -r1.7 conf.h
--- arch/amd64/include/conf.h   8 Jan 2016 11:20:58 -0000       1.7
+++ arch/amd64/include/conf.h   11 May 2020 08:39:54 -0000
@@ -41,7 +41,6 @@ cdev_decl(fd);
 
 cdev_decl(spkr);
 
-#define biosselect seltrue
 cdev_decl(bios);
 
 #define        cdev_acpi_init(c,n) {\
@@ -51,7 +50,6 @@ cdev_decl(bios);
        (dev_type_mmap((*))) enodev, 0, 0, dev_init(c,n,kqfilter) }
 cdev_decl(acpi);
 
-#define pctrpoll seltrue
 cdev_decl(pctr);
 
 #include "vmm.h"
Index: arch/i386/i386/conf.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/conf.c,v
retrieving revision 1.167
diff -u -p -r1.167 conf.c
--- arch/i386/i386/conf.c       24 Jan 2020 05:14:51 -0000      1.167
+++ arch/i386/i386/conf.c       11 May 2020 08:39:54 -0000
@@ -88,21 +88,21 @@ int nblkdev = nitems(bdevsw);
        dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
        (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
        (dev_type_stop((*))) enodev, 0, seltrue, \
-       (dev_type_mmap((*))) enodev }
+        (dev_type_mmap((*))) enodev, 0, 0, seltrue_kqfilter }
 
-/* open, close, ioctl, poll -- XXX should be a generic device */
+/* open, close, ioctl, seltrue, seltrue_kqfilter */
 #define cdev_ocis_init(c,n) { \
         dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
         (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \
-        (dev_type_stop((*))) enodev, 0,  dev_init(c,n,poll), \
-        (dev_type_mmap((*))) enodev, 0 }
+        (dev_type_stop((*))) enodev, 0,  seltrue, \
+        (dev_type_mmap((*))) enodev, 0, 0, seltrue_kqfilter }
 
 /* open, close, read */
 #define cdev_nvram_init(c,n) { \
        dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
        (dev_type_write((*))) enodev, (dev_type_ioctl((*))) enodev, \
        (dev_type_stop((*))) enodev, 0, seltrue, \
-       (dev_type_mmap((*))) enodev, 0 }
+        (dev_type_mmap((*))) enodev, 0, 0, seltrue_kqfilter }
 
 #define        mmread  mmrw
 #define        mmwrite mmrw
Index: arch/i386/include/conf.h
===================================================================
RCS file: /cvs/src/sys/arch/i386/include/conf.h,v
retrieving revision 1.17
diff -u -p -r1.17 conf.h
--- arch/i386/include/conf.h    18 Jan 2019 01:34:50 -0000      1.17
+++ arch/i386/include/conf.h    11 May 2020 08:39:54 -0000
@@ -65,7 +65,6 @@ cdev_decl(pms);
 
 cdev_decl(joy);
 
-#define biospoll seltrue
 cdev_decl(bios);
 
 cdev_decl(acpi);
@@ -74,5 +73,4 @@ cdev_decl(apm);
 
 cdev_decl(acpiapm);
 
-#define pctrpoll seltrue
 cdev_decl(pctr);

Reply via email to