Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] `vga_switcheroo_client_fb_set()` and the `fb_info` field in `struct 
vga_switcheroo_client` are orphaned and remain as dead code.
--

--- Patch [5]: [PATCH v2 5/7] drm: Implement struct 
vga_switcheroo_client_ops.pre_switch ---
commit d5ba75db20f40c6dde86b90da7c25acad6f23b57
Author: Thomas Zimmermann <[email protected]>

drm: Implement struct vga_switcheroo_client_ops.pre_switch

This commit implements the pre_switch callback for vga_switcheroo in amdgpu,
i915, nouveau, and radeon drivers. It pushes fbcon updates from vga_switcheroo
into DRM's fbdev emulation and removes calls to vga_switcheroo_client_fb_set()
from fbcon to prevent deadlocks.

> diff --git a/drivers/video/fbdev/core/fbcon.c 
> b/drivers/video/fbdev/core/fbcon.c
> index 9f5c4c101581d..974c7dcf52514 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
[ ... ]
> @@ -2987,10 +2983,6 @@ static int do_fb_registered(struct fb_info *info)
>               }
>       }
>  
> -     /* Set the fb info for vga_switcheroo clients. Does nothing otherwise. 
> */
> -     if (info->device && dev_is_pci(info->device))
> -             vga_switcheroo_client_fb_set(to_pci_dev(info->device), info);
> -

[Severity: Low]
With the removal of these calls from fbcon, are there any remaining users of
vga_switcheroo_client_fb_set()?

It looks like the exported function in drivers/gpu/vga/vga_switcheroo.c is
now completely unused:

void vga_switcheroo_client_fb_set(struct pci_dev *pdev,
                                 struct fb_info *info)
{
        struct vga_switcheroo_client *client;

        mutex_lock(&vgasr_mutex);
        client = find_client_from_pci(&vgasr_priv.clients, pdev);
        if (client)
                client->fb_info = info;
        mutex_unlock(&vgasr_mutex);
}
EXPORT_SYMBOL(vga_switcheroo_client_fb_set);

Because client->fb_info is never populated, does this also leave dead code
in vga_switchto_stage2() where it checks for the fallback?

#if defined(CONFIG_FB)
        else if (new_client->fb_info)
                fb_switch_outputs(new_client->fb_info);
#endif

Would it make sense to remove the orphaned vga_switcheroo_client_fb_set()
function, the fb_info field in struct vga_switcheroo_client, and the
unreachable fallback block to complete the cleanup?

>       return ret;
>  }

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=5

Reply via email to