media: Replace deprecated PCI functions
Subsystems (6)
cover media: Replace deprecated PCI functions
Replaces pcim_iomap_regions() and pcim_iomap_table(), which have been deprecated.
The successor pcim_iomap_region() is already used in many places and shouldn't cause trouble.
I test-built it, but have no hardware for testing.
P.
Philipp Stanner (5):
media: ipu3-cio2: Replace deprecated PCI functions
media: pt3: Replace deprecated PCI functions
media: intel/ipu6: Replace deprecated PCI functions
media: solo6x10: Replace deprecated PCI functions
media: tw5864: Replace deprecated PCI functions
drivers/media/pci/intel/ipu3/ipu3-cio2.c | 5 ++--- drivers/media/pci/intel/ipu6/ipu6.c | 8 ++++---- drivers/media/pci/pt3/pt3.c | 17 +++++++++++------ drivers/media/pci/solo6x10/solo6x10-core.c | 4 ++-- drivers/media/pci/tw5864/tw5864-core.c | 13 ++++++++----- 5 files changed, 27 insertions(+), 20 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/5 media: ipu3-cio2: Replace deprecated PCI functions
pcim_iomap_table() and pcim_iomap_regions() have been deprecated.
Replace them with pcim_iomap_region(), and pass the actual driver name to that function.
--- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/media/pci/intel/ipu3/ipu3-cio2.c +2 -3
@@ -1702,14 +1702,13 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,dev_info (dev,"device 0x%x (rev: 0x%x)\n" , pci_dev->device, pci_dev->revision); - r =pcim_iomap_regions (pci_dev,1 <<CIO2_PCI_BAR ,pci_name (pci_dev)); + cio2->base =pcim_iomap_region (pci_dev,CIO2_PCI_BAR ,CIO2_NAME ); + r =PTR_ERR_OR_ZERO (cio2->base);if (r) {dev_err (dev,"failed to remap I/O memory (%d)\n" , r);return -ENODEV ; } - cio2->base =pcim_iomap_table (pci_dev)[CIO2_PCI_BAR ]; -pci_set_drvdata (pci_dev, cio2);pci_set_master (pci_dev);
Signature · 1 line
2.48.1
PATCH 2/5 media: pt3: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().
--- drivers/media/pci/pt3/pt3.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/media/pci/pt3/pt3.c +11 -6
@@ -692,6 +692,7 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)u8 rev;u32 ver;int i, ret; +void __iomem *iomem;struct pt3_board *pt3;struct i2c_adapter *i2c;
@@ -703,10 +704,6 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)return -ENODEV ;pci_set_master (pdev); - ret =pcim_iomap_regions (pdev,BIT (0 ) |BIT (2 ),DRV_NAME ); -if (ret <0 ) -return ret; - ret =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 ));if (ret) {dev_err (&pdev->dev,"Failed to set DMA mask\n" );
@@ -719,8 +716,16 @@ static int pt3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)pci_set_drvdata (pdev, pt3); pt3->pdev = pdev;mutex_init (&pt3->lock); - pt3->regs[0 ] =pcim_iomap_table (pdev)[0 ]; - pt3->regs[1 ] =pcim_iomap_table (pdev)[2 ]; + + iomem =pcim_iomap_region (pdev,0 ,DRV_NAME ); +if (IS_ERR (iomem)) +return PTR_ERR (iomem); + pt3->regs[0 ] = iomem; + + iomem =pcim_iomap_region (pdev,2 ,DRV_NAME ); +if (IS_ERR (iomem)) +return PTR_ERR (iomem); + pt3->regs[1 ] = iomem; ver =ioread32 (pt3->regs[0 ] +REG_VERSION );if ((ver >>16 ) !=0x0301 ) {
Signature · 1 line
2.48.1
PATCH 3/5 media: intel/ipu6: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_table() and pcim_iomap_regions() have been deprecated. Furthermore, the "name" parameter in pcim_iomap_regions() and its successor, pcim_iomap_region(), should always reflect the driver name, whereas currently it is the device's name.
Replace the deprecated functions with pcim_iomap_region() and pass the actual driver name.
--- drivers/media/pci/intel/ipu6/ipu6.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/pci/intel/ipu6/ipu6.c +4 -4
@@ -525,11 +525,11 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) phys =pci_resource_start (pdev,IPU6_PCI_BAR );dev_dbg (dev,"IPU6 PCI bar[%u] = %pa\n" ,IPU6_PCI_BAR , &phys); - ret =pcim_iomap_regions (pdev,1 <<IPU6_PCI_BAR ,pci_name (pdev)); -if (ret) -return dev_err_probe (dev, ret,"Failed to I/O mem remapping\n" ); + isp->base =pcim_iomap_region (pdev,IPU6_PCI_BAR ,IPU6_NAME ); +if (IS_ERR (isp->base)) +return dev_err_probe (dev,PTR_ERR (isp->base), +"Failed to I/O mem remapping\n" ); - isp->base =pcim_iomap_table (pdev)[IPU6_PCI_BAR ];pci_set_drvdata (pdev, isp);pci_set_master (pdev);
Signature · 1 line
2.48.1
PATCH 4/5 media: solo6x10: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_table() and pcim_iomap_regions() have been deprecated. Replace them with pcim_iomap_region().
--- drivers/media/pci/solo6x10/solo6x10-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/solo6x10/solo6x10-core.c +2 -2
@@ -477,10 +477,10 @@ static int solo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)pci_write_config_byte (pdev,0x40 ,0x00 );pci_write_config_byte (pdev,0x41 ,0x00 ); - ret =pcim_iomap_regions (pdev,BIT (0 ),SOLO6X10_NAME ); + solo_dev->reg_base =pcim_iomap_region (pdev,0 ,SOLO6X10_NAME ); + ret =PTR_ERR_OR_ZERO (solo_dev->reg_base);if (ret) goto fail_probe; - solo_dev->reg_base =pcim_iomap_table (pdev)[0 ]; chip_id =solo_reg_read (solo_dev,SOLO_CHIP_OPTION ) &SOLO_CHIP_ID_MASK ;
Signature · 1 line
2.48.1
PATCH 5/5 media: tw5864: Replace deprecated PCI functions
In reply to Philipp Stannerpcim_iomap_table() and pcim_iomap_regions() have been deprecated. pcim_iomap_regions(), furthermore, has so far wrongly been passed the device's name instead of the driver's name, which makes that function's debug prints useless.
Replace the deprecated function with pcim_iomap_region().
Define the driver name globally and use it where appropriate.
--- drivers/media/pci/tw5864/tw5864-core.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/media/pci/tw5864/tw5864-core.c +8 -5
@@ -24,6 +24,8 @@#include "tw5864.h" #include "tw5864-reg.h" +#define DRIVER_NAME "tw5864" +MODULE_DESCRIPTION ("V4L2 driver module for tw5864-based multimedia capture & encoding devices" );MODULE_AUTHOR ("Bluecherry Maintainers <[email protected]>" );MODULE_AUTHOR ("Andrey Utkin <[email protected]>" );
@@ -246,7 +248,8 @@ static int tw5864_initdev(struct pci_dev *pci_dev,if (!dev)return -ENOMEM ; -snprintf (dev->name,sizeof (dev->name),"tw5864:%s" ,pci_name (pci_dev)); +snprintf (dev->name,sizeof (dev->name),"%s:%s" ,DRIVER_NAME , +pci_name (pci_dev)); err =v4l2_device_register (&pci_dev->dev, &dev->v4l2_dev);if (err)
@@ -269,12 +272,12 @@ static int tw5864_initdev(struct pci_dev *pci_dev, }/* get mmio */ - err =pcim_iomap_regions (pci_dev,BIT (0 ), dev->name); + dev->mmio =pcim_iomap_region (pci_dev,0 ,DRIVER_NAME ); + err =PTR_ERR_OR_ZERO (dev->mmio);if (err) {dev_err (&dev->pci->dev,"Cannot request regions for MMIO\n" ); goto unreg_v4l2; } - dev->mmio =pcim_iomap_table (pci_dev)[0 ];spin_lock_init (&dev->slock);
@@ -290,7 +293,7 @@ static int tw5864_initdev(struct pci_dev *pci_dev,/* get irq */ err =devm_request_irq (&pci_dev->dev, pci_dev->irq, tw5864_isr, -IRQF_SHARED ,"tw5864" , dev); +IRQF_SHARED ,DRIVER_NAME , dev);if (err <0 ) {dev_err (&dev->pci->dev,"can't get IRQ %d\n" , pci_dev->irq); goto fini_video;
@@ -324,7 +327,7 @@ static void tw5864_finidev(struct pci_dev *pci_dev) }static struct pci_driver tw5864_pci_driver = { - .name ="tw5864" , + .name =DRIVER_NAME , .id_table = tw5864_pci_tbl, .probe = tw5864_initdev, .remove = tw5864_finidev,
Signature · 1 line
2.48.1
Quoted 8 lines · Philipp Stanner
Replaces
pcim_iomap_regions()andpcim_iomap_table(), which have been deprecated.The successor
pcim_iomap_region()is already used in many places and shouldn't cause trouble.I test-built it, but have no hardware for testing.
Quoted 8 lines
P.
Philipp Stanner (5):
media: ipu3-cio2: Replace deprecated PCI functions
media: pt3: Replace deprecated PCI functions
media: intel/ipu6: Replace deprecated PCI functions
media: solo6x10: Replace deprecated PCI functions
media: tw5864: Replace deprecated PCI functions
Hello,
is there someone who's in charge of all of media: who could take this, or would it be more feasible to aim for the subcomponents?
P.
Quoted 8 lines
drivers/media/pci/intel/ipu3/ipu3-cio2.c | 5 ++--- drivers/media/pci/intel/ipu6/ipu6.c | 8 ++++---- drivers/media/pci/pt3/pt3.c | 17 +++++++++++------
drivers/media/pci/solo6x10/solo6x10-core.c| 4 ++-- drivers/media/pci/tw5864/tw5864-core.c | 13 ++++++++-----5 files changed, 27 insertions(+), 20 deletions(-)
Sakari Ailus
maintainerHi Philipp,
Quoted 18 lines · Philipp Stanner
Quoted 8 lines · Philipp Stanner
Replaces
pcim_iomap_regions()andpcim_iomap_table(), which have been deprecated.The successor
pcim_iomap_region()is already used in many places and shouldn't cause trouble.I test-built it, but have no hardware for testing.
Quoted 8 lines
P.
Philipp Stanner (5):
media: ipu3-cio2: Replace deprecated PCI functions
media: pt3: Replace deprecated PCI functions
media: intel/ipu6: Replace deprecated PCI functions
media: solo6x10: Replace deprecated PCI functions
media: tw5864: Replace deprecated PCI functions
Quoted 4 lines
Hello,
is there someone who's in charge of all of media: who could take this, or would it be more feasible to aim for the subcomponents?
I'll check the ipu patches soonish.
Signature · 3 lines
Kind regards, Sakari Ailus
Re: [PATCH 2/5] media: pt3: Replace deprecated PCI functions
In reply to Philipp StannerQuoted 7 lines · Philipp Stanner
pcim_iomap_table()andpcim_iomap_regions()have been deprecated. Replace them withpcim_iomap_region().Signed-off-by Philipp Stanner <[email protected]>--- drivers/media/pci/pt3/pt3.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
Ismael Luceno
maintainerRe: [PATCH 4/5] media: solo6x10: Replace deprecated PCI functions
In reply to Philipp StannerQuoted 15 lines · Philipp Stanner
pcim_iomap_table()andpcim_iomap_regions()have been deprecated. Replace them withpcim_iomap_region().Signed-off-by Philipp Stanner <[email protected]>--- drivers/media/pci/solo6x10/solo6x10-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/media/pci/solo6x10/solo6x10-core.c +0
-0@@ -477,10 +477,10 @@ static int solo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)pci_write_config_byte (pdev,0x40 ,0x00 );pci_write_config_byte (pdev,0x41 ,0x00 );
drivers/media/pci/solo6x10/solo6x10-core.c static int solo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 486
Quoted 10 lines
drivers/media/pci/solo6x10/solo6x10-core.c +2
-2- ret =pcim_iomap_regions (pdev,BIT (0 ),SOLO6X10_NAME ); + solo_dev->reg_base =pcim_iomap_region (pdev,0 ,SOLO6X10_NAME ); + ret =PTR_ERR_OR_ZERO (solo_dev->reg_base);if (ret) goto fail_probe; - solo_dev->reg_base =pcim_iomap_table (pdev)[0 ]; chip_id =solo_reg_read (solo_dev,SOLO_CHIP_OPTION ) &SOLO_CHIP_ID_MASK ;
It mostly looks OK, but the error check needs to happen before setting solo_dev->reg_base, because it's used by free_solo_dev.