Messages in this thread | | | Subject | Re: [PATCH 1/3] firmware: allow firmware files to be built into kernel image | From | David Woodhouse <> | Date | Fri, 23 May 2008 20:14:07 +0100 |
| |
On Fri, 2008-05-23 at 16:33 +0100, Alan Cox wrote: > > Yeah, I thought about that. I was slightly concerned that drivers might > > actually try to _modify_ the firmware they loaded, though. As it is, > > there's no fundamental reason why they shouldn't do that. > > I've not seen any that do and judicious use of "const" should catch > offenders.
Like this one...
static const int dvico_firmware_id_offsets[] = { 6638, 3204 }; static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const struct firmware *fw) { int pos;
for (pos = 0; pos < ARRAY_SIZE(dvico_firmware_id_offsets); pos++) { int idoff = dvico_firmware_id_offsets[pos];
if (fw->size < idoff + 4) continue;
if (fw->data[idoff] == (USB_VID_DVICO & 0xff) && fw->data[idoff + 1] == USB_VID_DVICO >> 8) { fw->data[idoff + 2] = le16_to_cpu(udev->descriptor.idProduct) + 1; fw->data[idoff + 3] = le16_to_cpu(udev->descriptor.idProduct) >> 8;
return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2); } }
return -EINVAL; }
-- dwmw2
| |