[lkml]   [2002]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: another IDE cleanup: kill duplicated code
Pavel Machek wrote:

>>>Well, after looking at yours code close engough I have one advice for
>>>you as well: LEARN C.
>>I specialize in storage, and C is self taught.
>Okay, few things to keep in mind:
>*) cut-copy-paste is bad. If you fix error in one copy, it is _very_
>easy not to fix it in other copies.
>*) void *'s and casts are bad. They hide real errors. If you have
>struct foo {} bar;
>and want
>bar * baz;
>You can write it as struct foo * baz. That will make type checks
>actually work and save you lot of casts.
>*) hungarian notation is considered evil in kernel.
>struct bla_s {} bla_t;
>*is* evil -- why have two types when one is enough? In kernel land,
>right way is to do
>struct bla {};
>and then use "struct bla" everywhere you'd use bla_t. It might be
>slightly longer, but it helps you with casts (above) and everyone can
>see what is going on.

Add the following:
Silly code like that:

ide_add_setting(drive, "bios_cyl",
ide_add_setting(drive, "bios_sect",
ide_add_setting(drive, "bswap",
ide_add_setting(drive, "multcount", id ? SETTING_RW

Can be replaced with somthing along:

struct resource_record {
} rr = {
{ asjdkasdh, asdjhasjkd, asdjhjaskd }
{ asdjaksd, adsjaksd, asdhjasdhasd }


for (i; i < nuofmemebers(rr); ++i )

to save you *a lot* of push stack call function and so on...

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 13:24    [W:0.060 / U:4.712 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site