drm: Make drm.debug parameter description more helpful

Submitted by Ezequiel Garcia on April 19, 2016, 5:40 p.m.

Details

Message ID 1461087638-16959-2-git-send-email-ezequiel@vanguardiasur.com.ar
State New
Headers show
Series "drm: probe_helper: Hide ugly ifdef" ( rev: 2 ) in DRI devel

Not browsing as part of any series.

Commit Message

Ezequiel Garcia April 19, 2016, 5:40 p.m.
Let's be user-friendly and print an actually helpful parameter
description.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
 drivers/gpu/drm/drm_drv.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 167c8d3d4a31..49b658069b51 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -37,15 +37,24 @@ 
 #include "drm_legacy.h"
 #include "drm_internal.h"
 
-unsigned int drm_debug = 0;	/* bitmask of DRM_UT_x */
+/*
+ * drm_debug: Enable debug output.
+ * Bitmask of DRM_UT_x. See include/drm/drmP.h for details.
+ */
+unsigned int drm_debug = 0;
 EXPORT_SYMBOL(drm_debug);
 
 MODULE_AUTHOR(CORE_AUTHOR);
 MODULE_DESCRIPTION(CORE_DESC);
 MODULE_LICENSE("GPL and additional rights");
-MODULE_PARM_DESC(debug, "Enable debug output");
+MODULE_PARM_DESC(debug, "Enables debug output, where each bit enables a debug category.\n"
+"Bit 0 (0x1) will enable CORE messages (drm core code)\n"
+"Bit 1 (0x2) will enable DRIVER messages (drm controller code)\n"
+"Bit 2 (0x4) will enable KMS messages (modesetting code)\n"
+"Bit 3 (0x8) will enable PRMIE messages (prime code)\n");
 module_param_named(debug, drm_debug, int, 0600);
 
+
 static DEFINE_SPINLOCK(drm_minor_lock);
 static struct idr drm_minors_idr;
 

Comments

On 19 April 2016 at 18:40, Ezequiel Garcia
<ezequiel@vanguardiasur.com.ar> wrote:
> Let's be user-friendly and print an actually helpful parameter
> description.
>
> Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
> ---
>  drivers/gpu/drm/drm_drv.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 167c8d3d4a31..49b658069b51 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -37,15 +37,24 @@
>  #include "drm_legacy.h"
>  #include "drm_internal.h"
>
> -unsigned int drm_debug = 0;    /* bitmask of DRM_UT_x */
> +/*
> + * drm_debug: Enable debug output.
> + * Bitmask of DRM_UT_x. See include/drm/drmP.h for details.
> + */
> +unsigned int drm_debug = 0;
>  EXPORT_SYMBOL(drm_debug);
>
>  MODULE_AUTHOR(CORE_AUTHOR);
>  MODULE_DESCRIPTION(CORE_DESC);
>  MODULE_LICENSE("GPL and additional rights");
> -MODULE_PARM_DESC(debug, "Enable debug output");
> +MODULE_PARM_DESC(debug, "Enables debug output, where each bit enables a debug category.\n"
> +"Bit 0 (0x1) will enable CORE messages (drm core code)\n"
> +"Bit 1 (0x2) will enable DRIVER messages (drm controller code)\n"
> +"Bit 2 (0x4) will enable KMS messages (modesetting code)\n"
> +"Bit 3 (0x8) will enable PRMIE messages (prime code)\n");
typo "PRIME"

If you're doing to document things please mention all the options -
you've missed the following two.
#define DRM_UT_ATOMIC           0x10
#define DRM_UT_VBL              0x20

Thanks
Emil
On Tue, 19 Apr 2016, Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> wrote:
> Let's be user-friendly and print an actually helpful parameter
> description.
>
> Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
> ---
>  drivers/gpu/drm/drm_drv.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 167c8d3d4a31..49b658069b51 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -37,15 +37,24 @@
>  #include "drm_legacy.h"
>  #include "drm_internal.h"
>  
> -unsigned int drm_debug = 0;	/* bitmask of DRM_UT_x */
> +/*
> + * drm_debug: Enable debug output.
> + * Bitmask of DRM_UT_x. See include/drm/drmP.h for details.
> + */
> +unsigned int drm_debug = 0;
>  EXPORT_SYMBOL(drm_debug);
>  
>  MODULE_AUTHOR(CORE_AUTHOR);
>  MODULE_DESCRIPTION(CORE_DESC);
>  MODULE_LICENSE("GPL and additional rights");
> -MODULE_PARM_DESC(debug, "Enable debug output");
> +MODULE_PARM_DESC(debug, "Enables debug output, where each bit enables a debug category.\n"

Please keep it as "Enable".

> +"Bit 0 (0x1) will enable CORE messages (drm core code)\n"
> +"Bit 1 (0x2) will enable DRIVER messages (drm controller code)\n"
> +"Bit 2 (0x4) will enable KMS messages (modesetting code)\n"
> +"Bit 3 (0x8) will enable PRMIE messages (prime code)\n");

Maybe prefix the continuation lines with a space or a tab? The last line
probably shouldn't contain \n. See what modinfo(8) displays and make it
pretty.

>  module_param_named(debug, drm_debug, int, 0600);
>  
> +

Spurious whitepace.

>  static DEFINE_SPINLOCK(drm_minor_lock);
>  static struct idr drm_minors_idr;
(Adding Dave again)

On 20 April 2016 at 06:21, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Tue, 19 Apr 2016, Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> wrote:
>> Let's be user-friendly and print an actually helpful parameter
>> description.
>>
>> Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
>> ---
>>  drivers/gpu/drm/drm_drv.c | 13 +++++++++++--
>>  1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
>> index 167c8d3d4a31..49b658069b51 100644
>> --- a/drivers/gpu/drm/drm_drv.c
>> +++ b/drivers/gpu/drm/drm_drv.c
>> @@ -37,15 +37,24 @@
>>  #include "drm_legacy.h"
>>  #include "drm_internal.h"
>>
>> -unsigned int drm_debug = 0;  /* bitmask of DRM_UT_x */
>> +/*
>> + * drm_debug: Enable debug output.
>> + * Bitmask of DRM_UT_x. See include/drm/drmP.h for details.
>> + */
>> +unsigned int drm_debug = 0;
>>  EXPORT_SYMBOL(drm_debug);
>>
>>  MODULE_AUTHOR(CORE_AUTHOR);
>>  MODULE_DESCRIPTION(CORE_DESC);
>>  MODULE_LICENSE("GPL and additional rights");
>> -MODULE_PARM_DESC(debug, "Enable debug output");
>> +MODULE_PARM_DESC(debug, "Enables debug output, where each bit enables a debug category.\n"
>
> Please keep it as "Enable".
>
>> +"Bit 0 (0x1) will enable CORE messages (drm core code)\n"
>> +"Bit 1 (0x2) will enable DRIVER messages (drm controller code)\n"
>> +"Bit 2 (0x4) will enable KMS messages (modesetting code)\n"
>> +"Bit 3 (0x8) will enable PRMIE messages (prime code)\n");
>
> Maybe prefix the continuation lines with a space or a tab? The last line
> probably shouldn't contain \n. See what modinfo(8) displays and make it
> pretty.
>
>>  module_param_named(debug, drm_debug, int, 0600);
>>
>> +
>
> Spurious whitepace.
>

Thanks for the feedback. I'll post a v2.