From: Jesse Barnes Date: Wed, 9 Apr 2008 18:30:15 +0000 (-0700) Subject: Fixup sysfs output registration X-Git-Tag: libdrm-2.4.3~16^2~219^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa116081a919e716eb95fcfa421d93f10f6f0a4f;p=platform%2Fupstream%2Flibdrm.git 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. --- diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c index 19155e1..f54ceb7 100644 --- a/linux-core/drm_crtc.c +++ b/linux-core/drm_crtc.c @@ -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); } diff --git a/linux-core/drm_sysfs.c b/linux-core/drm_sysfs.c index 3e682c9..427a2e5 100644 --- a/linux-core/drm_sysfs.c +++ b/linux-core/drm_sysfs.c @@ -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 diff --git a/linux-core/intel_crt.c b/linux-core/intel_crt.c index 915e430..ef40871 100644 --- a/linux-core/intel_crt.c +++ b/linux-core/intel_crt.c @@ -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); } diff --git a/linux-core/intel_lvds.c b/linux-core/intel_lvds.c index 80f77af..378ce45 100644 --- a/linux-core/intel_lvds.c +++ b/linux-core/intel_lvds.c @@ -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; diff --git a/linux-core/intel_sdvo.c b/linux-core/intel_sdvo.c index a8441d8..4fb3f21 100644 --- a/linux-core/intel_sdvo.c +++ b/linux-core/intel_sdvo.c @@ -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); diff --git a/linux-core/intel_tv.c b/linux-core/intel_tv.c index 0edbdba..cc50f8c 100644 --- a/linux-core/intel_tv.c +++ b/linux-core/intel_tv.c @@ -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); }