lkml.org 
[lkml]   [2008]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/3] firmware: allow firmware files to be built into kernel image
From
Date
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



\
 
 \ /
  Last update: 2008-05-23 21:17    [W:0.137 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site