genode/repos/dde_linux/patches/usb_mem.patch

328 lines
10 KiB
Diff

commit 91eb4a3e68978feca81f6a5bc31cfcd7c683d628
Author: Sebastian Sumpf <sebastian.sumpf@genode-labs.com>
Date: Tue Mar 15 09:59:11 2016 +0100
mem
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 5dd426f..6b4294a 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -841,7 +841,7 @@ static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid)
&usbhid->inbuf_dma);
usbhid->outbuf = usb_alloc_coherent(dev, usbhid->bufsize, GFP_KERNEL,
&usbhid->outbuf_dma);
- usbhid->cr = kmalloc(sizeof(*usbhid->cr), GFP_KERNEL);
+ usbhid->cr = kmalloc(sizeof(*usbhid->cr), GFP_LX_DMA);
usbhid->ctrlbuf = usb_alloc_coherent(dev, usbhid->bufsize, GFP_KERNEL,
&usbhid->ctrlbuf_dma);
if (!usbhid->inbuf || !usbhid->outbuf || !usbhid->cr ||
@@ -1013,7 +1013,7 @@ static int usbhid_parse(struct hid_device *hid)
return -EINVAL;
}
- if (!(rdesc = kmalloc(rsize, GFP_KERNEL))) {
+ if (!(rdesc = kmalloc(rsize, GFP_LX_DMA))) {
dbg_hid("couldn't allocate rdesc memory\n");
return -ENOMEM;
}
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 0744bf2..6237370 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -229,7 +229,7 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf)
period = max ((int) dev->status->desc.bInterval,
(dev->udev->speed == USB_SPEED_HIGH) ? 7 : 3);
- buf = kmalloc (maxp, GFP_KERNEL);
+ buf = kmalloc (maxp, GFP_LX_DMA);
if (buf) {
dev->interrupt = usb_alloc_urb (0, GFP_KERNEL);
if (!dev->interrupt) {
@@ -1916,7 +1916,7 @@ static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
cmd, reqtype, value, index, size);
if (data) {
- buf = kmalloc(size, GFP_KERNEL);
+ buf = kmalloc(size, GFP_LX_DMA);
if (!buf)
goto out;
}
@@ -1943,7 +1943,7 @@ static int __usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
cmd, reqtype, value, index, size);
if (data) {
- buf = kmemdup(data, size, GFP_KERNEL);
+ buf = kmemdup(data, size, GFP_LX_DMA);
if (!buf)
goto out;
}
@@ -2192,7 +2192,7 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
}
if (data) {
- buf = kmemdup(data, size, GFP_ATOMIC);
+ buf = kmemdup(data, size, GFP_LX_DMA);
if (!buf) {
netdev_err(dev->net, "Error allocating buffer"
" in %s!\n", __func__);
@@ -2200,7 +2200,7 @@ int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
}
}
- req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
+ req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_LX_DMA);
if (!req)
goto fail_free_buf;
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 5050760..9ac55f9 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -695,7 +695,7 @@ int usb_get_configuration(struct usb_device *dev)
if (!dev->rawdescriptors)
goto err2;
- desc = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL);
+ desc = kmalloc(USB_DT_CONFIG_SIZE, GFP_LX_DMA);
if (!desc)
goto err2;
@@ -724,7 +724,7 @@ int usb_get_configuration(struct usb_device *dev)
USB_DT_CONFIG_SIZE);
/* Now that we know the length, get the whole thing */
- bigbuffer = kmalloc(length, GFP_KERNEL);
+ bigbuffer = kmalloc(length, GFP_LX_DMA);
if (!bigbuffer) {
result = -ENOMEM;
goto err;
@@ -786,7 +786,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
int length, total_len, num, i;
int ret;
- bos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL);
+ bos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_LX_DMA);
if (!bos)
return -ENOMEM;
@@ -812,7 +812,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
return -ENOMEM;
/* Now let's get the whole BOS descriptor set */
- buffer = kzalloc(total_len, GFP_KERNEL);
+ buffer = kzalloc(total_len, GFP_LX_DMA);
if (!buffer) {
ret = -ENOMEM;
goto err;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 1560f3f..54e99b5 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1365,20 +1365,20 @@ static int hub_configure(struct usb_hub *hub,
unsigned full_load;
unsigned maxchild;
- hub->buffer = kmalloc(sizeof(*hub->buffer), GFP_KERNEL);
+ hub->buffer = kmalloc(sizeof(*hub->buffer), GFP_LX_DMA);
if (!hub->buffer) {
ret = -ENOMEM;
goto fail;
}
- hub->status = kmalloc(sizeof(*hub->status), GFP_KERNEL);
+ hub->status = kmalloc(sizeof(*hub->status), GFP_LX_DMA);
if (!hub->status) {
ret = -ENOMEM;
goto fail;
}
mutex_init(&hub->status_mutex);
- hub->descriptor = kmalloc(sizeof(*hub->descriptor), GFP_KERNEL);
+ hub->descriptor = kmalloc(sizeof(*hub->descriptor), GFP_LX_DMA);
if (!hub->descriptor) {
ret = -ENOMEM;
goto fail;
@@ -4586,7 +4586,7 @@ check_highspeed(struct usb_hub *hub, struct usb_device *udev, int port1)
if (udev->quirks & USB_QUIRK_DEVICE_QUALIFIER)
return;
- qual = kmalloc(sizeof *qual, GFP_KERNEL);
+ qual = kmalloc(sizeof *qual, GFP_LX_DMA);
if (qual == NULL)
return;
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 8e641b5..5807f68 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -942,7 +942,7 @@ int usb_get_device_descriptor(struct usb_device *dev, unsigned int size)
int usb_get_status(struct usb_device *dev, int type, int target, void *data)
{
int ret;
- __le16 *status = kmalloc(sizeof(*status), GFP_KERNEL);
+ __le16 *status = kmalloc(sizeof(*status), GFP_LX_DMA);
if (!status)
return -ENOMEM;
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index b6205fa..99cae0f 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -82,7 +82,7 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
struct ehci_qh *qh;
dma_addr_t dma;
- qh = kzalloc(sizeof *qh, GFP_ATOMIC);
+ qh = kzalloc(sizeof *qh, GFP_LX_DMA);
if (!qh)
goto done;
qh->hw = (struct ehci_qh_hw *)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 776d59c..e32db7b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1354,7 +1354,7 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags)
size = 1;
urb_priv = kzalloc(sizeof(struct urb_priv) +
- size * sizeof(struct xhci_td *), mem_flags);
+ size * sizeof(struct xhci_td *), GFP_LX_DMA);
if (!urb_priv)
return -ENOMEM;
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 43576ed..2b13b4e 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -450,7 +450,7 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf)
usb_set_intfdata(intf, us);
/* Allocate the control/setup and DMA-mapped buffers */
- us->cr = kmalloc(sizeof(*us->cr), GFP_KERNEL);
+ us->cr = kmalloc(sizeof(*us->cr), GFP_LX_DMA);
if (!us->cr)
return -ENOMEM;
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -325,7 +325,7 @@
if (td->mtclass.name != MT_CLS_WIN_8)
return;
- buf = hid_alloc_report_buf(report, GFP_KERNEL);
+ buf = hid_alloc_report_buf(report, GFP_LX_DMA);
if (!buf)
return;
@@ -912,7 +912,7 @@
if (r) {
if (cls->quirks & MT_QUIRK_FORCE_GET_FEATURE) {
report_len = hid_report_len(r);
- buf = hid_alloc_report_buf(r, GFP_KERNEL);
+ buf = hid_alloc_report_buf(r, GFP_LX_DMA);
if (!buf) {
hid_err(hdev, "failed to allocate buffer for report\n");
return;
@@ -1043,7 +1043,7 @@
if (suffix) {
name = devm_kzalloc(&hi->input->dev,
strlen(hdev->name) + strlen(suffix) + 2,
- GFP_KERNEL);
+ GFP_LX_DMA);
if (name) {
sprintf(name, "%s %s", hdev->name, suffix);
hi->input->name = name;
@@ -1096,7 +1096,7 @@
*/
hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
- td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL);
+ td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_LX_DMA);
if (!td) {
dev_err(&hdev->dev, "cannot allocate multitouch data\n");
return -ENOMEM;
@@ -1110,7 +1110,7 @@
hid_set_drvdata(hdev, td);
td->fields = devm_kzalloc(&hdev->dev, sizeof(struct mt_fields),
- GFP_KERNEL);
+ GFP_LX_DMA);
if (!td->fields) {
dev_err(&hdev->dev, "cannot allocate multitouch fields data\n");
return -ENOMEM;
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -124,7 +124,7 @@
/* leave touch_max as is if predefined */
if (!features->touch_max) {
/* read manually */
- data = kzalloc(2, GFP_KERNEL);
+ data = kzalloc(2, GFP_LX_DMA);
if (!data)
break;
data[0] = field->report->id;
@@ -328,7 +328,7 @@
unsigned char *rep_data;
int error = -ENOMEM, limit = 0;
- rep_data = kzalloc(length, GFP_KERNEL);
+ rep_data = kzalloc(length, GFP_LX_DMA);
if (!rep_data)
return error;
@@ -530,7 +530,7 @@
data = wacom_get_hdev_data(hdev);
if (!data) {
- data = kzalloc(sizeof(struct wacom_hdev_data), GFP_KERNEL);
+ data = kzalloc(sizeof(struct wacom_hdev_data), GFP_LX_DMA);
if (!data) {
retval = -ENOMEM;
goto out;
@@ -595,7 +595,7 @@
report_id = WAC_CMD_WL_LED_CONTROL;
buf_size = 13;
}
- buf = kzalloc(buf_size, GFP_KERNEL);
+ buf = kzalloc(buf_size, GFP_LX_DMA);
if (!buf)
return -ENOMEM;
@@ -648,7 +648,7 @@
int i, retval;
const unsigned chunk_len = len / 4; /* 4 chunks are needed to be sent */
- buf = kzalloc(chunk_len + 3 , GFP_KERNEL);
+ buf = kzalloc(chunk_len + 3 , GFP_LX_DMA);
if (!buf)
return -ENOMEM;
@@ -1176,7 +1176,7 @@
wacom_wac->serial[index] = serial;
- buf = kzalloc(WAC_REMOTE_SERIAL_MAX_STRLEN, GFP_KERNEL);
+ buf = kzalloc(WAC_REMOTE_SERIAL_MAX_STRLEN, GFP_LX_DMA);
if (!buf)
return -ENOMEM;
snprintf(buf, WAC_REMOTE_SERIAL_MAX_STRLEN, "%d", serial);
@@ -1222,7 +1222,7 @@
unsigned char *buf;
int retval;
- buf = kzalloc(buf_size, GFP_KERNEL);
+ buf = kzalloc(buf_size, GFP_LX_DMA);
if (!buf)
return -ENOMEM;
@@ -1705,7 +1705,7 @@
/* hid-core sets this quirk for the boot interface */
hdev->quirks &= ~HID_QUIRK_NOGET;
- wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
+ wacom = kzalloc(sizeof(struct wacom), GFP_LX_DMA);
if (!wacom)
return -ENOMEM;