All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: H Hartley Sweeten <hartleys@visionengravers.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
	Ian Abbott <ian.abbott@mev.co.uk>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 67/90] staging: comedi: dt3000: remove 'phys_addr' from the private data
Date: Thu, 19 Jul 2012 13:07:11 +0100	[thread overview]
Message-ID: <5007F86F.7060201@mev.co.uk> (raw)
In-Reply-To: <201207181858.25078.hartleys@visionengravers.com>

On 2012-07-19 02:58, H Hartley Sweeten wrote:
> The 'phys_addr' variable in the private data is simply used as
> a flag for the detach function to know that the pci device has
> been enabled. Use the 'dev->iobase' variable instead as is more
> typical for other comedi pci drivers.

I think dev->iobase is really only meant to hold I/O port addresses, 
although it is wide enough to hold a 32-bit PCI memory address.

> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
> Cc: Ian Abbott <abbotti@mev.co.uk>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>   drivers/staging/comedi/drivers/dt3000.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c
> index 92558e7..3937e87 100644
> --- a/drivers/staging/comedi/drivers/dt3000.c
> +++ b/drivers/staging/comedi/drivers/dt3000.c
> @@ -250,7 +250,6 @@ static const struct dt3k_boardtype dt3k_boardtypes[] = {
>   struct dt3k_private {
>
>   	struct pci_dev *pci_dev;
> -	resource_size_t phys_addr;
>   	void __iomem *io_addr;
>   	unsigned int lock;
>   	unsigned int ao_readback[2];
> @@ -824,8 +823,8 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>   	if (ret < 0)
>   		return ret;
>
> -	devpriv->phys_addr = pci_resource_start(pcidev, 0);
> -	devpriv->io_addr = ioremap(devpriv->phys_addr, DT3000_SIZE);
> +	dev->iobase = pci_resource_start(pcidev, 0);
> +	devpriv->io_addr = ioremap(dev->iobase, DT3000_SIZE);

dev->iobase is an unsigned long, which may be narrower than a 
resource_size_t.  You should really pass the full-width resource_size_t 
value to ioremap().

You could even set dev->iobase to some dummy non-zero value as a flag 
for the detach() routine to call comedi_pci_disable() as dev->iobase is 
not used for anything else.

>   	if (!devpriv->io_addr)
>   		return -ENOMEM;
>
> @@ -905,7 +904,7 @@ static void dt3000_detach(struct comedi_device *dev)
>   		free_irq(dev->irq, dev);
>   	if (devpriv) {
>   		if (devpriv->pci_dev) {
> -			if (devpriv->phys_addr)
> +			if (dev->iobase)
>   				comedi_pci_disable(devpriv->pci_dev);
>   			pci_dev_put(devpriv->pci_dev);
>   		}
>


-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

      reply	other threads:[~2012-07-19 12:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-19  1:58 [PATCH 67/90] staging: comedi: dt3000: remove 'phys_addr' from the private data H Hartley Sweeten
2012-07-19 12:07 ` Ian Abbott [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=5007F86F.7060201@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hartleys@visionengravers.com \
    --cc=ian.abbott@mev.co.uk \
    --cc=linux-kernel@vger.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 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.