drivers/pci/access.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
Fixed coding style warnings and errors in drivers/pci/access.c
Signed-off-by: Roshan Kumar <roshaen09@gmail.com>
---
drivers/pci/access.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index b123da16b63b..5ed434d3763d 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -25,16 +25,16 @@ DEFINE_RAW_SPINLOCK(pci_lock);
#define PCI_dword_BAD (pos & 3)
#ifdef CONFIG_PCI_LOCKLESS_CONFIG
-# define pci_lock_config(f) do { (void)(f); } while (0)
-# define pci_unlock_config(f) do { (void)(f); } while (0)
+# define pci_lock_config(f) ((void)(f))
+# define pci_unlock_config(f) ((void)(f))
#else
# define pci_lock_config(f) raw_spin_lock_irqsave(&pci_lock, f)
# define pci_unlock_config(f) raw_spin_unlock_irqrestore(&pci_lock, f)
#endif
#define PCI_OP_READ(size, type, len) \
-int noinline pci_bus_read_config_##size \
- (struct pci_bus *bus, unsigned int devfn, int pos, type *value) \
+noinline int pci_bus_read_config_##size \
+ (struct pci_bus *bus, unsigned int devfn, int pos, type * value) \
{ \
unsigned long flags; \
u32 data = 0; \
@@ -55,7 +55,7 @@ int noinline pci_bus_read_config_##size \
}
#define PCI_OP_WRITE(size, type, len) \
-int noinline pci_bus_write_config_##size \
+noinline int pci_bus_write_config_##size \
(struct pci_bus *bus, unsigned int devfn, int pos, type value) \
{ \
unsigned long flags; \
@@ -72,17 +72,16 @@ int noinline pci_bus_write_config_##size \
}
PCI_OP_READ(byte, u8, 1)
-PCI_OP_READ(word, u16, 2)
-PCI_OP_READ(dword, u32, 4)
-PCI_OP_WRITE(byte, u8, 1)
-PCI_OP_WRITE(word, u16, 2)
-PCI_OP_WRITE(dword, u32, 4)
-
EXPORT_SYMBOL(pci_bus_read_config_byte);
+PCI_OP_READ(word, u16, 2)
EXPORT_SYMBOL(pci_bus_read_config_word);
+PCI_OP_READ(dword, u32, 4)
EXPORT_SYMBOL(pci_bus_read_config_dword);
+PCI_OP_WRITE(byte, u8, 1)
EXPORT_SYMBOL(pci_bus_write_config_byte);
+PCI_OP_WRITE(word, u16, 2)
EXPORT_SYMBOL(pci_bus_write_config_word);
+PCI_OP_WRITE(dword, u32, 4)
EXPORT_SYMBOL(pci_bus_write_config_dword);
int pci_generic_config_read(struct pci_bus *bus, unsigned int devfn,
@@ -226,7 +225,7 @@ static noinline void pci_wait_cfg(struct pci_dev *dev)
/* Returns 0 on success, negative values indicate error. */
#define PCI_USER_READ_CONFIG(size, type) \
int pci_user_read_config_##size \
- (struct pci_dev *dev, int pos, type *val) \
+ (struct pci_dev *dev, int pos, type * val) \
{ \
u32 data = -1; \
int ret; \
@@ -247,7 +246,7 @@ int pci_user_read_config_##size \
\
return pcibios_err_to_errno(ret); \
} \
-EXPORT_SYMBOL_GPL(pci_user_read_config_##size);
+EXPORT_SYMBOL_GPL(pci_user_read_config_##size)
/* Returns 0 on success, negative values indicate error. */
#define PCI_USER_WRITE_CONFIG(size, type) \
@@ -268,7 +267,7 @@ int pci_user_write_config_##size \
\
return pcibios_err_to_errno(ret); \
} \
-EXPORT_SYMBOL_GPL(pci_user_write_config_##size);
+EXPORT_SYMBOL_GPL(pci_user_write_config_##size)
PCI_USER_READ_CONFIG(byte, u8)
PCI_USER_READ_CONFIG(word, u16)
--
2.34.1
Hi Roshan,
kernel test robot noticed the following build errors:
[auto build test ERROR on pci/next]
[also build test ERROR on pci/for-linus linus/master v6.17-rc5 next-20250911]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Roshan-Kumar/pci-access-fixed-coding-style-issues-in-access-c/20250911-024937
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/20250910184809.392702-1-roshaen09%40gmail.com
patch subject: [PATCH] pci: access: fixed coding style issues in access.c
config: x86_64-buildonly-randconfig-001-20250911 (https://download.01.org/0day-ci/archive/20250912/202509120146.8WGO09ab-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250912/202509120146.8WGO09ab-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509120146.8WGO09ab-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/pci/access.c:227:1: error: expected ';' before 'int'
227 | int pci_user_read_config_##size \
| ^~~
drivers/pci/access.c:273:1: note: in expansion of macro 'PCI_USER_READ_CONFIG'
273 | PCI_USER_READ_CONFIG(word, u16)
| ^~~~~~~~~~~~~~~~~~~~
>> drivers/pci/access.c:227:1: error: expected ';' before 'int'
227 | int pci_user_read_config_##size \
| ^~~
drivers/pci/access.c:274:1: note: in expansion of macro 'PCI_USER_READ_CONFIG'
274 | PCI_USER_READ_CONFIG(dword, u32)
| ^~~~~~~~~~~~~~~~~~~~
drivers/pci/access.c:253:1: error: expected ';' before 'int'
253 | int pci_user_write_config_##size \
| ^~~
drivers/pci/access.c:275:1: note: in expansion of macro 'PCI_USER_WRITE_CONFIG'
275 | PCI_USER_WRITE_CONFIG(byte, u8)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/pci/access.c:253:1: error: expected ';' before 'int'
253 | int pci_user_write_config_##size \
| ^~~
drivers/pci/access.c:276:1: note: in expansion of macro 'PCI_USER_WRITE_CONFIG'
276 | PCI_USER_WRITE_CONFIG(word, u16)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/pci/access.c:253:1: error: expected ';' before 'int'
253 | int pci_user_write_config_##size \
| ^~~
drivers/pci/access.c:277:1: note: in expansion of macro 'PCI_USER_WRITE_CONFIG'
277 | PCI_USER_WRITE_CONFIG(dword, u32)
| ^~~~~~~~~~~~~~~~~~~~~
>> drivers/pci/access.c:287:1: error: expected ';' before 'void'
287 | void pci_cfg_access_lock(struct pci_dev *dev)
| ^~~~
vim +227 drivers/pci/access.c
e04b0ea2e0f9c1 Brian King 2005-09-27 224
34e3207205ef49 Greg Thelen 2011-04-17 225 /* Returns 0 on success, negative values indicate error. */
e04b0ea2e0f9c1 Brian King 2005-09-27 226 #define PCI_USER_READ_CONFIG(size, type) \
e04b0ea2e0f9c1 Brian King 2005-09-27 @227 int pci_user_read_config_##size \
e04b0ea2e0f9c1 Brian King 2005-09-27 228 (struct pci_dev *dev, int pos, type * val) \
e04b0ea2e0f9c1 Brian King 2005-09-27 229 { \
e04b0ea2e0f9c1 Brian King 2005-09-27 230 u32 data = -1; \
4c407392c1aff3 Ilpo Järvinen 2024-04-29 231 int ret; \
4c407392c1aff3 Ilpo Järvinen 2024-04-29 232 \
34e3207205ef49 Greg Thelen 2011-04-17 233 if (PCI_##size##_BAD) \
34e3207205ef49 Greg Thelen 2011-04-17 234 return -EINVAL; \
4c407392c1aff3 Ilpo Järvinen 2024-04-29 235 \
511dd98ce8cf6d Thomas Gleixner 2010-02-17 236 raw_spin_lock_irq(&pci_lock); \
fb51ccbf217c1c Jan Kiszka 2011-11-04 237 if (unlikely(dev->block_cfg_access)) \
fb51ccbf217c1c Jan Kiszka 2011-11-04 238 pci_wait_cfg(dev); \
e04b0ea2e0f9c1 Brian King 2005-09-27 239 ret = dev->bus->ops->read(dev->bus, dev->devfn, \
e04b0ea2e0f9c1 Brian King 2005-09-27 240 pos, sizeof(type), &data); \
511dd98ce8cf6d Thomas Gleixner 2010-02-17 241 raw_spin_unlock_irq(&pci_lock); \
f4f7eb43c5238f Naveen Naidu 2021-11-18 242 if (ret) \
f4f7eb43c5238f Naveen Naidu 2021-11-18 243 PCI_SET_ERROR_RESPONSE(val); \
f4f7eb43c5238f Naveen Naidu 2021-11-18 244 else \
e04b0ea2e0f9c1 Brian King 2005-09-27 245 *val = (type)data; \
4c407392c1aff3 Ilpo Järvinen 2024-04-29 246 \
d97ffe23689485 Gavin Shan 2014-05-21 247 return pcibios_err_to_errno(ret); \
c63587d7f5b9db Alex Williamson 2012-06-11 248 } \
08fa50b5c3a3d8 Roshan Kumar 2025-09-10 249 EXPORT_SYMBOL_GPL(pci_user_read_config_##size)
e04b0ea2e0f9c1 Brian King 2005-09-27 250
34e3207205ef49 Greg Thelen 2011-04-17 251 /* Returns 0 on success, negative values indicate error. */
e04b0ea2e0f9c1 Brian King 2005-09-27 252 #define PCI_USER_WRITE_CONFIG(size, type) \
e04b0ea2e0f9c1 Brian King 2005-09-27 253 int pci_user_write_config_##size \
e04b0ea2e0f9c1 Brian King 2005-09-27 254 (struct pci_dev *dev, int pos, type val) \
e04b0ea2e0f9c1 Brian King 2005-09-27 255 { \
4c407392c1aff3 Ilpo Järvinen 2024-04-29 256 int ret; \
4c407392c1aff3 Ilpo Järvinen 2024-04-29 257 \
34e3207205ef49 Greg Thelen 2011-04-17 258 if (PCI_##size##_BAD) \
34e3207205ef49 Greg Thelen 2011-04-17 259 return -EINVAL; \
4c407392c1aff3 Ilpo Järvinen 2024-04-29 260 \
511dd98ce8cf6d Thomas Gleixner 2010-02-17 261 raw_spin_lock_irq(&pci_lock); \
fb51ccbf217c1c Jan Kiszka 2011-11-04 262 if (unlikely(dev->block_cfg_access)) \
fb51ccbf217c1c Jan Kiszka 2011-11-04 263 pci_wait_cfg(dev); \
e04b0ea2e0f9c1 Brian King 2005-09-27 264 ret = dev->bus->ops->write(dev->bus, dev->devfn, \
e04b0ea2e0f9c1 Brian King 2005-09-27 265 pos, sizeof(type), val); \
511dd98ce8cf6d Thomas Gleixner 2010-02-17 266 raw_spin_unlock_irq(&pci_lock); \
4c407392c1aff3 Ilpo Järvinen 2024-04-29 267 \
d97ffe23689485 Gavin Shan 2014-05-21 268 return pcibios_err_to_errno(ret); \
c63587d7f5b9db Alex Williamson 2012-06-11 269 } \
08fa50b5c3a3d8 Roshan Kumar 2025-09-10 270 EXPORT_SYMBOL_GPL(pci_user_write_config_##size)
e04b0ea2e0f9c1 Brian King 2005-09-27 271
e04b0ea2e0f9c1 Brian King 2005-09-27 272 PCI_USER_READ_CONFIG(byte, u8)
e04b0ea2e0f9c1 Brian King 2005-09-27 273 PCI_USER_READ_CONFIG(word, u16)
e04b0ea2e0f9c1 Brian King 2005-09-27 274 PCI_USER_READ_CONFIG(dword, u32)
e04b0ea2e0f9c1 Brian King 2005-09-27 275 PCI_USER_WRITE_CONFIG(byte, u8)
e04b0ea2e0f9c1 Brian King 2005-09-27 276 PCI_USER_WRITE_CONFIG(word, u16)
e04b0ea2e0f9c1 Brian King 2005-09-27 277 PCI_USER_WRITE_CONFIG(dword, u32)
e04b0ea2e0f9c1 Brian King 2005-09-27 278
e04b0ea2e0f9c1 Brian King 2005-09-27 279 /**
fb51ccbf217c1c Jan Kiszka 2011-11-04 280 * pci_cfg_access_lock - Lock PCI config reads/writes
e04b0ea2e0f9c1 Brian King 2005-09-27 281 * @dev: pci device struct
e04b0ea2e0f9c1 Brian King 2005-09-27 282 *
fb51ccbf217c1c Jan Kiszka 2011-11-04 283 * When access is locked, any userspace reads or writes to config
fb51ccbf217c1c Jan Kiszka 2011-11-04 284 * space and concurrent lock requests will sleep until access is
0b131b139467db Brian Norris 2017-03-27 285 * allowed via pci_cfg_access_unlock() again.
7ea7e98fd8d023 Matthew Wilcox 2006-10-19 286 */
fb51ccbf217c1c Jan Kiszka 2011-11-04 @287 void pci_cfg_access_lock(struct pci_dev *dev)
fb51ccbf217c1c Jan Kiszka 2011-11-04 288 {
fb51ccbf217c1c Jan Kiszka 2011-11-04 289 might_sleep();
fb51ccbf217c1c Jan Kiszka 2011-11-04 290
fb51ccbf217c1c Jan Kiszka 2011-11-04 291 raw_spin_lock_irq(&pci_lock);
fb51ccbf217c1c Jan Kiszka 2011-11-04 292 if (dev->block_cfg_access)
fb51ccbf217c1c Jan Kiszka 2011-11-04 293 pci_wait_cfg(dev);
fb51ccbf217c1c Jan Kiszka 2011-11-04 294 dev->block_cfg_access = 1;
fb51ccbf217c1c Jan Kiszka 2011-11-04 295 raw_spin_unlock_irq(&pci_lock);
fb51ccbf217c1c Jan Kiszka 2011-11-04 296 }
fb51ccbf217c1c Jan Kiszka 2011-11-04 297 EXPORT_SYMBOL_GPL(pci_cfg_access_lock);
fb51ccbf217c1c Jan Kiszka 2011-11-04 298
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2026 Red Hat, Inc.