serial: 8250_pci: use DEFINE_PCI_DEVICE_TABLE macro
Subsystems (5)
PATCH 1/5 serial: 8250_pci: use DEFINE_PCI_DEVICE_TABLE macro
This macro is used to create a struct pci_device_id array.
--- drivers/tty/serial/8250/8250_pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_pci.c +2 -2
@@ -3492,7 +3492,7 @@ static struct pciserial_board pci_boards[] = { }, }; -static const struct pci_device_id blacklist[] = { +static DEFINE_PCI_DEVICE_TABLE (blacklist) = {/* softmodems */ {PCI_VDEVICE (AL ,0x5457 ), },/* ALi Corporation M5457 AC'97 Modem */ {PCI_VDEVICE (MOTOROLA ,0x3052 ), },/* Motorola Si3052-based modem */
@@ -3849,7 +3849,7 @@ static int pciserial_resume_one(struct pci_dev *dev) }#endif -static struct pci_device_id serial_pci_tbl[] = { +static DEFINE_PCI_DEVICE_TABLE (serial_pci_tbl) = {/* Advantech use PCI_DEVICE_ID_ADVANTECH_PCI3620 (0x3620) as 'PCI_SUBVENDOR_ID' */ {PCI_VENDOR_ID_ADVANTECH ,PCI_DEVICE_ID_ADVANTECH_PCI3620 ,PCI_DEVICE_ID_ADVANTECH_PCI3620 ,0x0001 ,0 ,0 ,
Signature · 1 line
1.7.10.4
PATCH 2/5 serial: icom: use DEFINE_PCI_DEVICE_TABLE macro
This macro is used to create a struct pci_device_id array.
--- drivers/tty/serial/icom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/icom.c +1 -1
@@ -66,7 +66,7 @@#define ICOM_PORT ((struct icom_port *)port)#define to_icom_adapter (d) container_of(d, struct icom_adapter, kref) -static const struct pci_device_id icom_pci_table[] = { +static DEFINE_PCI_DEVICE_TABLE (icom_pci_table) = { { .vendor =PCI_VENDOR_ID_IBM , .device =PCI_DEVICE_ID_IBM_ICOM_DEV_ID_1 ,
Signature · 1 line
1.7.10.4
PATCH 3/5 serial: jsm: use DEFINE_PCI_DEVICE_TABLE macro
In reply to Jingoo HanThis macro is used to create a struct pci_device_id array.
--- drivers/tty/serial/jsm/jsm_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/jsm/jsm_driver.c +1 -1
@@ -202,7 +202,7 @@ static void jsm_remove_one(struct pci_dev *pdev)kfree (brd); } -static struct pci_device_id jsm_pci_tbl[] = { +static DEFINE_PCI_DEVICE_TABLE (jsm_pci_tbl) = { {PCI_DEVICE (PCI_VENDOR_ID_DIGI ,PCI_DEVICE_ID_NEO_2DB9 ),0 ,0 ,0 }, {PCI_DEVICE (PCI_VENDOR_ID_DIGI ,PCI_DEVICE_ID_NEO_2DB9PRI ),0 ,0 ,1 }, {PCI_DEVICE (PCI_VENDOR_ID_DIGI ,PCI_DEVICE_ID_NEO_2RJ45 ),0 ,0 ,2 },
Signature · 1 line
1.7.10.4
Re: [PATCH 3/5] serial: jsm: use DEFINE_PCI_DEVICE_TABLE macro
Quoted 24 lines · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Signed-off-by Jingoo Han <[email protected]>--- drivers/tty/serial/jsm/jsm_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/tty/serial/jsm/jsm_driver.c +1
-1@@ -202,7 +202,7 @@ static void jsm_remove_one(struct pci_dev *pdev)kfree (brd); } -static struct pci_device_id jsm_pci_tbl[] = { +static DEFINE_PCI_DEVICE_TABLE (jsm_pci_tbl) = { {PCI_DEVICE (PCI_VENDOR_ID_DIGI ,PCI_DEVICE_ID_NEO_2DB9 ),0 ,0 ,0 }, {PCI_DEVICE (PCI_VENDOR_ID_DIGI ,PCI_DEVICE_ID_NEO_2DB9PRI ),0 ,0 ,1 }, {PCI_DEVICE (PCI_VENDOR_ID_DIGI ,PCI_DEVICE_ID_NEO_2RJ45 ),0 ,0 ,2 },Signature · 1 line
1.7.10.4
Re: [PATCH 3/5] serial: jsm: use DEFINE_PCI_DEVICE_TABLE macro
Quoted 7 lines · Thadeu Lima de Souza Cascardo
Quoted 6 lines · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Signed-off-by Jingoo Han <[email protected]>--- drivers/tty/serial/jsm/jsm_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[.....]
Quoted 2 lines
Thank you for your review! :-)
However, these patches should NOT be merged.
According to the Greg Kroah-Hartman,
"Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches."
So, I will send the patch to remove 'DEFINE_PCI_DEVICE_TABLE' instead. Sorry for annoying you. :-)
Best regards,
Jingoo Han
PATCH 4/5 serial: mfd: use DEFINE_PCI_DEVICE_TABLE macro
In reply to Jingoo HanThis macro is used to create a struct pci_device_id array.
--- drivers/tty/serial/mfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/mfd.c +1 -1
@@ -1458,7 +1458,7 @@ static void serial_hsu_remove(struct pci_dev *pdev) }/* First 3 are UART ports, and the 4th is the DMA */ -static const struct pci_device_id pci_ids[] = { +static DEFINE_PCI_DEVICE_TABLE (pci_ids) = { {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x081B ) }, {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x081C ) }, {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x081D ) },
Signature · 1 line
1.7.10.4
PATCH 5/5 serial: txx9: use DEFINE_PCI_DEVICE_TABLE macro
In reply to Jingoo HanThis macro is used to create a struct pci_device_id array.
--- drivers/tty/serial/serial_txx9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/serial_txx9.c +1 -1
@@ -1250,7 +1250,7 @@ static int pciserial_txx9_resume_one(struct pci_dev *dev) }#endif -static const struct pci_device_id serial_txx9_pci_tbl[] = { +static DEFINE_PCI_DEVICE_TABLE (serial_txx9_pci_tbl) = { {PCI_DEVICE (PCI_VENDOR_ID_TOSHIBA_2 ,PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC ) }, {0 , } };
Signature · 1 line
1.7.10.4
'Greg Kroah-Hartman'
maintainerQuoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.
Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
OK, I see. :-)
Then, I will send the patch to remove DEFINE_PCI_DEVICE_TABLE soon. Thank you for your guidance.
Best regards,
Jingoo Han
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
(+cc Joe Perches, Andrew Morton, Andy Whitcroft)
Hi Joe Perches,
Would you fix checkpatch.pl about DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to use DEFINE_PCI_DEVICE_TABLE as below.
WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id
#331: FILE: drivers/usb/host/ehci-pci.c:331:
+static const struct pci_device_id pci_ids [] = { {However, Greg Kroah-Hartman mentioned that DEFINE_PCI_DEVICE_TABLE shouldn't be used anymore.
So, would you change checkpatch.pl in order to guide to use struct pci_device_id instead of DEFINE_PCI_DEVICE_TABLE?
For example,
WARNING: Use struct pci_device_id instead of DEFINE_PCI_DEVICE_TABLE
Thank you.
Best regards,
Jingoo Han
Joe Perches
maintainerQuoted 22 lines · Jingoo Han
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
(+cc Joe Perches, Andrew Morton, Andy Whitcroft)
Hi Joe Perches,
Would you fix checkpatch.pl about
DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to useDEFINE_PCI_DEVICE_TABLEas below.WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #331: FILE: drivers/usb/host/ehci-pci.c:331: +static const struct pci_device_id pci_ids [] = { {
Quoted 8 lines
However, Greg Kroah-Hartman mentioned that
DEFINE_PCI_DEVICE_TABLEshouldn't be used anymore.So, would you change checkpatch.pl in order to guide to use struct
pci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE?For example,
WARNING: Use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE
The documentation doesn't agree with Greg.
Documentation/PCI/pci.txt:
The ID table is an array of struct pci_device_id entries ending with an all-zero entry; use of the macro DEFINE_PCI_DEVICE_TABLE is the preferred method of declaring the table.
Neither does the kernel tree:
$ git grep -w DEFINE_PCI_DEVICE_TABLE | wc -l 410
$ git grep -E "\bstruct\s+pci_device_id\s+\w+\s*\[\s*\]\s*=" | wc -l 376
Most of the 376 should be const and are not.
$ git grep -E "\bconst\s+struct\s+pci_device_id\s+\w+\s*\[\s*\]\s*=" | wc -l 155
Everything that uses DEFINE_PCI_DEVICE_TABLE is const.
$ git grep -A1 -E "define\s+DEFINE_PCI_DEVICE_TABLE" include/linux/pci.h:#define DEFINE_PCI_DEVICE_TABLE(_table) \ include/linux/pci.h- const struct pci_device_id _table[]
'Greg Kroah-Hartman'
maintainerQuoted 32 lines · Joe Perches
Quoted 22 lines · Jingoo Han
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
(+cc Joe Perches, Andrew Morton, Andy Whitcroft)
Hi Joe Perches,
Would you fix checkpatch.pl about
DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to useDEFINE_PCI_DEVICE_TABLEas below.WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #331: FILE: drivers/usb/host/ehci-pci.c:331: +static const struct pci_device_id pci_ids [] = { {Quoted 8 lines
However, Greg Kroah-Hartman mentioned that
DEFINE_PCI_DEVICE_TABLEshouldn't be used anymore.So, would you change checkpatch.pl in order to guide to use struct
pci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE?For example,
WARNING: Use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE
Quoted 7 lines
The documentation doesn't agree with Greg.
Documentation/PCI/pci.txt:The ID table is an array of struct
pci_device_identries ending with an all-zero entry; use of the macroDEFINE_PCI_DEVICE_TABLEis the preferred method of declaring the table.
Then it should be fixed.
Quoted 5 lines
Neither does the kernel tree:
$ git grep -w DEFINE_PCI_DEVICE_TABLE | wc -l 410
Quoted 7 lines
$ git grep -E "\bstruct\s+pci_device_id\s+\w+\s*\[\s*\]\s*=" | wc -l 376Most of the 376 should be const and are not.
$ git grep -E "\bconst\s+struct\s+pci_device_id\s+\w+\s*\[\s*\]\s*=" | wc -l 155
Then fix those and make them const.
Hiding structures behind an odd (and misnamed) macro isn't the best thing.
Quoted 5 lines
Everything that uses
DEFINE_PCI_DEVICE_TABLEis const.$ git grep -A1 -E "define\s+DEFINE_PCI_DEVICE_TABLE" include/linux/pci.h:#define DEFINE_PCI_DEVICE_TABLE(_table) \ include/linux/pci.h- const struct pci_device_id _table[]
I say just remove it, I should have done that years ago when I was the PCI maintainer, just never got around to it. No other bus has something like this for their device ids, why should PCI be "special"?
thanks,
greg k-h
Joe Perches
maintainerQuoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Joe Perches
Quoted 25 lines · Jingoo Han
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
(+cc Joe Perches, Andrew Morton, Andy Whitcroft)
Hi Joe Perches,
Would you fix checkpatch.pl about
DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to useDEFINE_PCI_DEVICE_TABLEas below.WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #331: FILE: drivers/usb/host/ehci-pci.c:331: +static const struct pci_device_id pci_ids [] = { {However, Greg Kroah-Hartman mentioned that
DEFINE_PCI_DEVICE_TABLEshouldn't be used anymore.
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
So, would you change checkpatch.pl in order to guide to use struct
pci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE?For example,
WARNING: Use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLEThe documentation doesn't agree with Greg.
[]
Quoted 3 lines
I say just remove it, I should have done that years ago when I was the PCI maintainer, just never got around to it. No other bus has something like this for their device ids, why should PCI be "special"?
Anyone else have an opinion?
I don't care one way or another, but please, one way not two.
Changing checkpatch is a trifle, but there are a _lot_ of maintainers to work through if it's to be removed.
It'll probably take several releases.
$ git grep --name-only -w DEFINE_PCI_DEVICE_TABLE | \
cut -f1,2 -d/ | uniq -c
1 Documentation/PCI
1 arch/x86
1 drivers/bcma
3 drivers/block
1 drivers/char
1 drivers/cpufreq
2 drivers/dma
18 drivers/edac
6 drivers/gpio
6 drivers/gpu
6 drivers/hwmon
20 drivers/i2c
2 drivers/infiniband
1 drivers/ipack
1 drivers/leds
3 drivers/media
10 drivers/mfd
2 drivers/misc
1 drivers/mmc
1 drivers/mtd
132 drivers/net
1 drivers/ntb
1 drivers/pci
5 drivers/pcmcia
2 drivers/platform
1 drivers/ptp
1 drivers/rapidio
7 drivers/scsi
3 drivers/spi
65 drivers/staging
3 drivers/tty
1 drivers/uio
5 drivers/usb
1 drivers/video
1 drivers/virtio
3 drivers/vme
9 drivers/watchdog
1 drivers/xen
1 include/linux
1 scripts/checkpatch.pl
1 scripts/tags.sh
1 sound/oss
67 sound/pciQuoted 36 lines · Joe Perches
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Joe Perches
Quoted 25 lines · Jingoo Han
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
(+cc Joe Perches, Andrew Morton, Andy Whitcroft)
Hi Joe Perches,
Would you fix checkpatch.pl about
DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to useDEFINE_PCI_DEVICE_TABLEas below.WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #331: FILE: drivers/usb/host/ehci-pci.c:331: +static const struct pci_device_id pci_ids [] = { {However, Greg Kroah-Hartman mentioned that
DEFINE_PCI_DEVICE_TABLEshouldn't be used anymore.Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
So, would you change checkpatch.pl in order to guide to use struct
pci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE?For example,
WARNING: Use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLEThe documentation doesn't agree with Greg.
[]
Quoted 8 lines
Quoted 3 lines
I say just remove it, I should have done that years ago when I was the PCI maintainer, just never got around to it. No other bus has something like this for their device ids, why should PCI be "special"?
Anyone else have an opinion?
I don't care one way or another, but please, one way not two.
(+cc Bjorn Helgaas, linux-pci)
Then, how about the following steps?
1. Fix ./Documentation/PCI/pci.txt as below.
(Jingoo Han)
The ID table is an array of struct pci_device_id entries ending with an -all-zero entry; use of the macro DEFINE_PCI_DEVICE_TABLE is the preferred -method of declaring the table. Each entry consists of:
+all-zero entry; Each entry consists of:
2. Fix ./scripts/checkpatch.pl in order to guide to use struct pci_device_id instead of DEFINE_PCI_DEVICE_TABLE. (Joe Perches)
3. Replace DEFINE_PCI_DEVICE_TABLE of ./drivers/*
with 'const struct pci_device_id'.
(Jingoo Han)
4. These patches will be merged through 'driver-core.git' with 'Acked-by' of each subsystem maintainer. (Greg Kroah-Hartman)
Best regards,
Jingoo Han
Quoted 50 lines
Changing checkpatch is a trifle, but there are a _lot_ of maintainers to work through if it's to be removed.
It'll probably take several releases.
$ git grep --name-only -w DEFINE_PCI_DEVICE_TABLE | \ cut -f1,2 -d/ | uniq -c 1 Documentation/PCI 1 arch/x86 1 drivers/bcma 3 drivers/block 1 drivers/char 1 drivers/cpufreq 2 drivers/dma 18 drivers/edac 6 drivers/gpio 6 drivers/gpu 6 drivers/hwmon 20 drivers/i2c 2 drivers/infiniband 1 drivers/ipack 1 drivers/leds 3 drivers/media 10 drivers/mfd 2 drivers/misc 1 drivers/mmc 1 drivers/mtd 132 drivers/net 1 drivers/ntb 1 drivers/pci 5 drivers/pcmcia 2 drivers/platform 1 drivers/ptp 1 drivers/rapidio 7 drivers/scsi 3 drivers/spi 65 drivers/staging 3 drivers/tty 1 drivers/uio 5 drivers/usb 1 drivers/video 1 drivers/virtio 3 drivers/vme 9 drivers/watchdog 1 drivers/xen 1 include/linux 1 scripts/checkpatch.pl 1 scripts/tags.sh 1 sound/oss 67 sound/pci
Quoted 57 lines · Jingoo Han
Quoted 36 lines · Joe Perches
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Joe Perches
Quoted 25 lines · Jingoo Han
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
(+cc Joe Perches, Andrew Morton, Andy Whitcroft)
Hi Joe Perches,
Would you fix checkpatch.pl about
DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to useDEFINE_PCI_DEVICE_TABLEas below.WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #331: FILE: drivers/usb/host/ehci-pci.c:331: +static const struct pci_device_id pci_ids [] = { {However, Greg Kroah-Hartman mentioned that
DEFINE_PCI_DEVICE_TABLEshouldn't be used anymore.Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
So, would you change checkpatch.pl in order to guide to use struct
pci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE?For example,
WARNING: Use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLEThe documentation doesn't agree with Greg.
[]
Quoted 8 lines
Quoted 3 lines
I say just remove it, I should have done that years ago when I was the PCI maintainer, just never got around to it. No other bus has something like this for their device ids, why should PCI be "special"?
Anyone else have an opinion?
I don't care one way or another, but please, one way not two.
(+cc Bjorn Helgaas, linux-pci)
Then, how about the following steps?
1. Fix
./Documentation/PCI/pci.txtas below.
(Jingoo Han)
The ID table is an array of structpci_device_identries ending with an -all-zero entry; use of the macroDEFINE_PCI_DEVICE_TABLEis the preferred -method of declaring the table. Each entry consists of:
+all-zero entry; Each entry consists of:
Quoted 3 lines
2. Fix
./scripts/checkpatch.plin order to guide to use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE. (Joe Perches)
If all DEFINE_PCI_DEVICE_TABLEs are replaced with 'const struct pci_device_id' and these patches are merged through 'driver-core.git', it will be not necessary to fix ./scripts/checkpatch.pl.
Then, I will send patches to Greg Kroah-Hartman, with CC'ing each subsystem maintainer.
Best regards,
Jingoo Han
Quoted 62 lines
3. Replace
DEFINE_PCI_DEVICE_TABLEof./drivers/*
with 'const structpci_device_id'.
(Jingoo Han)4. These patches will be merged through 'driver-core.git' with 'Acked-by' of each subsystem maintainer. (Greg Kroah-Hartman)
Best regards,
Jingoo HanQuoted 50 lines
Changing checkpatch is a trifle, but there are a _lot_ of maintainers to work through if it's to be removed.
It'll probably take several releases.
$ git grep --name-only -w DEFINE_PCI_DEVICE_TABLE | \ cut -f1,2 -d/ | uniq -c 1 Documentation/PCI 1 arch/x86 1 drivers/bcma 3 drivers/block 1 drivers/char 1 drivers/cpufreq 2 drivers/dma 18 drivers/edac 6 drivers/gpio 6 drivers/gpu 6 drivers/hwmon 20 drivers/i2c 2 drivers/infiniband 1 drivers/ipack 1 drivers/leds 3 drivers/media 10 drivers/mfd 2 drivers/misc 1 drivers/mmc 1 drivers/mtd 132 drivers/net 1 drivers/ntb 1 drivers/pci 5 drivers/pcmcia 2 drivers/platform 1 drivers/ptp 1 drivers/rapidio 7 drivers/scsi 3 drivers/spi 65 drivers/staging 3 drivers/tty 1 drivers/uio 5 drivers/usb 1 drivers/video 1 drivers/virtio 3 drivers/vme 9 drivers/watchdog 1 drivers/xen 1 include/linux 1 scripts/checkpatch.pl 1 scripts/tags.sh 1 sound/oss 67 sound/pci
Quoted 42 lines · Jingoo Han
Quoted 41 lines · Jingoo Han
Quoted 40 lines · Joe Perches
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Joe Perches
Quoted 25 lines · Jingoo Han
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
(+cc Joe Perches, Andrew Morton, Andy Whitcroft)
Hi Joe Perches,
Would you fix checkpatch.pl about
DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to useDEFINE_PCI_DEVICE_TABLEas below.WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #331: FILE: drivers/usb/host/ehci-pci.c:331: +static const struct pci_device_id pci_ids [] = { {However, Greg Kroah-Hartman mentioned that
DEFINE_PCI_DEVICE_TABLEshouldn't be used anymore.Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
So, would you change checkpatch.pl in order to guide to use struct
pci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE?For example,
WARNING: Use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLEThe documentation doesn't agree with Greg.
[]
Quoted 3 lines
I say just remove it, I should have done that years ago when I was the PCI maintainer, just never got around to it. No other bus has something like this for their device ids, why should PCI be "special"?
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Anyone else have an opinion?
I don't care one way or another, but please, one way not two.
Same here.
Quoted 11 lines
Quoted 11 lines
(+cc Bjorn Helgaas, linux-pci)
Then, how about the following steps?
1. Fix
./Documentation/PCI/pci.txtas below.
(Jingoo Han)
The ID table is an array of structpci_device_identries ending with an -all-zero entry; use of the macroDEFINE_PCI_DEVICE_TABLEis the preferred -method of declaring the table. Each entry consists of:
+all-zero entry; Each entry consists of:
Quoted 8 lines
Quoted 3 lines
2. Fix
./scripts/checkpatch.plin order to guide to use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE. (Joe Perches)If all
DEFINE_PCI_DEVICE_TABLEsare replaced with 'const structpci_device_id' and these patches are merged through 'driver-core.git', it will be not necessary to fix./scripts/checkpatch.pl.
Why not ?
Guenter
Quoted 66 lines · Guenter Roeck
Quoted 42 lines · Jingoo Han
Quoted 41 lines · Jingoo Han
Quoted 40 lines · Joe Perches
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Joe Perches
Quoted 25 lines · Jingoo Han
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
(+cc Joe Perches, Andrew Morton, Andy Whitcroft)
Hi Joe Perches,
Would you fix checkpatch.pl about
DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to useDEFINE_PCI_DEVICE_TABLEas below.WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #331: FILE: drivers/usb/host/ehci-pci.c:331: +static const struct pci_device_id pci_ids [] = { {However, Greg Kroah-Hartman mentioned that
DEFINE_PCI_DEVICE_TABLEshouldn't be used anymore.Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
So, would you change checkpatch.pl in order to guide to use struct
pci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE?For example,
WARNING: Use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLEThe documentation doesn't agree with Greg.
[]
Quoted 3 lines
I say just remove it, I should have done that years ago when I was the PCI maintainer, just never got around to it. No other bus has something like this for their device ids, why should PCI be "special"?
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Anyone else have an opinion?
I don't care one way or another, but please, one way not two.
Same here.
Quoted 15 lines
Quoted 14 lines
(+cc Bjorn Helgaas, linux-pci)
Then, how about the following steps?
1. Fix
./Documentation/PCI/pci.txtas below.
(Jingoo Han)
The ID table is an array of structpci_device_identries ending with an -all-zero entry; use of the macroDEFINE_PCI_DEVICE_TABLEis the preferred -method of declaring the table. Each entry consists of:
+all-zero entry; Each entry consists of:2. Fix
./scripts/checkpatch.plin order to guide to use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE. (Joe Perches)
Quoted 5 lines
Quoted 4 lines
If all
DEFINE_PCI_DEVICE_TABLEsare replaced with 'const structpci_device_id' and these patches are merged through 'driver-core.git', it will be not necessary to fix./scripts/checkpatch.pl.Why not ?
I will replace all DEFINE_PCI_DEVICE_TABLEs with 'const struct pci_device_id', and remove the definition of DEFINE_PCI_DEVICE_TABLE macro.
include/linux/pci.h +0 -10
@@ -631,16 +631,6 @@ struct pci_driver {#define to_pci_driver (drv) container_of(drv, struct pci_driver, driver)/** -* DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table -* @_table: device table name -* -* This macro is used to create a struct pci_device_id array (a device table) -* in a generic manner. -*/ -#define DEFINE_PCI_DEVICE_TABLE (_table) \ - const struct pci_device_id _table[] - -/**
In this case, there is no DEFINE_PCI_DEVICE_TABLE usage in the kernel. If someone uses DEFINE_PCI_DEVICE_TABLE macro, it will make build error.
Best regards,
Jingoo Han
Quoted 93 lines · Jingoo Han
Quoted 66 lines · Guenter Roeck
Quoted 42 lines · Jingoo Han
Quoted 41 lines · Jingoo Han
Quoted 40 lines · Joe Perches
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Joe Perches
Quoted 25 lines · Jingoo Han
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
(+cc Joe Perches, Andrew Morton, Andy Whitcroft)
Hi Joe Perches,
Would you fix checkpatch.pl about
DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to useDEFINE_PCI_DEVICE_TABLEas below.WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #331: FILE: drivers/usb/host/ehci-pci.c:331: +static const struct pci_device_id pci_ids [] = { {However, Greg Kroah-Hartman mentioned that
DEFINE_PCI_DEVICE_TABLEshouldn't be used anymore.Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
So, would you change checkpatch.pl in order to guide to use struct
pci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE?For example,
WARNING: Use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLEThe documentation doesn't agree with Greg.
[]
Quoted 3 lines
I say just remove it, I should have done that years ago when I was the PCI maintainer, just never got around to it. No other bus has something like this for their device ids, why should PCI be "special"?
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Anyone else have an opinion?
I don't care one way or another, but please, one way not two.
Same here.
Quoted 15 lines
Quoted 14 lines
(+cc Bjorn Helgaas, linux-pci)
Then, how about the following steps?
1. Fix
./Documentation/PCI/pci.txtas below.
(Jingoo Han)
The ID table is an array of structpci_device_identries ending with an -all-zero entry; use of the macroDEFINE_PCI_DEVICE_TABLEis the preferred -method of declaring the table. Each entry consists of:
+all-zero entry; Each entry consists of:2. Fix
./scripts/checkpatch.plin order to guide to use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE. (Joe Perches)Quoted 5 lines
Quoted 4 lines
If all
DEFINE_PCI_DEVICE_TABLEsare replaced with 'const structpci_device_id' and these patches are merged through 'driver-core.git', it will be not necessary to fix./scripts/checkpatch.pl.Why not ?
I will replace all
DEFINE_PCI_DEVICE_TABLEswith 'const structpci_device_id', and remove the definition ofDEFINE_PCI_DEVICE_TABLEmacro.include/linux/pci.h +0
-10@@ -631,16 +631,6 @@ struct pci_driver {#define to_pci_driver (drv) container_of(drv, struct pci_driver, driver)/** -* DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table -* @_table: device table name -* -* This macro is used to create a struct pci_device_id array (a device table) -* in a generic manner. -*/ -#define DEFINE_PCI_DEVICE_TABLE (_table) \ - const struct pci_device_id _table[] - -/**
Quoted 4 lines
In this case, there is no
DEFINE_PCI_DEVICE_TABLEusage in the kernel. If someone usesDEFINE_PCI_DEVICE_TABLEmacro, it will make build error.
And that will make the checkpatch warning go away ? That seems to be very unlikely.
Guenter
Quoted 94 lines · Guenter Roeck
Quoted 93 lines · Jingoo Han
Quoted 66 lines · Guenter Roeck
Quoted 42 lines · Jingoo Han
Quoted 41 lines · Jingoo Han
Quoted 40 lines · Joe Perches
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Joe Perches
Quoted 25 lines · Jingoo Han
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
(+cc Joe Perches, Andrew Morton, Andy Whitcroft)
Hi Joe Perches,
Would you fix checkpatch.pl about
DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to useDEFINE_PCI_DEVICE_TABLEas below.WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #331: FILE: drivers/usb/host/ehci-pci.c:331: +static const struct pci_device_id pci_ids [] = { {However, Greg Kroah-Hartman mentioned that
DEFINE_PCI_DEVICE_TABLEshouldn't be used anymore.Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
So, would you change checkpatch.pl in order to guide to use struct
pci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE?For example,
WARNING: Use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLEThe documentation doesn't agree with Greg.
[]
Quoted 3 lines
I say just remove it, I should have done that years ago when I was the PCI maintainer, just never got around to it. No other bus has something like this for their device ids, why should PCI be "special"?
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Anyone else have an opinion?
I don't care one way or another, but please, one way not two.
Same here.
Quoted 15 lines
Quoted 14 lines
(+cc Bjorn Helgaas, linux-pci)
Then, how about the following steps?
1. Fix
./Documentation/PCI/pci.txtas below.
(Jingoo Han)
The ID table is an array of structpci_device_identries ending with an -all-zero entry; use of the macroDEFINE_PCI_DEVICE_TABLEis the preferred -method of declaring the table. Each entry consists of:
+all-zero entry; Each entry consists of:2. Fix
./scripts/checkpatch.plin order to guide to use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE. (Joe Perches)Quoted 5 lines
Quoted 4 lines
If all
DEFINE_PCI_DEVICE_TABLEsare replaced with 'const structpci_device_id' and these patches are merged through 'driver-core.git', it will be not necessary to fix./scripts/checkpatch.pl.Why not ?
I will replace all
DEFINE_PCI_DEVICE_TABLEswith 'const structpci_device_id', and remove the definition ofDEFINE_PCI_DEVICE_TABLEmacro.include/linux/pci.h +0
-10@@ -631,16 +631,6 @@ struct pci_driver {#define to_pci_driver (drv) container_of(drv, struct pci_driver, driver)/** -* DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table -* @_table: device table name -* -* This macro is used to create a struct pci_device_id array (a device table) -* in a generic manner. -*/ -#define DEFINE_PCI_DEVICE_TABLE (_table) \ - const struct pci_device_id _table[] - -/**
Quoted 7 lines
Quoted 4 lines
In this case, there is no
DEFINE_PCI_DEVICE_TABLEusage in the kernel. If someone usesDEFINE_PCI_DEVICE_TABLEmacro, it will make build error.And that will make the checkpatch warning go away ? That seems to be very unlikely.
OK, I will ask Joe Perches to remove the following checkpatch warning.
WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id
Best regards,
Jingoo Han
Joe Perches
maintainer(Adding Jonas Bonn to list as he added the macro in the first place...)
Quoted 111 lines · Jingoo Han
Quoted 94 lines · Guenter Roeck
Quoted 93 lines · Jingoo Han
Quoted 66 lines · Guenter Roeck
Quoted 42 lines · Jingoo Han
Quoted 41 lines · Jingoo Han
Quoted 40 lines · Joe Perches
Quoted 27 lines · Greg Kroah-Hartman
Quoted 26 lines · Joe Perches
Quoted 25 lines · Jingoo Han
Quoted 8 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
This macro is used to create a struct
pci_device_idarray.Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
(+cc Joe Perches, Andrew Morton, Andy Whitcroft)
Hi Joe Perches,
Would you fix checkpatch.pl about
DEFINE_PCI_DEVICE_TABLE? Currently, checkpatch.pl guides to useDEFINE_PCI_DEVICE_TABLEas below.WARNING: Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id #331: FILE: drivers/usb/host/ehci-pci.c:331: +static const struct pci_device_id pci_ids [] = { {However, Greg Kroah-Hartman mentioned that
DEFINE_PCI_DEVICE_TABLEshouldn't be used anymore.Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
So, would you change checkpatch.pl in order to guide to use struct
pci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE?For example,
WARNING: Use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLEThe documentation doesn't agree with Greg.
[]
Quoted 3 lines
I say just remove it, I should have done that years ago when I was the PCI maintainer, just never got around to it. No other bus has something like this for their device ids, why should PCI be "special"?
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Anyone else have an opinion?
I don't care one way or another, but please, one way not two.
Same here.
Quoted 15 lines
Quoted 14 lines
(+cc Bjorn Helgaas, linux-pci)
Then, how about the following steps?
1. Fix
./Documentation/PCI/pci.txtas below.
(Jingoo Han)
The ID table is an array of structpci_device_identries ending with an -all-zero entry; use of the macroDEFINE_PCI_DEVICE_TABLEis the preferred -method of declaring the table. Each entry consists of:
+all-zero entry; Each entry consists of:2. Fix
./scripts/checkpatch.plin order to guide to use structpci_device_idinstead ofDEFINE_PCI_DEVICE_TABLE. (Joe Perches)Quoted 5 lines
Quoted 4 lines
If all
DEFINE_PCI_DEVICE_TABLEsare replaced with 'const structpci_device_id' and these patches are merged through 'driver-core.git', it will be not necessary to fix./scripts/checkpatch.pl.Why not ?
I will replace all
DEFINE_PCI_DEVICE_TABLEswith 'const structpci_device_id', and remove the definition ofDEFINE_PCI_DEVICE_TABLEmacro.include/linux/pci.h +0
-10@@ -631,16 +631,6 @@ struct pci_driver {#define to_pci_driver (drv) container_of(drv, struct pci_driver, driver)/** -* DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table -* @_table: device table name -* -* This macro is used to create a struct pci_device_id array (a device table) -* in a generic manner. -*/ -#define DEFINE_PCI_DEVICE_TABLE (_table) \ - const struct pci_device_id _table[] - -/** Quoted 7 lines
Quoted 4 lines
In this case, there is no
DEFINE_PCI_DEVICE_TABLEusage in the kernel. If someone usesDEFINE_PCI_DEVICE_TABLEmacro, it will make build error.And that will make the checkpatch warning go away ? That seems to be very unlikely.
OK, I will ask Joe Perches to remove the following checkpatch warning.
WARNING: Use
DEFINE_PCI_DEVICE_TABLEfor structpci_device_idBest regards,
Jingoo Han
Hi Joe,
Quoted 1 line · Joe Perches
(Adding Jonas Bonn to list as he added the macro in the first place...)
Thanks... ;)
Actually, I think I submitted an even uglier macro called DECLARE_PCI_DEVICE_TABLE... might have been the first kernel patch I ever sent? In any case, it should certainly have been kindly rejected.
After it hit mainline Andrew Morton just about choked on his tea and
renamed it DEFINE_PCI_DEVICE_TABLE.
Quoted 13 lines · Jingoo Han
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · Jingoo Han
Quoted 9 lines · Guenter Roeck
Quoted 8 lines · Jingoo Han
Quoted 7 lines · Jingoo Han
Quoted 6 lines · Joe Perches
Quoted 5 lines · Greg Kroah-Hartman
Quoted 4 lines · Joe Perches
Quoted 3 lines · Jingoo Han
Quoted 2 lines · Greg Kroah-Hartman
Quoted 1 line · Jingoo Han
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
This macro is used to create a struct pci_device_id array.
Yeah, and it's a horrid macro that deserves to be removed, please don't use it in more places.
Actually, if you could just remove it, that would be best, sorry, I'm not going to take these patches.
Feel free to just remove the macro; it serves no purpose but to confuse.
That said, the underlying issue that the macro was supposed to resolve
(if I recall correctly) was to make sure that all the struct pci_device_id instances were marked as const, as per the PCI documentation; if there's something checkpatch should be warning for it's simply that the struct is const.
/Jonas
Joe Perches
maintainerPATCH 1/1 pci/checkpatch: Deprecate DEFINE_PCI_DEVICE_TABLE
Prefer use of the direct definition of struct pci_device_id instead of indirection via macro DEFINE_PCI_DEVICE_TABLE.
Update the PCI documentation to deprecate DEFINE_PCI_DEVICE_TABLE. Update checkpatch adding --fix option.
--- Documentation/PCI/pci.txt | 6 ++++-- include/linux/pci.h | 3 +-- scripts/checkpatch.pl | 11 +++++++---- 3 files changed, 12 insertions(+), 8 deletions(-)
Documentation/PCI/pci.txt +4 -2
@@ -123,8 +123,10 @@ initialization with a pointer to a structure describing the driver The ID table is an array of struct pci_device_id entries ending with an -all-zero entry; use of the macro DEFINE_PCI_DEVICE_TABLE is the preferred -method of declaring the table. Each entry consists of: +all-zero entry. Definitions with static const are generally preferred. +Use of the deprecated macro DEFINE_PCI_DEVICE_TABLE should be avoided. + +Each entry consists of: vendor,device Vendor and device ID to match (or PCI_ANY_ID)
include/linux/pci.h +1 -2
@@ -634,8 +634,7 @@ struct pci_driver {* DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table * @_table: device table name * -* This macro is used to create a struct pci_device_id array (a device table) -* in a generic manner. +* This macro is deprecated and should not be used in new code. */ #define DEFINE_PCI_DEVICE_TABLE (_table) \ const struct pci_device_id _table[]
scripts/checkpatch.pl +7 -4
@@ -2643,10 +2643,13 @@ sub process { } } -# check for declarations of struct pci_device_id - if ($line =~ /\bstruct\s+pci_device_id\s+\w+\s*\[\s*\]\s*\=\s*\{/) { - WARN("DEFINE_PCI_DEVICE_TABLE", - "Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id\n" . $herecurr); +# check for uses of DEFINE_PCI_DEVICE_TABLE + if ($line =~ /\bDEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=/) { + if (WARN("DEFINE_PCI_DEVICE_TABLE", + "Prefer struct pci_device_id over deprecated DEFINE_PCI_DEVICE_TABLE\n" . $herecurr) && + $fix) { + $fixed[$linenr - 1] =~ s/\b(?:static\s+|)DEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=\s*/static const struct pci_device_id $1\[\] = /; + } } # check for new typedefs, only function parameters and sparse annotations
Re: [PATCH] pci/checkpatch: Deprecate DEFINE_PCI_DEVICE_TABLE
Quoted 1 line · Joe Perches
Prefer use of the direct definition of struct
pci_device_id
Add 'const' ?
Quoted 49 lines
instead of indirection via macro
DEFINE_PCI_DEVICE_TABLE.Update the PCI documentation to deprecate
DEFINE_PCI_DEVICE_TABLE. Update checkpatch adding --fix option.Signed-off-by Joe Perches <[email protected]>--- Documentation/PCI/pci.txt | 6 ++++-- include/linux/pci.h | 3 +-- scripts/checkpatch.pl | 11 +++++++---- 3 files changed, 12 insertions(+), 8 deletions(-)Documentation/PCI/pci.txt +4
-2@@ -123,8 +123,10 @@ initialization with a pointer to a structure describing the driver The ID table is an array of struct pci_device_id entries ending with an -all-zero entry; use of the macro DEFINE_PCI_DEVICE_TABLE is the preferred -method of declaring the table. Each entry consists of: +all-zero entry. Definitions with static const are generally preferred. +Use of the deprecated macro DEFINE_PCI_DEVICE_TABLE should be avoided. + +Each entry consists of: vendor,device Vendor and device ID to match (or PCI_ANY_ID)include/linux/pci.h +1
-2@@ -634,8 +634,7 @@ struct pci_driver {* DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table * @_table: device table name * -* This macro is used to create a struct pci_device_id array (a device table) -* in a generic manner. +* This macro is deprecated and should not be used in new code. */ #define DEFINE_PCI_DEVICE_TABLE (_table) \ const struct pci_device_id _table[]scripts/checkpatch.pl +0
-0@@ -2643,10 +2643,13 @@ sub process { }
scripts/checkpatch.pl sub process { · line 2649
Quoted 10 lines
scripts/checkpatch.pl +4
-4} -# check for declarations of struct pci_device_id - if ($line =~ /\bstruct\s+pci_device_id\s+\w+\s*\[\s*\]\s*\=\s*\{/) { - WARN("DEFINE_PCI_DEVICE_TABLE", - "Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id\n" . $herecurr); +# check for uses of DEFINE_PCI_DEVICE_TABLE + if ($line =~ /\bDEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=/) { + if (WARN("DEFINE_PCI_DEVICE_TABLE", + "Prefer struct pci_device_id over deprecated DEFINE_PCI_DEVICE_TABLE\n" . $herecurr) &&
Add 'const' ?
Guenter
Joe Perches
maintainerRe: [PATCH] pci/checkpatch: Deprecate DEFINE_PCI_DEVICE_TABLE
Quoted 2 lines · Guenter Roeck
Quoted 1 line · Joe Perches
Prefer use of the direct definition of struct
pci_device_id
[]
Quoted 1 line
Quoted 1 line
+all-zero entry. Definitions with static const are generally preferred.
see here:
Quoted 1 line
Add 'const' ?
Also see $fix.
Not all can be const as some codes actually modify the tables for various quirks.
Re: [PATCH] pci/checkpatch: Deprecate DEFINE_PCI_DEVICE_TABLE
In reply to Joe PerchesOn Tuesday, December 03, 2013 2:44 AM, Joe Perches
Quoted 8 lines
Prefer use of the direct definition of struct
pci_device_idinstead of indirection via macroDEFINE_PCI_DEVICE_TABLE.Update the PCI documentation to deprecate
DEFINE_PCI_DEVICE_TABLE. Update checkpatch adding --fix option.Signed-off-by Joe Perches <[email protected]>
Best regards,
Jingoo Han
Quoted 62 lines
--- Documentation/PCI/pci.txt | 6 ++++-- include/linux/pci.h | 3 +-- scripts/checkpatch.pl | 11 +++++++---- 3 files changed, 12 insertions(+), 8 deletions(-)Documentation/PCI/pci.txt +4
-2@@ -123,8 +123,10 @@ initialization with a pointer to a structure describing the driver The ID table is an array of struct pci_device_id entries ending with an -all-zero entry; use of the macro DEFINE_PCI_DEVICE_TABLE is the preferred -method of declaring the table. Each entry consists of: +all-zero entry. Definitions with static const are generally preferred. +Use of the deprecated macro DEFINE_PCI_DEVICE_TABLE should be avoided. + +Each entry consists of: vendor,device Vendor and device ID to match (or PCI_ANY_ID)include/linux/pci.h +1
-2@@ -634,8 +634,7 @@ struct pci_driver {* DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table * @_table: device table name * -* This macro is used to create a struct pci_device_id array (a device table) -* in a generic manner. +* This macro is deprecated and should not be used in new code. */ #define DEFINE_PCI_DEVICE_TABLE (_table) \ const struct pci_device_id _table[]scripts/checkpatch.pl +4
-4@@ -2643,10 +2643,13 @@ sub process { } } -# check for declarations of struct pci_device_id - if ($line =~ /\bstruct\s+pci_device_id\s+\w+\s*\[\s*\]\s*\=\s*\{/) { - WARN("DEFINE_PCI_DEVICE_TABLE", - "Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id\n" . $herecurr); +# check for uses of DEFINE_PCI_DEVICE_TABLE + if ($line =~ /\bDEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=/) { + if (WARN("DEFINE_PCI_DEVICE_TABLE", + "Prefer struct pci_device_id over deprecated DEFINE_PCI_DEVICE_TABLE\n" .$herecurr) &&
scripts/checkpatch.pl +2
-0+ $fix) { + $fixed[$linenr - 1] =~s/\b(?:static\s+|)DEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=\s*/static const struct
pci_device_id$1\[\] = /;scripts/checkpatch.pl +1
-0+ } } # check for new typedefs, only function parameters and sparse annotations
Bjorn Helgaas
maintainerRe: [PATCH] pci/checkpatch: Deprecate DEFINE_PCI_DEVICE_TABLE
In reply to Joe PerchesQuoted 7 lines · Joe Perches
Prefer use of the direct definition of struct
pci_device_idinstead of indirection via macroDEFINE_PCI_DEVICE_TABLE.Update the PCI documentation to deprecate
DEFINE_PCI_DEVICE_TABLE. Update checkpatch adding --fix option.Signed-off-by Joe Perches <[email protected]>
Applied with Jingoo's ack for v3.14, thanks!
Bjorn
Quoted 61 lines
--- Documentation/PCI/pci.txt | 6 ++++-- include/linux/pci.h | 3 +-- scripts/checkpatch.pl | 11 +++++++---- 3 files changed, 12 insertions(+), 8 deletions(-)Documentation/PCI/pci.txt +4
-2@@ -123,8 +123,10 @@ initialization with a pointer to a structure describing the driver The ID table is an array of struct pci_device_id entries ending with an -all-zero entry; use of the macro DEFINE_PCI_DEVICE_TABLE is the preferred -method of declaring the table. Each entry consists of: +all-zero entry. Definitions with static const are generally preferred. +Use of the deprecated macro DEFINE_PCI_DEVICE_TABLE should be avoided. + +Each entry consists of: vendor,device Vendor and device ID to match (or PCI_ANY_ID)include/linux/pci.h +1
-2@@ -634,8 +634,7 @@ struct pci_driver {* DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table * @_table: device table name * -* This macro is used to create a struct pci_device_id array (a device table) -* in a generic manner. +* This macro is deprecated and should not be used in new code. */ #define DEFINE_PCI_DEVICE_TABLE (_table) \ const struct pci_device_id _table[]scripts/checkpatch.pl +7
-4@@ -2643,10 +2643,13 @@ sub process { } } -# check for declarations of struct pci_device_id - if ($line =~ /\bstruct\s+pci_device_id\s+\w+\s*\[\s*\]\s*\=\s*\{/) { - WARN("DEFINE_PCI_DEVICE_TABLE", - "Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id\n" . $herecurr); +# check for uses of DEFINE_PCI_DEVICE_TABLE + if ($line =~ /\bDEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=/) { + if (WARN("DEFINE_PCI_DEVICE_TABLE", + "Prefer struct pci_device_id over deprecated DEFINE_PCI_DEVICE_TABLE\n" . $herecurr) && + $fix) { + $fixed[$linenr - 1] =~ s/\b(?:static\s+|)DEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=\s*/static const struct pci_device_id $1\[\] = /; + } } # check for new typedefs, only function parameters and sparse annotations