On Thu, 2006-07-06 at 16:21 +0200, Martin Langer wrote:

> There was only one reason. It's easier to add new signatures into the 
> table. But kernel stuff should be speed optimized. I will change it.

Well, it's not that much difference between something like
  md5sum file
and
  md5sum file | sed 's/\(.*\) .*/\1/ ; s/\(..\)/0x\1, /g'
:P


> There's a general firmware part which returns a s32 version number. This 
> can be used by all drivers (not only bcm43xx!!). And the driver specific 
> part transforms s32 into the broadcom number. That part is completely 
> placed in the bcm43xx code. Was that your problem? I guess I 
> misunderstood it in the former mail. 

Ah right, I see now.

> The real problem is that each company has it's own version scheme. 
> That's why I took that transformation. I don't want to put 
> maj,min,rc,patchlevel into the firmware_class.c file.

Yeah. You have a signedness issue. The function returns an s32 but the
struct lists a u32.

How about making it a void* instead? Like

struct firmware_hash_table {
        u8 signature[16];
        void* value;
};

Then we can use a NULL pointer to indicate end-of-array (for the input)
or not-found (for output), and those that know that their values are
going to fit into a pointer like bcm43xx can encode them in there right
away:

#define VERSION_PTR(a,b,c,d) ((void*) (((a)<<24) | ((b)<<16) | ((c)<<8) | (d))

struct firmware_hash_table bcm43xx_firmware_versions[] = {
{ {0x44, 0xc5, 0xa5, 0x28, 0xcb, 0x3b, 0x43, 0x08, 0x9c, 0x1f, 0x4b, 0x56, 
0x2b, 0x66, 0x0d, 0xc7 }, VERSION_PTR(3,130,20,0) },
...,
{} /* terminate array */
};

johannes

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to