Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev video(4): Allow drivers to pass the softc explicitly.
details: https://anonhg.NetBSD.org/src/rev/952eefc8efdb
branches: trunk
changeset: 362576:952eefc8efdb
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Mar 03 06:22:23 2022 +0000
description:
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.
diffstat:
sys/dev/video.c | 19 ++++++++++++++++---
sys/dev/video_if.h | 4 +++-
2 files changed, 19 insertions(+), 4 deletions(-)
diffs (68 lines):
diff -r bec5e153cc6b -r 952eefc8efdb sys/dev/video.c
--- a/sys/dev/video.c Thu Mar 03 06:22:03 2022 +0000
+++ b/sys/dev/video.c Thu Mar 03 06:22:23 2022 +0000
@@ -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 <pat%polycrystal.org@localhost>
@@ -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 @@
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 @@
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"));
}
diff -r bec5e153cc6b -r 952eefc8efdb sys/dev/video_if.h
--- a/sys/dev/video_if.h Thu Mar 03 06:22:03 2022 +0000
+++ b/sys/dev/video_if.h Thu Mar 03 06:22:23 2022 +0000
@@ -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 <pat%polycrystal.org@localhost>
@@ -501,9 +501,11 @@
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_ */
Home |
Main Index |
Thread Index |
Old Index