[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <473C5EA3.7020101@dbservice.com>
Date: Thu, 15 Nov 2007 15:58:43 +0100
From: Tomas Carnecky <tom@...ervice.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
CC: linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: statically allocated input_dev
CC: lkml, because that's a question anyone familiar with the driver
subsystem can answer.
Dmitry Torokhov wrote:
> On Nov 15, 2007 9:20 AM, Tomas Carnecky <tom@...ervice.com> wrote:
>> Dmitry Torokhov wrote:
>>> No, sorry. Current object lifetime rules require input devices (as
>>> well as platform devices) to be dynamically allocated.
>>>
>> Interesting, especially the 'platform device' bit, because, from
>> ./drivers/block/floppy.c:
>>
>> floppy_device[drive].name = floppy_device_name;
>> floppy_device[drive].id = drive;
>> floppy_device[drive].dev.release = floppy_device_release;
>>
>> err = platform_device_register(&floppy_device[drive]);
>>
>> where 'floppy_device' is a static array defined as follows:
>>
>> static struct platform_device floppy_device[N_DRIVE];
>>
>> So is that code incorrect?
>>
>
> I would not look at floopy code when searching for examples ;)
>
Statically allocating platform devices works, I can register those just
fine and I don't see any oops when loading/removing the module. Even
though there are no signs of breakage, should I change my code anyway?
I'm trying to keep the code as simple as possible. The platform device,
platform driver and the input device will live only as long as the
module is loaded. There is nothing else that would rely or depend on my
driver. Any advices you can give? Or is there nothing that I could use
to keep the code simple?
tom
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists