diff mbox

[RESEND,1/4] drm/sysfs: add a helper for extracting connector type from kobject

Message ID 1431422095-20175-1-git-send-email-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula May 12, 2015, 9:14 a.m. UTC
This reduces duplication in the patches to follow. No functional
changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/drm_sysfs.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Ville Syrjälä May 12, 2015, 11:03 a.m. UTC | #1
On Tue, May 12, 2015 at 12:14:52PM +0300, Jani Nikula wrote:
> This reduces duplication in the patches to follow. No functional
> changes.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

The series looks reasonable.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/drm_sysfs.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> index ffc305fc2076..33466999b59a 100644
> --- a/drivers/gpu/drm/drm_sysfs.c
> +++ b/drivers/gpu/drm/drm_sysfs.c
> @@ -407,17 +407,23 @@ static struct attribute *connector_opt_dev_attrs[] = {
>  	NULL
>  };
>  
> -static umode_t connector_opt_dev_is_visible(struct kobject *kobj,
> -					    struct attribute *attr, int idx)
> +/* Connector type related helpers */
> +static int kobj_connector_type(struct kobject *kobj)
>  {
>  	struct device *dev = kobj_to_dev(kobj);
>  	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
>  	 * optionals per connector type.
>  	 */
> -	switch (connector->connector_type) {
> +	switch (kobj_connector_type(kobj)) {
>  	case DRM_MODE_CONNECTOR_DVII:
>  	case DRM_MODE_CONNECTOR_Composite:
>  	case DRM_MODE_CONNECTOR_SVIDEO:
> -- 
> 2.1.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter May 12, 2015, 11:44 a.m. UTC | #2
On Tue, May 12, 2015 at 02:03:36PM +0300, Ville Syrjälä wrote:
> On Tue, May 12, 2015 at 12:14:52PM +0300, Jani Nikula wrote:
> > This reduces duplication in the patches to follow. No functional
> > changes.
> > 
> > Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> 
> The series looks reasonable.
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Series merged to topic/drm-misc, thanks.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/drm_sysfs.c | 12 +++++++++---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
> > index ffc305fc2076..33466999b59a 100644
> > --- a/drivers/gpu/drm/drm_sysfs.c
> > +++ b/drivers/gpu/drm/drm_sysfs.c
> > @@ -407,17 +407,23 @@ static struct attribute *connector_opt_dev_attrs[] = {
> >  	NULL
> >  };
> >  
> > -static umode_t connector_opt_dev_is_visible(struct kobject *kobj,
> > -					    struct attribute *attr, int idx)
> > +/* Connector type related helpers */
> > +static int kobj_connector_type(struct kobject *kobj)
> >  {
> >  	struct device *dev = kobj_to_dev(kobj);
> >  	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
> >  	 * optionals per connector type.
> >  	 */
> > -	switch (connector->connector_type) {
> > +	switch (kobj_connector_type(kobj)) {
> >  	case DRM_MODE_CONNECTOR_DVII:
> >  	case DRM_MODE_CONNECTOR_Composite:
> >  	case DRM_MODE_CONNECTOR_SVIDEO:
> > -- 
> > 2.1.4
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index ffc305fc2076..33466999b59a 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -407,17 +407,23 @@  static struct attribute *connector_opt_dev_attrs[] = {
 	NULL
 };
 
-static umode_t connector_opt_dev_is_visible(struct kobject *kobj,
-					    struct attribute *attr, int idx)
+/* Connector type related helpers */
+static int kobj_connector_type(struct kobject *kobj)
 {
 	struct device *dev = kobj_to_dev(kobj);
 	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
 	 * optionals per connector type.
 	 */
-	switch (connector->connector_type) {
+	switch (kobj_connector_type(kobj)) {
 	case DRM_MODE_CONNECTOR_DVII:
 	case DRM_MODE_CONNECTOR_Composite:
 	case DRM_MODE_CONNECTOR_SVIDEO: