Re: [PATCH v2 2/4] x86: pmc_atom: print index of device in loop

From: Andy Shevchenko
Date: Thu Jan 22 2015 - 04:41:01 EST


On Thu, 2015-01-22 at 11:45 +0800, Li, Aubrey wrote:
> On 2015/1/21 5:50, Andy Shevchenko wrote:
> > The register mapping may change from one platform to another. Thus, indices
> > might be not the same on different platforms. The patch makes the code to print
> > the device index dynamically at run time.
>
> Will another platform use the same table but different bit position? In
> my opinion, different platform should use different mapping table.

Yes, indeed.

The only improvement I could suggest now is to use indices for bit field
name from one array of possible names.

Or use macro to fill the item like
#define BIT_X(bitname) { .name = __stringify(bitname), .bit_mask = BIT_
## bitname, }


> >
> > The patch also changes the for loop to iterate over the map until a terminator
> > is found.
>
> Why do we need to do this? did you see any hurt from the existing
> implementation?

Just a micro optimization plus it allows in consequent patches to avoid
size members in the pmc_reg_map.

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Intel Finland Oy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/