Commit 7d4d3a58 authored by Jani Nikula's avatar Jani Nikula Committed by Daniel Vetter

drm/sysfs: add a helper for extracting connector type from kobject

This reduces duplication in the patches to follow. No functional
changes.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 4d53dc0c
...@@ -407,17 +407,23 @@ static struct attribute *connector_opt_dev_attrs[] = { ...@@ -407,17 +407,23 @@ static struct attribute *connector_opt_dev_attrs[] = {
NULL NULL
}; };
static umode_t connector_opt_dev_is_visible(struct kobject *kobj, /* Connector type related helpers */
struct attribute *attr, int idx) static int kobj_connector_type(struct kobject *kobj)
{ {
struct device *dev = kobj_to_dev(kobj); struct device *dev = kobj_to_dev(kobj);
struct drm_connector *connector = to_drm_connector(dev); struct drm_connector *connector = to_drm_connector(dev);
return connector->connector_type;
}
static umode_t connector_opt_dev_is_visible(struct kobject *kobj,
struct attribute *attr, int idx)
{
/* /*
* In the long run it maybe a good idea to make one set of * In the long run it maybe a good idea to make one set of
* optionals per connector type. * optionals per connector type.
*/ */
switch (connector->connector_type) { switch (kobj_connector_type(kobj)) {
case DRM_MODE_CONNECTOR_DVII: case DRM_MODE_CONNECTOR_DVII:
case DRM_MODE_CONNECTOR_Composite: case DRM_MODE_CONNECTOR_Composite:
case DRM_MODE_CONNECTOR_SVIDEO: case DRM_MODE_CONNECTOR_SVIDEO:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment