From: daniel.lezcano@linaro.org (Daniel Lezcano)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] clocksource: Add Oxford Semiconductor RPS Dual Timer
Date: Tue, 14 Jun 2016 13:48:18 +0200 [thread overview]
Message-ID: <575FEF02.4000805@linaro.org> (raw)
In-Reply-To: <575FD3F0.6040604@baylibre.com>
On 06/14/2016 11:52 AM, Neil Armstrong wrote:
> Hi Daniel,
Hi Neil,
[ ... ]
>>> +config OXNAS_RPS_TIMER
>>
>> config OXNAS_RPS_TIMER "bla bla" if COMPILE_TEST
>>
> OK
>
> Shoud I also add CLKSRC_OF ?
Yes, right.
>>> + bool
>>> + select CLKSRC_MMIO
>>> + help
>>> + This enables support for the Oxford Semiconductor OXNAS RPS timers.
>>> +
>>> @@ -0,0 +1,270 @@
>>> +/*
>>> + * drivers/clocksource/timer-oxnas-rps.c
>>> + *
>>> + * Copyright (C) 2009 Oxford Semiconductor Ltd
>>> + * Copyright (C) 2013 Ma Haijun <mahaijuns@gmail.com>
>>
>> What are these two copyrights ?
>>
>> [ ... ]
>
> This driver is based from a driver from the OX820 sdk from Oxford and modified by Ma Haijun, thus the copyrights.
Ok.
>>> +static void __init oxnas_rps_timer_init(struct device_node *np)
>>> +{
>>> + struct oxnas_rps_timer *rps;
>>> + void __iomem *base;
>>> + int ret;
>>> +
>>> + rps = kzalloc(sizeof(*rps), GFP_KERNEL);
>>> + if (WARN_ON(!rps))
>>
>> It is pointless to add a WARN_ON, kzalloc already does that on failure.
>>
>>> + return;
>>> +
>>> + rps->clk = of_clk_get(np, 0);
>>> + if (WARN_ON(IS_ERR(rps->clk)))
>>> + return;
>
> [....]
>
>>> + goto err;
>>> +
>>> + oxnas_rps_clockevent_init(rps);
>>> + oxnas_rps_clocksource_init(rps);
>>> +
>>> + return;
>>
>> err_iounmap:
>> iounmap(base);
>>
>> err_clk_unprepare:
>> clk_unprepare(rps->clk)
>>
>> err_clk_put:
>>> + clk_put(rps->clk);
>>> + kfree(rps);
>>> +}
>>
>> Regarding the current work I am doing to change the init function to return
>> an error in case of failure, can you do proper error handling in this
>> function and rollback ?
>>
>> 1. replace WARN_ON by a pr_err
>> 2. make oxnas_rps_clockevent_init and oxnas_rps_clocksource_init to return
>> an error code
> It can be done.
>
>> 3. rollback clockevent or clocksource if one fails.
> Sure, but as for 4.6, it seems neither sched_clock_register, clocksource_mmio_init or clockevents_config_and_register can be reverted !
> What should I do ?
Just try to do the best effort.
eg.
ret = oxnas_rps_clockevent_init(rps);
if (ret)
goto err_...
ret = oxnas_rps_clocksource_init(rps);
if (ret)
goto err_...
If the function themselves just return 0, it is fine for me.
I initiated a process to cleanup and factor out the clocksource /
clockevents, so any changes being able to rollback will help in this
process.
-- Daniel
--
<http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2016-06-14 11:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-07 16:04 [PATCH v2 0/2] clocksource: Add support for Oxford Semiconductor RPS Dual Timer Neil Armstrong
2016-06-07 16:04 ` [PATCH v2 1/2] clocksource: Add " Neil Armstrong
2016-06-13 14:35 ` Daniel Lezcano
2016-06-14 9:52 ` Neil Armstrong
2016-06-14 11:48 ` Daniel Lezcano [this message]
2016-06-07 16:04 ` [PATCH v2 2/2] dt-bindings: clocksource: Add Add Oxford Semiconductor RPS Timer bindings Neil Armstrong
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=575FEF02.4000805@linaro.org \
--to=daniel.lezcano@linaro.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).