From: Thomas Zimmermann <tzimmermann@suse.de>
To: lukas@wunner.de, jfalempe@redhat.com, alexander.deucher@amd.com,
christian.koenig@amd.com, airlied@gmail.com, simona@ffwll.ch,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
rodrigo.vivi@intel.com, tursulin@ursulin.net, lyude@redhat.com,
dakr@kernel.org, deller@gmx.de
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org,
linux-fbdev@vger.kernel.org, sashiko-reviews@lists.linux.dev,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH 10/10] vga-switcheroo: Remove unused interfaces
Date: Tue, 7 Jul 2026 15:38:17 +0200 [thread overview]
Message-ID: <20260707135724.247562-11-tzimmermann@suse.de> (raw)
In-Reply-To: <20260707135724.247562-1-tzimmermann@suse.de>
Remove all unused interfaces that used to implement the functionality
of pre_switch and post_switch.
For pre_switch, drop calls to vga_switcheroo_client_fb_set() from
fbcon. Each client that implements pre_switch holds references to
its resources; either fbcon's fb_info or something else. Also remove
vga_switcheroo_client_fb_set(). This further allows for removing all
symbols and data structures that refer to fbdev; such as fb_info and
fb_switch_outputs().
For post_switch, remove the reprobe callback from the client ops.
Nouveau, the only driver that implemented the interface, now uses
post_switch.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 -
drivers/gpu/drm/i915/i915_switcheroo.c | 1 -
drivers/gpu/drm/radeon/radeon_device.c | 1 -
drivers/gpu/vga/vga_switcheroo.c | 37 +++-------------------
drivers/video/fbdev/core/fbcon.c | 8 -----
include/linux/vga_switcheroo.h | 12 +++----
6 files changed, 9 insertions(+), 51 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 87a59a79a019..5bb1567d512d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1708,7 +1708,6 @@ static void amdgpu_switcheroo_pre_switch(struct pci_dev *pdev)
static const struct vga_switcheroo_client_ops amdgpu_switcheroo_ops = {
.set_gpu_state = amdgpu_switcheroo_set_state,
- .reprobe = NULL,
.can_switch = amdgpu_switcheroo_can_switch,
.pre_switch = amdgpu_switcheroo_pre_switch,
};
diff --git a/drivers/gpu/drm/i915/i915_switcheroo.c b/drivers/gpu/drm/i915/i915_switcheroo.c
index 6b306ece0556..d97057722fde 100644
--- a/drivers/gpu/drm/i915/i915_switcheroo.c
+++ b/drivers/gpu/drm/i915/i915_switcheroo.c
@@ -69,7 +69,6 @@ static void i915_switcheroo_pre_switch(struct pci_dev *pdev)
static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
.set_gpu_state = i915_switcheroo_set_state,
- .reprobe = NULL,
.can_switch = i915_switcheroo_can_switch,
.pre_switch = i915_switcheroo_pre_switch,
};
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 8697a9eb5d13..9523240110a6 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1267,7 +1267,6 @@ static void radeon_switcheroo_pre_switch(struct pci_dev *pdev)
static const struct vga_switcheroo_client_ops radeon_switcheroo_ops = {
.set_gpu_state = radeon_switcheroo_set_state,
- .reprobe = NULL,
.can_switch = radeon_switcheroo_can_switch,
.pre_switch = radeon_switcheroo_pre_switch,
};
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index 7b0af4a8aa7d..9431d83b38a9 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -32,9 +32,9 @@
#include <linux/apple-gmux.h>
#include <linux/debugfs.h>
-#include <linux/fb.h>
+#include <linux/export.h>
#include <linux/fs.h>
-#include <linux/module.h>
+#include <linux/mutex.h>
#include <linux/pci.h>
#include <linux/pm_domain.h>
#include <linux/pm_runtime.h>
@@ -90,7 +90,6 @@
/**
* struct vga_switcheroo_client - registered client
* @pdev: client pci device
- * @fb_info: framebuffer to which console is remapped on switching
* @pwr_state: current power state if manual power control is used.
* For driver power control, call vga_switcheroo_pwr_state().
* @ops: client callbacks
@@ -105,12 +104,11 @@
* @vga_dev: pci device, indicate which GPU is bound to current audio client
*
* Registered client. A client can be either a GPU or an audio device on a GPU.
- * For audio clients, the @fb_info and @active members are bogus. For GPU
- * clients, the @vga_dev is bogus.
+ * For audio clients, the @active member is bogus. For GPU clients, the @vga_dev
+ * is bogus.
*/
struct vga_switcheroo_client {
struct pci_dev *pdev;
- struct fb_info *fb_info;
enum vga_switcheroo_state pwr_state;
const struct vga_switcheroo_client_ops *ops;
enum vga_switcheroo_client_id id;
@@ -514,27 +512,6 @@ void vga_switcheroo_unregister_client(struct pci_dev *pdev)
}
EXPORT_SYMBOL(vga_switcheroo_unregister_client);
-/**
- * vga_switcheroo_client_fb_set() - set framebuffer of a given client
- * @pdev: client pci device
- * @info: framebuffer
- *
- * Set framebuffer of a given client. The console will be remapped to this
- * on switching.
- */
-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);
-
/**
* vga_switcheroo_lock_ddc() - temporarily switch DDC lines to a given client
* @pdev: client pci device
@@ -735,10 +712,6 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
if (new_client->ops->pre_switch)
new_client->ops->pre_switch(new_client->pdev);
-#if defined(CONFIG_FB)
- else if (new_client->fb_info)
- fb_switch_outputs(new_client->fb_info);
-#endif
mutex_lock(&vgasr_priv.mux_hw_lock);
ret = vgasr_priv.handler->switchto(new_client->id);
@@ -748,8 +721,6 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
if (new_client->ops->post_switch)
new_client->ops->post_switch(new_client->pdev);
- else if (new_client->ops->reprobe)
- new_client->ops->reprobe(new_client->pdev);
if (vga_switcheroo_pwr_state(active) == VGA_SWITCHEROO_ON)
vga_switchoff(active);
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 9f5c4c101581..974c7dcf5251 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -78,7 +78,6 @@
#include <linux/interrupt.h>
#include <linux/crc32.h> /* For counting font checksums */
#include <linux/uaccess.h>
-#include <linux/vga_switcheroo.h>
#include <asm/irq.h>
#include "fbcon.h"
@@ -2851,9 +2850,6 @@ void fbcon_fb_unregistered(struct fb_info *info)
console_lock();
- if (info->device && dev_is_pci(info->device))
- vga_switcheroo_client_fb_set(to_pci_dev(info->device), NULL);
-
fbcon_registered_fb[info->node] = NULL;
fbcon_num_registered_fb--;
@@ -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);
-
return ret;
}
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index 38047fe6ea60..e0198cffb4d6 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -31,8 +31,12 @@
#ifndef _LINUX_VGA_SWITCHEROO_H_
#define _LINUX_VGA_SWITCHEROO_H_
-#include <linux/fb.h>
+#include <linux/errno.h>
+#include <linux/types.h>
+struct device;
+struct dev_pm_domain;
+struct fb_info;
struct pci_dev;
/**
@@ -128,7 +132,6 @@ struct vga_switcheroo_handler {
* Mandatory. This should not cut power to the discrete GPU,
* which is the job of the handler
* @gpu_bound: Optional. Called before switching the outputs to the device.
- * @reprobe: deprecated
* @can_switch: check if the device is in a position to switch now.
* Mandatory. The client should return false if a user space process
* has one of its device files open
@@ -148,7 +151,6 @@ struct vga_switcheroo_handler {
*/
struct vga_switcheroo_client_ops {
void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state);
- void (*reprobe)(struct pci_dev *dev);
bool (*can_switch)(struct pci_dev *dev);
void (*pre_switch)(struct pci_dev *dev);
void (*post_switch)(struct pci_dev *dev);
@@ -164,9 +166,6 @@ int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
const struct vga_switcheroo_client_ops *ops,
struct pci_dev *vga_dev);
-void vga_switcheroo_client_fb_set(struct pci_dev *dev,
- struct fb_info *info);
-
int vga_switcheroo_register_handler(const struct vga_switcheroo_handler *handler,
enum vga_switcheroo_handler_flags_t handler_flags);
void vga_switcheroo_unregister_handler(void);
@@ -186,7 +185,6 @@ void vga_switcheroo_fini_domain_pm_ops(struct device *dev);
static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {}
static inline int vga_switcheroo_register_client(struct pci_dev *dev,
const struct vga_switcheroo_client_ops *ops, bool driver_power_control) { return 0; }
-static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {}
static inline int vga_switcheroo_register_handler(const struct vga_switcheroo_handler *handler,
enum vga_switcheroo_handler_flags_t handler_flags) { return 0; }
static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
--
2.54.0
next prev parent reply other threads:[~2026-07-07 13:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 13:38 [PATCH 00/10] vga_switcheroo, drm: Push fbcon handling into DRM clients Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 01/10] drm/edid: Include <linux/fb.h> Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 02/10] drm/client: Add acquire_outputs callback; implement for fbdev emulation Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 03/10] vga_switcheroo: Add pre_switch callback to client ops Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 04/10] vga_switcheroo: Add post_switch " Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 05/10] drm/amdgpu: Implement struct vga_switcheroo_client_ops.pre_switch Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 06/10] drm/i915: Implement vga_switcheroo_client_ops.pre_switch Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 07/10] drm/nouveau: " Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 08/10] drm/nouveau: Implement vga_switcheroo_client_ops.post_switch Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 09/10] drm/radeon: Implement struct vga_switcheroo_client_ops.pre_switch Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann [this message]
2026-07-08 21:56 ` [PATCH 00/10] vga_switcheroo, drm: Push fbcon handling into DRM clients lyude
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=20260707135724.247562-11-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jfalempe@redhat.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=lyude@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=rodrigo.vivi@intel.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
--cc=tursulin@ursulin.net \
/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