Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/wscons wsdisplay(4): Use C99 initializer for usl_syn...



details:   https://anonhg.NetBSD.org/src/rev/40ec5f7f2333
branches:  trunk
changeset: 379472:40ec5f7f2333
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Jun 01 23:28:07 2021 +0000

description:
wsdisplay(4): Use C99 initializer for usl_syncops.

Avoid sketchy function pointer cast while here.

diffstat:

 sys/dev/wscons/wsdisplay_compat_usl.c |  22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diffs (52 lines):

diff -r 5859f9e7b9ae -r 40ec5f7f2333 sys/dev/wscons/wsdisplay_compat_usl.c
--- a/sys/dev/wscons/wsdisplay_compat_usl.c     Tue Jun 01 22:58:03 2021 +0000
+++ b/sys/dev/wscons/wsdisplay_compat_usl.c     Tue Jun 01 23:28:07 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_compat_usl.c,v 1.53 2020/05/23 23:42:42 ad Exp $ */
+/* $NetBSD: wsdisplay_compat_usl.c,v 1.54 2021/06/01 23:28:07 riastradh Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.53 2020/05/23 23:42:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_compat_usl.c,v 1.54 2021/06/01 23:28:07 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_freebsd.h"
@@ -80,13 +80,13 @@ static void usl_detachtimeout(void *);
 static int usl_attachproc(void *, int, void (*)(void *, int, int), void *);
 static int usl_attachack(struct usl_syncdata *, int);
 static void usl_attachtimeout(void *);
+static void usl_sync_destroy(void *);
 
 static const struct wscons_syncops usl_syncops = {
-       usl_detachproc,
-       usl_attachproc,
-       usl_sync_check,
-#define _usl_sync_destroy ((void (*)(void *))usl_sync_done)
-       _usl_sync_destroy
+       .detach = usl_detachproc,
+       .attach = usl_attachproc,
+       .check = usl_sync_check,
+       .destroy = usl_sync_destroy,
 };
 
 #ifndef WSCOMPAT_USL_SYNCTIMEOUT
@@ -294,6 +294,14 @@ usl_attachtimeout(void *arg)
        (void) usl_sync_check(sd);
 }
 
+static void
+usl_sync_destroy(void *cookie)
+{
+       struct usl_syncdata *sd = cookie;
+
+       usl_sync_done(sd);
+}
+
 int
 wsdisplay_usl_ioctl1(device_t dv, u_long cmd, void *data,
     int flag, struct lwp *l)



Home | Main Index | Thread Index | Old Index