Merge branch 'davinci-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.git] / drivers / char / hvc_iucv.c
index 21681a81cc35d6ee5cc5a09ac5d37e8be7ce5e15..5a80ad68ef22c259a734c2ae987cf5375aafda55 100644 (file)
@@ -12,6 +12,7 @@
 #define pr_fmt(fmt)            KMSG_COMPONENT ": " fmt
 
 #include <linux/types.h>
+#include <linux/slab.h>
 #include <asm/ebcdic.h>
 #include <linux/ctype.h>
 #include <linux/delay.h>
@@ -139,6 +140,8 @@ struct hvc_iucv_private *hvc_iucv_get_private(uint32_t num)
  *
  * This function allocates a new struct iucv_tty_buffer element and, optionally,
  * allocates an internal data buffer with the specified size @size.
+ * The internal data buffer is always allocated with GFP_DMA which is
+ * required for receiving and sending data with IUCV.
  * Note: The total message size arises from the internal buffer size and the
  *      members of the iucv_tty_msg structure.
  * The function returns NULL if memory allocation has failed.
@@ -154,7 +157,7 @@ static struct iucv_tty_buffer *alloc_tty_buffer(size_t size, gfp_t flags)
 
        if (size > 0) {
                bufp->msg.length = MSG_SIZE(size);
-               bufp->mbuf = kmalloc(bufp->msg.length, flags);
+               bufp->mbuf = kmalloc(bufp->msg.length, flags | GFP_DMA);
                if (!bufp->mbuf) {
                        mempool_free(bufp, hvc_iucv_mempool);
                        return NULL;
@@ -237,7 +240,7 @@ static int hvc_iucv_write(struct hvc_iucv_private *priv,
        if (!rb->mbuf) { /* message not yet received ... */
                /* allocate mem to store msg data; if no memory is available
                 * then leave the buffer on the list and re-try later */
-               rb->mbuf = kmalloc(rb->msg.length, GFP_ATOMIC);
+               rb->mbuf = kmalloc(rb->msg.length, GFP_ATOMIC | GFP_DMA);
                if (!rb->mbuf)
                        return -ENOMEM;