Skip to contentSkip to conversation

lib: kstrtox: add kstrtoudec64() and kstrtodec64()

PATCH Alexey Dobriyan 2 participants 2 messages Apr 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Quoted 2 lines · Rodrigo Alencar

kstrtoudec64
kstrtodec64

The only comment I have is to maybe sneak in "fixed point" into names somehow. Or change to kstrtou64_scaled() because return type is not real fixed point type.

A.lexey

#1 lore raw
Quoted 10 lines · Alexey Dobriyan
Quoted 2 lines · Rodrigo Alencar

kstrtoudec64
kstrtodec64

The only comment I have is to maybe sneak in "fixed point" into names somehow. Or change to kstrtou64_scaled() because return type is not real fixed point type.

A.lexey

I understand that a decimal number is inherently a fixed precision number with pre-defined scale. The "64" in "dec64" tells that we are storing it in a 64-bit variable.

kstrtou64_scaled() does not tell me anything about a decimal point handling, or that the base 10 is taken for granted. Maybe a typedef on u64/s64 to udec64 or dec64 can make things clearer?
I suppose the documentation header of the function would be enough for that. As it is clear, the function intent is not to return a "fixed point type", but its scaled representation in u64/s64.

Signature · 3 lines
Kind regards,

Rodrigo Alencar