public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Jaccon Bastiaansen <jaccon.bastiaansen@gmail.com>
Cc: s.hauer@pengutronix.de, gfm@funxed.com, davem@davemloft.net,
	festevam@gmail.com, linux-arm-kernel@lists.infradead.org,
	kernel@pengutronix.de, netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] cs89x0_platform : Use ioread16/iowrite16 instead of inw/outw
Date: Mon, 30 Apr 2012 14:19:26 +0000	[thread overview]
Message-ID: <201204301419.27119.arnd@arndb.de> (raw)
In-Reply-To: <1335779839-30420-1-git-send-email-jaccon.bastiaansen@gmail.com>

On Monday 30 April 2012, Jaccon Bastiaansen wrote:
> The use of the inw/outw functions by the cs89x0 platform driver
> results in NULL pointer references.
> 
> Signed-off-by: Jaccon Bastiaansen <jaccon.bastiaansen@gmail.com>
> ---
>  drivers/net/ethernet/cirrus/cs89x0.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)

It's actually broken on most platforms already, and the #ifdef is
about to go away since IXP2xxx is getting removed in v3.5.

> diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c
> index b9406cb..95737e9 100644
> --- a/drivers/net/ethernet/cirrus/cs89x0.c
> +++ b/drivers/net/ethernet/cirrus/cs89x0.c
> @@ -369,6 +369,18 @@ writeword(unsigned long base_addr, int portno, u16 value)
>  {
>         __raw_writel(value, base_addr + (portno << 1));
>  }
> +#elif defined(CONFIG_CS89x0_PLATFORM)
> +static u16
> +readword(unsigned long base_addr, int portno)
> +{
> +       return ioread16(base_addr + portno);
> +}
> +
> +static void
> +writeword(unsigned long base_addr, int portno, u16 value)
> +{
> +       iowrite16(value, base_addr + portno);
> +}
>  #else
>  static u16
>  readword(unsigned long base_addr, int portno)

I think the best solution would be to always using ioread32/iowrite32
in the #else path, and change the ISA code to do an ioport_map
for the base address, passing around the virtual address as an __iomem
pointer.

	Arnd

  reply	other threads:[~2012-04-30 14:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-30  9:57 [PATCH 1/2] cs89x0_platform : Use ioread16/iowrite16 instead of inw/outw Jaccon Bastiaansen
2012-04-30 14:19 ` Arnd Bergmann [this message]
2012-05-03 20:55   ` Jaccon Bastiaansen
2012-05-04  9:05     ` Arnd Bergmann

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=201204301419.27119.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=festevam@gmail.com \
    --cc=gfm@funxed.com \
    --cc=jaccon.bastiaansen@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=s.hauer@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox