1 comment:
File src/soc/intel/common/block/cse/cse.c:
if (offset == PCI_ME_HFSTS1)
index = 1;
else if (offset == PCI_ME_HFSTS2)
index = 2;
else if (offset == PCI_ME_HFSTS3)
index = 3;
else if (offset == PCI_ME_HFSTS4)
index = 4;
else if (offset == PCI_ME_HFSTS5)
index = 5;
else if (offset == PCI_ME_HFSTS6)
index = 6;
would using a static structure beautify it? like below..
struct hfsts_index{
uint32_t hfsts;
uint32_t index;
}
struct hfsts_index hfsts_to_index[6] = {
{PCI_ME_HFSTS1, 1},
{PCI_ME_HFSTS2, 2},
{PCI_ME_HFSTS3, 3},
{PCI_ME_HFSTS4, 4},
{PCI_ME_HFSTS5, 5},
{PCI_ME_HFSTS6, 6},
};
for (i = 0, i<=6 , i++) {
if (hfsts_to_index[i].hfsts == hfsts_reg)
index=hfsts_to_index[i].index;
}
I think just a switch statement would be more appropriate here.
To view, visit change 35225. To unsubscribe, or for help writing mail filters, visit settings.