[lkml]   [2001]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Newbie idiotic questions.
On 16 Jun 2001, Bill Pringlemeir wrote:

> I have been looking at the emu10k1 driver and I had a few questions
> about general idioms used there.
> In a line like this,
> [main.c, line 175]
> for (count = 0; count < sizeof(card->digmix) / sizeof(card->digmix[0]); count++) {
> Isn't there some sort of `ALEN' macro available, or is this
> considered to muddy things by using a macro?

Note that code in drivers range from very nice to awful, and every level
in between.

I generally use a macro called ArraySize(), defined up-front.

> [main.c, line 223]
> if ((card->mpuout = kmalloc(sizeof(struct emu10k1_mpuout), GFP_KERNEL))
> Why is the struct type referenced for the allocation size? Why not,
> if ((card->mpuout = kmalloc(sizeof(card->mpuout), GFP_KERNEL))
> This seems to get the size for the actual object being allocated.

Again, you are correct. However, you may not know the history of the
driver. Perhaps at one time the above statement was correct.

> [cardmi.c, line 42]
> static struct {
> int (*Fn) (struct emu10k1_mpuin *, u8);
> } midistatefn[] = {
> ...


> regards,
> Bill Pringlemeir.

What you should do is supply a patch. Call it a "general cleanup". Send
it first to the maintainer of the driver. If this doesn't work, send it
to linux-kernel. Test your patch well because you may fix something that
breaks something else.

Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:55    [W:0.108 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site