All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: use kernel is_power_of_2 rather than local version
@ 2017-06-21 16:44 Alex Deucher
       [not found] ` <1498063478-12052-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Deucher @ 2017-06-21 16:44 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

Use the kernel provided version.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 6c64551..b6efda1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1032,19 +1032,6 @@ static unsigned int amdgpu_vga_set_decode(void *cookie, bool state)
 		return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
 }
 
-/**
- * amdgpu_check_pot_argument - check that argument is a power of two
- *
- * @arg: value to check
- *
- * Validates that a certain argument is a power of two (all asics).
- * Returns true if argument is valid.
- */
-static bool amdgpu_check_pot_argument(int arg)
-{
-	return (arg & (arg - 1)) == 0;
-}
-
 static void amdgpu_check_block_size(struct amdgpu_device *adev)
 {
 	/* defines number of bits in page table versus page directory,
@@ -1078,7 +1065,7 @@ static void amdgpu_check_vm_size(struct amdgpu_device *adev)
 	if (amdgpu_vm_size == -1)
 		return;
 
-	if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
+	if (!is_power_of_2(amdgpu_vm_size)) {
 		dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
 			 amdgpu_vm_size);
 		goto def_value;
@@ -1119,7 +1106,7 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
 		dev_warn(adev->dev, "sched jobs (%d) must be at least 4\n",
 			 amdgpu_sched_jobs);
 		amdgpu_sched_jobs = 4;
-	} else if (!amdgpu_check_pot_argument(amdgpu_sched_jobs)){
+	} else if (!is_power_of_2(amdgpu_sched_jobs)){
 		dev_warn(adev->dev, "sched jobs (%d) must be a power of 2\n",
 			 amdgpu_sched_jobs);
 		amdgpu_sched_jobs = roundup_pow_of_two(amdgpu_sched_jobs);
@@ -1139,7 +1126,7 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
 	amdgpu_check_block_size(adev);
 
 	if (amdgpu_vram_page_split != -1 && (amdgpu_vram_page_split < 16 ||
-	    !amdgpu_check_pot_argument(amdgpu_vram_page_split))) {
+	    !is_power_of_2(amdgpu_vram_page_split))) {
 		dev_warn(adev->dev, "invalid VRAM page split (%d)\n",
 			 amdgpu_vram_page_split);
 		amdgpu_vram_page_split = 1024;
-- 
2.5.5

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

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

* Re: [PATCH] drm/amdgpu: use kernel is_power_of_2 rather than local version
       [not found] ` <1498063478-12052-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
@ 2017-06-21 17:38   ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2017-06-21 17:38 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

Am 21.06.2017 um 18:44 schrieb Alex Deucher:
> Use the kernel provided version.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

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

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++----------------
>   1 file changed, 3 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 6c64551..b6efda1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1032,19 +1032,6 @@ static unsigned int amdgpu_vga_set_decode(void *cookie, bool state)
>   		return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
>   }
>   
> -/**
> - * amdgpu_check_pot_argument - check that argument is a power of two
> - *
> - * @arg: value to check
> - *
> - * Validates that a certain argument is a power of two (all asics).
> - * Returns true if argument is valid.
> - */
> -static bool amdgpu_check_pot_argument(int arg)
> -{
> -	return (arg & (arg - 1)) == 0;
> -}
> -
>   static void amdgpu_check_block_size(struct amdgpu_device *adev)
>   {
>   	/* defines number of bits in page table versus page directory,
> @@ -1078,7 +1065,7 @@ static void amdgpu_check_vm_size(struct amdgpu_device *adev)
>   	if (amdgpu_vm_size == -1)
>   		return;
>   
> -	if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
> +	if (!is_power_of_2(amdgpu_vm_size)) {
>   		dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
>   			 amdgpu_vm_size);
>   		goto def_value;
> @@ -1119,7 +1106,7 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
>   		dev_warn(adev->dev, "sched jobs (%d) must be at least 4\n",
>   			 amdgpu_sched_jobs);
>   		amdgpu_sched_jobs = 4;
> -	} else if (!amdgpu_check_pot_argument(amdgpu_sched_jobs)){
> +	} else if (!is_power_of_2(amdgpu_sched_jobs)){
>   		dev_warn(adev->dev, "sched jobs (%d) must be a power of 2\n",
>   			 amdgpu_sched_jobs);
>   		amdgpu_sched_jobs = roundup_pow_of_two(amdgpu_sched_jobs);
> @@ -1139,7 +1126,7 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
>   	amdgpu_check_block_size(adev);
>   
>   	if (amdgpu_vram_page_split != -1 && (amdgpu_vram_page_split < 16 ||
> -	    !amdgpu_check_pot_argument(amdgpu_vram_page_split))) {
> +	    !is_power_of_2(amdgpu_vram_page_split))) {
>   		dev_warn(adev->dev, "invalid VRAM page split (%d)\n",
>   			 amdgpu_vram_page_split);
>   		amdgpu_vram_page_split = 1024;


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

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

end of thread, other threads:[~2017-06-21 17:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21 16:44 [PATCH] drm/amdgpu: use kernel is_power_of_2 rather than local version Alex Deucher
     [not found] ` <1498063478-12052-1-git-send-email-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2017-06-21 17:38   ` Christian König

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.