[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1211576672.31212.6.camel@shinybook.infradead.org>
Date: Fri, 23 May 2008 22:04:32 +0100
From: David Woodhouse <dwmw2@...radead.org>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: Takashi Iwai <tiwai@...e.de>, linux-kernel@...r.kernel.org,
aoliva@...hat.com, Abhay Salunke <Abhay_Salunke@...l.com>,
kay.sievers@...y.org
Subject: Re: [PATCH 1/3] firmware: allow firmware files to be built into
kernel image
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists