Re: [PATCH] x86, tboot: iomem fixes
From: Ingo Molnar
Date: Sat Jul 20 2013 - 03:35:44 EST
* Qiaowei Ren <qiaowei.ren@xxxxxxxxx> wrote:
> +#define SINIT_MLE_DATA_VTD_DMAR_OFF 140
> /* get addr of DMAR table */
> + dmar_tbl_off = readl(heap_ptr + SINIT_MLE_DATA_VTD_DMAR_OFF);
> dmar_tbl = (struct acpi_table_header *)(heap_ptr +
> - ((struct sinit_mle_data *)heap_ptr)->vtd_dmars_off -
> - sizeof(u64));
> + dmar_tbl_off - sizeof(u64));
So the offset of ->vtd_dmars_off within struct sinit_mle_data is 140?
The new code is less readable: what's wrong with getting the offset
automatically via C, instead of hardcoding it manually? You can use
offsetof() primitive for increased readability.
Thanks,
Ingo
--
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/