Skip to content

Commit 5686601

Browse files
gregkhtdz
authored andcommitted
drm/vkms: convert to use faux_device
The vkms driver does not need to create a platform device, as there is no real platform resources associated it, it only did so because it was simple to do that in order to get a device to use for resource management of drm resources. Change the driver to use the faux device instead as this is NOT a real platform device. Tested-by: Louis Chauvet <louis.chauvet@bootlin.com> Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Cc: Haneen Mohammed <hamohammed.sa@gmail.com> Cc: Simona Vetter <simona@ffwll.ch> Cc: Melissa Wen <melissa.srw@gmail.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: David Airlie <airlied@gmail.com> Cc: dri-devel@lists.freedesktop.org Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://lore.kernel.org/r/2025070147-antics-pleat-edd2@gregkh
1 parent e7a1cbc commit 5686601

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

drivers/gpu/drm/vkms/vkms_drv.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212
#include <linux/module.h>
13-
#include <linux/platform_device.h>
13+
#include <linux/device/faux.h>
1414
#include <linux/dma-mapping.h>
1515

1616
#include <drm/clients/drm_client_setup.h>
@@ -149,27 +149,27 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev)
149149
static int vkms_create(struct vkms_config *config)
150150
{
151151
int ret;
152-
struct platform_device *pdev;
152+
struct faux_device *fdev;
153153
struct vkms_device *vkms_device;
154154
const char *dev_name;
155155

156156
dev_name = vkms_config_get_device_name(config);
157-
pdev = platform_device_register_simple(dev_name, -1, NULL, 0);
158-
if (IS_ERR(pdev))
159-
return PTR_ERR(pdev);
157+
fdev = faux_device_create(dev_name, NULL, NULL);
158+
if (!fdev)
159+
return -ENODEV;
160160

161-
if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) {
161+
if (!devres_open_group(&fdev->dev, NULL, GFP_KERNEL)) {
162162
ret = -ENOMEM;
163163
goto out_unregister;
164164
}
165165

166-
vkms_device = devm_drm_dev_alloc(&pdev->dev, &vkms_driver,
166+
vkms_device = devm_drm_dev_alloc(&fdev->dev, &vkms_driver,
167167
struct vkms_device, drm);
168168
if (IS_ERR(vkms_device)) {
169169
ret = PTR_ERR(vkms_device);
170170
goto out_devres;
171171
}
172-
vkms_device->platform = pdev;
172+
vkms_device->faux_dev = fdev;
173173
vkms_device->config = config;
174174
config->dev = vkms_device;
175175

@@ -203,9 +203,9 @@ static int vkms_create(struct vkms_config *config)
203203
return 0;
204204

205205
out_devres:
206-
devres_release_group(&pdev->dev, NULL);
206+
devres_release_group(&fdev->dev, NULL);
207207
out_unregister:
208-
platform_device_unregister(pdev);
208+
faux_device_destroy(fdev);
209209
return ret;
210210
}
211211

@@ -231,19 +231,19 @@ static int __init vkms_init(void)
231231

232232
static void vkms_destroy(struct vkms_config *config)
233233
{
234-
struct platform_device *pdev;
234+
struct faux_device *fdev;
235235

236236
if (!config->dev) {
237237
DRM_INFO("vkms_device is NULL.\n");
238238
return;
239239
}
240240

241-
pdev = config->dev->platform;
241+
fdev = config->dev->faux_dev;
242242

243243
drm_dev_unregister(&config->dev->drm);
244244
drm_atomic_helper_shutdown(&config->dev->drm);
245-
devres_release_group(&pdev->dev, NULL);
246-
platform_device_unregister(pdev);
245+
devres_release_group(&fdev->dev, NULL);
246+
faux_device_destroy(fdev);
247247

248248
config->dev = NULL;
249249
}

drivers/gpu/drm/vkms/vkms_drv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,13 @@ struct vkms_config;
232232
* struct vkms_device - Description of a VKMS device
233233
*
234234
* @drm - Base device in DRM
235-
* @platform - Associated platform device
235+
* @faux_dev - Associated faux device
236236
* @output - Configuration and sub-components of the VKMS device
237237
* @config: Configuration used in this VKMS device
238238
*/
239239
struct vkms_device {
240240
struct drm_device drm;
241-
struct platform_device *platform;
241+
struct faux_device *faux_dev;
242242
const struct vkms_config *config;
243243
};
244244

0 commit comments

Comments
 (0)