Re: [RFC PATCH 2/3] ata: Replace deprecated PCI functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/4/24 8:10 PM, Philipp Stanner wrote:

> The ata subsystem uses the deprecated PCI devres functions
> pcim_iomap_table() and pcim_request_regions().
> 
> These functions internally already use their successors, notably
> pcim_request_region(), so they are quite trivial to replace.
> 
> Replace all calls to pcim_request_regions() with ones to
> pcim_request_region().
> 
> Remove all calls to pcim_iomap_table().
> 
> The last remaining user, libata-sff.c, is very complicated to port and
> left for future work.
> 
> Signed-off-by: Philipp Stanner <pstanner@xxxxxxxxxx>
[...]

> diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
> index abe64b5f83cf..1f74666a0f37 100644
> --- a/drivers/ata/pata_sil680.c
> +++ b/drivers/ata/pata_sil680.c
> @@ -360,15 +360,17 @@ static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
>  	/* Try to acquire MMIO resources and fallback to PIO if
>  	 * that fails
>  	 */
> -	rc = pcim_iomap_regions(pdev, 1 << SIL680_MMIO_BAR, DRV_NAME);
> -	if (rc)
> +	rc = 0;

   Doesn't seem necessary...

> +	mmio_base = pcim_iomap_region(pdev, SIL680_MMIO_BAR, DRV_NAME);
> +	if (IS_ERR(mmio_base)) {
> +		rc = PTR_ERR(mmio_base);
>  		goto use_ioports;
> +	}
>  
>  	/* Allocate host and set it up */
>  	host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
>  	if (!host)
>  		return -ENOMEM;
> -	host->iomap = pcim_iomap_table(pdev);
>  
>  	/* Setup DMA masks */
>  	rc = dma_set_mask_and_coherent(&pdev->dev, ATA_DMA_MASK);
[...]
> diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
> index a482741eb181..f4644ba5f095 100644
> --- a/drivers/ata/sata_sx4.c
> +++ b/drivers/ata/sata_sx4.c
> @@ -1390,6 +1390,7 @@ static int pdc_sata_init_one(struct pci_dev *pdev,
>  	struct ata_host *host;
>  	struct pdc_host_priv *hpriv;
>  	int i, rc;
> +	void __iomem *io_tmp;

   I'd suggest a better name, like iomem here...

[...]
> diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
> index 57cbf2cef618..73b78834fa3f 100644
> --- a/drivers/ata/sata_via.c
> +++ b/drivers/ata/sata_via.c
[...]
> @@ -494,13 +497,17 @@ static int vt6421_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
>  		return -ENOMEM;
>  	}
>  
> -	rc = pcim_iomap_regions(pdev, 0x3f, DRV_NAME);
> -	if (rc) {
> -		dev_err(&pdev->dev, "failed to request/iomap PCI BARs (errno=%d)\n",
> -			rc);
> -		return rc;
> +	/* Request and ioremap _all_ PCI BARs. */
> +	for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> +		iomem = pcim_iomap_region(pdev, i, DRV_NAME);
> +		if (IS_ERR(iomem)) {
> +			rc = PTR_ERR(iomem);
> +			dev_err(&pdev->dev, "failed to request/iomap PCI BARs (errno=%d)\n",
> +				rc);

   You have a limit of 100 columns now. :-)

[...]

MBR, Sergey





[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux