From nobody Tue Apr 7 17:18:34 2026 Received: from smtp.smtpout.orange.fr (smtp-82.smtpout.orange.fr [80.12.242.82]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F15046AF0F; Thu, 26 Feb 2026 20:44:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772138667; cv=none; b=enb6/UjBvqOKKPNYsY3q2h+TI0RhS/Fwm48750HX4glTMQ0HykvIlL7cEqRzjZcuM/eisw4MAoICX1BrM8alE860iA0kQYSivKWGzfXUk/ktun6bJyKofgTL0UOXw6YgGwmPZ4/AgYQ/qjoD+KWN920gRHrCMcM3vlpo2gNjaVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772138667; c=relaxed/simple; bh=RpZviqvGWVJR1tcATAIWAtKC+QlaZLR+DGJO/TZlyz0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tMJFM2dU3OW7FTYs+if4O7gvk7jiJc+bibkxFp+ccJyrVZhDwWUH49t6/XVcU36WBtm1RwZ4JHYaSXysqeo1gaIlWek1zsgbATITEia1iL8l0Qw8DmoGsCm10MayLMmx00LUFlpUIipdrohh+ShBTt+k4Xby2hvCt+SC0X6Q37s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=sWNx3deX; arc=none smtp.client-ip=80.12.242.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="sWNx3deX" Received: from fedora.home ([IPv6:2a01:cb10:785:b00:8347:f260:7456:7662]) by smtp.orange.fr with ESMTPSA id viDZvEqUkbni4viDavq6iC; Thu, 26 Feb 2026 21:44:21 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1772138661; bh=DacmWtirnDJ8c5FfO60izxCVDBNId/jIFsPzSSFKxMk=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=sWNx3deX74wZ1sLmbYlB94WwaAvsbzZjnr/HqeBUWAOhun7bKOCvQbAnp1elKkvzt ef6PBgecHm1z/Ua/2PhYmMnHJzfwb0C3KNbIuPhRPcZiLM1ZuPS7E5X9T8t56MLJcs wn7ngmD4UfdxYcVwXMKGJuHQL9er9gH4vZMBlZsmZJPus1/UJ3ySU5VVbZM0q6eUjJ E3GcXHEwuv8Vup9GCxUFH5tcK1US0W+l7IYFd2W56mKh03e81/REuI8ZfgenpFXs+Z jqq/hPeb1DL0biKYbHI2BhIOh/ZVmM8w1UV59jlUvdas2tRkKexZud3w+qcnFiruL/ bjxcsLkEKKxKQ== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 26 Feb 2026 21:44:21 +0100 X-ME-IP: 2a01:cb10:785:b00:8347:f260:7456:7662 From: Christophe JAILLET To: Johannes Berg , Jaroslav Kysela , Takashi Iwai Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linuxppc-dev@lists.ozlabs.org, linux-sound@vger.kernel.org Subject: [PATCH v1] ALSA: aoa: Constify struct codec_connection Date: Thu, 26 Feb 2026 21:44:10 +0100 Message-ID: <4009c337cc1a1a57795562279270c03687973b3b.1772138640.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 'struct codec_connection' are not modified in this driver. Constifying these structures moves some data to a read-only section, so increases overall security. On a x86_64, with allmodconfig: Before: =3D=3D=3D=3D=3D=3D text data bss dec hex filename 10034 3392 12 13438 347e sound/aoa/fabrics/layout.o After: =3D=3D=3D=3D=3D text data bss dec hex filename 10370 3040 12 13422 346e sound/aoa/fabrics/layout.o Signed-off-by: Christophe JAILLET --- Compile tested only. The fabric_data field in struct aoa_codecis is only used in sound/aoa/fabrics/layout.c, so there should be no side effect for other files that include sound/aoa/aoa.h --- sound/aoa/aoa.h | 2 +- sound/aoa/fabrics/layout.c | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sound/aoa/aoa.h b/sound/aoa/aoa.h index badff9f7cd54..b92593f170ca 100644 --- a/sound/aoa/aoa.h +++ b/sound/aoa/aoa.h @@ -48,7 +48,7 @@ struct aoa_codec { u32 connected; =20 /* data the fabric can associate with this structure */ - void *fabric_data; + const void *fabric_data; =20 /* private! */ struct list_head list; diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c index c18b55305294..c3ebb6de4789 100644 --- a/sound/aoa/fabrics/layout.c +++ b/sound/aoa/fabrics/layout.c @@ -55,7 +55,7 @@ struct codec_connection { =20 struct codec_connect_info { char *name; - struct codec_connection *connections; + const struct codec_connection *connections; }; =20 #define LAYOUT_FLAG_COMBO_LINEOUT_SPDIF (1<<0) @@ -116,7 +116,7 @@ MODULE_ALIAS("aoa-device-id-35"); MODULE_ALIAS("aoa-device-id-44"); =20 /* onyx with all but microphone connected */ -static struct codec_connection onyx_connections_nomic[] =3D { +static const struct codec_connection onyx_connections_nomic[] =3D { { .connected =3D CC_SPEAKERS | CC_HEADPHONE | CC_LINEOUT, .codec_bit =3D 0, @@ -133,7 +133,7 @@ static struct codec_connection onyx_connections_nomic[]= =3D { }; =20 /* onyx on machines without headphone */ -static struct codec_connection onyx_connections_noheadphones[] =3D { +static const struct codec_connection onyx_connections_noheadphones[] =3D { { .connected =3D CC_SPEAKERS | CC_LINEOUT | CC_LINEOUT_LABELLED_HEADPHONE, @@ -157,7 +157,7 @@ static struct codec_connection onyx_connections_noheadp= hones[] =3D { }; =20 /* onyx on machines with real line-out */ -static struct codec_connection onyx_connections_reallineout[] =3D { +static const struct codec_connection onyx_connections_reallineout[] =3D { { .connected =3D CC_SPEAKERS | CC_LINEOUT | CC_HEADPHONE, .codec_bit =3D 0, @@ -174,7 +174,7 @@ static struct codec_connection onyx_connections_reallin= eout[] =3D { }; =20 /* tas on machines without line out */ -static struct codec_connection tas_connections_nolineout[] =3D { +static const struct codec_connection tas_connections_nolineout[] =3D { { .connected =3D CC_SPEAKERS | CC_HEADPHONE, .codec_bit =3D 0, @@ -191,7 +191,7 @@ static struct codec_connection tas_connections_nolineou= t[] =3D { }; =20 /* tas on machines with neither line out nor line in */ -static struct codec_connection tas_connections_noline[] =3D { +static const struct codec_connection tas_connections_noline[] =3D { { .connected =3D CC_SPEAKERS | CC_HEADPHONE, .codec_bit =3D 0, @@ -204,7 +204,7 @@ static struct codec_connection tas_connections_noline[]= =3D { }; =20 /* tas on machines without microphone */ -static struct codec_connection tas_connections_nomic[] =3D { +static const struct codec_connection tas_connections_nomic[] =3D { { .connected =3D CC_SPEAKERS | CC_HEADPHONE | CC_LINEOUT, .codec_bit =3D 0, @@ -217,7 +217,7 @@ static struct codec_connection tas_connections_nomic[] = =3D { }; =20 /* tas on machines with everything connected */ -static struct codec_connection tas_connections_all[] =3D { +static const struct codec_connection tas_connections_all[] =3D { { .connected =3D CC_SPEAKERS | CC_HEADPHONE | CC_LINEOUT, .codec_bit =3D 0, @@ -233,7 +233,7 @@ static struct codec_connection tas_connections_all[] = =3D { {} /* terminate array by .connected =3D=3D 0 */ }; =20 -static struct codec_connection toonie_connections[] =3D { +static const struct codec_connection toonie_connections[] =3D { { .connected =3D CC_SPEAKERS | CC_HEADPHONE, .codec_bit =3D 0, @@ -241,7 +241,7 @@ static struct codec_connection toonie_connections[] =3D= { {} /* terminate array by .connected =3D=3D 0 */ }; =20 -static struct codec_connection topaz_input[] =3D { +static const struct codec_connection topaz_input[] =3D { { .connected =3D CC_DIGITALIN, .codec_bit =3D 0, @@ -249,7 +249,7 @@ static struct codec_connection topaz_input[] =3D { {} /* terminate array by .connected =3D=3D 0 */ }; =20 -static struct codec_connection topaz_output[] =3D { +static const struct codec_connection topaz_output[] =3D { { .connected =3D CC_DIGITALOUT, .codec_bit =3D 1, @@ -257,7 +257,7 @@ static struct codec_connection topaz_output[] =3D { {} /* terminate array by .connected =3D=3D 0 */ }; =20 -static struct codec_connection topaz_inout[] =3D { +static const struct codec_connection topaz_inout[] =3D { { .connected =3D CC_DIGITALIN, .codec_bit =3D 0, @@ -772,7 +772,7 @@ static int check_codec(struct aoa_codec *codec, { const u32 *ref; char propname[32]; - struct codec_connection *cc; + const struct codec_connection *cc; =20 /* if the codec has a 'codec' node, we require a reference */ if (of_node_name_eq(codec->node, "codec")) { @@ -895,7 +895,7 @@ static void layout_notify(void *data) =20 static void layout_attached_codec(struct aoa_codec *codec) { - struct codec_connection *cc; + const struct codec_connection *cc; struct snd_kcontrol *ctl; int headphones, lineout; struct layout_dev *ldev =3D layout_device; --=20 2.53.0