Fixup sysfs output registration
authorJesse Barnes <jbarnes@jbarnes-t61.(none)>
Wed, 9 Apr 2008 18:30:15 +0000 (11:30 -0700)
committerJesse Barnes <jbarnes@jbarnes-t61.(none)>
Wed, 9 Apr 2008 18:30:15 +0000 (11:30 -0700)
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.

linux-core/drm_crtc.c
linux-core/drm_sysfs.c
linux-core/intel_crt.c
linux-core/intel_lvds.c
linux-core/intel_sdvo.c
linux-core/intel_tv.c

index 19155e1..f54ceb7 100644 (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);
        }
 
index 3e682c9..427a2e5 100644 (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
index 915e430..ef40871 100644 (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);
 }
index 80f77af..378ce45 100644 (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;
 
index a8441d8..4fb3f21 100644 (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);
        
index 0edbdba..cc50f8c 100644 (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);
 }