diff mbox

[06/39] dma: remove DEFINE_PCI_DEVICE_TABLE macro

Message ID 001b01ceefb2$ffd995f0$ff8cc1d0$%han@samsung.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Jingoo Han Dec. 2, 2013, 11:05 p.m. UTC
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
is not preferred.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/dma/dw/pci.c  |    2 +-
 drivers/dma/pch_dma.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Joe Perches Dec. 2, 2013, 11:11 p.m. UTC | #1
On Tue, 2013-12-03 at 08:05 +0900, Jingoo Han wrote:
> Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
> is not preferred.
[]
> diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
[]
> @@ -996,7 +996,7 @@ static void pch_dma_remove(struct pci_dev *pdev)
>  #define PCI_DEVICE_ID_ML7831_DMA1_8CH	0x8810
>  #define PCI_DEVICE_ID_ML7831_DMA2_4CH	0x8815
>  
> -DEFINE_PCI_DEVICE_TABLE(pch_dma_id_table) = {
> +const struct pci_device_id pch_dma_id_table[] = {
>  	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_8CH), 8 },
>  	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_4CH), 4 },
>  	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA1_8CH), 8}, /* UART Video */

As you do these, please check/verify if the converted
table should also be static and add it where appropriate.

$ git grep -w pch_dma_id_table 
drivers/dma/pch_dma.c:DEFINE_PCI_DEVICE_TABLE(pch_dma_id_table) = {
drivers/dma/pch_dma.c:  .id_table       = pch_dma_id_table,
drivers/dma/pch_dma.c:MODULE_DEVICE_TABLE(pci, pch_dma_id_table);


--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Shevchenko Dec. 3, 2013, 12:11 p.m. UTC | #2
On Tue, 2013-12-03 at 08:05 +0900, Jingoo Han wrote:
> Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro

> is not preferred.


I'm sorry, but Documentation/PCI/pci.txt still says "is the preferred
method".

Is there any link to patch for Documentation and discussion why change
is established?

> 

> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

> ---

>  drivers/dma/dw/pci.c  |    2 +-

>  drivers/dma/pch_dma.c |    2 +-

>  2 files changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c

> index e89fc24..fc3aea1 100644

> --- a/drivers/dma/dw/pci.c

> +++ b/drivers/dma/dw/pci.c

> @@ -75,7 +75,7 @@ static void dw_pci_remove(struct pci_dev *pdev)

>  		dev_warn(&pdev->dev, "can't remove device properly: %d\n", ret);

>  }

>  

> -static DEFINE_PCI_DEVICE_TABLE(dw_pci_id_table) = {

> +static const struct pci_device_id dw_pci_id_table[] = {

>  	/* Medfield */

>  	{ PCI_VDEVICE(INTEL, 0x0827), (kernel_ulong_t)&dw_pci_pdata },

>  	{ PCI_VDEVICE(INTEL, 0x0830), (kernel_ulong_t)&dw_pci_pdata },

> diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c

> index 61fdc54..9f0cdb1 100644

> --- a/drivers/dma/pch_dma.c

> +++ b/drivers/dma/pch_dma.c

> @@ -996,7 +996,7 @@ static void pch_dma_remove(struct pci_dev *pdev)

>  #define PCI_DEVICE_ID_ML7831_DMA1_8CH	0x8810

>  #define PCI_DEVICE_ID_ML7831_DMA2_4CH	0x8815

>  

> -DEFINE_PCI_DEVICE_TABLE(pch_dma_id_table) = {

> +const struct pci_device_id pch_dma_id_table[] = {

>  	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_8CH), 8 },

>  	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_4CH), 4 },

>  	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA1_8CH), 8}, /* UART Video */


-- 
Andy Shevchenko <andriy.shevchenko@intel.com>
Intel Finland Oy
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
Jingoo Han Dec. 4, 2013, 12:19 a.m. UTC | #3
On Tuesday, December 03, 2013 9:11 PM, Shevchenko, Andriy wrote:
> On Tue, 2013-12-03 at 08:05 +0900, Jingoo Han wrote:
> > Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
> > is not preferred.
> 
> I'm sorry, but Documentation/PCI/pci.txt still says "is the preferred
> method".
> 
> Is there any link to patch for Documentation and discussion why change
> is established?

(+cc Joe Perches, Jonas Bonn)

Since last week, there has been discussion about this.
There is no special reason to use DEFINE_PCI_DEVICE_TABLE macro.

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."

Currently, there is no other bus that has something like this
macro for their device ids. Thus, DEFINE_PCI_DEVICE_TABLE macro
should be removed.

Jonas Bonn (author of DEFINE_PCI_DEVICE_TABLE macro) also agreed
to remove this macro. According to Jonas Bonn,
"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 Joe Perches's patch[1] is merged, I will send these patches
to each subsystem maintainer.

[1][PATCH] pci/checkpatch: Deprecate DEFINE_PCI_DEVICE_TABLE
    (http://lkml.org/lkml/2013/12/2/400)

In this patch, Joe Perches fixed 'Documentation/PCI/pci.txt', and
'scripts/checkpatch.pl', in order to guide to use 'struct pci_device_id'
instead of 'DEFINE_PCI_DEVICE_TABLE' macro.

Thank you.

Best regards,
Jingoo Han

Best regards,
Jingoo Han

--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Shevchenko Dec. 4, 2013, 12:48 p.m. UTC | #4
On Wed, 2013-12-04 at 09:19 +0900, Jingoo Han wrote:
> On Tuesday, December 03, 2013 9:11 PM, Shevchenko, Andriy wrote:
> > On Tue, 2013-12-03 at 08:05 +0900, Jingoo Han wrote:
> > > Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
> > > is not preferred.
> > 
> > I'm sorry, but Documentation/PCI/pci.txt still says "is the preferred
> > method".
> > 
> > Is there any link to patch for Documentation and discussion why change
> > is established?
> 
> (+cc Joe Perches, Jonas Bonn)
> 
> Since last week, there has been discussion about this.
> There is no special reason to use DEFINE_PCI_DEVICE_TABLE macro.
> 
> 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."
> 
> Currently, there is no other bus that has something like this
> macro for their device ids. Thus, DEFINE_PCI_DEVICE_TABLE macro
> should be removed.
> 
> Jonas Bonn (author of DEFINE_PCI_DEVICE_TABLE macro) also agreed
> to remove this macro. According to Jonas Bonn,
> "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 Joe Perches's patch[1] is merged, I will send these patches
> to each subsystem maintainer.
> 
> [1][PATCH] pci/checkpatch: Deprecate DEFINE_PCI_DEVICE_TABLE
>     (http://lkml.org/lkml/2013/12/2/400)
> 
> In this patch, Joe Perches fixed 'Documentation/PCI/pci.txt', and
> 'scripts/checkpatch.pl', in order to guide to use 'struct pci_device_id'
> instead of 'DEFINE_PCI_DEVICE_TABLE' macro.

Thanks for the detailed explanation!

Thus, give you my 

Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

for drivers/dma/dw/ part.
diff mbox

Patch

diff --git a/drivers/dma/dw/pci.c b/drivers/dma/dw/pci.c
index e89fc24..fc3aea1 100644
--- a/drivers/dma/dw/pci.c
+++ b/drivers/dma/dw/pci.c
@@ -75,7 +75,7 @@  static void dw_pci_remove(struct pci_dev *pdev)
 		dev_warn(&pdev->dev, "can't remove device properly: %d\n", ret);
 }
 
-static DEFINE_PCI_DEVICE_TABLE(dw_pci_id_table) = {
+static const struct pci_device_id dw_pci_id_table[] = {
 	/* Medfield */
 	{ PCI_VDEVICE(INTEL, 0x0827), (kernel_ulong_t)&dw_pci_pdata },
 	{ PCI_VDEVICE(INTEL, 0x0830), (kernel_ulong_t)&dw_pci_pdata },
diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index 61fdc54..9f0cdb1 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -996,7 +996,7 @@  static void pch_dma_remove(struct pci_dev *pdev)
 #define PCI_DEVICE_ID_ML7831_DMA1_8CH	0x8810
 #define PCI_DEVICE_ID_ML7831_DMA2_4CH	0x8815
 
-DEFINE_PCI_DEVICE_TABLE(pch_dma_id_table) = {
+const struct pci_device_id pch_dma_id_table[] = {
 	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_8CH), 8 },
 	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_EG20T_PCH_DMA_4CH), 4 },
 	{ PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_DMA1_8CH), 8}, /* UART Video */