Messages in this thread Patch in this message | | | Subject | Re: [PATCH 1/3] firmware: allow firmware files to be built into kernel image | From | David Woodhouse <> | Date | Fri, 23 May 2008 22:04:32 +0100 |
| |
On Fri, 2008-05-23 at 21:31 +0100, Alan Cox wrote: > It saves us a lot of memory in several cases where the drivers hang onto > the firmware so I definitely think we should fix the folks assuming they > can widdle on the firmware. That doesn't look hard to do and could save > 50K+ on many systems.
Hm, ok. Do you see any better fix than this for cxusb.c ?
--- cxusb.c~ 2008-04-13 13:38:13.000000000 +0100 +++ cxusb.c 2008-05-23 22:01:31.000000000 +0100 @@ -23,6 +23,8 @@ * * see Documentation/dvb/README.dvb-usb for more information */ +#include <linux/vmalloc.h> + #include "cxusb.h" #include "cx22702.h" @@ -695,12 +697,26 @@ static int bluebird_patch_dvico_firmware if (fw->data[idoff] == (USB_VID_DVICO & 0xff) && fw->data[idoff + 1] == USB_VID_DVICO >> 8) { - fw->data[idoff + 2] = + struct firmware new_fw; + u8 *new_fw_data = vmalloc(fw->size); + int ret; + + if (!new_fw_data) + return -ENOMEM; + + memcpy(new_fw_data, fw->data, fw->size); + new_fw.size = fw->size; + new_fw.data = fw->data; + + new_fw_data[idoff + 2] = le16_to_cpu(udev->descriptor.idProduct) + 1; - fw->data[idoff + 3] = + new_fw_data[idoff + 3] = le16_to_cpu(udev->descriptor.idProduct) >> 8; - return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2); + ret = usb_cypress_load_firmware(udev, &new_fw, + CYPRESS_FX2); + vfree(new_fw_data); + return ret; } } -- dwmw2
| |