linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/3] kernel/params.c: Align last argument with a tab
@ 2020-07-03 14:29 Paul Menzel
  2020-07-03 14:29 ` [PATCH v3 2/3] moduleparams: Add hexint type parameter Paul Menzel
  2020-07-03 14:29 ` [PATCH v3 3/3] drm/amdgpu: Change type of module param `ppfeaturemask` to hexint Paul Menzel
  0 siblings, 2 replies; 8+ messages in thread
From: Paul Menzel @ 2020-07-03 14:29 UTC (permalink / raw)
  To: Linus Torvalds, Christian König, Alex Deucher
  Cc: Paul Menzel, linux-kernel

The second and third arguments are aligned with tabs, so do the same for
the fourth.

Cc: linux-kernel@vger.kernel.org
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
 kernel/params.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/kernel/params.c b/kernel/params.c
index 8e56f8b12d8f..111eee82b999 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -233,14 +233,14 @@ char *parse_args(const char *doing,
 	EXPORT_SYMBOL(param_ops_##name)
 
 
-STANDARD_PARAM_DEF(byte,	unsigned char,		"%hhu", kstrtou8);
-STANDARD_PARAM_DEF(short,	short,			"%hi",  kstrtos16);
-STANDARD_PARAM_DEF(ushort,	unsigned short,		"%hu",  kstrtou16);
-STANDARD_PARAM_DEF(int,		int,			"%i",   kstrtoint);
-STANDARD_PARAM_DEF(uint,	unsigned int,		"%u",   kstrtouint);
-STANDARD_PARAM_DEF(long,	long,			"%li",  kstrtol);
-STANDARD_PARAM_DEF(ulong,	unsigned long,		"%lu",  kstrtoul);
-STANDARD_PARAM_DEF(ullong,	unsigned long long,	"%llu", kstrtoull);
+STANDARD_PARAM_DEF(byte,	unsigned char,		"%hhu",	kstrtou8);
+STANDARD_PARAM_DEF(short,	short,			"%hi",	kstrtos16);
+STANDARD_PARAM_DEF(ushort,	unsigned short,		"%hu",	kstrtou16);
+STANDARD_PARAM_DEF(int,		int,			"%i",	kstrtoint);
+STANDARD_PARAM_DEF(uint,	unsigned int,		"%u",	kstrtouint);
+STANDARD_PARAM_DEF(long,	long,			"%li",	kstrtol);
+STANDARD_PARAM_DEF(ulong,	unsigned long,		"%lu",	kstrtoul);
+STANDARD_PARAM_DEF(ullong,	unsigned long long,	"%llu",	kstrtoull);
 
 int param_set_charp(const char *val, const struct kernel_param *kp)
 {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/3] moduleparams: Add hexint type parameter
  2020-07-03 14:29 [PATCH v3 1/3] kernel/params.c: Align last argument with a tab Paul Menzel
@ 2020-07-03 14:29 ` Paul Menzel
  2020-07-03 14:29 ` [PATCH v3 3/3] drm/amdgpu: Change type of module param `ppfeaturemask` to hexint Paul Menzel
  1 sibling, 0 replies; 8+ messages in thread
From: Paul Menzel @ 2020-07-03 14:29 UTC (permalink / raw)
  To: Linus Torvalds, Christian König, Alex Deucher
  Cc: Paul Menzel, linux-kernel, amd-gfx

For bitmasks printing values in hex is more convenient.

Prefix with `0x` to make it clear, that it’s a hex value, and pad it
out.

Using the helper for `amdgpu.ppfeaturemask`, it will look like below.

Before:

    $ more /sys/module/amdgpu/parameters/ppfeaturemask
    4294950911

After:

    $ more /sys/module/amdgpu/parameters/ppfeaturemask
    0xffffbfff

Cc: linux-kernel@vger.kernel.org
Cc: amd-gfx@lists.freedesktop.org
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
 include/linux/moduleparam.h |  7 ++++++-
 kernel/params.c             | 17 +++++++++--------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 3ef917ff0964..cff7261e98bb 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -118,7 +118,7 @@ struct kparam_array
  * you can create your own by defining those variables.
  *
  * Standard types are:
- *	byte, short, ushort, int, uint, long, ulong
+ *	byte, hexint, short, ushort, int, uint, long, ulong
  *	charp: a character pointer
  *	bool: a bool, values 0/1, y/n, Y/N.
  *	invbool: the above, only sense-reversed (N = true).
@@ -448,6 +448,11 @@ extern int param_set_ullong(const char *val, const struct kernel_param *kp);
 extern int param_get_ullong(char *buffer, const struct kernel_param *kp);
 #define param_check_ullong(name, p) __param_check(name, p, unsigned long long)
 
+extern const struct kernel_param_ops param_ops_hexint;
+extern int param_set_hexint(const char *val, const struct kernel_param *kp);
+extern int param_get_hexint(char *buffer, const struct kernel_param *kp);
+#define param_check_hexint(name, p) param_check_uint(name, p)
+
 extern const struct kernel_param_ops param_ops_charp;
 extern int param_set_charp(const char *val, const struct kernel_param *kp);
 extern int param_get_charp(char *buffer, const struct kernel_param *kp);
diff --git a/kernel/params.c b/kernel/params.c
index 111eee82b999..3835fb82c64b 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -233,14 +233,15 @@ char *parse_args(const char *doing,
 	EXPORT_SYMBOL(param_ops_##name)
 
 
-STANDARD_PARAM_DEF(byte,	unsigned char,		"%hhu",	kstrtou8);
-STANDARD_PARAM_DEF(short,	short,			"%hi",	kstrtos16);
-STANDARD_PARAM_DEF(ushort,	unsigned short,		"%hu",	kstrtou16);
-STANDARD_PARAM_DEF(int,		int,			"%i",	kstrtoint);
-STANDARD_PARAM_DEF(uint,	unsigned int,		"%u",	kstrtouint);
-STANDARD_PARAM_DEF(long,	long,			"%li",	kstrtol);
-STANDARD_PARAM_DEF(ulong,	unsigned long,		"%lu",	kstrtoul);
-STANDARD_PARAM_DEF(ullong,	unsigned long long,	"%llu",	kstrtoull);
+STANDARD_PARAM_DEF(byte,	unsigned char,		"%hhu",		kstrtou8);
+STANDARD_PARAM_DEF(short,	short,			"%hi",		kstrtos16);
+STANDARD_PARAM_DEF(ushort,	unsigned short,		"%hu",		kstrtou16);
+STANDARD_PARAM_DEF(int,		int,			"%i",		kstrtoint);
+STANDARD_PARAM_DEF(uint,	unsigned int,		"%u",		kstrtouint);
+STANDARD_PARAM_DEF(long,	long,			"%li",		kstrtol);
+STANDARD_PARAM_DEF(ulong,	unsigned long,		"%lu",		kstrtoul);
+STANDARD_PARAM_DEF(ullong,	unsigned long long,	"%llu",		kstrtoull);
+STANDARD_PARAM_DEF(hexint,	unsigned int,		"%#08x", 	kstrtouint);
 
 int param_set_charp(const char *val, const struct kernel_param *kp)
 {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/3] drm/amdgpu: Change type of module param `ppfeaturemask` to hexint
  2020-07-03 14:29 [PATCH v3 1/3] kernel/params.c: Align last argument with a tab Paul Menzel
  2020-07-03 14:29 ` [PATCH v3 2/3] moduleparams: Add hexint type parameter Paul Menzel
@ 2020-07-03 14:29 ` Paul Menzel
  2020-07-03 15:29   ` Christian König
  1 sibling, 1 reply; 8+ messages in thread
From: Paul Menzel @ 2020-07-03 14:29 UTC (permalink / raw)
  To: Linus Torvalds, Christian König, Alex Deucher
  Cc: Paul Menzel, amd-gfx, linux-kernel

The newly added hexint helper is more convenient for bitmasks.

Before:

    $ more /sys/module/amdgpu/parameters/ppfeaturemask
    4294950911

After:

    $ more /sys/module/amdgpu/parameters/ppfeaturemask
    0xffffbfff

Cc: amd-gfx@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 126e74758a34..5c4263335cba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -391,12 +391,12 @@ MODULE_PARM_DESC(sched_hw_submission, "the max number of HW submissions (default
 module_param_named(sched_hw_submission, amdgpu_sched_hw_submission, int, 0444);
 
 /**
- * DOC: ppfeaturemask (uint)
+ * DOC: ppfeaturemask (hexint)
  * Override power features enabled. See enum PP_FEATURE_MASK in drivers/gpu/drm/amd/include/amd_shared.h.
  * The default is the current set of stable power features.
  */
 MODULE_PARM_DESC(ppfeaturemask, "all power features enabled (default))");
-module_param_named(ppfeaturemask, amdgpu_pp_feature_mask, uint, 0444);
+module_param_named(ppfeaturemask, amdgpu_pp_feature_mask, hexint, 0444);
 
 /**
  * DOC: forcelongtraining (uint)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] drm/amdgpu: Change type of module param `ppfeaturemask` to hexint
  2020-07-03 14:29 ` [PATCH v3 3/3] drm/amdgpu: Change type of module param `ppfeaturemask` to hexint Paul Menzel
@ 2020-07-03 15:29   ` Christian König
  2020-07-23 13:44     ` Paul Menzel
  0 siblings, 1 reply; 8+ messages in thread
From: Christian König @ 2020-07-03 15:29 UTC (permalink / raw)
  To: Paul Menzel, Linus Torvalds, Alex Deucher; +Cc: amd-gfx, linux-kernel

Am 03.07.20 um 16:29 schrieb Paul Menzel:
> The newly added hexint helper is more convenient for bitmasks.
>
> Before:
>
>      $ more /sys/module/amdgpu/parameters/ppfeaturemask
>      4294950911
>
> After:
>
>      $ more /sys/module/amdgpu/parameters/ppfeaturemask
>      0xffffbfff
>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>

Reviewed-by: Christian König <christian.koenig@amd.com> for this one.

Feel free to add my Acked-by to the other two, but I'm not familiar 
enough with the code to review those.

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 126e74758a34..5c4263335cba 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -391,12 +391,12 @@ MODULE_PARM_DESC(sched_hw_submission, "the max number of HW submissions (default
>   module_param_named(sched_hw_submission, amdgpu_sched_hw_submission, int, 0444);
>   
>   /**
> - * DOC: ppfeaturemask (uint)
> + * DOC: ppfeaturemask (hexint)
>    * Override power features enabled. See enum PP_FEATURE_MASK in drivers/gpu/drm/amd/include/amd_shared.h.
>    * The default is the current set of stable power features.
>    */
>   MODULE_PARM_DESC(ppfeaturemask, "all power features enabled (default))");
> -module_param_named(ppfeaturemask, amdgpu_pp_feature_mask, uint, 0444);
> +module_param_named(ppfeaturemask, amdgpu_pp_feature_mask, hexint, 0444);
>   
>   /**
>    * DOC: forcelongtraining (uint)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] drm/amdgpu: Change type of module param `ppfeaturemask` to hexint
  2020-07-03 15:29   ` Christian König
@ 2020-07-23 13:44     ` Paul Menzel
  2020-07-24  7:54       ` Christian König
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Menzel @ 2020-07-23 13:44 UTC (permalink / raw)
  To: Christian König, Linus Torvalds, Alex Deucher; +Cc: amd-gfx, linux-kernel

Dear Linus, dear Christian,


Am 03.07.20 um 17:29 schrieb Christian König:
> Am 03.07.20 um 16:29 schrieb Paul Menzel:
>> The newly added hexint helper is more convenient for bitmasks.
>>
>> Before:
>>
>>      $ more /sys/module/amdgpu/parameters/ppfeaturemask
>>      4294950911
>>
>> After:
>>
>>      $ more /sys/module/amdgpu/parameters/ppfeaturemask
>>      0xffffbfff
>>
>> Cc: amd-gfx@lists.freedesktop.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
> 
> Reviewed-by: Christian König <christian.koenig@amd.com> for this one.
> 
> Feel free to add my Acked-by to the other two, but I'm not familiar 
> enough with the code to review those.

Thank you. Sorry for being ignorant, but what is the way forward?


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] drm/amdgpu: Change type of module param `ppfeaturemask` to hexint
  2020-07-23 13:44     ` Paul Menzel
@ 2020-07-24  7:54       ` Christian König
  2020-07-24 20:29         ` Linus Torvalds
  0 siblings, 1 reply; 8+ messages in thread
From: Christian König @ 2020-07-24  7:54 UTC (permalink / raw)
  To: Paul Menzel, Linus Torvalds, Alex Deucher; +Cc: amd-gfx, linux-kernel

Am 23.07.20 um 15:44 schrieb Paul Menzel:
> Dear Linus, dear Christian,
>
>
> Am 03.07.20 um 17:29 schrieb Christian König:
>> Am 03.07.20 um 16:29 schrieb Paul Menzel:
>>> The newly added hexint helper is more convenient for bitmasks.
>>>
>>> Before:
>>>
>>>      $ more /sys/module/amdgpu/parameters/ppfeaturemask
>>>      4294950911
>>>
>>> After:
>>>
>>>      $ more /sys/module/amdgpu/parameters/ppfeaturemask
>>>      0xffffbfff
>>>
>>> Cc: amd-gfx@lists.freedesktop.org
>>> Cc: linux-kernel@vger.kernel.org
>>> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
>>
>> Reviewed-by: Christian König <christian.koenig@amd.com> for this one.
>>
>> Feel free to add my Acked-by to the other two, but I'm not familiar 
>> enough with the code to review those.
>
> Thank you. Sorry for being ignorant, but what is the way forward?

Well, that's a very valid question. The general approach is that driver 
changes are pushed upstream through the driver maintainers tree.

Since this driver change depends on a change in the general kernel an rb 
from somebody who feels responsible for the code in the general kernel 
might be a good idea.

But since you already addressed Linus comments and it looks rather clean 
I think I can just push it to drm-misc-next on Monday if nobody objects 
over the weekend.

Thanks for the help,
Christian.

>
>
> Kind regards,
>
> Paul


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] drm/amdgpu: Change type of module param `ppfeaturemask` to hexint
  2020-07-24  7:54       ` Christian König
@ 2020-07-24 20:29         ` Linus Torvalds
  2020-07-25  8:44           ` Christian König
  0 siblings, 1 reply; 8+ messages in thread
From: Linus Torvalds @ 2020-07-24 20:29 UTC (permalink / raw)
  To: Christian König
  Cc: Paul Menzel, Alex Deucher, amd-gfx, Linux Kernel Mailing List

On Fri, Jul 24, 2020 at 12:54 AM Christian König
<christian.koenig@amd.com> wrote:
>
> But since you already addressed Linus comments and it looks rather clean
> I think I can just push it to drm-misc-next on Monday if nobody objects
> over the weekend.

Yeah, no objections from me.

Add a note to it to the pull request, so that when my bird-brain sees
the pull during the next merge window and I've forgotten this thread,
I don't go "why is the drm tree modifying code files"?

             Linus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 3/3] drm/amdgpu: Change type of module param `ppfeaturemask` to hexint
  2020-07-24 20:29         ` Linus Torvalds
@ 2020-07-25  8:44           ` Christian König
  0 siblings, 0 replies; 8+ messages in thread
From: Christian König @ 2020-07-25  8:44 UTC (permalink / raw)
  To: Linus Torvalds, Christian König
  Cc: Alex Deucher, Paul Menzel, Linux Kernel Mailing List, amd-gfx

Am 24.07.20 um 22:29 schrieb Linus Torvalds:
> On Fri, Jul 24, 2020 at 12:54 AM Christian König
> <christian.koenig@amd.com> wrote:
>> But since you already addressed Linus comments and it looks rather clean
>> I think I can just push it to drm-misc-next on Monday if nobody objects
>> over the weekend.
> Yeah, no objections from me.
>
> Add a note to it to the pull request, so that when my bird-brain sees
> the pull during the next merge window and I've forgotten this thread,
> I don't go "why is the drm tree modifying code files"?

Well Dave is sending those requests to you usually.

I will just add an Acked-by: Linus Torvalds 
<torvalds@linux-foundation.org> to the patch before pushing :)

Thanks,
Christian.

>
>               Linus
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-07-25  8:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-03 14:29 [PATCH v3 1/3] kernel/params.c: Align last argument with a tab Paul Menzel
2020-07-03 14:29 ` [PATCH v3 2/3] moduleparams: Add hexint type parameter Paul Menzel
2020-07-03 14:29 ` [PATCH v3 3/3] drm/amdgpu: Change type of module param `ppfeaturemask` to hexint Paul Menzel
2020-07-03 15:29   ` Christian König
2020-07-23 13:44     ` Paul Menzel
2020-07-24  7:54       ` Christian König
2020-07-24 20:29         ` Linus Torvalds
2020-07-25  8:44           ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).