All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: hpa@zytor.com, mingo@redhat.com, tglx@linutronix.de,
	hpa@linux.intel.com, linux-kernel@vger.kernel.org,
	linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/headers] x86: truncate ISA addresses to unsigned int
Date: Tue, 17 Feb 2009 22:55:35 +0100	[thread overview]
Message-ID: <20090217215535.GA11336@elte.hu> (raw)
In-Reply-To: <1234905865.23466.11.camel@localhost.localdomain>


* James Bottomley <James.Bottomley@HansenPartnership.com> wrote:

> On Tue, 2009-02-17 at 21:12 +0000, H. Peter Anvin wrote:
> > Author:     H. Peter Anvin <hpa@linux.intel.com>
> > AuthorDate: Tue, 17 Feb 2009 13:01:51 -0800
> > Commit:     H. Peter Anvin <hpa@linux.intel.com>
> > CommitDate: Tue, 17 Feb 2009 13:01:51 -0800
> > 
> > x86: truncate ISA addresses to unsigned int
> > 
> > Impact: Cleanup; fix inappropriate macro use
> > 
> > ISA addresses on x86 are mapped 1:1 with the physical address space.
> > Since the ISA address space is only 24 bits (32 for VLB or LPC) it
> > will always fit in an unsigned int, and at least in the aha1542 driver
> > using a wider type would cause an undesirable promotion.  Hence
> > explicitly cast the ISA bus addresses to unsigned int.
> > 
> > Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
> > Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
> > 
> > 
> > ---
> >  arch/x86/include/asm/io.h |   11 ++++++++---
> >  1 files changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
> > index 4f8e820..683d0b4 100644
> > --- a/arch/x86/include/asm/io.h
> > +++ b/arch/x86/include/asm/io.h
> > @@ -124,10 +124,15 @@ static inline void *phys_to_virt(phys_addr_t address)
> >  
> >  /*
> >   * ISA I/O bus memory addresses are 1:1 with the physical address.
> > + * However, we truncate the address to unsigned int to avoid undesirable
> > + * promitions in legacy drivers.
> >   */
> > -#define isa_virt_to_bus (unsigned long)virt_to_phys
> > -#define isa_page_to_bus page_to_phys
> > -#define isa_bus_to_virt phys_to_virt
> > +static inline unsigned int isa_virt_to_bus(volatile void *address)
> 
> The rest looks fine, but why is the address volatile?  The macro below
> never actually dereferences it.

That is because the volatile keyword here broadens the permitted 
_input_ type.

	Ingo

      parent reply	other threads:[~2009-02-17 21:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tip-a7eb518998529c08cc53fef17756d9fe433b0c23@kernel.org>
2009-02-17 21:24 ` [tip:x86/headers] x86: truncate ISA addresses to unsigned int James Bottomley
2009-02-17 21:25   ` H. Peter Anvin
2009-02-17 21:55   ` Ingo Molnar [this message]

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=20090217215535.GA11336@elte.hu \
    --to=mingo@elte.hu \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.