All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	Misael Lopez Cruz <misael.lopez@ti.com>,
	Benoit Cousson <b-cousson@ti.com>,
	devicetree-discuss@lists.ozlabs.org, Liam Girdwood <lrg@ti.com>
Subject: Re: [PATCH] Input: tl6040-vibra: Device Tree support
Date: Mon, 07 May 2012 13:49:29 +0300	[thread overview]
Message-ID: <4FA7A8B9.4040208@ti.com> (raw)
In-Reply-To: <20120507070233.GB22074@core.coreip.homeip.net>

Hi Dmitry,

On 05/07/2012 10:02 AM, Dmitry Torokhov wrote:
> Hi Peter,
> 
> On Fri, May 04, 2012 at 03:05:13PM +0300, Peter Ujfalusi wrote:
>> +	if (pdata) {
>> +		info->vibldrv_res = pdata->vibldrv_res;
>> +		info->vibrdrv_res = pdata->vibrdrv_res;
>> +		info->viblmotor_res = pdata->viblmotor_res;
>> +		info->vibrmotor_res = pdata->vibrmotor_res;
>> +		vddvibl_uV = pdata->vddvibl_uV;
>> +		vddvibr_uV = pdata->vddvibr_uV;
>> +	} else {
>> +		of_property_read_u32(node, "vibldrv_res", &info->vibldrv_res);
>> +		of_property_read_u32(node, "vibrdrv_res", &info->vibrdrv_res);
>> +		of_property_read_u32(node, "viblmotor_res",
>> +				     &info->viblmotor_res);
>> +		of_property_read_u32(node, "vibrmotor_res",
>> +				     &info->vibrmotor_res);
> 
> Since these 4 appear to be mandatory properties don't we need to
> validate they are actually present in DT?

If the property does not exist in the DT blob the variable will not be
updated - it will remain 0.
I have kept the validity check for the resistance values. This will
catch the case when something is missing from the DT blob.

I just did not wanted to complicate the code with additional checks
since the end result would be the same.

-- 
Péter

  reply	other threads:[~2012-05-07 10:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-04 12:05 [PATCH] Input: tl6040-vibra: Device Tree support Peter Ujfalusi
2012-05-07  7:02 ` Dmitry Torokhov
2012-05-07 10:49   ` Peter Ujfalusi [this message]
2012-05-07 15:48     ` Dmitry Torokhov

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=4FA7A8B9.4040208@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=b-cousson@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=misael.lopez@ti.com \
    /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.