All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Alejandro Cabrera <acabrera@udio.cujae.edu.cu>,
	Wim Van Sebroeck <wim@iguana.be>
Cc: Michal Simek <michal.simek@xilinx.com>,
	linux-kernel@vger.kernel.org, monstr@monstr.eu,
	linux-watchdog@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 07/11] watchdog: xilinx: Use of_property_read_u32
Date: Sat, 22 Feb 2014 15:18:16 -0800	[thread overview]
Message-ID: <53093038.6000604@roeck-us.net> (raw)
In-Reply-To: <53094A15.1080708@udio.cujae.edu.cu>

On 02/22/2014 05:08 PM, Alejandro Cabrera wrote:
> On 22/2/2014 10:46 AM, Wim Van Sebroeck wrote:
>> Hi All,
>>
>>> Hi Michal,
>>>
>>> On Wed, Feb 12, 2014 at 02:41:21PM +0100, Michal Simek wrote:
>>>> Use of_property_read_u32 functions to clean probe function.
>>>>
>>>> Signed-off-by: Michal Simek<michal.simek@xilinx.com>
>>>> Reviewed-by: Guenter Roeck<linux@roeck-us.net>
>>>> ---
>>>>
>>>> Changes in v3:
>>>> - Remove one if checking and use variable directly
>>>>
>>> Looks good.
>>>
>>> Another comment/remark.
>>>
>>>> -    pfreq = (u32 *)of_get_property(pdev->dev.of_node,
>>>> -                    "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);
>>>> -    }
>>> All the above properties are optional. Is a warning really
>>> 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 agree with Guenter: these are not really warnings. Seperate patch is thus welcome.
> Hi
>
> 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" ?
How do you expect anyone to know that omitting those
"optional" properties is by some definition "wrong" ?

Guenter



WARNING: multiple messages have this Message-ID (diff)
From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 07/11] watchdog: xilinx: Use of_property_read_u32
Date: Sat, 22 Feb 2014 15:18:16 -0800	[thread overview]
Message-ID: <53093038.6000604@roeck-us.net> (raw)
In-Reply-To: <53094A15.1080708@udio.cujae.edu.cu>

On 02/22/2014 05:08 PM, Alejandro Cabrera wrote:
> On 22/2/2014 10:46 AM, Wim Van Sebroeck wrote:
>> Hi All,
>>
>>> Hi Michal,
>>>
>>> On Wed, Feb 12, 2014 at 02:41:21PM +0100, Michal Simek wrote:
>>>> Use of_property_read_u32 functions to clean probe function.
>>>>
>>>> Signed-off-by: Michal Simek<michal.simek@xilinx.com>
>>>> Reviewed-by: Guenter Roeck<linux@roeck-us.net>
>>>> ---
>>>>
>>>> Changes in v3:
>>>> - Remove one if checking and use variable directly
>>>>
>>> Looks good.
>>>
>>> Another comment/remark.
>>>
>>>> -    pfreq = (u32 *)of_get_property(pdev->dev.of_node,
>>>> -                    "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);
>>>> -    }
>>> All the above properties are optional. Is a warning really
>>> 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 agree with Guenter: these are not really warnings. Seperate patch is thus welcome.
> Hi
>
> 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" ?
How do you expect anyone to know that omitting those
"optional" properties is by some definition "wrong" ?

Guenter

  reply	other threads:[~2014-02-22 23:18 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12 13:34 [PATCH v3 0/11] Xilinx watchdog changes Michal Simek
2014-02-12 13:34 ` Michal Simek
2014-02-12 13:34 ` [PATCH v3 01/11] watchdog: xilinx: Convert driver to the watchdog framework Michal Simek
2014-02-12 13:34   ` Michal Simek
2014-02-12 13:34 ` [PATCH v3 02/11] watchdog: xilinx: Move control_status_reg to functions Michal Simek
2014-02-12 13:34   ` Michal Simek
2014-02-12 13:34 ` [PATCH v3 03/11] watchdog: xilinx: Simplify probe and remove functions Michal Simek
2014-02-12 13:34   ` Michal Simek
2014-02-12 13:34 ` [PATCH v3 04/11] watchdog: xilinx: Move no_timeout to probe function Michal Simek
2014-02-12 13:34   ` Michal Simek
2014-02-12 13:41 ` [PATCH v3 05/11] watchdog: xilinx: Allocate private structure per device Michal Simek
2014-02-12 13:41   ` Michal Simek
2014-02-12 13:41 ` [PATCH v3 06/11] watchdog: xilinx: Fix all printk messages Michal Simek
2014-02-12 13:41   ` Michal Simek
2014-02-12 13:41 ` [PATCH v3 07/11] watchdog: xilinx: Use of_property_read_u32 Michal Simek
2014-02-12 13:41   ` Michal Simek
2014-02-12 17:15   ` Guenter Roeck
2014-02-12 17:15     ` Guenter Roeck
2014-02-22 18:46     ` Wim Van Sebroeck
2014-02-23  1:08       ` Alejandro Cabrera
2014-02-23  1:08         ` Alejandro Cabrera
2014-02-22 23:18         ` Guenter Roeck [this message]
2014-02-22 23:18           ` Guenter Roeck
2014-02-23  3:52           ` Alejandro Cabrera
2014-02-23  3:52             ` Alejandro Cabrera
2014-02-23  1:36             ` Guenter Roeck
2014-02-23  1:36               ` Guenter Roeck
2014-02-23  6:14               ` Alejandro Cabrera
2014-02-23  6:14                 ` Alejandro Cabrera
2014-02-23  3:44                 ` Guenter Roeck
2014-02-23  3:44                   ` Guenter Roeck
2014-02-23 16:25                   ` Alejandro Cabrera
2014-02-23 16:25                     ` Alejandro Cabrera
2014-02-23 14:43                     ` Guenter Roeck
2014-02-23 14:43                       ` Guenter Roeck
2014-02-23 19:00                       ` Alejandro Cabrera
2014-02-23 19:00                         ` Alejandro Cabrera
2014-02-24  8:52                         ` Michal Simek
2014-02-24  8:52                           ` Michal Simek
2014-02-24 19:25                           ` Wim Van Sebroeck
2014-02-25  7:39                             ` Michal Simek
2014-02-25  7:39                               ` Michal Simek
2014-02-12 13:41 ` [PATCH v3 08/11] watchdog: xilinx: Use correct comment indentation Michal Simek
2014-02-12 13:41   ` Michal Simek
2014-02-12 13:41 ` [PATCH v3 09/11] watchdog: xilinx: Add missing binding Michal Simek
2014-02-12 13:41   ` Michal Simek
2014-02-12 13:41 ` [PATCH v3 10/11] watchdog: xilinx: Enable this driver for Zynq Michal Simek
2014-02-12 13:41   ` Michal Simek
2014-02-22 18:44   ` Wim Van Sebroeck
2014-02-22 20:42     ` Guenter Roeck
2014-02-22 20:42       ` Guenter Roeck
2014-02-12 13:41 ` [PATCH v3 11/11] watchdog: xilinx: Remove no_timeout variable Michal Simek
2014-02-12 13:41   ` Michal Simek
2014-02-24 20:01 ` [PATCH v3 0/11] Xilinx watchdog changes Wim Van Sebroeck

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=53093038.6000604@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=acabrera@udio.cujae.edu.cu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=wim@iguana.be \
    /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.