From: Steven Rostedt <rostedt@goodmis.org>
To: Claudio Scordino <cloud.of.andor@gmail.com>
Cc: kernelnewbies@nl.linux.org, linux-kernel@vger.kernel.org
Subject: Re: A problem with ktimer
Date: Thu, 17 Nov 2005 12:28:08 -0500 [thread overview]
Message-ID: <1132248488.10522.4.camel@localhost.localdomain> (raw)
In-Reply-To: <200511171639.27565.cloud.of.andor@gmail.com>
On Thu, 2005-11-17 at 16:39 +0100, Claudio Scordino wrote:
> Hi,
>
> I know that ktimer is not yet part of the main tree of the Linux kernel.
>
> However, maybe someone can help me to understand why the following code in a
> module makes crash my x86_64.
>
> Many thanks,
>
> Claudio
>
>
>
> struct ktimer mytimer;
>
> void myfunction()
> {
> int i;
> }
>
>
> static int module_insert(void)
> {
> ktime_t mytime = ktime_set(1,0);
> mytimer.function = myfunction;
> mytimer.data = NULL;
> ktimer_init(&mytimer);
> ktimer_start(&mytimer, &mytime, KTIMER_REL);
> //...
> }
You must do the ktimer_init first!
So the order must be:
ktimer_init(&mytimer);
mytimer.function = myfunction;
mytimer.data = NULL;
//...
Think of ktimer_init like memset(...) (since it actually does a memset)
You wouldn't do;
struct myvar;
myvar.my_field = 1;
memset(&myvar, 0, sizeof(myvar));
Right ;-)
-- Steve
next prev parent reply other threads:[~2005-11-17 17:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-17 15:39 A problem with ktimer Claudio Scordino
2005-11-17 17:28 ` Steven Rostedt [this message]
2006-01-16 14:45 ` ktimer not firing ? Claudio Scordino
2006-01-17 8:04 ` Thomas Gleixner
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=1132248488.10522.4.camel@localhost.localdomain \
--to=rostedt@goodmis.org \
--cc=cloud.of.andor@gmail.com \
--cc=kernelnewbies@nl.linux.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox