All of lore.kernel.org
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Paul Mackerras <paulus@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Greg Kroah-Hartman <greg@kroah.com>,
	sensors@stimpy.netroedge.com,
	Linux/PPC Development <linuxppc-dev@lists.linuxppc.org>
Subject: [PATCH 2.6] Hydra i2c
Date: Thu, 19 May 2005 06:24:35 +0000	[thread overview]
Message-ID: <20040118124957.GA7585@lst.de> (raw)
In-Reply-To: <Pine.LNX.4.58.0401181323130.653@callisto>

On Sun, Jan 18, 2004 at 01:28:22PM +0100, Geert Uytterhoeven wrote:
> +static int __devinit hydra_probe(struct pci_dev *dev,
> +				 const struct pci_device_id *id)
> +{
> +	unsigned int base_addr;
> +
> +	base_addr = dev->resource[0].start;

I think you should use pci_resource_start here.

> +	hydra_bit_data.data = ioremap(base_addr, 0x100);

And pci_resource len instead of hardcoding it?  Also you need to
check the ioremap return value.

You should also add a safety exit for the case the probe callback is
called more than once.  Or dynamic allocate a per-device struct instead
of using hydra_bit_data.

> +static void __exit i2c_hydra_exit(void)
> +{
> +	pci_unregister_driver(&hydra_driver);
> +	iounmap(hydra_bit_data.data);

The ioremap should move into the hydra_remove.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Paul Mackerras <paulus@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Greg Kroah-Hartman <greg@kroah.com>,
	sensors@stimpy.netroedge.com,
	Linux/PPC Development <linuxppc-dev@lists.linuxppc.org>
Subject: Re: [PATCH 2.6] Hydra i2c
Date: Sun, 18 Jan 2004 13:49:57 +0100	[thread overview]
Message-ID: <20040118124957.GA7585@lst.de> (raw)
In-Reply-To: <Pine.LNX.4.58.0401181323130.653@callisto>


On Sun, Jan 18, 2004 at 01:28:22PM +0100, Geert Uytterhoeven wrote:
> +static int __devinit hydra_probe(struct pci_dev *dev,
> +				 const struct pci_device_id *id)
> +{
> +	unsigned int base_addr;
> +
> +	base_addr = dev->resource[0].start;

I think you should use pci_resource_start here.

> +	hydra_bit_data.data = ioremap(base_addr, 0x100);

And pci_resource len instead of hardcoding it?  Also you need to
check the ioremap return value.

You should also add a safety exit for the case the probe callback is
called more than once.  Or dynamic allocate a per-device struct instead
of using hydra_bit_data.

> +static void __exit i2c_hydra_exit(void)
> +{
> +	pci_unregister_driver(&hydra_driver);
> +	iounmap(hydra_bit_data.data);

The ioremap should move into the hydra_remove.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

  reply	other threads:[~2005-05-19  6:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-18 12:28 [PATCH 2.6] Hydra i2c Geert Uytterhoeven
2005-05-19  6:24 ` Geert Uytterhoeven
2004-01-18 12:49 ` Christoph Hellwig [this message]
2005-05-19  6:24   ` Christoph Hellwig
2004-01-25 11:22   ` Geert Uytterhoeven
2005-05-19  6:24     ` Geert Uytterhoeven
2004-01-31  0:35     ` Greg KH
2005-05-19  6:24       ` Greg KH
2004-01-18 23:30 ` Benjamin Herrenschmidt
2005-05-19  6:24   ` Benjamin Herrenschmidt

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=20040118124957.GA7585@lst.de \
    --to=hch@lst.de \
    --cc=benh@kernel.crashing.org \
    --cc=geert@linux-m68k.org \
    --cc=greg@kroah.com \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=paulus@samba.org \
    --cc=sensors@stimpy.netroedge.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 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.