Displaying 4 results from an estimated 4 matches for "awesome_div_macro".
2017 Sep 06
2
[PATCH] [RESEND] drm/nouveau/clk: fix gcc-7 -Wint-in-bool-context warning
...t M and P actually are in this function, so I couldn't
come up with a much better name either, how about simply 'divisor'?
> I even imagine, that there
> are some macros in the kernel for dealing with something like this
> already, so that we could do instead:
>
> return AWESOME_DIV_MACRO(sclk * N, M * P)
I don't think that exists, the behavior for divide-by-zero really
depends a lot on the context, and returning zero is probably
often not a good solution.
Arnd
2017 Sep 06
2
[PATCH] [RESEND] drm/nouveau/clk: fix gcc-7 -Wint-in-bool-context warning
gcc thinks that interpreting a multiplication result as a bool
is confusing:
drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c: In function 'read_pll':
drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c:133:8: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]
In this instance, I think using multiplication is more intuitive
than
2017 Sep 06
0
[PATCH] [RESEND] drm/nouveau/clk: fix gcc-7 -Wint-in-bool-context warning
...hing like this:
int denominator = M * P
if (denominator == 0)
return 0;
return sclk * N / denominator;
but with a better name for "denominator". I even imagine, that there
are some macros in the kernel for dealing with something like this
already, so that we could do instead:
return AWESOME_DIV_MACRO(sclk * N, M * P)
> Fixes: 7632b30e4b8b ("drm/nouveau/clk: namespace + nvidia gpu names (no binary change)")
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>
> ---
> Originally submitted on July 14, but no reply. This is the same
> patch again. The warning is current...
2017 Sep 06
0
[PATCH] [RESEND] drm/nouveau/clk: fix gcc-7 -Wint-in-bool-context warning
...re simply dividers for the PLL configuration
and there are two of them. I think "P" is the post divider.
>> I even imagine, that there
>> are some macros in the kernel for dealing with something like this
>> already, so that we could do instead:
>>
>> return AWESOME_DIV_MACRO(sclk * N, M * P)
>
> I don't think that exists, the behavior for divide-by-zero really
> depends a lot on the context, and returning zero is probably
> often not a good solution.
>
> Arnd