drm/amd/powerplay: use ARRAY_SIZE() to calculate array size.
Subsystems (2)
PATCH v2 1/1 drm/amd/powerplay: use ARRAY_SIZE() to calculate array size.
It is preferred to use ARRAY_SIZE() for size calculation, instead using sizeof(array)/sizeof(*array). It makes the code more readable.
--- drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c +1 -1
@@ -639,7 +639,7 @@ static int cz_smu_populate_firmware_entries(struct pp_smumgr *smumgr) cz_smu->driver_buffer_length =0 ; -for (i =0 ; i <sizeof (firmware_list)/sizeof (*firmware_list); i++) { +for (i =0 ; i <ARRAY_SIZE (firmware_list); i++) { firmware_type =cz_translate_firmware_enum_to_arg (smumgr, firmware_list[i]);
Signature · 1 line
1.9.1
Am 13.05.2016 um 19:36 schrieb Muhammad Falak R Wani:
Quoted 4 lines
It is preferred to use
ARRAY_SIZE()for size calculation, instead using sizeof(array)/sizeof(*array). It makes the code more readable.Signed-off-by Muhammad Falak R Wani <[email protected]>
Thanks for the cleanup,
Christian.
Quoted 9 lines
--- drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c +0
-0
drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c static int cz_smu_populate_firmware_entries(struct pp_smumgr *smumgr) · line 645
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c +1
-1@@ -639,7 +639,7 @@ static int cz_smu_populate_firmware_entries(struct pp_smumgr *smumgr) cz_smu->driver_buffer_length =0 ; -for (i =0 ; i <sizeof (firmware_list)/sizeof (*firmware_list); i++) { +for (i =0 ; i <ARRAY_SIZE (firmware_list); i++) { firmware_type =cz_translate_firmware_enum_to_arg (smumgr, firmware_list[i]);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Muhammad Falak R Wani
It is preferred to use
ARRAY_SIZE()for size calculation, instead using sizeof(array)/sizeof(*array). It makes the code more readable.Signed-off-by Muhammad Falak R Wani <[email protected]>
Thanks, and sorry about before, if I made you feel like you made a "childish mistake". As Dan said, this is mostly a question of
style: your code was right, it just had an unnecessary bit.
I hope I didn't give you a bad impression of the community, most people around here have better manners than I :P
Cheers
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · Eric Engestrom
Quoted 4 lines · Muhammad Falak R Wani
It is preferred to use
ARRAY_SIZE()for size calculation, instead using sizeof(array)/sizeof(*array). It makes the code more readable.Signed-off-by Muhammad Falak R Wani <[email protected]>Reviewed-by Eric Engestrom <[email protected]>
Quoted 8 lines
Thanks, and sorry about before, if I made you feel like you made a "childish mistake". As Dan said, this is mostly a question of
style: your code was right, it just had an unnecessary bit.I hope I didn't give you a bad impression of the community, most people around here have better manners than I :P
Cheers
Thank you for such a nice gesture. No, I didn't get any bad impression. Infact people learn like this.
Thank you guys :)
Alex Deucher
AppliedQuoted 4 lines · Muhammad Falak R Wani
It is preferred to use
ARRAY_SIZE()for size calculation, instead using sizeof(array)/sizeof(*array). It makes the code more readable.Signed-off-by Muhammad Falak R Wani <[email protected]>
Applied. thanks!
Alex
Quoted 20 lines
--- drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c +1
-2@@ -639,7 +639,7 @@ static int cz_smu_populate_firmware_entries(struct pp_smumgr *smumgr) cz_smu->driver_buffer_length =0 ; -for (i =0 ; i <sizeof (firmware_list)/sizeof (*firmware_list); i++) { +for (i =0 ; i <ARRAY_SIZE (firmware_list); i++) { firmware_type =cz_translate_firmware_enum_to_arg (smumgr, firmware_list[i]); --1.9.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel