aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/hvc_iucv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/hvc_iucv.c')
-rw-r--r--drivers/char/hvc_iucv.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/char/hvc_iucv.c b/drivers/char/hvc_iucv.c
index b8a5d654d3d0..5a80ad68ef22 100644
--- a/drivers/char/hvc_iucv.c
+++ b/drivers/char/hvc_iucv.c
@@ -12,6 +12,7 @@
12#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 12#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/slab.h>
15#include <asm/ebcdic.h> 16#include <asm/ebcdic.h>
16#include <linux/ctype.h> 17#include <linux/ctype.h>
17#include <linux/delay.h> 18#include <linux/delay.h>
@@ -139,6 +140,8 @@ struct hvc_iucv_private *hvc_iucv_get_private(uint32_t num)
139 * 140 *
140 * This function allocates a new struct iucv_tty_buffer element and, optionally, 141 * This function allocates a new struct iucv_tty_buffer element and, optionally,
141 * allocates an internal data buffer with the specified size @size. 142 * allocates an internal data buffer with the specified size @size.
143 * The internal data buffer is always allocated with GFP_DMA which is
144 * required for receiving and sending data with IUCV.
142 * Note: The total message size arises from the internal buffer size and the 145 * Note: The total message size arises from the internal buffer size and the
143 * members of the iucv_tty_msg structure. 146 * members of the iucv_tty_msg structure.
144 * The function returns NULL if memory allocation has failed. 147 * 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)
154 157
155 if (size > 0) { 158 if (size > 0) {
156 bufp->msg.length = MSG_SIZE(size); 159 bufp->msg.length = MSG_SIZE(size);
157 bufp->mbuf = kmalloc(bufp->msg.length, flags); 160 bufp->mbuf = kmalloc(bufp->msg.length, flags | GFP_DMA);
158 if (!bufp->mbuf) { 161 if (!bufp->mbuf) {
159 mempool_free(bufp, hvc_iucv_mempool); 162 mempool_free(bufp, hvc_iucv_mempool);
160 return NULL; 163 return NULL;
@@ -237,7 +240,7 @@ static int hvc_iucv_write(struct hvc_iucv_private *priv,
237 if (!rb->mbuf) { /* message not yet received ... */ 240 if (!rb->mbuf) { /* message not yet received ... */
238 /* allocate mem to store msg data; if no memory is available 241 /* allocate mem to store msg data; if no memory is available
239 * then leave the buffer on the list and re-try later */ 242 * then leave the buffer on the list and re-try later */
240 rb->mbuf = kmalloc(rb->msg.length, GFP_ATOMIC); 243 rb->mbuf = kmalloc(rb->msg.length, GFP_ATOMIC | GFP_DMA);
241 if (!rb->mbuf) 244 if (!rb->mbuf)
242 return -ENOMEM; 245 return -ENOMEM;
243 246
@@ -922,7 +925,7 @@ static int hvc_iucv_pm_restore_thaw(struct device *dev)
922 925
923 926
924/* HVC operations */ 927/* HVC operations */
925static struct hv_ops hvc_iucv_ops = { 928static const struct hv_ops hvc_iucv_ops = {
926 .get_chars = hvc_iucv_get_chars, 929 .get_chars = hvc_iucv_get_chars,
927 .put_chars = hvc_iucv_put_chars, 930 .put_chars = hvc_iucv_put_chars,
928 .notifier_add = hvc_iucv_notifier_add, 931 .notifier_add = hvc_iucv_notifier_add,
@@ -931,7 +934,7 @@ static struct hv_ops hvc_iucv_ops = {
931}; 934};
932 935
933/* Suspend / resume device operations */ 936/* Suspend / resume device operations */
934static struct dev_pm_ops hvc_iucv_pm_ops = { 937static const struct dev_pm_ops hvc_iucv_pm_ops = {
935 .freeze = hvc_iucv_pm_freeze, 938 .freeze = hvc_iucv_pm_freeze,
936 .thaw = hvc_iucv_pm_restore_thaw, 939 .thaw = hvc_iucv_pm_restore_thaw,
937 .restore = hvc_iucv_pm_restore_thaw, 940 .restore = hvc_iucv_pm_restore_thaw,