Fixup sysfs output registration

Put off registering new outputs with sysfs until they're properly configured,
or we may get duplicates if the type hasn't been set yet (as is the case with
SDVO initialization).  This also means moving de-registration into the cleanup
function instead of output destroy, since the latter occurs during the normal
course of setup when an output isn't found (and therefore not registered with
sysfs yet.
main
Jesse Barnes 2008-04-09 11:30:15 -07:00
parent e3c7a0fcb0
commit fa116081a9
6 changed files with 10 additions and 4 deletions

View File

@ -651,8 +651,6 @@ struct drm_output *drm_output_create(struct drm_device *dev,
/* output_set_monitor(output)? */
/* check for output_ignored(output)? */
drm_sysfs_output_add(output);
mutex_lock(&dev->mode_config.mutex);
list_add_tail(&output->head, &dev->mode_config.output_list);
dev->mode_config.num_output++;
@ -683,8 +681,6 @@ void drm_output_destroy(struct drm_output *output)
struct drm_device *dev = output->dev;
struct drm_display_mode *mode, *t;
drm_sysfs_output_remove(output);
if (*output->funcs->cleanup)
(*output->funcs->cleanup)(output);
@ -1080,6 +1076,7 @@ void drm_mode_config_cleanup(struct drm_device *dev)
struct drm_property *property, *pt;
list_for_each_entry_safe(output, ot, &dev->mode_config.output_list, head) {
drm_sysfs_output_remove(output);
drm_output_destroy(output);
}

View File

@ -287,6 +287,7 @@ err_out_files:
out:
return ret;
}
EXPORT_SYMBOL(drm_sysfs_output_add);
/**
* drm_sysfs_output_remove - remove an output device from sysfs
@ -306,6 +307,7 @@ void drm_sysfs_output_remove(struct drm_output *output)
sysfs_remove_bin_file(&output->kdev.kobj, &edid_attr);
device_unregister(&output->kdev);
}
EXPORT_SYMBOL(drm_sysfs_output_remove);
/**
* drm_sysfs_hotplug_event - generate a DRM uevent

View File

@ -261,5 +261,7 @@ void intel_crt_init(struct drm_device *dev)
output->interlace_allowed = 0;
output->doublescan_allowed = 0;
drm_sysfs_output_add(output);
drm_output_attach_property(output, dev->mode_config.connector_type_property, ConnectorVGA);
}

View File

@ -500,6 +500,7 @@ void intel_lvds_init(struct drm_device *dev)
#endif
out:
drm_sysfs_output_add(output);
drm_output_attach_property(output, dev->mode_config.connector_type_property, ConnectorLVDS);
return;

View File

@ -1123,6 +1123,8 @@ void intel_sdvo_init(struct drm_device *dev, int output_device)
output->output_type = output_type;
output->output_type_id = output_id;
drm_sysfs_output_add(output);
/* Set the input timing to the screen. Assume always input 0. */
intel_sdvo_set_target_input(output, true, false);

View File

@ -1760,4 +1760,6 @@ intel_tv_init(struct drm_device *dev)
output->driver_private = intel_output;
output->interlace_allowed = FALSE;
output->doublescan_allowed = FALSE;
drm_sysfs_output_add(output);
}