On Wed Oct 29, 2025 at 3:37 PM CET, Louis Chauvet wrote:
> DRM allows the connector to be created after the device. To allows
> emulating this, add two configfs attributes to connector to allows this.
>
> Using the dynamic attribute you can set if a connector will be dynamic or
> not.
> Using the enabled attribute, you can set at runtime if a dynamic connector
> is present or not.
>
> Co-developed-by: José Expósito <[email protected]>
> Signed-off-by: José Expósito <[email protected]>
> Signed-off-by: Louis Chauvet <[email protected]>
> --- a/drivers/gpu/drm/vkms/vkms_configfs.c
> +++ b/drivers/gpu/drm/vkms/vkms_configfs.c
> @@ -1215,8 +1223,10 @@ static ssize_t connector_type_store(struct config_item
> *item,
> }
>
> scoped_guard(mutex, &connector->dev->lock) {
> - if (connector->dev->enabled)
> - return -EINVAL;
> + if (connector->dev->enabled) {
> + if (connector_is_enabled(connector->config))
> + return -EBUSY;
> + }
You are changing from -EINVAL to -EBUSY. Why? Was -EINVAL wrong in the
first place?
And you can avoid the nested if:
if (connector->dev->enabled &&
connector_is_enabled(connector->config))
return -E<WHATEVER>;
> +static ssize_t connector_dynamic_show(struct config_item *item, char *page)
> +{
> + struct vkms_configfs_connector *connector;
> + bool enabled;
^^^^^^^
dynamic
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com