public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Stone <daniel.stone@nokia.com>
To: ext Girish <girishsg@ti.com>
Cc: linux-omap-open-source@linux.omap.com
Subject: Re: [PATCH 2/2] silicon revision check for OMAP2/3
Date: Fri, 26 Oct 2007 20:52:24 +0300	[thread overview]
Message-ID: <20071026175224.GA5457@intune.research.nokia.com> (raw)
In-Reply-To: <000d01c817e2$90dd0230$6a8918ac@ent.ti.com>

On Fri, Oct 26, 2007 at 08:42:03PM +0530, ext Girish wrote:
> +#define is_sil_rev_greater_than(rev) \
> +		(((((system_rev & 0xffff0000) >> 16) == \
> +		((rev & 0xffff0000) >> 16)) && 	\
> +		(system_rev & 0xf000) >> 12) > ((rev & 0xf000) >> 12))
> +#define is_sil_rev_less_than(rev) \
> +		(((((system_rev & 0xffff0000) >> 16) == \
> +		((rev & 0xffff0000) >> 16)) && 	\
> +		(system_rev & 0xf000) >> 12) < ((rev & 0xf000) >> 12))
> +#define is_sil_rev_equal_to(rev) \
> +		(((((system_rev & 0xffff0000) >> 16) ==	\
> +		((rev & 0xffff0000) >> 16)) && \
> +		(system_rev & 0xf000) >> 12) == ((rev & 0xf000) >> 12))
> +#define get_sil_rev() \
> +		((system_rev & 0xf000) >> 12)

Hi,
Just for code clarity, you could use (taking is_sil_rev_greater_than as
an example):
#define is_sil_rev_greater_than(rev) \
                ((system_rev & 0xffff0000) == (rev & 0xffff0000) && \
                 (system_rev & 0x0000f000) == (rev & 0x0000f000))

You don't need the extra shifts in the comparison.  But, even better,
you could use:
#define get_sil_generation(rev) ((rev & 0xffff0000) >> 16)
#define get_sil_revision(rev) ((rev & 0x00000f000) >> 12)
#define is_sil_rev_greater_than(rev) \
                ((get_sil_generation(system_rev) == \
                  get_sil_generation(rev)) && \
                 (get_sil_revision(system_rev) >
                  get_sil_revision(rev)))

and likewise for all the rest.

Cheers,
Daniel

  reply	other threads:[~2007-10-26 17:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-26 15:12 [PATCH 2/2] silicon revision check for OMAP2/3 Girish
2007-10-26 17:52 ` Daniel Stone [this message]
2007-11-01 11:59   ` Tony Lindgren
  -- strict thread matches above, loose matches on Subject: below --
2007-10-26 15:39 Girish

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=20071026175224.GA5457@intune.research.nokia.com \
    --to=daniel.stone@nokia.com \
    --cc=girishsg@ti.com \
    --cc=linux-omap-open-source@linux.omap.com \
    /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