From: "Fabio M. De Francesco" <fabio.maria.de.francesco@linux.intel.com>
To: Ayush Tiwari <ayushtiw0110@gmail.com>
Cc: Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
linux-staging@lists.linux.dev, outreachy@lists.linux.dev
Subject: Re: [PATCH v4] staging: greybus: Constify gb_audio_module_type
Date: Sat, 16 Mar 2024 18:41:44 +0100 [thread overview]
Message-ID: <6152476.lOV4Wx5bFT@fdefranc-mobl3> (raw)
In-Reply-To: <ZfNGYSC8CDHqVPlm@ayush-HP-Pavilion-Gaming-Laptop-15-ec0xxx>
On Thursday, 14 March 2024 19:48:01 CET Ayush Tiwari wrote:
> Constify static struct kobj_type gb_audio_module_type to prevent
> modification of data shared across many instances,
I overlooked these in v3...
What do you exactly mean, in this context, by "data shared across many
instances"? Can you please clarify that?
I suspect that by "shared data" we usually mean something different.
> ensuring that the
> structure's usage is consistent and predictable throughout the driver
> and allows
ensuring, allowing (s/allows/allowing/).
> the compiler to place it in read-only memory.
> The gb_audio_module_type structure is used when initializing and
> adding kobj instances to the kernel's object hierarchy.
> After adding const, any attempt to alter gb_audio_module_type
> in the code is raising
would raise?
Fabio
> a compile-time error. This enforcement
> ensures that the sysfs interface and operations for audio
> modules remain stable.
>
> Signed-off-by: Ayush Tiwari <ayushtiw0110@gmail.com>
>
> ---
> Changes in v4: added more details verifying the change.
>
> Changes in v3: added the message that verifies the change,
> as suggested by Julia
>
> Changes in v2: incorporated changes in commit message
> as suggested by Alison
> ---
> drivers/staging/greybus/audio_manager_module.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/greybus/audio_manager_module.c
> b/drivers/staging/greybus/audio_manager_module.c index
> 5f9dcbdbc191..4a4dfb42f50f 100644
> --- a/drivers/staging/greybus/audio_manager_module.c
> +++ b/drivers/staging/greybus/audio_manager_module.c
> @@ -144,7 +144,7 @@ static struct attribute
> *gb_audio_module_default_attrs[] = { };
> ATTRIBUTE_GROUPS(gb_audio_module_default);
>
> -static struct kobj_type gb_audio_module_type = {
> +static const struct kobj_type gb_audio_module_type = {
> .sysfs_ops = &gb_audio_module_sysfs_ops,
> .release = gb_audio_module_release,
> .default_groups = gb_audio_module_default_groups,
prev parent reply other threads:[~2024-03-16 17:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 18:48 [PATCH v4] staging: greybus: Constify gb_audio_module_type Ayush Tiwari
2024-03-16 17:41 ` Fabio M. De Francesco [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6152476.lOV4Wx5bFT@fdefranc-mobl3 \
--to=fabio.maria.de.francesco@linux.intel.com \
--cc=Larry.Finger@lwfinger.net \
--cc=ayushtiw0110@gmail.com \
--cc=florian.c.schilhabel@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=outreachy@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).