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

Commit fd0fcf5c authored by Michael Buesch's avatar Michael Buesch Committed by David S. Miller
Browse files

ssb: Fix DMA-API compilation for non-PCI systems



This fixes compilation of the SSB DMA-API code on non-PCI platforms.

Signed-off-by: default avatarMichael Buesch <mb@bu3sch.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 95814834
Loading
Loading
Loading
Loading
+35 −7
Original line number Original line Diff line number Diff line
@@ -427,12 +427,16 @@ static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr)
{
{
	switch (dev->bus->bustype) {
	switch (dev->bus->bustype) {
	case SSB_BUSTYPE_PCI:
	case SSB_BUSTYPE_PCI:
#ifdef CONFIG_SSB_PCIHOST
		return pci_dma_mapping_error(dev->bus->host_pci, addr);
		return pci_dma_mapping_error(dev->bus->host_pci, addr);
#endif
		break;
	case SSB_BUSTYPE_SSB:
	case SSB_BUSTYPE_SSB:
		return dma_mapping_error(dev->dev, addr);
		return dma_mapping_error(dev->dev, addr);
	default:
	default:
		__ssb_dma_not_implemented(dev);
		break;
	}
	}
	__ssb_dma_not_implemented(dev);
	return -ENOSYS;
	return -ENOSYS;
}
}


@@ -441,12 +445,16 @@ static inline dma_addr_t ssb_dma_map_single(struct ssb_device *dev, void *p,
{
{
	switch (dev->bus->bustype) {
	switch (dev->bus->bustype) {
	case SSB_BUSTYPE_PCI:
	case SSB_BUSTYPE_PCI:
#ifdef CONFIG_SSB_PCIHOST
		return pci_map_single(dev->bus->host_pci, p, size, dir);
		return pci_map_single(dev->bus->host_pci, p, size, dir);
#endif
		break;
	case SSB_BUSTYPE_SSB:
	case SSB_BUSTYPE_SSB:
		return dma_map_single(dev->dev, p, size, dir);
		return dma_map_single(dev->dev, p, size, dir);
	default:
	default:
		__ssb_dma_not_implemented(dev);
		break;
	}
	}
	__ssb_dma_not_implemented(dev);
	return 0;
	return 0;
}
}


@@ -455,14 +463,18 @@ static inline void ssb_dma_unmap_single(struct ssb_device *dev, dma_addr_t dma_a
{
{
	switch (dev->bus->bustype) {
	switch (dev->bus->bustype) {
	case SSB_BUSTYPE_PCI:
	case SSB_BUSTYPE_PCI:
#ifdef CONFIG_SSB_PCIHOST
		pci_unmap_single(dev->bus->host_pci, dma_addr, size, dir);
		pci_unmap_single(dev->bus->host_pci, dma_addr, size, dir);
		return;
		return;
#endif
		break;
	case SSB_BUSTYPE_SSB:
	case SSB_BUSTYPE_SSB:
		dma_unmap_single(dev->dev, dma_addr, size, dir);
		dma_unmap_single(dev->dev, dma_addr, size, dir);
		return;
		return;
	default:
	default:
		__ssb_dma_not_implemented(dev);
		break;
	}
	}
	__ssb_dma_not_implemented(dev);
}
}


static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev,
static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev,
@@ -472,15 +484,19 @@ static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev,
{
{
	switch (dev->bus->bustype) {
	switch (dev->bus->bustype) {
	case SSB_BUSTYPE_PCI:
	case SSB_BUSTYPE_PCI:
#ifdef CONFIG_SSB_PCIHOST
		pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
		pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
					    size, dir);
					    size, dir);
		return;
		return;
#endif
		break;
	case SSB_BUSTYPE_SSB:
	case SSB_BUSTYPE_SSB:
		dma_sync_single_for_cpu(dev->dev, dma_addr, size, dir);
		dma_sync_single_for_cpu(dev->dev, dma_addr, size, dir);
		return;
		return;
	default:
	default:
		__ssb_dma_not_implemented(dev);
		break;
	}
	}
	__ssb_dma_not_implemented(dev);
}
}


static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev,
static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev,
@@ -490,15 +506,19 @@ static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev,
{
{
	switch (dev->bus->bustype) {
	switch (dev->bus->bustype) {
	case SSB_BUSTYPE_PCI:
	case SSB_BUSTYPE_PCI:
#ifdef CONFIG_SSB_PCIHOST
		pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
		pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
					       size, dir);
					       size, dir);
		return;
		return;
#endif
		break;
	case SSB_BUSTYPE_SSB:
	case SSB_BUSTYPE_SSB:
		dma_sync_single_for_device(dev->dev, dma_addr, size, dir);
		dma_sync_single_for_device(dev->dev, dma_addr, size, dir);
		return;
		return;
	default:
	default:
		__ssb_dma_not_implemented(dev);
		break;
	}
	}
	__ssb_dma_not_implemented(dev);
}
}


static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev,
static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev,
@@ -509,17 +529,21 @@ static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev,
{
{
	switch (dev->bus->bustype) {
	switch (dev->bus->bustype) {
	case SSB_BUSTYPE_PCI:
	case SSB_BUSTYPE_PCI:
#ifdef CONFIG_SSB_PCIHOST
		/* Just sync everything. That's all the PCI API can do. */
		/* Just sync everything. That's all the PCI API can do. */
		pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
		pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
					    offset + size, dir);
					    offset + size, dir);
		return;
		return;
#endif
		break;
	case SSB_BUSTYPE_SSB:
	case SSB_BUSTYPE_SSB:
		dma_sync_single_range_for_cpu(dev->dev, dma_addr, offset,
		dma_sync_single_range_for_cpu(dev->dev, dma_addr, offset,
					      size, dir);
					      size, dir);
		return;
		return;
	default:
	default:
		__ssb_dma_not_implemented(dev);
		break;
	}
	}
	__ssb_dma_not_implemented(dev);
}
}


static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev,
static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev,
@@ -530,17 +554,21 @@ static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev,
{
{
	switch (dev->bus->bustype) {
	switch (dev->bus->bustype) {
	case SSB_BUSTYPE_PCI:
	case SSB_BUSTYPE_PCI:
#ifdef CONFIG_SSB_PCIHOST
		/* Just sync everything. That's all the PCI API can do. */
		/* Just sync everything. That's all the PCI API can do. */
		pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
		pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
					       offset + size, dir);
					       offset + size, dir);
		return;
		return;
#endif
		break;
	case SSB_BUSTYPE_SSB:
	case SSB_BUSTYPE_SSB:
		dma_sync_single_range_for_device(dev->dev, dma_addr, offset,
		dma_sync_single_range_for_device(dev->dev, dma_addr, offset,
						 size, dir);
						 size, dir);
		return;
		return;
	default:
	default:
		__ssb_dma_not_implemented(dev);
		break;
	}
	}
	__ssb_dma_not_implemented(dev);
}
}