From: viresh.kumar@st.com (Viresh KUMAR)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] Watchdog: Adding support for ARM Primecell SP805 Watchdog
Date: Tue, 27 Jul 2010 10:20:44 +0530 [thread overview]
Message-ID: <4C4E65A4.7030005@st.com> (raw)
In-Reply-To: <4C43DD7E.5050800@st.com>
On 7/19/2010 10:37 AM, vireshk wrote:
>>> +/* This routine finds load value that will reset system in required timout */
>>> >> +static void wdt_setload(unsigned int timeout)
>>> >> +{
>>> >> + u64 load, rate;
>>> >> +
>>> >> + rate = clk_get_rate(wdt->clk);
>>> >> +
>>> >> + /*
>>> >> + * sp805 runs counter with given value twice, after the end of first
>>> >> + * counter it gives an interrupt and then starts counter again. If
>>> >> + * interrupt already occured then it resets the system. This is why
>>> >> + * load is half of what should be required.
>>> >> + */
>>> >> + load = div_u64(rate, 2) * timeout - 1;
>>> >> +
>>> >> + load = (load > LOAD_MAX) ? LOAD_MAX : load;
>>> >> + load = (load < LOAD_MIN) ? LOAD_MIN : load;
>>> >> +
>>> >> + spin_lock(&wdt->lock);
>>> >> + wdt->load_val = load;
>>> >> + /* roundup timeout to closest positive integer value */
>>> >> + wdt->timeout = div_u64((load + 1) * 2 + (rate / 2), rate);
>> >
>> > Look in linux/kernel.h, use the
>> > DIV_ROUND_CLOSEST() macro instead of this.
> OK.
>
Linus,
Now i remember why i didn't choose DIV_ROUND_CLOSEST in V1 of this patch.
As it is a u64 division, i get following compilation error if i use
DIV_ROUND_CLOSEST. I wasn't sure if inclusion of some header file can remove
this error, and so i used div_u64.
error:
"undefined reference to '__aeabi_uldivmod'"
Do you have some other solution to fix this error??
viresh.
next prev parent reply other threads:[~2010-07-27 4:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-20 8:33 [PATCH] Watchdog: Adding support for ARM Primecell SP805 Watchdog Viresh KUMAR
2010-06-02 7:48 ` Russell King - ARM Linux
2010-06-02 7:57 ` Viresh KUMAR
2010-07-18 20:29 ` Linus Walleij
2010-07-19 5:07 ` Viresh KUMAR
2010-07-27 4:50 ` Viresh KUMAR [this message]
2010-07-27 22:25 ` Linus Walleij
2010-07-28 4:02 ` Viresh KUMAR
2010-07-28 23:14 ` Linus Walleij
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=4C4E65A4.7030005@st.com \
--to=viresh.kumar@st.com \
--cc=linux-arm-kernel@lists.infradead.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.