mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
Fix reg block enumeration to properly handle NULL register blocks
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
parent
f4d2662dff
commit
1b3caa1f0f
@ -69,7 +69,7 @@ int mqnic_create_interface(struct mqnic_dev *mdev, struct mqnic_if **interface_p
|
||||
}
|
||||
|
||||
dev_info(dev, "Interface-level register blocks:");
|
||||
for (rb = interface->rb_list; rb->type && rb->version; rb++)
|
||||
for (rb = interface->rb_list; rb->regs; rb++)
|
||||
dev_info(dev, " type 0x%08x (v %d.%d.%d.%d)", rb->type, rb->version >> 24,
|
||||
(rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff);
|
||||
|
||||
|
@ -274,7 +274,7 @@ static int mqnic_common_probe(struct mqnic_dev *mqnic)
|
||||
}
|
||||
|
||||
dev_info(dev, "Device-level register blocks:");
|
||||
for (rb = mqnic->rb_list; rb->type && rb->version; rb++)
|
||||
for (rb = mqnic->rb_list; rb->regs; rb++)
|
||||
dev_info(dev, " type 0x%08x (v %d.%d.%d.%d)", rb->type, rb->version >> 24,
|
||||
(rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff);
|
||||
|
||||
|
@ -70,12 +70,12 @@ int mqnic_create_sched_block(struct mqnic_if *interface, struct mqnic_sched_bloc
|
||||
}
|
||||
|
||||
dev_info(dev, "Scheduler block-level register blocks:");
|
||||
for (rb = block->rb_list; rb->type && rb->version; rb++)
|
||||
for (rb = block->rb_list; rb->regs; rb++)
|
||||
dev_info(dev, " type 0x%08x (v %d.%d.%d.%d)", rb->type, rb->version >> 24,
|
||||
(rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff);
|
||||
|
||||
block->sched_count = 0;
|
||||
for (rb = block->rb_list; rb->type && rb->version; rb++) {
|
||||
for (rb = block->rb_list; rb->regs; rb++) {
|
||||
if (rb->type == MQNIC_RB_SCHED_RR_TYPE && rb->version == MQNIC_RB_SCHED_RR_VER) {
|
||||
ret = mqnic_create_scheduler(block, &block->sched[block->sched_count],
|
||||
block->sched_count, rb);
|
||||
|
@ -114,7 +114,7 @@ int main(int argc, char *argv[])
|
||||
printf("RAM region size: %lu\n", dev->ram_size);
|
||||
|
||||
printf("Device-level register blocks:\n");
|
||||
for (struct reg_block *rb = dev->rb_list; rb->type && rb->version; rb++)
|
||||
for (struct reg_block *rb = dev->rb_list; rb->regs; rb++)
|
||||
printf(" type 0x%08x (v %d.%d.%d.%d)\n", rb->type, rb->version >> 24,
|
||||
(rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff);
|
||||
|
||||
@ -138,7 +138,7 @@ int main(int argc, char *argv[])
|
||||
mqnic_reg_read32(dev->phc_rb->regs, MQNIC_RB_PHC_REG_NOM_PERIOD_FNS));
|
||||
|
||||
ch = 0;
|
||||
for (struct reg_block *rb = dev->rb_list; rb->type && rb->version; rb++)
|
||||
for (struct reg_block *rb = dev->rb_list; rb->regs; rb++)
|
||||
{
|
||||
if (rb->type == MQNIC_RB_PHC_PEROUT_TYPE && rb->version == MQNIC_RB_PHC_PEROUT_VER)
|
||||
{
|
||||
@ -174,7 +174,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
printf("Interface-level register blocks:\n");
|
||||
for (struct reg_block *rb = dev_interface->rb_list; rb->type && rb->version; rb++)
|
||||
for (struct reg_block *rb = dev_interface->rb_list; rb->regs; rb++)
|
||||
printf(" type 0x%08x (v %d.%d.%d.%d)\n", rb->type, rb->version >> 24,
|
||||
(rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff);
|
||||
|
||||
@ -233,13 +233,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
printf("Scheduler block-level register blocks:\n");
|
||||
for (struct reg_block *rb = dev_sched_block->rb_list; rb->type && rb->version; rb++)
|
||||
for (struct reg_block *rb = dev_sched_block->rb_list; rb->regs; rb++)
|
||||
printf(" type 0x%08x (v %d.%d.%d.%d)\n", rb->type, rb->version >> 24,
|
||||
(rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff);
|
||||
|
||||
printf("Sched count: %d\n", dev_sched_block->sched_count);
|
||||
|
||||
for (struct reg_block *rb = dev_sched_block->rb_list; rb->type && rb->version; rb++)
|
||||
for (struct reg_block *rb = dev_sched_block->rb_list; rb->regs; rb++)
|
||||
{
|
||||
if (rb->type == MQNIC_RB_SCHED_RR_TYPE && rb->version == MQNIC_RB_SCHED_RR_VER)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user