On 02/22/2014 05:08 PM, Alejandro Cabrera wrote:Hi Guenter
On 22/2/2014 10:46 AM, Wim Van Sebroeck wrote:
Hi All,Hi
Hi Michal,I agree with Guenter: these are not really warnings. Seperate patch is thus welcome.
On Wed, Feb 12, 2014 at 02:41:21PM +0100, Michal Simek wrote:
Use of_property_read_u32 functions to clean probe function.Looks good.
Signed-off-by: Michal Simek<michal.simek@xxxxxxxxxx>
Reviewed-by: Guenter Roeck<linux@xxxxxxxxxxxx>
---
Changes in v3:
- Remove one if checking and use variable directly
Another comment/remark.
- pfreq = (u32 *)of_get_property(pdev->dev.of_node,All the above properties are optional. Is a warning really
- "clock-frequency", NULL);
-
- if (pfreq == NULL) {
+ rc = of_property_read_u32(pdev->dev.of_node, "clock-frequency",&pfreq);
+ if (rc) {
dev_warn(&pdev->dev,
"The watchdog clock frequency cannot be obtained\n");
no_timeout = true;
}
- tmptr = (u32 *)of_get_property(pdev->dev.of_node,
- "xlnx,wdt-interval", NULL);
- if (tmptr == NULL) {
+ rc = of_property_read_u32(pdev->dev.of_node, "xlnx,wdt-interval",
+ &xdev->wdt_interval);
+ if (rc) {
dev_warn(&pdev->dev,
"Parameter \"xlnx,wdt-interval\" not found\n");
no_timeout = true;
- } else {
- xdev->wdt_interval = *tmptr;
}
- tmptr = (u32 *)of_get_property(pdev->dev.of_node,
- "xlnx,wdt-enable-once", NULL);
- if (tmptr == NULL) {
+ rc = of_property_read_u32(pdev->dev.of_node, "xlnx,wdt-enable-once",
+ &enable_once);
+ if (rc)
dev_warn(&pdev->dev,
"Parameter \"xlnx,wdt-enable-once\" not found\n");
- watchdog_set_nowayout(xilinx_wdt_wdd, true);
- }
warranted in this case ? I usually associate a warning with
something that is wrong, which is not the case here.
I would encourage you to drop those warnings, but that should be
a separate patch.
I support Michal intention, I think it is a warning because device tree blob must have the "xlnx,wdt-enable-once" property specified in order to allow the system to be sure of the real value of this property. In addition to, this warning can be helpful to detect a wrong device tree specification.
The dt documentation states that the properties are optional.
Optional properties:
- clock-frequency : Frequency of clock in Hz
- xlnx,wdt-enable-once : 0 - Watchdog can be restarted
1 - Watchdog can be enabled just once
- xlnx,wdt-interval : Watchdog timeout interval in 2^<val> clock cycles,
<val> is integer from 8 to 31.
This clearly conflicts with your statement. An optional property
is just that, optional. If it warrants a warning, it must
not be optional. If you claim that not providing the properties
would be "wrong", why are they defined as optional ?
What is your definition of "wrong" and "must have" ?what I mean for "must have" is: if these properties can be obtained
How do you expect anyone to know that omitting thoseI'm agree with you.
"optional" properties is by some definition "wrong" ?