linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: Keith Busch <keith.busch@intel.com>, Jens Axboe <axboe@fb.com>,
	linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH] NVMe: Only release requested regions
Date: Thu, 12 May 2016 09:34:56 +0200	[thread overview]
Message-ID: <20160512073456.GD25134@c203.arch.suse.de> (raw)
In-Reply-To: <20160512070352.GB20802@infradead.org>

On Thu, May 12, 2016 at 12:03:52AM -0700, Christoph Hellwig wrote:
> >  static void nvme_dev_unmap(struct nvme_dev *dev)
> >  {
> > +	struct pci_dev *pdev = to_pci_dev(dev->dev);
> > +	int bars;
> > +
> >  	if (dev->bar)
> >  		iounmap(dev->bar);
> > -	pci_release_regions(to_pci_dev(dev->dev));
> > +
> > +	bars = pci_select_bars(pdev, IORESOURCE_MEM);
> > +	pci_release_selected_regions(pdev, bars);
> 
> This looks fine, but I really hate this API.
> 
> Can someone add these two nice helpers to pci.h:

Well I could send a patch, but then this is your code...

> 
> static inline int
> pci_request_mem_regions(struct pci_dev *pdev, const char *name)
> {
> 	return pci_request_selected_regions(pdev,
> 			pci_select_bars(pdev, IORESOURCE_MEM), name);
> }
> 
> static inline void
> pci_release_mem_regions(struct pci_dev *pdev)
> {
> 	return pci_release_selected_regions(pdev,
> 			pci_select_bars(pdev, IORESOURCE_MEM));
> }
> 
> But for now this should do it:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Thanks

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

  reply	other threads:[~2016-05-12  7:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-10 13:14 [PATCH] NVMe: Only release requested regions Johannes Thumshirn
2016-05-10 13:16 ` Hannes Reinecke
2016-05-12  7:03 ` Christoph Hellwig
2016-05-12  7:34   ` Johannes Thumshirn [this message]
2016-05-24  9:15 ` Johannes Thumshirn
2016-05-24  9:19   ` Christoph Hellwig
2016-05-24 14:29     ` Keith Busch
2016-06-08  7:16 ` Johannes Thumshirn
2016-06-09 20:28   ` Jens Axboe

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=20160512073456.GD25134@c203.arch.suse.de \
    --to=jthumshirn@suse.de \
    --cc=axboe@fb.com \
    --cc=hch@infradead.org \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-pci@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).