Re: [Mesa-dev] [PATCH] i965: use strtol to convert the integer deviceID override

2017-07-17 Thread Emil Velikov
On 14 July 2017 at 18:02, Kenneth Graunke  wrote:
> On Friday, July 14, 2017 5:56:58 AM PDT Emil Velikov wrote:
>> From: Emil Velikov 
>>
>> One can override the deviceID, by setting the INTEL_DEVID_OVERRIDE
>> variable. A few symbolic names or a numerical value for the actual
>> device ID is accepted.
>>
>> At the same time we're using strtod (string to double) to convert the
>> string to a decimal numeral. A seeming thinko, made by the original
>> commit that introduces the code in libdrm_intel and got here with the
>> import.
>>
>> Fixes: 514db96c117a ("i965: Import libdrm_intel.")
>> Cc: Kenneth Graunke 
>> Signed-off-by: Emil Velikov 
>> ---
>> The device ID is a uint16_t in practise, despite that we're using
>> uint32_t or int thoughout. Should we bother and consistently use
>> uint16_t/other?
>> ---
>>  src/mesa/drivers/dri/i965/intel_screen.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
>> b/src/mesa/drivers/dri/i965/intel_screen.c
>> index 641edb7e72b..f4670fc2614 100644
>> --- a/src/mesa/drivers/dri/i965/intel_screen.c
>> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
>> @@ -2026,7 +2026,7 @@ parse_devid_override(const char *devid_override)
>>   return name_map[i].pci_id;
>> }
>>
>> -   return strtod(devid_override, NULL);
>> +   return strtol(devid_override, NULL, 0);
>>  }
>>
>>  /**
>>
>
> *shrug* - I'm fine with uint16_t, but uint32_t or int isn't
> exactly going to break the bank :)
>
> Reviewed-by: Kenneth Graunke 

Not the biggest fish to fry indeed. Let's 'worry' about that some other day ;-)

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: use strtol to convert the integer deviceID override

2017-07-14 Thread Kenneth Graunke
On Friday, July 14, 2017 5:56:58 AM PDT Emil Velikov wrote:
> From: Emil Velikov 
> 
> One can override the deviceID, by setting the INTEL_DEVID_OVERRIDE
> variable. A few symbolic names or a numerical value for the actual
> device ID is accepted.
> 
> At the same time we're using strtod (string to double) to convert the
> string to a decimal numeral. A seeming thinko, made by the original
> commit that introduces the code in libdrm_intel and got here with the
> import.
> 
> Fixes: 514db96c117a ("i965: Import libdrm_intel.")
> Cc: Kenneth Graunke 
> Signed-off-by: Emil Velikov 
> ---
> The device ID is a uint16_t in practise, despite that we're using
> uint32_t or int thoughout. Should we bother and consistently use 
> uint16_t/other?
> ---
>  src/mesa/drivers/dri/i965/intel_screen.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
> b/src/mesa/drivers/dri/i965/intel_screen.c
> index 641edb7e72b..f4670fc2614 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -2026,7 +2026,7 @@ parse_devid_override(const char *devid_override)
>   return name_map[i].pci_id;
> }
>  
> -   return strtod(devid_override, NULL);
> +   return strtol(devid_override, NULL, 0);
>  }
>  
>  /**
> 

*shrug* - I'm fine with uint16_t, but uint32_t or int isn't
exactly going to break the bank :)

Reviewed-by: Kenneth Graunke 

signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: use strtol to convert the integer deviceID override

2017-07-14 Thread Eric Engestrom
On Friday, 2017-07-14 13:56:58 +0100, Emil Velikov wrote:
> From: Emil Velikov 
> 
> One can override the deviceID, by setting the INTEL_DEVID_OVERRIDE
> variable. A few symbolic names or a numerical value for the actual
> device ID is accepted.
> 
> At the same time we're using strtod (string to double) to convert the
> string to a decimal numeral. A seeming thinko, made by the original
> commit that introduces the code in libdrm_intel and got here with the
> import.
> 
> Fixes: 514db96c117a ("i965: Import libdrm_intel.")
> Cc: Kenneth Graunke 
> Signed-off-by: Emil Velikov 

Reviewed-by: Eric Engestrom 

> ---
> The device ID is a uint16_t in practise, despite that we're using
> uint32_t or int thoughout. Should we bother and consistently use 
> uint16_t/other?
> ---
>  src/mesa/drivers/dri/i965/intel_screen.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
> b/src/mesa/drivers/dri/i965/intel_screen.c
> index 641edb7e72b..f4670fc2614 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -2026,7 +2026,7 @@ parse_devid_override(const char *devid_override)
>   return name_map[i].pci_id;
> }
>  
> -   return strtod(devid_override, NULL);
> +   return strtol(devid_override, NULL, 0);
>  }
>  
>  /**
> -- 
> 2.13.0
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965: use strtol to convert the integer deviceID override

2017-07-14 Thread Emil Velikov
From: Emil Velikov 

One can override the deviceID, by setting the INTEL_DEVID_OVERRIDE
variable. A few symbolic names or a numerical value for the actual
device ID is accepted.

At the same time we're using strtod (string to double) to convert the
string to a decimal numeral. A seeming thinko, made by the original
commit that introduces the code in libdrm_intel and got here with the
import.

Fixes: 514db96c117a ("i965: Import libdrm_intel.")
Cc: Kenneth Graunke 
Signed-off-by: Emil Velikov 
---
The device ID is a uint16_t in practise, despite that we're using
uint32_t or int thoughout. Should we bother and consistently use 
uint16_t/other?
---
 src/mesa/drivers/dri/i965/intel_screen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index 641edb7e72b..f4670fc2614 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -2026,7 +2026,7 @@ parse_devid_override(const char *devid_override)
  return name_map[i].pci_id;
}
 
-   return strtod(devid_override, NULL);
+   return strtol(devid_override, NULL, 0);
 }
 
 /**
-- 
2.13.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev