volt: use kernel's 64-bit signed division function
PATCH 1/1 volt: use kernel's 64-bit signed division function
Doing direct 64 bit divisions in kernel code leads to references to undefined symbols on 32 bit architectures. Replace such divisions with calls to div64_s64 to make the module usable on 32 bit archs.
--- drm/nouveau/nvkm/subdev/volt/base.c | 6 +++--- lib/include/nvif/os.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
drm/nouveau/nvkm/subdev/volt/base.c +3 -3
@@ -116,9 +116,9 @@ nvkm_volt_map(struct nvkm_volt *volt, u8 id, u8 temp)return volt->speedo;if (ver ==0x10 || (ver ==0x20 && info.mode ==0 )) { - result = (s64 )info.arg[0 ] /10 ; - result += ((s64 )info.arg[1 ] * volt->speedo) /10 ; - result += ((s64 )info.arg[2 ] * volt->speedo * volt->speedo) /100000 ; + result =div64_s64 ((s64 )info.arg[0 ],10 ); + result +=div64_s64 ((s64 )info.arg[1 ] * volt->speedo,10 ); + result +=div64_s64 ((s64 )info.arg[2 ] * volt->speedo * volt->speedo,100000 ); }else if (ver ==0x20 ) {switch (info.mode) {/* 0x0 handled above! */
lib/include/nvif/os.h +1 -0
@@ -88,6 +88,7 @@ typedef dma_addr_t resource_size_t; )#define do_div (a,b) (a) = (a) / (b)#define div_u64 (a,b) (a) / (b) +#define div64_s64 (a,b) (a) / (b)#define likely (a) (a)#define unlikely (a) (a)#define BIT (a) (1UL << (a))
Signature · 6 lines
2.9.3 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 20160916090912.27451-1-acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Karol Herbst
Reviewed-byyeah locks fine
2016-09-16 11:09 GMT+02:00 Alexandre Courbot <[email protected]>:
Quoted 40 lines
Doing direct 64 bit divisions in kernel code leads to references to undefined symbols on 32 bit architectures. Replace such divisions with calls to
div64_s64to make the module usable on 32 bit archs.Signed-off-by Alexandre Courbot <[email protected]>--- drm/nouveau/nvkm/subdev/volt/base.c | 6 +++--- lib/include/nvif/os.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)drm/nouveau/nvkm/subdev/volt/base.c +3
-3@@ -116,9 +116,9 @@ nvkm_volt_map(struct nvkm_volt *volt, u8 id, u8 temp)return volt->speedo;if (ver ==0x10 || (ver ==0x20 && info.mode ==0 )) { - result = (s64 )info.arg[0 ] /10 ; - result += ((s64 )info.arg[1 ] * volt->speedo) /10 ; - result += ((s64 )info.arg[2 ] * volt->speedo * volt->speedo) /100000 ; + result =div64_s64 ((s64 )info.arg[0 ],10 ); + result +=div64_s64 ((s64 )info.arg[1 ] * volt->speedo,10 ); + result +=div64_s64 ((s64 )info.arg[2 ] * volt->speedo * volt->speedo,100000 ); }else if (ver ==0x20 ) {switch (info.mode) {/* 0x0 handled above! */ lib/include/nvif/os.h +1
-1@@ -88,6 +88,7 @@ typedef dma_addr_t resource_size_t; )#define do_div (a,b) (a) = (a) / (b)#define div_u64 (a,b) (a) / (b) +#define div64_s64 (a,b) (a) / (b)#define likely (a) (a)#define unlikely (a) (a)#define BIT (a) (1UL << (a)) --
Quoted 2 lines
2.9.3
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau