Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 374b1873 authored by Jeff Garzik's avatar Jeff Garzik
Browse files

[libata] update several drivers to use pci_iomap()/pci_iounmap()

parent ea6ba10b
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -995,8 +995,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
	probe_ent->dev = pci_dev_to_dev(pdev);
	INIT_LIST_HEAD(&probe_ent->node);

	mmio_base = ioremap(pci_resource_start(pdev, AHCI_PCI_BAR),
		            pci_resource_len(pdev, AHCI_PCI_BAR));
	mmio_base = pci_iomap(pdev, AHCI_PCI_BAR, 0);
	if (mmio_base == NULL) {
		rc = -ENOMEM;
		goto err_out_free_ent;
@@ -1040,7 +1039,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_hpriv:
	kfree(hpriv);
err_out_iounmap:
	iounmap(mmio_base);
	pci_iounmap(pdev, mmio_base);
err_out_free_ent:
	kfree(probe_ent);
err_out_msi:
@@ -1081,7 +1080,7 @@ static void ahci_remove_one (struct pci_dev *pdev)
	}

	kfree(hpriv);
	iounmap(host_set->mmio_base);
	pci_iounmap(pdev, host_set->mmio_base);
	kfree(host_set);

	if (have_msi)
+4 −5
Original line number Diff line number Diff line
@@ -584,7 +584,6 @@ static void pci_enable_intx(struct pci_dev *pdev)
static int piix_disable_ahci(struct pci_dev *pdev)
{
	void __iomem *mmio;
	unsigned long addr;
	u32 tmp;
	int rc = 0;

@@ -592,11 +591,11 @@ static int piix_disable_ahci(struct pci_dev *pdev)
	 * works because this device is usually set up by BIOS.
	 */

	addr = pci_resource_start(pdev, AHCI_PCI_BAR);
	if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR))
	if (!pci_resource_start(pdev, AHCI_PCI_BAR) ||
	    !pci_resource_len(pdev, AHCI_PCI_BAR))
		return 0;

	mmio = ioremap(addr, 64);
	mmio = pci_iomap(pdev, AHCI_PCI_BAR, 64);
	if (!mmio)
		return -ENOMEM;

@@ -610,7 +609,7 @@ static int piix_disable_ahci(struct pci_dev *pdev)
			rc = -EIO;
	}

	iounmap(mmio);
	pci_iounmap(pdev, mmio);
	return rc;
}

+10 −1
Original line number Diff line number Diff line
@@ -4200,6 +4200,15 @@ ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port)



#ifdef CONFIG_PCI

void ata_pci_host_stop (struct ata_host_set *host_set)
{
	struct pci_dev *pdev = to_pci_dev(host_set->dev);

	pci_iounmap(pdev, host_set->mmio_base);
}

/**
 *	ata_pci_init_native_mode - Initialize native-mode driver
 *	@pdev:  pci device to be initialized
@@ -4212,7 +4221,6 @@ ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port)
 *	ata_probe_ent structure should then be freed with kfree().
 */

#ifdef CONFIG_PCI
struct ata_probe_ent *
ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port)
{
@@ -4595,6 +4603,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_simulate);

#ifdef CONFIG_PCI
EXPORT_SYMBOL_GPL(pci_test_config_bits);
EXPORT_SYMBOL_GPL(ata_pci_host_stop);
EXPORT_SYMBOL_GPL(ata_pci_init_native_mode);
EXPORT_SYMBOL_GPL(ata_pci_init_one);
EXPORT_SYMBOL_GPL(ata_pci_remove_one);
+5 −4
Original line number Diff line number Diff line
@@ -351,6 +351,7 @@ static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
static void nv_host_stop (struct ata_host_set *host_set)
{
	struct nv_host *host = host_set->private_data;
	struct pci_dev *pdev = to_pci_dev(host_set->dev);

	// Disable hotplug event interrupts.
	if (host->host_desc->disable_hotplug)
@@ -358,7 +359,8 @@ static void nv_host_stop (struct ata_host_set *host_set)

	kfree(host);

	ata_host_stop(host_set);
	if (host_set->mmio_base)
		pci_iounmap(pdev, host_set->mmio_base);
}

static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
@@ -420,8 +422,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
	if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) {
		unsigned long base;

		probe_ent->mmio_base = ioremap(pci_resource_start(pdev, 5),
				pci_resource_len(pdev, 5));
		probe_ent->mmio_base = pci_iomap(pdev, 5, 0);
		if (probe_ent->mmio_base == NULL) {
			rc = -EIO;
			goto err_out_free_host;
@@ -457,7 +458,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)

err_out_iounmap:
	if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO)
		iounmap(probe_ent->mmio_base);
		pci_iounmap(pdev, probe_ent->mmio_base);
err_out_free_host:
	kfree(host);
err_out_free_ent:
+4 −4
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf);
static void pdc_irq_clear(struct ata_port *ap);
static int pdc_qc_issue_prot(struct ata_queued_cmd *qc);


static Scsi_Host_Template pdc_ata_sht = {
	.module			= THIS_MODULE,
	.name			= DRV_NAME,
@@ -132,7 +133,7 @@ static struct ata_port_operations pdc_sata_ops = {
	.scr_write		= pdc_sata_scr_write,
	.port_start		= pdc_port_start,
	.port_stop		= pdc_port_stop,
	.host_stop		= ata_host_stop,
	.host_stop		= ata_pci_host_stop,
};

static struct ata_port_operations pdc_pata_ops = {
@@ -153,7 +154,7 @@ static struct ata_port_operations pdc_pata_ops = {

	.port_start		= pdc_port_start,
	.port_stop		= pdc_port_stop,
	.host_stop		= ata_host_stop,
	.host_stop		= ata_pci_host_stop,
};

static struct ata_port_info pdc_port_info[] = {
@@ -663,8 +664,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
	probe_ent->dev = pci_dev_to_dev(pdev);
	INIT_LIST_HEAD(&probe_ent->node);

	mmio_base = ioremap(pci_resource_start(pdev, 3),
		            pci_resource_len(pdev, 3));
	mmio_base = pci_iomap(pdev, 3, 0);
	if (mmio_base == NULL) {
		rc = -ENOMEM;
		goto err_out_free_ent;
Loading