Skip to contentSkip to conversation

compat: drop const to fix compiler warnings

PATCH In review Felix Fietkau 3 participants 5 messages Sep 7, 2012 – Sep 11, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat: drop const to fix compiler warnings

When calling pci_find_capability and pci_read_config_word, struct pci_dev needs to be passed without const.

---
 compat/compat-3.7.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
compat/compat-3.7.c +6 -6
index b37b73a..f591f16 100644
@@ -29,7 +29,7 @@ EXPORT_SYMBOL_GPL(mod_delayed_work);
  * pci_dev but if we found it we likely would remove it from
  * the kernel anyway right? Bite me.
  */
-static inline u16 pcie_flags_reg(const struct pci_dev *dev)
+static inline u16 pcie_flags_reg(struct pci_dev *dev)
 {
 	int pos;
 	u16 reg16;
@@ -43,12 +43,12 @@ static inline u16 pcie_flags_reg(const struct pci_dev *dev)
 	return reg16;
 }
 
-static inline int pci_pcie_type(const struct pci_dev *dev)
+static inline int pci_pcie_type(struct pci_dev *dev)
 {
 	return (pcie_flags_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
 }
 
-static inline int pcie_cap_version(const struct pci_dev *dev)
+static inline int pcie_cap_version(struct pci_dev *dev)
 {
 	return pcie_flags_reg(dev) & PCI_EXP_FLAGS_VERS;
 }
@@ -58,7 +58,7 @@ static inline bool pcie_cap_has_devctl(const struct pci_dev *dev)
 	return true;
 }
 
-static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
+static inline bool pcie_cap_has_lnkctl(struct pci_dev *dev)
 {
 	int type = pci_pcie_type(dev);
 
@@ -68,7 +68,7 @@ static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
 	       type == PCI_EXP_TYPE_LEG_END;
 }
 
-static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev)
+static inline bool pcie_cap_has_sltctl(struct pci_dev *dev)
 {
 	int type = pci_pcie_type(dev);
 
@@ -78,7 +78,7 @@ static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev)
 		pcie_flags_reg(dev) & PCI_EXP_FLAGS_SLOT);
 }
 
-static inline bool pcie_cap_has_rtctl(const struct pci_dev *dev)
+static inline bool pcie_cap_has_rtctl(struct pci_dev *dev)
 {
 	int type = pci_pcie_type(dev);
 
Signature · 1 line
1.7.9.6 (Apple Git-31.1)
#1 lore raw
Quoted 2 lines · Felix Fietkau

When calling pci_find_capability and pci_read_config_word, struct pci_dev needs to be passed without const.

Thanks! I guess because at certain kernel version pci_dev was const ?

Luis

#2 lore raw
Quoted 5 lines · Luis R. Rodriguez
Quoted 2 lines · Felix Fietkau

When calling pci_find_capability and pci_read_config_word, struct pci_dev needs to be passed without const.

Thanks! I guess because at certain kernel version pci_dev was const ?

Probably, I didn't really check. Either way, this patch should be safe for all kernel versions.

- Felix

#3 lore raw
In reply to Luis R. Rodriguez
Quoted 6 lines · Luis R. Rodriguez
Quoted 2 lines · Felix Fietkau

When calling pci_find_capability and pci_read_config_word, struct pci_dev needs to be passed without const.

Thanks! I guess because at certain kernel version pci_dev was const ?

Similar issues exist with ethtool_ops, but it's not a huge deal, imo.