All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Rafael Antognolli <rafael.antognolli@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v8 1/2] drm/dp: Add a drm_aux-dev module for reading/writing dpcd registers.
Date: Wed, 25 Nov 2015 15:02:50 +0200	[thread overview]
Message-ID: <20151125130250.GN4437@intel.com> (raw)
In-Reply-To: <1446496428-12135-2-git-send-email-rafael.antognolli@intel.com>

On Mon, Nov 02, 2015 at 12:33:47PM -0800, Rafael Antognolli wrote:
<snip>
> +static int __init drm_dp_aux_dev_init(void)
> +{
> +	int res;
> +
> +	drm_dp_aux_dev_class = class_create(THIS_MODULE, "drm_dp_aux_dev");
> +	if (IS_ERR(drm_dp_aux_dev_class)) {
> +		res = PTR_ERR(drm_dp_aux_dev_class);
> +		goto out;
> +	}
> +	drm_dp_aux_dev_class->dev_groups = drm_dp_aux_groups;
> +
> +	res = register_chrdev(0, "aux", &auxdev_fops);
> +	if (res < 0)
> +		goto out;
> +	drm_dev_major = res;
> +
> +	return 0;
> +out:
> +	class_destroy(drm_dp_aux_dev_class);
> +	return res;
> +}
> +
> +static void __exit drm_dp_aux_dev_exit(void)
> +{
> +	unregister_chrdev(drm_dev_major, "aux");
> +	class_destroy(drm_dp_aux_dev_class);
> +}
> +
> +MODULE_AUTHOR("Rafael Antognolli <rafael.antognolli@intel.com>");
> +MODULE_DESCRIPTION("DRM DP AUX /dev entries driver");
> +MODULE_LICENSE("GPL and additional rights");
> +
> +module_init(drm_dp_aux_dev_init);
> +module_exit(drm_dp_aux_dev_exit);

Since this is no longer a separate module this stuff can cause a
build failure due to drm_fb_helper.c already providing a module_init
for the same module.

So maybe we neet to have module_init/exit for drm_kms_helper.o in
some central place and have those call the init/exit functions for
drm_fb_helper and drm_dp_aux_dev?

> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index 9535c5b..7d58f59 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -28,6 +28,7 @@
>  #include <linux/sched.h>
>  #include <linux/i2c.h>
>  #include <drm/drm_dp_helper.h>
> +#include <drm/drm_dp_aux_dev.h>
>  #include <drm/drmP.h>
>  
>  /**
> @@ -754,6 +755,8 @@ static const struct i2c_algorithm drm_dp_i2c_algo = {
>   */
>  int drm_dp_aux_register(struct drm_dp_aux *aux)
>  {
> +	int ret;
> +
>  	mutex_init(&aux->hw_mutex);
>  
>  	aux->ddc.algo = &drm_dp_i2c_algo;
> @@ -768,7 +771,17 @@ int drm_dp_aux_register(struct drm_dp_aux *aux)
>  	strlcpy(aux->ddc.name, aux->name ? aux->name : dev_name(aux->dev),
>  		sizeof(aux->ddc.name));
>  
> -	return i2c_add_adapter(&aux->ddc);
> +	ret = drm_dp_aux_register_devnode(aux);
> +	if (ret)
> +		return ret;
> +
> +	ret = i2c_add_adapter(&aux->ddc);
> +	if (ret) {
> +		drm_dp_aux_unregister_devnode(aux);
> +		return ret;
> +	}
> +
> +	return 0;
>  }
>  EXPORT_SYMBOL(drm_dp_aux_register);
>  
> @@ -778,6 +791,7 @@ EXPORT_SYMBOL(drm_dp_aux_register);
>   */
>  void drm_dp_aux_unregister(struct drm_dp_aux *aux)
>  {
> +	drm_dp_aux_unregister_devnode(aux);
>  	i2c_del_adapter(&aux->ddc);
>  }
>  EXPORT_SYMBOL(drm_dp_aux_unregister);
> diff --git a/include/drm/drm_dp_aux_dev.h b/include/drm/drm_dp_aux_dev.h
> new file mode 100644
> index 0000000..391a2cf
> --- /dev/null
> +++ b/include/drm/drm_dp_aux_dev.h
> @@ -0,0 +1,50 @@
> +/*
> + * Copyright © 2015 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + * Authors:
> + *    Rafael Antognolli <rafael.antognolli@intel.com>
> + *
> + */
> +
> +#ifndef DRM_DP_AUX_DEV
> +#define DRM_DP_AUX_DEV
> +
> +#ifdef CONFIG_DRM_DP_AUX_CHARDEV
> +
> +int drm_dp_aux_register_devnode(struct drm_dp_aux *aux);
> +void drm_dp_aux_unregister_devnode(struct drm_dp_aux *aux);
> +
> +#else
> +
> +static inline int drm_dp_aux_register_devnode(struct drm_dp_aux *aux)
> +{
> +	return 0;
> +}
> +
> +static inline void drm_dp_aux_unregister_devnode(struct drm_dp_aux *aux)
> +{
> +	return 0;
> +}
> +
> +#endif
> +
> +#endif
> -- 
> 2.4.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-11-25 13:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02 20:33 [PATCH v8 0/2] Add drm_dp_aux chardev support Rafael Antognolli
2015-11-02 20:33 ` [PATCH v8 1/2] drm/dp: Add a drm_aux-dev module for reading/writing dpcd registers Rafael Antognolli
2015-11-24 20:28   ` Ville Syrjälä
2015-11-25 13:02   ` Ville Syrjälä [this message]
2015-11-02 20:33 ` [PATCH v8 2/2] drm/dp: Set aux.dev to the drm_connector device, instead of drm_device Rafael Antognolli
2015-11-24 20:31   ` Ville Syrjälä
2015-12-02  0:37     ` Rafael Antognolli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151125130250.GN4437@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rafael.antognolli@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.