ssb: Fix DMA-API compilation for non-PCI systems
Subsystems (3)
PATCH 1/1 ssb: Fix DMA-API compilation for non-PCI systems
This fixes compilation of the SSB DMA-API code on non-PCI platforms.
---
John, please queue this for whatever kernel. I forgot what version we're working on. :P
include/linux/ssb/ssb.h +35 -7
@@ -427,12 +427,16 @@ static inline int ssb_dma_mapping_error( {switch (dev->bus->bustype) {case SSB_BUSTYPE_PCI : +#ifdef CONFIG_SSB_PCIHOST return pci_dma_mapping_error (dev->bus->host_pci, addr); +#endif +break ;case SSB_BUSTYPE_SSB :return dma_mapping_error (dev->dev, addr);default : -__ssb_dma_not_implemented (dev); +break ; } +__ssb_dma_not_implemented (dev);return -ENOSYS ; }
@@ -441,12 +445,16 @@ static inline dma_addr_t ssb_dma_map_sin {switch (dev->bus->bustype) {case SSB_BUSTYPE_PCI : +#ifdef CONFIG_SSB_PCIHOST return pci_map_single (dev->bus->host_pci, p, size, dir); +#endif +break ;case SSB_BUSTYPE_SSB :return dma_map_single (dev->dev, p, size, dir);default : -__ssb_dma_not_implemented (dev); +break ; } +__ssb_dma_not_implemented (dev);return 0 ; }
@@ -455,14 +463,18 @@ static inline void ssb_dma_unmap_single( {switch (dev->bus->bustype) {case SSB_BUSTYPE_PCI : +#ifdef CONFIG_SSB_PCIHOST pci_unmap_single (dev->bus->host_pci, dma_addr, size, dir);return ; +#endif +break ;case SSB_BUSTYPE_SSB :dma_unmap_single (dev->dev, dma_addr, size, dir);return ;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,
@@ -472,15 +484,19 @@ static inline void ssb_dma_sync_single_f {switch (dev->bus->bustype) {case SSB_BUSTYPE_PCI : +#ifdef CONFIG_SSB_PCIHOST pci_dma_sync_single_for_cpu (dev->bus->host_pci, dma_addr, size, dir);return ; +#endif +break ;case SSB_BUSTYPE_SSB :dma_sync_single_for_cpu (dev->dev, dma_addr, size, dir);return ;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,
@@ -490,15 +506,19 @@ static inline void ssb_dma_sync_single_f {switch (dev->bus->bustype) {case SSB_BUSTYPE_PCI : +#ifdef CONFIG_SSB_PCIHOST pci_dma_sync_single_for_device (dev->bus->host_pci, dma_addr, size, dir);return ; +#endif +break ;case SSB_BUSTYPE_SSB :dma_sync_single_for_device (dev->dev, dma_addr, size, dir);return ;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,
@@ -509,17 +529,21 @@ static inline void ssb_dma_sync_single_r {switch (dev->bus->bustype) {case SSB_BUSTYPE_PCI : +#ifdef CONFIG_SSB_PCIHOST /* Just sync everything. That's all the PCI API can do. */ pci_dma_sync_single_for_cpu (dev->bus->host_pci, dma_addr, offset + size, dir);return ; +#endif +break ;case SSB_BUSTYPE_SSB :dma_sync_single_range_for_cpu (dev->dev, dma_addr, offset, size, dir);return ;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,
@@ -530,17 +554,21 @@ static inline void ssb_dma_sync_single_r {switch (dev->bus->bustype) {case SSB_BUSTYPE_PCI : +#ifdef CONFIG_SSB_PCIHOST /* Just sync everything. That's all the PCI API can do. */ pci_dma_sync_single_for_device (dev->bus->host_pci, dma_addr, offset + size, dir);return ; +#endif +break ;case SSB_BUSTYPE_SSB :dma_sync_single_range_for_device (dev->dev, dma_addr, offset, size, dir);return ;default : -__ssb_dma_not_implemented (dev); +break ; } +__ssb_dma_not_implemented (dev); }
Signature · 1 line
Greetings Michael.
Quoted 6 lines · Michael Buesch
include/linux/ssb/ssb.h 2008-11-06 21:45:37.000000000 +0100 renamed from include/linux/ssb/ssb.h 2008-08-01 17:26:05.000000000 +0200 +0
-0@@ -427,12 +427,16 @@ static inline int ssb_dma_mapping_error( { switch (dev->bus->bustype) { case SSB_BUSTYPE_PCI:
include/linux/ssb/ssb.h 2008-11-06 21:45:37.000000000 +0100 static inline int ssb_dma_mapping_error( · line 438
Quoted 10 lines
include/linux/ssb/ssb.h 2008-11-06 21:45:37.000000000 +0100 renamed from include/linux/ssb/ssb.h 2008-08-01 17:26:05.000000000 +0200 +4
-1+#ifdef CONFIG_SSB_PCIHOST return pci_dma_mapping_error(dev->bus->host_pci, addr); +#endif + break; case SSB_BUSTYPE_SSB: return dma_mapping_error(dev->dev, addr); default: - __ssb_dma_not_implemented(dev); + break; }
all these functions now read:
default: break;
seems kind of pointless ... why not just drop that case completely
otherwise looks good, thanks
-mike
Quoted 13 lines · On Thursday 06 November 2008 22:16:00 Mike Frysinger wrote:
Quoted 12 lines · Michael Buesch
include/linux/ssb/ssb.h 2008-11-06 21:45:37.000000000 +0100 renamed from include/linux/ssb/ssb.h 2008-08-01 17:26:05.000000000 +0200 +3
-0@@ -427,12 +427,16 @@ static inline int ssb_dma_mapping_error( { switch (dev->bus->bustype) { case SSB_BUSTYPE_PCI: +#ifdef CONFIG_SSB_PCIHOST return pci_dma_mapping_error(dev->bus->host_pci, addr); +#endif + break; case SSB_BUSTYPE_SSB: return dma_mapping_error(dev->dev, addr);
Quoted 8 lines
include/linux/ssb/ssb.h 2008-11-06 21:45:37.000000000 +0100 static inline int ssb_dma_mapping_error( · line 438
Quoted 4 lines
include/linux/ssb/ssb.h 2008-11-06 21:45:37.000000000 +0100 renamed from include/linux/ssb/ssb.h 2008-08-01 17:26:05.000000000 +0200 +1
-1default: - __ssb_dma_not_implemented(dev); + break; }all these functions now read:
default: break;
seems kind of pointless ... why not just drop that case completely
Because the compiler complains "not handled all cases...". And yes, we do want to trigger __ssb_dma_not_implemented() for these cases.
Signature · 1 line
Greetings Michael.
Quoted 23 lines · On Thu, 6 Nov 2008 22:23:09 +0100 Michael Buesch <[email protected]> wrote:
Quoted 13 lines · On Thursday 06 November 2008 22:16:00 Mike Frysinger wrote:
Quoted 12 lines · Michael Buesch
include/linux/ssb/ssb.h 2008-11-06 21:45:37.000000000 +0100 renamed from include/linux/ssb/ssb.h 2008-08-01 17:26:05.000000000 +0200 +3
-0@@ -427,12 +427,16 @@ static inline int ssb_dma_mapping_error( { switch (dev->bus->bustype) { case SSB_BUSTYPE_PCI: +#ifdef CONFIG_SSB_PCIHOST return pci_dma_mapping_error(dev->bus->host_pci, addr); +#endif + break; case SSB_BUSTYPE_SSB: return dma_mapping_error(dev->dev, addr);Quoted 8 lines
include/linux/ssb/ssb.h 2008-11-06 21:45:37.000000000 +0100 static inline int ssb_dma_mapping_error( · line 438
Quoted 4 lines
include/linux/ssb/ssb.h 2008-11-06 21:45:37.000000000 +0100 renamed from include/linux/ssb/ssb.h 2008-08-01 17:26:05.000000000 +0200 +1
-1default: - __ssb_dma_not_implemented(dev); + break; }all these functions now read:
default: break;
seems kind of pointless ... why not just drop that case completely
Quoted 3 lines
Because the compiler complains "not handled all cases...". And yes, we do want to trigger
__ssb_dma_not_implemented()for these cases.
Please always quote the compiler error messages when fixing build errors. It is unobvious what the problems are here. I could struggle away and create a CONFIG_PCI=n build, but what .c file do I need to compile? Dunno.
All those ifdefs are nasty. Couldn't we do something like:
#ifdef CONFIG_SSB_PCIHOST
static inline intssb_pci_dma_mapping_error(structy pci_dev *host_pci, dma_addr_t addr)
{
return pci_dma_mapping_error(host_pci, addr);
}#else
static inline intssb_pci_dma_mapping_error(structy pci_dev *host_pci, dma_addr_t addr)
{
return -ENOSYS;
}#endif
(etc)
and then leave the __ssb_dma_not_implemented() calls under the default:
case in the switch statements?