On Tue, 24 Nov 2026, Andy Shevchenko <[email protected]> wrote:
> Use DEFINE_SHOW_STORE_ATTRIBUTE() helper for read-write file to reduce some
> duplicated code.
>
> Signed-off-by: Andy Shevchenko <[email protected]>

Reviewed-by: Jani Nikula <[email protected]>

> ---
>  drivers/gpu/drm/i915/display/intel_hotplug.c | 32 ++------------------
>  1 file changed, 2 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
> b/drivers/gpu/drm/i915/display/intel_hotplug.c
> index d095eb13dc06..c47a7c9044e7 100644
> --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> @@ -1246,20 +1246,7 @@ static ssize_t i915_hpd_storm_ctl_write(struct file 
> *file,
>  
>       return len;
>  }
> -
> -static int i915_hpd_storm_ctl_open(struct inode *inode, struct file *file)
> -{
> -     return single_open(file, i915_hpd_storm_ctl_show, inode->i_private);
> -}
> -
> -static const struct file_operations i915_hpd_storm_ctl_fops = {
> -     .owner = THIS_MODULE,
> -     .open = i915_hpd_storm_ctl_open,
> -     .read = seq_read,
> -     .llseek = seq_lseek,
> -     .release = single_release,
> -     .write = i915_hpd_storm_ctl_write
> -};
> +DEFINE_SHOW_STORE_ATTRIBUTE(i915_hpd_storm_ctl);
>  
>  static int i915_hpd_short_storm_ctl_show(struct seq_file *m, void *data)
>  {
> @@ -1271,13 +1258,6 @@ static int i915_hpd_short_storm_ctl_show(struct 
> seq_file *m, void *data)
>       return 0;
>  }
>  
> -static int
> -i915_hpd_short_storm_ctl_open(struct inode *inode, struct file *file)
> -{
> -     return single_open(file, i915_hpd_short_storm_ctl_show,
> -                        inode->i_private);
> -}
> -
>  static ssize_t i915_hpd_short_storm_ctl_write(struct file *file,
>                                             const char __user *ubuf,
>                                             size_t len, loff_t *offp)
> @@ -1324,15 +1304,7 @@ static ssize_t i915_hpd_short_storm_ctl_write(struct 
> file *file,
>  
>       return len;
>  }
> -
> -static const struct file_operations i915_hpd_short_storm_ctl_fops = {
> -     .owner = THIS_MODULE,
> -     .open = i915_hpd_short_storm_ctl_open,
> -     .read = seq_read,
> -     .llseek = seq_lseek,
> -     .release = single_release,
> -     .write = i915_hpd_short_storm_ctl_write,
> -};
> +DEFINE_SHOW_STORE_ATTRIBUTE(i915_hpd_short_storm_ctl);
>  
>  void intel_hpd_debugfs_register(struct intel_display *display)
>  {

-- 
Jani Nikula, Intel

Reply via email to