From: Hans de Goede <hansg@kernel.org>
To: Abdelrahman Fekry <abdelrahmanfekry375@gmail.com>,
andy@kernel.org, mchehab@kernel.org,
sakari.ailus@linux.intel.com, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-staging@lists.linux.dev, skhan@linuxfoundation.org,
linux-kernel-mentees@lists.linux.dev
Subject: Re: [PATCH] staging: media: atomisp: Replace scnprintf with sysfs_emit in bo_show
Date: Mon, 23 Jun 2025 20:31:38 +0200 [thread overview]
Message-ID: <7852d6ac-95f0-41ec-8365-d23a2b16b208@kernel.org> (raw)
In-Reply-To: <20250621062944.168386-1-abdelrahmanfekry375@gmail.com>
Hi,
On 21-Jun-25 8:29 AM, Abdelrahman Fekry wrote:
> Convert buffer output to use sysfs_emit/sysfs_emit_at API for safer
> PAGE_SIZE handling and standardized sysfs output.
>
> Signed-off-by: Abdelrahman Fekry <abdelrahmanfekry375@gmail.com>
> ---
> drivers/staging/media/atomisp/pci/hmm/hmm.c | 24 ++++++---------------
> 1 file changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c
> index 84102c3aaf97..cae1fccd06af 100644
> --- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
> +++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
> @@ -37,51 +37,41 @@ static const char hmm_bo_type_string[] = "pv";
> static ssize_t bo_show(struct device *dev, struct device_attribute *attr,
> char *buf, struct list_head *bo_list, bool active)
> {
<snip>
As Andy already mentioned you really should try to first better understand
the code before changing it.
In this case this code is used for 2 custom sysfs attributes called
"active_bo" and "free_bo".
sysfs attributes are custom userspace API and we really want to remove
all custom userspace APIs from this driver before moving it out of
drivers/staging
Instead everything should be done through existing standard kernels
API, mostly the standard v4l2 API.
Note this is already mentioned in drivers/staging/media/atomisp/TODO
although these specific sysfs attributes are not named:
"""
TODO
====
1. Items which MUST be fixed before the driver can be moved out of staging:
* Remove/disable private IOCTLs
* Remove/disable custom v4l2-ctrls
* Remove custom sysfs files created by atomisp_drvfs.c
"""
In this case the "active_bo" and "free_bo" sysfs attributes seem
to be there for debugging purposes only and they can simply be removed.
So instead of replacing scnprintf you should write a new patch
removing everything starting at:
<--- start removing code here --->
/*
* p: private
* v: vmalloc
...
static struct attribute_group atomisp_attribute_group[] = {
{.attrs = sysfs_attrs_ctrl },
};
<--- end removing code here --->
and then also remove the sysfs_create_group() and
sysfs_remove_group() calls.
After writing that patch maybe you can also take a look at tackling
the "Remove custom sysfs files created by atomisp_drvfs.c" TODO
list item?
Regards,
Hans
next prev parent reply other threads:[~2025-06-23 18:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-21 6:29 [PATCH] staging: media: atomisp: Replace scnprintf with sysfs_emit in bo_show Abdelrahman Fekry
2025-06-21 18:24 ` Andy Shevchenko
2025-06-22 6:36 ` Abdelrahman Fekry
2025-06-23 14:16 ` Dan Carpenter
2025-06-23 14:32 ` Andy Shevchenko
2025-06-23 18:31 ` Hans de Goede [this message]
2025-06-24 12:13 ` Abdelrahman Fekry
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=7852d6ac-95f0-41ec-8365-d23a2b16b208@kernel.org \
--to=hansg@kernel.org \
--cc=abdelrahmanfekry375@gmail.com \
--cc=andy@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=skhan@linuxfoundation.org \
/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