Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Zongyao Bai <zongyao.bai@intel.com>, <intel-xe@lists.freedesktop.org>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>,
	Stuart Summers <stuart.summers@intel.com>,
	Shuicheng Lin <shuicheng.lin@intel.com>
Subject: Re: [PATCH v3 2/2] drm/xe/xe_device_sysfs: Remove sysfs unconditionally while clean sysfs entries
Date: Tue, 16 Sep 2025 16:39:06 +0200	[thread overview]
Message-ID: <7cdce3a1-7b03-439d-980c-a47bc542452c@intel.com> (raw)
In-Reply-To: <20250915214716.1327379-3-zongyao.bai@intel.com>


please use correct subject prefix

On 9/15/2025 11:47 PM, Zongyao Bai wrote:
> xe_device_sysfs_fini() and late_bind_remove_files():

above line could be dropped,
below lines don't need to be indented 
>   Adjust the remove order of sysfs entries to follow LIFO.
>   Remove configuration and status checking,
>   call the sysfs removal unconditionally.
> 
> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> Cc: Stuart Summers <stuart.summers@intel.com>
> Cc: Shuicheng Lin <shuicheng.lin@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: Zongyao Bai <zongyao.bai@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_device_sysfs.c | 32 ++++++----------------------
>  1 file changed, 6 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device_sysfs.c b/drivers/gpu/drm/xe/xe_device_sysfs.c
> index e5e3c56ea53c..693bfda1cfa6 100644
> --- a/drivers/gpu/drm/xe/xe_device_sysfs.c
> +++ b/drivers/gpu/drm/xe/xe_device_sysfs.c
> @@ -184,25 +184,8 @@ static int late_bind_create_files(struct device *dev)
>  
>  static void late_bind_remove_files(struct device *dev)
>  {
> -	struct xe_device *xe = pdev_to_xe_device(to_pci_dev(dev));
> -	struct xe_tile *root = xe_device_get_root_tile(xe);
> -	u32 cap = 0;
> -	int ret;
> -
> -	xe_pm_runtime_get(xe);
> -
> -	ret = xe_pcode_read(root, PCODE_MBOX(PCODE_LATE_BINDING, GET_CAPABILITY_STATUS, 0),
> -			    &cap, NULL);
> -	if (ret)
> -		goto out;
> -
> -	if (REG_FIELD_GET(V1_FAN_SUPPORTED, cap))
> -		sysfs_remove_file(&dev->kobj, &dev_attr_lb_fan_control_version.attr);
> -
> -	if (REG_FIELD_GET(VR_PARAMS_SUPPORTED, cap))
> -		sysfs_remove_file(&dev->kobj, &dev_attr_lb_voltage_regulator_version.attr);
> -out:
> -	xe_pm_runtime_put(xe);
> +	sysfs_remove_file(&dev->kobj, &dev_attr_lb_voltage_regulator_version.attr);
> +	sysfs_remove_file(&dev->kobj, &dev_attr_lb_fan_control_version.attr);
>  }
>  
>  /**
> @@ -287,14 +270,11 @@ static const struct attribute *auto_link_downgrade_attrs[] = {
>  static void xe_device_sysfs_fini(void *arg)
>  {
>  	struct xe_device *xe = arg;
> +	struct device *dev = xe->drm.dev;

if you only need "dev" here then maybe pass it as "arg" instead of "xe" ?

>  
> -	if (xe->d3cold.capable)
> -		sysfs_remove_file(&xe->drm.dev->kobj, &dev_attr_vram_d3cold_threshold.attr);
> -
> -	if (xe->info.platform == XE_BATTLEMAGE) {
> -		sysfs_remove_files(&xe->drm.dev->kobj, auto_link_downgrade_attrs);
> -		late_bind_remove_files(xe->drm.dev);
> -	}
> +    late_bind_remove_files(dev);

as you remove files unconditionally, does it make sense to keep this helper function?
maybe just move here:

  +	sysfs_remove_file(&dev->kobj, &dev_attr_lb_voltage_regulator_version.attr);
  +	sysfs_remove_file(&dev->kobj, &dev_attr_lb_fan_control_version.attr);

> +    sysfs_remove_files(&dev->kobj, auto_link_downgrade_attrs);
> +    sysfs_remove_file(&dev->kobj, &dev_attr_vram_d3cold_threshold.attr);
>  }
>  
>  int xe_device_sysfs_init(struct xe_device *xe)


  parent reply	other threads:[~2025-09-16 14:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-10 18:32 [PATCH] drm/xe/xe_device_sysfs: add cleanup action in xe_device_sysfs_init Zongyao Bai
2025-09-10 18:38 ` ✗ CI.checkpatch: warning for drm/xe/xe_device_sysfs: add cleanup action in xe_device_sysfs_init (rev2) Patchwork
2025-09-10 18:39 ` ✓ CI.KUnit: success " Patchwork
2025-09-10 19:12 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-11  2:24 ` ✗ Xe.CI.Full: failure " Patchwork
2025-09-11  4:11 ` [PATCH] drm/xe/xe_device_sysfs: add cleanup action in xe_device_sysfs_init Lucas De Marchi
2025-09-15 21:47 ` [PATCH v3 0/2] drm/xe/xe_device_sysfs: modify sysfs clean up process Zongyao Bai
2025-09-15 21:47   ` [PATCH v3 1/2] drm/xe/xe_device_sysfs: Add cleanup action in xe_device_sysfs_init Zongyao Bai
2025-09-15 22:34     ` Lin, Shuicheng
2025-09-16 14:29     ` Michal Wajdeczko
2025-09-16 15:06     ` (subset) " Lucas De Marchi
2025-09-15 21:47   ` [PATCH v3 2/2] drm/xe/xe_device_sysfs: Remove sysfs unconditionally while clean sysfs entries Zongyao Bai
2025-09-15 22:46     ` Lin, Shuicheng
2025-09-16 14:39     ` Michal Wajdeczko [this message]
2025-09-16 15:03       ` Lucas De Marchi
2025-09-15 21:55 ` ✗ CI.checkpatch: warning for drm/xe/xe_device_sysfs: add cleanup action in xe_device_sysfs_init (rev3) Patchwork
2025-09-15 21:56 ` ✓ CI.KUnit: success " Patchwork
2025-09-15 22:34 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-16  3:29 ` ✗ Xe.CI.Full: failure " Patchwork

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=7cdce3a1-7b03-439d-980c-a47bc542452c@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=shuicheng.lin@intel.com \
    --cc=stuart.summers@intel.com \
    --cc=zongyao.bai@intel.com \
    /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