From: Ingo Oeser <ioe-lkml@rameria.de>
To: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
linux-pci@atrey.karlin.mff.cuni.cz, Greg KH <greg@kroah.com>,
Grant Grundler <grundler@parisc-linux.org>,
Andrew Morton <akpm@osdl.org>,
e1000-devel@lists.sourceforge.net, linux-scsi@vger.kernel.org,
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Subject: Re: [PATCH 3/5] PCI : Add selected_regions funcs
Date: Thu, 23 Nov 2006 20:33:32 +0100 [thread overview]
Message-ID: <200611232033.35280.ioe-lkml@rameria.de> (raw)
In-Reply-To: <456404FE.1040708@jp.fujitsu.com>
Hi Hidetoshi Seto,
bitfields (and bitmask) should be unsigned and use machine word size,
which is usually "long". So please pass them in "unsigned long" instead of "int".
On Wednesday, 22. November 2006 09:06, Hidetoshi Seto wrote:
> --- linux-2.6.19-rc6.orig/drivers/pci/pci.c
> +++ linux-2.6.19-rc6/drivers/pci/pci.c
> @@ -758,6 +758,47 @@
> return -EBUSY;
> }
>
> +/**
> + * pci_release_selected_regions - Release selected PCI I/O and memory resources
> + * @pdev: PCI device whose resources were previously reserved
> + * @bars: Bitmask of BARs to be released
> + *
> + * Release selected PCI I/O and memory resources previously reserved.
> + * Call this function only after all use of the PCI regions has ceased.
> + */
> +void pci_release_selected_regions(struct pci_dev *pdev, int bars)
"unsigned long bars" here
> +{
> + int i;
"unsigned long i" here
> +
> + for (i = 0; i < 6; i++)
> + if (bars & (1 << i))
> + pci_release_region(pdev, i);
> +}
> +
> +/**
> + * pci_request_selected_regions - Reserve selected PCI I/O and memory resources
> + * @pdev: PCI device whose resources are to be reserved
> + * @bars: Bitmask of BARs to be requested
> + * @res_name: Name to be associated with resource
> + */
> +int pci_request_selected_regions(struct pci_dev *pdev, int bars,
> + const char *res_name)
> +{
"unsigned long bars" here
> + int i;
"unsigned long i" here
> @@ -975,6 +1002,22 @@
> }
> #endif
>
> +/**
> + * pci_select_bars - Make BAR mask from the type of resource
> + * @pdev: the PCI device for which BAR mask is made
> + * @flags: resource type mask to be selected
> + *
> + * This helper routine makes bar mask from the type of resource.
> + */
> +int pci_select_bars(struct pci_dev *dev, unsigned long flags)
unsigned long pci_select_bars(struct pci_dev *dev, unsigned long flags)
> +{
> + int i, bars = 0;
"unsigned long i, bars" here
> + for (i = 0; i < PCI_NUM_RESOURCES; i++)
> + if (pci_resource_flags(dev, i) & flags)
> + bars |= (1 << i);
> + return bars;
> +}
> +
> static int __devinit pci_init(void)
> {
> struct pci_dev *dev = NULL;
> @@ -1023,6 +1066,8 @@
> EXPORT_SYMBOL(pci_request_regions);
> EXPORT_SYMBOL(pci_release_region);
> EXPORT_SYMBOL(pci_request_region);
> +EXPORT_SYMBOL(pci_release_selected_regions);
> +EXPORT_SYMBOL(pci_request_selected_regions);
> EXPORT_SYMBOL(pci_set_master);
> EXPORT_SYMBOL(pci_set_mwi);
> EXPORT_SYMBOL(pci_clear_mwi);
> @@ -1031,6 +1076,7 @@
> EXPORT_SYMBOL(pci_set_consistent_dma_mask);
> EXPORT_SYMBOL(pci_assign_resource);
> EXPORT_SYMBOL(pci_find_parent_resource);
> +EXPORT_SYMBOL(pci_select_bars);
>
> EXPORT_SYMBOL(pci_set_power_state);
> EXPORT_SYMBOL(pci_save_state);
> Index: linux-2.6.19-rc6/include/linux/pci.h
> ===================================================================
> --- linux-2.6.19-rc6.orig/include/linux/pci.h
> +++ linux-2.6.19-rc6/include/linux/pci.h
> @@ -514,6 +514,7 @@
> int __must_check pci_assign_resource(struct pci_dev *dev, int i);
> int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
> void pci_restore_bars(struct pci_dev *dev);
> +int pci_select_bars(struct pci_dev *dev, unsigned long flags);
unsigned long pci_select_bars(struct pci_dev *dev, unsigned long flags)
>
> /* ROM control related routines */
> void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
> @@ -542,6 +543,8 @@
> void pci_release_regions(struct pci_dev *);
> int __must_check pci_request_region(struct pci_dev *, int, const char *);
> void pci_release_region(struct pci_dev *, int);
> +int pci_request_selected_regions(struct pci_dev *, int, const char *);
> +void pci_release_selected_regions(struct pci_dev *, int);
int pci_request_selected_regions(struct pci_dev *, unsigned long, const char *);
void pci_release_selected_regions(struct pci_dev *, unsigned long);
Regards
Ingo Oeser
next prev parent reply other threads:[~2006-11-23 19:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-22 8:06 Hidetoshi Seto
2006-11-23 19:33 ` Ingo Oeser [this message]
2006-11-23 19:39 ` Matthew Wilcox
2006-11-23 21:42 ` Alan
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=200611232033.35280.ioe-lkml@rameria.de \
--to=ioe-lkml@rameria.de \
--cc=akpm@osdl.org \
--cc=e1000-devel@lists.sourceforge.net \
--cc=greg@kroah.com \
--cc=grundler@parisc-linux.org \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=linux-scsi@vger.kernel.org \
--cc=seto.hidetoshi@jp.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®