diff options
-rw-r--r-- | drivers/dma/acpi-dma.c | 15 | ||||
-rw-r--r-- | drivers/dma/dmaengine.c | 9 | ||||
-rw-r--r-- | include/linux/acpi_dma.h | 5 |
3 files changed, 13 insertions, 16 deletions
diff --git a/drivers/dma/acpi-dma.c b/drivers/dma/acpi-dma.c index 1fda371af4b7..de361a156b34 100644 --- a/drivers/dma/acpi-dma.c +++ b/drivers/dma/acpi-dma.c | |||
@@ -13,6 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/err.h> | ||
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
17 | #include <linux/list.h> | 18 | #include <linux/list.h> |
18 | #include <linux/mutex.h> | 19 | #include <linux/mutex.h> |
@@ -343,7 +344,7 @@ static int acpi_dma_parse_fixed_dma(struct acpi_resource *res, void *data) | |||
343 | * @index: index of FixedDMA descriptor for @dev | 344 | * @index: index of FixedDMA descriptor for @dev |
344 | * | 345 | * |
345 | * Return: | 346 | * Return: |
346 | * Pointer to appropriate dma channel on success or NULL on error. | 347 | * Pointer to appropriate dma channel on success or an error pointer. |
347 | */ | 348 | */ |
348 | struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev, | 349 | struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev, |
349 | size_t index) | 350 | size_t index) |
@@ -358,10 +359,10 @@ struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev, | |||
358 | 359 | ||
359 | /* Check if the device was enumerated by ACPI */ | 360 | /* Check if the device was enumerated by ACPI */ |
360 | if (!dev || !ACPI_HANDLE(dev)) | 361 | if (!dev || !ACPI_HANDLE(dev)) |
361 | return NULL; | 362 | return ERR_PTR(-ENODEV); |
362 | 363 | ||
363 | if (acpi_bus_get_device(ACPI_HANDLE(dev), &adev)) | 364 | if (acpi_bus_get_device(ACPI_HANDLE(dev), &adev)) |
364 | return NULL; | 365 | return ERR_PTR(-ENODEV); |
365 | 366 | ||
366 | memset(&pdata, 0, sizeof(pdata)); | 367 | memset(&pdata, 0, sizeof(pdata)); |
367 | pdata.index = index; | 368 | pdata.index = index; |
@@ -376,7 +377,7 @@ struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev, | |||
376 | acpi_dev_free_resource_list(&resource_list); | 377 | acpi_dev_free_resource_list(&resource_list); |
377 | 378 | ||
378 | if (dma_spec->slave_id < 0 || dma_spec->chan_id < 0) | 379 | if (dma_spec->slave_id < 0 || dma_spec->chan_id < 0) |
379 | return NULL; | 380 | return ERR_PTR(-ENODEV); |
380 | 381 | ||
381 | mutex_lock(&acpi_dma_lock); | 382 | mutex_lock(&acpi_dma_lock); |
382 | 383 | ||
@@ -399,7 +400,7 @@ struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev, | |||
399 | } | 400 | } |
400 | 401 | ||
401 | mutex_unlock(&acpi_dma_lock); | 402 | mutex_unlock(&acpi_dma_lock); |
402 | return chan; | 403 | return chan ? chan : ERR_PTR(-EPROBE_DEFER); |
403 | } | 404 | } |
404 | EXPORT_SYMBOL_GPL(acpi_dma_request_slave_chan_by_index); | 405 | EXPORT_SYMBOL_GPL(acpi_dma_request_slave_chan_by_index); |
405 | 406 | ||
@@ -413,7 +414,7 @@ EXPORT_SYMBOL_GPL(acpi_dma_request_slave_chan_by_index); | |||
413 | * the first FixedDMA descriptor is TX and second is RX. | 414 | * the first FixedDMA descriptor is TX and second is RX. |
414 | * | 415 | * |
415 | * Return: | 416 | * Return: |
416 | * Pointer to appropriate dma channel on success or NULL on error. | 417 | * Pointer to appropriate dma channel on success or an error pointer. |
417 | */ | 418 | */ |
418 | struct dma_chan *acpi_dma_request_slave_chan_by_name(struct device *dev, | 419 | struct dma_chan *acpi_dma_request_slave_chan_by_name(struct device *dev, |
419 | const char *name) | 420 | const char *name) |
@@ -425,7 +426,7 @@ struct dma_chan *acpi_dma_request_slave_chan_by_name(struct device *dev, | |||
425 | else if (!strcmp(name, "rx")) | 426 | else if (!strcmp(name, "rx")) |
426 | index = 1; | 427 | index = 1; |
427 | else | 428 | else |
428 | return NULL; | 429 | return ERR_PTR(-ENODEV); |
429 | 430 | ||
430 | return acpi_dma_request_slave_chan_by_index(dev, index); | 431 | return acpi_dma_request_slave_chan_by_index(dev, index); |
431 | } | 432 | } |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index ed610b497518..a886713937fd 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -627,18 +627,13 @@ EXPORT_SYMBOL_GPL(__dma_request_channel); | |||
627 | struct dma_chan *dma_request_slave_channel_reason(struct device *dev, | 627 | struct dma_chan *dma_request_slave_channel_reason(struct device *dev, |
628 | const char *name) | 628 | const char *name) |
629 | { | 629 | { |
630 | struct dma_chan *chan; | ||
631 | |||
632 | /* If device-tree is present get slave info from here */ | 630 | /* If device-tree is present get slave info from here */ |
633 | if (dev->of_node) | 631 | if (dev->of_node) |
634 | return of_dma_request_slave_channel(dev->of_node, name); | 632 | return of_dma_request_slave_channel(dev->of_node, name); |
635 | 633 | ||
636 | /* If device was enumerated by ACPI get slave info from here */ | 634 | /* If device was enumerated by ACPI get slave info from here */ |
637 | if (ACPI_HANDLE(dev)) { | 635 | if (ACPI_HANDLE(dev)) |
638 | chan = acpi_dma_request_slave_chan_by_name(dev, name); | 636 | return acpi_dma_request_slave_chan_by_name(dev, name); |
639 | if (chan) | ||
640 | return chan; | ||
641 | } | ||
642 | 637 | ||
643 | return ERR_PTR(-ENODEV); | 638 | return ERR_PTR(-ENODEV); |
644 | } | 639 | } |
diff --git a/include/linux/acpi_dma.h b/include/linux/acpi_dma.h index fb0298082916..329436d38e66 100644 --- a/include/linux/acpi_dma.h +++ b/include/linux/acpi_dma.h | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
18 | #include <linux/device.h> | 18 | #include <linux/device.h> |
19 | #include <linux/err.h> | ||
19 | #include <linux/dmaengine.h> | 20 | #include <linux/dmaengine.h> |
20 | 21 | ||
21 | /** | 22 | /** |
@@ -103,12 +104,12 @@ static inline void devm_acpi_dma_controller_free(struct device *dev) | |||
103 | static inline struct dma_chan *acpi_dma_request_slave_chan_by_index( | 104 | static inline struct dma_chan *acpi_dma_request_slave_chan_by_index( |
104 | struct device *dev, size_t index) | 105 | struct device *dev, size_t index) |
105 | { | 106 | { |
106 | return NULL; | 107 | return ERR_PTR(-ENODEV); |
107 | } | 108 | } |
108 | static inline struct dma_chan *acpi_dma_request_slave_chan_by_name( | 109 | static inline struct dma_chan *acpi_dma_request_slave_chan_by_name( |
109 | struct device *dev, const char *name) | 110 | struct device *dev, const char *name) |
110 | { | 111 | { |
111 | return NULL; | 112 | return ERR_PTR(-ENODEV); |
112 | } | 113 | } |
113 | 114 | ||
114 | #define acpi_dma_simple_xlate NULL | 115 | #define acpi_dma_simple_xlate NULL |