dma-mapping updates for 4.17:
- provide proper stubs for architectures not supporting dma (Geert) -----BEGIN PGP SIGNATURE----- iQI/BAABCgApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAlrF6W0LHGhjaEBsc3Qu ZGUACgkQD55TZVIEUYP95g/+MzIYRXboccCCjGXlgW188diLjjpcI6gdOSpgf8kD FB6XDobkXa1mpFaauFYfKJMhcwZF2kW/o9FnT1/IHd6x6N9OIDuxCYuGeHGGVSbU TrH2BUZp3gdhlgOOCNJ8vIETtW2ZoUxAWF+sAH8snR/8x8/sc1bn1QPS+Xwm8RkJ WaksYeGhN0exYHFWJ5e6dT84TtwojfF+jnFOiYR7jLMGqezAsaOMNI/EhqhQrh1a IbZCoeCKZRiTiOLIdFleTp0Ks+AIXvLGdSNrQq/NFuCceQJtkEHkts0MyZaSkSOT bL1ee5bDxcy5A1Fs6YsiddLuY/SPUbB3Mgfhol5wAYVp7KlwaqaXAT0oq8Vzlfsr MiH8yyqvU6DbWoXRs3QUb8lwgPTNEq2mIOva+QSiVfhA+YUNcjDD0+DjW9sbrgDu 9QhFvQIzz1uaqViY0YvufniMrLsUcj3JNHNZyqqgtag4tR333KU1NBNj4Y5V58ep r/qevuvbyyvxQMW9dmY+2FEE7tmwAZIcEt3FNW4/Ot5ijLCTbylxP+auXC0NvUeA WK/ZvdaOXGHNaoFdbNUllBHWeR8CuCvnwugIzEgdkNsUp9J3m3DVsNMK5YoYBNzL UmwSVz4l014yu7+6oIxNb59VE8jGJsYLrarmECLCE/txUMLy2T0DCQpCjBvdYRoW Mgw= =1rou -----END PGP SIGNATURE----- Merge tag 'dma-mapping-4.17' of git://git.infradead.org/users/hch/dma-mapping Pull dma-mapping updates from Christoph Hellwig: "Very light this round as the interesting dma mapping changes went through the x86 tree. This just provides proper stubs for architectures not supporting dma (Geert Uytterhoeven)" * tag 'dma-mapping-4.17' of git://git.infradead.org/users/hch/dma-mapping: usb: gadget: Add NO_DMA dummies for DMA mapping API scsi: Add NO_DMA dummies for SCSI DMA mapping API mm: Add NO_DMA dummies for DMA pool API dma-coherent: Add NO_DMA dummies for managed DMA API dma-mapping: Convert NO_DMA get_dma_ops() into a real dummy
This commit is contained in:
commit
652ede37ce
|
@ -212,14 +212,14 @@ static inline void set_dma_ops(struct device *dev,
|
|||
}
|
||||
#else
|
||||
/*
|
||||
* Define the dma api to allow compilation but not linking of
|
||||
* dma dependent code. Code that depends on the dma-mapping
|
||||
* API needs to set 'depends on HAS_DMA' in its Kconfig
|
||||
* Define the dma api to allow compilation of dma dependent code.
|
||||
* Code that depends on the dma-mapping API needs to set 'depends on HAS_DMA'
|
||||
* in its Kconfig, unless it already depends on <something> || COMPILE_TEST,
|
||||
* where <something> guarantuees the availability of the dma-mapping API.
|
||||
*/
|
||||
extern const struct dma_map_ops bad_dma_ops;
|
||||
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
|
||||
{
|
||||
return &bad_dma_ops;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -772,10 +772,19 @@ static inline void dma_deconfigure(struct device *dev) {}
|
|||
/*
|
||||
* Managed DMA API
|
||||
*/
|
||||
#ifdef CONFIG_HAS_DMA
|
||||
extern void *dmam_alloc_coherent(struct device *dev, size_t size,
|
||||
dma_addr_t *dma_handle, gfp_t gfp);
|
||||
extern void dmam_free_coherent(struct device *dev, size_t size, void *vaddr,
|
||||
dma_addr_t dma_handle);
|
||||
#else /* !CONFIG_HAS_DMA */
|
||||
static inline void *dmam_alloc_coherent(struct device *dev, size_t size,
|
||||
dma_addr_t *dma_handle, gfp_t gfp)
|
||||
{ return NULL; }
|
||||
static inline void dmam_free_coherent(struct device *dev, size_t size,
|
||||
void *vaddr, dma_addr_t dma_handle) { }
|
||||
#endif /* !CONFIG_HAS_DMA */
|
||||
|
||||
extern void *dmam_alloc_attrs(struct device *dev, size_t size,
|
||||
dma_addr_t *dma_handle, gfp_t gfp,
|
||||
unsigned long attrs);
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
struct device;
|
||||
|
||||
#ifdef CONFIG_HAS_DMA
|
||||
|
||||
struct dma_pool *dma_pool_create(const char *name, struct device *dev,
|
||||
size_t size, size_t align, size_t allocation);
|
||||
|
||||
|
@ -23,13 +25,6 @@ void dma_pool_destroy(struct dma_pool *pool);
|
|||
|
||||
void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
|
||||
dma_addr_t *handle);
|
||||
|
||||
static inline void *dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags,
|
||||
dma_addr_t *handle)
|
||||
{
|
||||
return dma_pool_alloc(pool, mem_flags | __GFP_ZERO, handle);
|
||||
}
|
||||
|
||||
void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr);
|
||||
|
||||
/*
|
||||
|
@ -39,5 +34,26 @@ struct dma_pool *dmam_pool_create(const char *name, struct device *dev,
|
|||
size_t size, size_t align, size_t allocation);
|
||||
void dmam_pool_destroy(struct dma_pool *pool);
|
||||
|
||||
#else /* !CONFIG_HAS_DMA */
|
||||
static inline struct dma_pool *dma_pool_create(const char *name,
|
||||
struct device *dev, size_t size, size_t align, size_t allocation)
|
||||
{ return NULL; }
|
||||
static inline void dma_pool_destroy(struct dma_pool *pool) { }
|
||||
static inline void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
|
||||
dma_addr_t *handle) { return NULL; }
|
||||
static inline void dma_pool_free(struct dma_pool *pool, void *vaddr,
|
||||
dma_addr_t addr) { }
|
||||
static inline struct dma_pool *dmam_pool_create(const char *name,
|
||||
struct device *dev, size_t size, size_t align, size_t allocation)
|
||||
{ return NULL; }
|
||||
static inline void dmam_pool_destroy(struct dma_pool *pool) { }
|
||||
#endif /* !CONFIG_HAS_DMA */
|
||||
|
||||
static inline void *dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags,
|
||||
dma_addr_t *handle)
|
||||
{
|
||||
return dma_pool_alloc(pool, mem_flags | __GFP_ZERO, handle);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -806,6 +806,7 @@ int usb_otg_descriptor_init(struct usb_gadget *gadget,
|
|||
|
||||
/* utility to simplify map/unmap of usb_requests to/from DMA */
|
||||
|
||||
#ifdef CONFIG_HAS_DMA
|
||||
extern int usb_gadget_map_request_by_dev(struct device *dev,
|
||||
struct usb_request *req, int is_in);
|
||||
extern int usb_gadget_map_request(struct usb_gadget *gadget,
|
||||
|
@ -815,6 +816,17 @@ extern void usb_gadget_unmap_request_by_dev(struct device *dev,
|
|||
struct usb_request *req, int is_in);
|
||||
extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
|
||||
struct usb_request *req, int is_in);
|
||||
#else /* !CONFIG_HAS_DMA */
|
||||
static inline int usb_gadget_map_request_by_dev(struct device *dev,
|
||||
struct usb_request *req, int is_in) { return -ENOSYS; }
|
||||
static inline int usb_gadget_map_request(struct usb_gadget *gadget,
|
||||
struct usb_request *req, int is_in) { return -ENOSYS; }
|
||||
|
||||
static inline void usb_gadget_unmap_request_by_dev(struct device *dev,
|
||||
struct usb_request *req, int is_in) { }
|
||||
static inline void usb_gadget_unmap_request(struct usb_gadget *gadget,
|
||||
struct usb_request *req, int is_in) { }
|
||||
#endif /* !CONFIG_HAS_DMA */
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -174,8 +174,13 @@ extern void scsi_kunmap_atomic_sg(void *virt);
|
|||
|
||||
extern int scsi_init_io(struct scsi_cmnd *cmd);
|
||||
|
||||
#ifdef CONFIG_SCSI_DMA
|
||||
extern int scsi_dma_map(struct scsi_cmnd *cmd);
|
||||
extern void scsi_dma_unmap(struct scsi_cmnd *cmd);
|
||||
#else /* !CONFIG_SCSI_DMA */
|
||||
static inline int scsi_dma_map(struct scsi_cmnd *cmd) { return -ENOSYS; }
|
||||
static inline void scsi_dma_unmap(struct scsi_cmnd *cmd) { }
|
||||
#endif /* !CONFIG_SCSI_DMA */
|
||||
|
||||
static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue