Module Name: src
Committed By: riastradh
Date: Thu Mar 3 06:22:23 UTC 2022
Modified Files:
src/sys/dev: video.c video_if.h
Log Message:
video(4): Allow drivers to pass the softc explicitly.
This way one device driver can have multiple video0, video1, &c.,
interfaces attached, using independent state and a common parent.
To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/video.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/video_if.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/video.c
diff -u src/sys/dev/video.c:1.43 src/sys/dev/video.c:1.44
--- src/sys/dev/video.c:1.43 Wed Dec 8 20:50:02 2021
+++ src/sys/dev/video.c Thu Mar 3 06:22:23 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: video.c,v 1.43 2021/12/08 20:50:02 andvar Exp $ */
+/* $NetBSD: video.c,v 1.44 2022/03/03 06:22:23 riastradh Exp $ */
/*
* Copyright (c) 2008 Patrick Mahoney <[email protected]>
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.43 2021/12/08 20:50:02 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.44 2022/03/03 06:22:23 riastradh Exp $");
#include "video.h"
#if NVIDEO > 0
@@ -351,7 +351,7 @@ video_attach(device_t parent, device_t s
sc->sc_dev = self;
sc->hw_dev = parent;
sc->hw_if = args->hw_if;
- sc->hw_softc = device_private(parent);
+ sc->hw_softc = args->hw_softc;
sc->sc_open = 0;
sc->sc_refcnt = 0;
@@ -433,6 +433,19 @@ video_attach_mi(const struct video_hw_if
struct video_attach_args args;
args.hw_if = hw_if;
+ args.hw_softc = device_private(parent);
+ return config_found(parent, &args, video_print,
+ CFARGS(.iattr = "videobus"));
+}
+
+device_t
+video_attach_mi_softc(const struct video_hw_if *hw_if, device_t parent,
+ void *sc)
+{
+ struct video_attach_args args;
+
+ args.hw_if = hw_if;
+ args.hw_softc = sc;
return config_found(parent, &args, video_print,
CFARGS(.iattr = "videobus"));
}
Index: src/sys/dev/video_if.h
diff -u src/sys/dev/video_if.h:1.9 src/sys/dev/video_if.h:1.10
--- src/sys/dev/video_if.h:1.9 Fri May 22 11:23:51 2020
+++ src/sys/dev/video_if.h Thu Mar 3 06:22:23 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: video_if.h,v 1.9 2020/05/22 11:23:51 jmcneill Exp $ */
+/* $NetBSD: video_if.h,v 1.10 2022/03/03 06:22:23 riastradh Exp $ */
/*
* Copyright (c) 2008 Patrick Mahoney <[email protected]>
@@ -501,9 +501,11 @@ struct video_hw_if {
struct video_attach_args {
const struct video_hw_if *hw_if;
+ void *hw_softc;
};
device_t video_attach_mi(const struct video_hw_if *, device_t);
+device_t video_attach_mi_softc(const struct video_hw_if *, device_t, void *);
void video_submit_payload(device_t, const struct video_payload *);
#endif /* _SYS_DEV_VIDEO_IF_H_ */