@@ -453,7 +453,7 @@ static void sriov_restore_state(struct pci_dev *dev)
*/
int pci_iov_init(struct pci_dev *dev)
{
- int pos;
+ u16 pos;
if (!pci_is_pcie(dev))
return -ENODEV;
@@ -266,11 +266,11 @@ EXPORT_SYMBOL(pci_bus_find_capability);
* not support it. Some capabilities can occur several times, e.g., the
* vendor-specific capability, and this provides a way to find them all.
*/
-int pci_find_next_ext_capability(struct pci_dev *dev, int start, int cap)
+u16 pci_find_next_ext_capability(struct pci_dev *dev, int start, u16 cap)
{
u32 header;
int ttl;
- int pos = PCI_CFG_SPACE_SIZE;
+ u16 pos = PCI_CFG_SPACE_SIZE;
/* minimum 8 bytes per capability */
ttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8;
@@ -321,7 +321,7 @@ EXPORT_SYMBOL_GPL(pci_find_next_ext_capability);
* %PCI_EXT_CAP_ID_DSN Device Serial Number
* %PCI_EXT_CAP_ID_PWR Power Budgeting
*/
-int pci_find_ext_capability(struct pci_dev *dev, int cap)
+u16 pci_find_ext_capability(struct pci_dev *dev, u16 cap)
{
return pci_find_next_ext_capability(dev, 0, cap);
}
@@ -2119,7 +2119,7 @@ static void pci_add_saved_cap(struct pci_dev *pci_dev,
static int _pci_add_cap_save_buffer(struct pci_dev *dev, u16 cap,
bool extended, unsigned int size)
{
- int pos;
+ u16 pos;
struct pci_cap_saved_state *save_state;
if (extended)
@@ -2233,7 +2233,7 @@ void pci_request_acs(void)
*/
static int pci_std_enable_acs(struct pci_dev *dev)
{
- int pos;
+ u16 pos;
u16 cap;
u16 ctrl;
@@ -2278,7 +2278,7 @@ void pci_enable_acs(struct pci_dev *dev)
static bool pci_acs_flags_enabled(struct pci_dev *pdev, u16 acs_flags)
{
- int pos;
+ u16 pos;
u16 cap, ctrl;
pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ACS);
@@ -1425,7 +1425,7 @@ EXPORT_SYMBOL(pci_scan_single_device);
static unsigned next_fn(struct pci_bus *bus, struct pci_dev *dev, unsigned fn)
{
- int pos;
+ u16 pos;
u16 cap = 0;
unsigned next_fn;
@@ -820,8 +820,8 @@ enum pci_lost_interrupt_reason {
enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev);
u8 pci_find_capability(struct pci_dev *dev, u8 cap);
u8 pci_find_next_capability(struct pci_dev *dev, u8 pos, u8 cap);
-int pci_find_ext_capability(struct pci_dev *dev, int cap);
-int pci_find_next_ext_capability(struct pci_dev *dev, int pos, int cap);
+u16 pci_find_ext_capability(struct pci_dev *dev, u16 cap);
+u16 pci_find_next_ext_capability(struct pci_dev *dev, int pos, u16 cap);
u8 pci_find_ht_capability(struct pci_dev *dev, int ht_cap);
u8 pci_find_next_ht_capability(struct pci_dev *dev, u8 pos, int ht_cap);
struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
@@ -1365,7 +1365,7 @@ static inline u8 pci_find_capability(struct pci_dev *dev, u8 cap)
static inline u8 pci_find_next_capability(struct pci_dev *dev, u8 post,
u8 cap)
{ return 0; }
-static inline int pci_find_ext_capability(struct pci_dev *dev, int cap)
+static inline u16 pci_find_ext_capability(struct pci_dev *dev, u16 cap)
{ return 0; }
/* Power management related routines */
For pci express devices, it could have extended capabilities. The position of extened capabilities is 12bit and the cap is 16bit. This patch does a clean up for pci express extended capabilities by replacing type int with u16. Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com> --- drivers/pci/iov.c | 2 +- drivers/pci/pci.c | 12 ++++++------ drivers/pci/probe.c | 2 +- include/linux/pci.h | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-)