arm64: aplmca: constify _hw_if struct

2022-10-18 Thread Klemens Nanni
The only driver with a non-const struct.
Seen while looking at it for audio(9).

OK?

diff --git a/sys/arch/arm64/dev/aplmca.c b/sys/arch/arm64/dev/aplmca.c
index 07a53103be4..03ade86fee7 100644
--- a/sys/arch/arm64/dev/aplmca.c
+++ b/sys/arch/arm64/dev/aplmca.c
@@ -135,7 +135,7 @@ int aplmca_trigger_input(void *, void *, void *, int,
 intaplmca_halt_output(void *);
 intaplmca_halt_input(void *);
 
-struct audio_hw_if aplmca_hw_if = {
+const struct audio_hw_if aplmca_hw_if = {
.set_params = aplmca_set_params,
.get_props = aplmca_get_props,
.allocm = aplmca_allocm,



Re: constify *_hw_if

2022-03-21 Thread Alexandre Ratchov
On Mon, Mar 21, 2022 at 12:09:54PM +, Miod Vallat wrote:
> The following diff makes {audio,midi,radio,video}_hw_if structs in the
> kernel const, in order to move them to rodata.
> 

ok ratchov



constify *_hw_if

2022-03-21 Thread Miod Vallat
The following diff makes {audio,midi,radio,video}_hw_if structs in the
kernel const, in order to move them to rodata.

Index: share/man/man9/audio.9
===
RCS file: /OpenBSD/src/share/man/man9/audio.9,v
retrieving revision 1.29
diff -u -p -r1.29 audio.9
--- share/man/man9/audio.9  13 Sep 2019 15:47:47 -  1.29
+++ share/man/man9/audio.9  21 Mar 2022 12:08:58 -
@@ -104,7 +104,7 @@ when the latter calls
 This call is:
 .Bd -literal -offset indent
 struct device *
-audio_attach_mi(struct audio_hw_if *ahwp, void *hdl,
+audio_attach_mi(const struct audio_hw_if *ahwp, void *hdl,
struct device *dev);
 .Ed
 .Pp
Index: share/man/man9/radio.9
===
RCS file: /OpenBSD/src/share/man/man9/radio.9,v
retrieving revision 1.11
diff -u -p -r1.11 radio.9
--- share/man/man9/radio.9  31 Aug 2016 16:54:33 -  1.11
+++ share/man/man9/radio.9  21 Mar 2022 12:08:58 -
@@ -53,7 +53,7 @@ when the latter calls
 This call should be
 .Bd -literal
 .Ft void
-.Fn radio_attach_mi "struct radio_hw_if *rhwp" "void *hdlp" \
+.Fn radio_attach_mi "const struct radio_hw_if *rhwp" "void *hdlp" \
 "struct device * dev"
 .Ed
 .Pp
Index: sys/arch/hppa/gsc/harmony.c
===
RCS file: /OpenBSD/src/sys/arch/hppa/gsc/harmony.c,v
retrieving revision 1.37
diff -u -p -r1.37 harmony.c
--- sys/arch/hppa/gsc/harmony.c 13 Mar 2022 08:04:38 -  1.37
+++ sys/arch/hppa/gsc/harmony.c 21 Mar 2022 12:08:58 -
@@ -73,7 +73,7 @@ int harmony_trigger_output(void *, v
 int harmony_trigger_input(void *, void *, void *, int,
 void (*intr)(void *), void *, struct audio_params *);
 
-struct audio_hw_if harmony_sa_hw_if = {
+const struct audio_hw_if harmony_sa_hw_if = {
harmony_open,
harmony_close,
harmony_set_params,
Index: sys/arch/luna88k/cbus/nec86.c
===
RCS file: /OpenBSD/src/sys/arch/luna88k/cbus/nec86.c,v
retrieving revision 1.4
diff -u -p -r1.4 nec86.c
--- sys/arch/luna88k/cbus/nec86.c   16 Feb 2022 06:21:18 -  1.4
+++ sys/arch/luna88k/cbus/nec86.c   21 Mar 2022 12:08:58 -
@@ -67,7 +67,7 @@
  * Define our interface to the higher level audio driver.
  */
 
-struct audio_hw_if nec86_hw_if = {
+const struct audio_hw_if nec86_hw_if = {
.open   = nec86hw_open,
.close  = nec86hw_close,
.set_params = nec86hw_set_params,
Index: sys/arch/luna88k/cbus/nec86var.h
===
RCS file: /OpenBSD/src/sys/arch/luna88k/cbus/nec86var.h,v
retrieving revision 1.1
diff -u -p -r1.1 nec86var.h
--- sys/arch/luna88k/cbus/nec86var.h28 Dec 2014 13:03:18 -  1.1
+++ sys/arch/luna88k/cbus/nec86var.h21 Mar 2022 12:08:58 -
@@ -55,7 +55,7 @@ struct nec86_softc {
int sc_intlevel;
 };
 
-extern  struct  audio_hw_if nec86_hw_if;
+extern  const struct  audio_hw_if nec86_hw_if;
 intnec86_probesubr(bus_space_tag_t, bus_space_handle_t,
bus_space_handle_t);
 void   nec86_attachsubr(struct nec86_softc *);
Index: sys/arch/macppc/dev/aoa.c
===
RCS file: /OpenBSD/src/sys/arch/macppc/dev/aoa.c,v
retrieving revision 1.13
diff -u -p -r1.13 aoa.c
--- sys/arch/macppc/dev/aoa.c   13 Mar 2022 12:33:01 -  1.13
+++ sys/arch/macppc/dev/aoa.c   21 Mar 2022 12:08:58 -
@@ -65,7 +65,7 @@ struct cfdriver aoa_cd = {
NULL, "aoa", DV_DULL
 };
 
-struct audio_hw_if aoa_hw_if = {
+const struct audio_hw_if aoa_hw_if = {
i2s_open,
i2s_close,
i2s_set_params,
Index: sys/arch/macppc/dev/awacs.c
===
RCS file: /OpenBSD/src/sys/arch/macppc/dev/awacs.c,v
retrieving revision 1.36
diff -u -p -r1.36 awacs.c
--- sys/arch/macppc/dev/awacs.c 13 Mar 2022 12:33:01 -  1.36
+++ sys/arch/macppc/dev/awacs.c 21 Mar 2022 12:08:58 -
@@ -126,7 +126,7 @@ struct cfdriver awacs_cd = {
NULL, "awacs", DV_DULL
 };
 
-struct audio_hw_if awacs_hw_if = {
+const struct audio_hw_if awacs_hw_if = {
awacs_open,
awacs_close,
awacs_set_params,
Index: sys/arch/macppc/dev/daca.c
===
RCS file: /OpenBSD/src/sys/arch/macppc/dev/daca.c,v
retrieving revision 1.12
diff -u -p -r1.12 daca.c
--- sys/arch/macppc/dev/daca.c  13 Mar 2022 12:33:01 -  1.12
+++ sys/arch/macppc/dev/daca.c  21 Mar 2022 12:08:58 -
@@ -71,7 +71,7 @@ struct cfdriver daca_cd = {
NULL, "daca", DV_DULL
 };
 
-struct audio_hw_if daca_hw_if = {
+const struct audio_hw_if daca_hw_if = {
i2s_open,
i2s_close,
i2s_set_params,
Index: sys/arch/macppc/dev/onyx.c