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