All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomas Carnecky <tom@dbservice.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: statically allocated input_dev
Date: Thu, 15 Nov 2007 15:58:43 +0100	[thread overview]
Message-ID: <473C5EA3.7020101@dbservice.com> (raw)
In-Reply-To: <d120d5000711150630n538a78e3sd3676a19eb051327@mail.gmail.com>

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@dbservice.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

       reply	other threads:[~2007-11-15 14:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20071115094309.innulage80owccko@www.neopsis.com>
     [not found] ` <d120d5000711150556r18842b09o2ed5ef3db7abd3d9@mail.gmail.com>
     [not found]   ` <473C5595.3010403@dbservice.com>
     [not found]     ` <d120d5000711150630n538a78e3sd3676a19eb051327@mail.gmail.com>
2007-11-15 14:58       ` Tomas Carnecky [this message]
2007-11-15 15:15         ` statically allocated input_dev Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=473C5EA3.7020101@dbservice.com \
    --to=tom@dbservice.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.