public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Qiaowei Ren <qiaowei.ren@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Gang Wei <gang.wei@intel.com>
Subject: Re: [PATCH] x86, tboot: iomem fixes
Date: Sat, 20 Jul 2013 09:34:59 +0200	[thread overview]
Message-ID: <20130720073459.GA5555@gmail.com> (raw)
In-Reply-To: <1374282787-30327-1-git-send-email-qiaowei.ren@intel.com>


* Qiaowei Ren <qiaowei.ren@intel.com> 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

  reply	other threads:[~2013-07-20  7:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-20  1:13 [PATCH] x86, tboot: iomem fixes Qiaowei Ren
2013-07-20  7:34 ` Ingo Molnar [this message]
2013-07-20 16:16   ` Ren, Qiaowei
  -- strict thread matches above, loose matches on Subject: below --
2013-07-04 10:16 Qiaowei Ren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130720073459.GA5555@gmail.com \
    --to=mingo@kernel.org \
    --cc=gang.wei@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=qiaowei.ren@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox