lkml.org 
[lkml]   [2022]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 16/24] EDAC/amd64: Define function to make space for CS ID
On Mon, Feb 14, 2022 at 01:50:54PM +0100, Borislav Petkov wrote:
> On Thu, Jan 27, 2022 at 08:41:07PM +0000, Yazen Ghannam wrote:
> > +static void expand_bits(u8 start_bit, u8 num_bits, u64 *value)
> > +{
> > + u64 temp1, temp2;
> > +
> > + if (start_bit == 0) {
>
> As always
>
> if (!<variable, etc>)
>
> for 0/NULL tests.
>

Will fix.

> > + *value <<= num_bits;
> > + return;
> > + }
> > +
> > + temp1 = *value & GENMASK_ULL(start_bit - 1, 0);
> > + temp2 = (*value & GENMASK_ULL(63, start_bit)) << num_bits;
> > + *value = temp1 | temp2;
> > +}
> > +
> > +static void make_space_for_cs_id_simple(struct addr_ctx *ctx)
> > +{
> > + u8 num_intlv_bits = ctx->intlv_num_chan;
> > +
> > + num_intlv_bits += ctx->intlv_num_dies;
> > + num_intlv_bits += ctx->intlv_num_sockets;
> > + expand_bits(ctx->intlv_addr_bit, num_intlv_bits, &ctx->ret_addr);
> > +}
>
> void functions but they return values through their pointer arguments?
> I'm sure you can design those better.
>

I guess this could be "addr = func(x, y, addr)", but why not just operate on
the value directly? There isn't an error condition here that's obvious to me.

Thanks,
Yazen

\
 
 \ /
  Last update: 2022-03-09 23:26    [W:0.079 / U:1.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site