All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: "AnilKumar, Chimata" <anilkumar@ti.com>
Cc: "wg@grandegger.com" <wg@grandegger.com>,
	"swarren@wwwdotorg.org" <swarren@wwwdotorg.org>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
	"tony@atomide.com" <tony@atomide.com>,
	"Cousson, Benoit" <b-cousson@ti.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"grant.likely@secretlab.ca" <grant.likely@secretlab.ca>,
	"devicetree-discuss@lists.ozlabs.org"
	<devicetree-discuss@lists.ozlabs.org>
Subject: Re: [PATCH 1/3] can: c_can: Add d_can raminit support
Date: Tue, 20 Nov 2012 14:46:04 +0100	[thread overview]
Message-ID: <50AB899C.3040701@pengutronix.de> (raw)
In-Reply-To: <331ABD5ECB02734CA317220B2BBEABC13EA771E9@DBDE01.ent.ti.com>

[-- Attachment #1: Type: text/plain, Size: 2095 bytes --]

On 11/20/2012 02:05 PM, AnilKumar, Chimata wrote:
[...]

>>>  static struct platform_device_id c_can_id_table[] = {
>>>  	[BOSCH_C_CAN_PLATFORM] = {
>>>  		.name = KBUILD_MODNAME,
>>> @@ -99,7 +119,7 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
>>>  	const struct of_device_id *match;
>>>  	const struct platform_device_id *id;
>>>  	struct pinctrl *pinctrl;
>>> -	struct resource *mem;
>>> +	struct resource *mem, *res;
>>>  	int irq;
>>>  	struct clk *clk;
>>>  
>>> @@ -178,6 +198,18 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
>>>  		priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
>>>  		priv->read_reg = c_can_plat_read_reg_aligned_to_16bit;
>>>  		priv->write_reg = c_can_plat_write_reg_aligned_to_16bit;
>>> +
>>> +		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>>> +		priv->raminit_ctrlreg =
>>> +				devm_request_and_ioremap(&pdev->dev, res);
>>
>> What happens if there isn't a second IORESOURCE_MEM region? devm_request
>> will print an error in this case and any other error, too [1]. Do we
>> need streamlining here?
>>
>> [1] http://lxr.free-electrons.com/source/drivers/base/platform.c#L59
> 
> I did not get what the point is.
> 
> In most of the cases above two API's returns NULL. Even res is NULL
> nothing to worry, first condition in devm_request_and_ioremap() is
> NULL pointer check of res. If "res" is NULL then devm_xx will return
> NULL which result into printing of below warning.
> 
>>
>>> +		if (!priv->raminit_ctrlreg)
>>> +			dev_warn(&pdev->dev, "failed to obtain control memory\n");
> 
> I will change this warning to info
> 
> if (!priv->raminit_ctrlreg)
> 	dev_info(&pdev->dev, "control memory is not used for raminit\n");

That's more descriptive, good.

Marc


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: mkl@pengutronix.de (Marc Kleine-Budde)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] can: c_can: Add d_can raminit support
Date: Tue, 20 Nov 2012 14:46:04 +0100	[thread overview]
Message-ID: <50AB899C.3040701@pengutronix.de> (raw)
In-Reply-To: <331ABD5ECB02734CA317220B2BBEABC13EA771E9@DBDE01.ent.ti.com>

On 11/20/2012 02:05 PM, AnilKumar, Chimata wrote:
[...]

>>>  static struct platform_device_id c_can_id_table[] = {
>>>  	[BOSCH_C_CAN_PLATFORM] = {
>>>  		.name = KBUILD_MODNAME,
>>> @@ -99,7 +119,7 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
>>>  	const struct of_device_id *match;
>>>  	const struct platform_device_id *id;
>>>  	struct pinctrl *pinctrl;
>>> -	struct resource *mem;
>>> +	struct resource *mem, *res;
>>>  	int irq;
>>>  	struct clk *clk;
>>>  
>>> @@ -178,6 +198,18 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
>>>  		priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
>>>  		priv->read_reg = c_can_plat_read_reg_aligned_to_16bit;
>>>  		priv->write_reg = c_can_plat_write_reg_aligned_to_16bit;
>>> +
>>> +		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
>>> +		priv->raminit_ctrlreg =
>>> +				devm_request_and_ioremap(&pdev->dev, res);
>>
>> What happens if there isn't a second IORESOURCE_MEM region? devm_request
>> will print an error in this case and any other error, too [1]. Do we
>> need streamlining here?
>>
>> [1] http://lxr.free-electrons.com/source/drivers/base/platform.c#L59
> 
> I did not get what the point is.
> 
> In most of the cases above two API's returns NULL. Even res is NULL
> nothing to worry, first condition in devm_request_and_ioremap() is
> NULL pointer check of res. If "res" is NULL then devm_xx will return
> NULL which result into printing of below warning.
> 
>>
>>> +		if (!priv->raminit_ctrlreg)
>>> +			dev_warn(&pdev->dev, "failed to obtain control memory\n");
> 
> I will change this warning to info
> 
> if (!priv->raminit_ctrlreg)
> 	dev_info(&pdev->dev, "control memory is not used for raminit\n");

That's more descriptive, good.

Marc


-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121120/3669f037/attachment.sig>

  reply	other threads:[~2012-11-20 13:46 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 18:08 [PATCH 0/3] can: Add D_CAN raminit support to am335x-evm AnilKumar Ch
2012-11-14 18:08 ` AnilKumar Ch
2012-11-14 18:08 ` [PATCH 1/3] can: c_can: Add d_can raminit support AnilKumar Ch
2012-11-14 18:08   ` AnilKumar Ch
     [not found]   ` <1352916505-12343-2-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org>
2012-11-20 10:50     ` Marc Kleine-Budde
2012-11-20 10:50       ` Marc Kleine-Budde
2012-11-20 13:05       ` AnilKumar, Chimata
2012-11-20 13:05         ` AnilKumar, Chimata
2012-11-20 13:46         ` Marc Kleine-Budde [this message]
2012-11-20 13:46           ` Marc Kleine-Budde
     [not found] ` <1352916505-12343-1-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org>
2012-11-14 18:08   ` [PATCH 2/3] ARM: dts: AM33XX: Add d_can instances to aliases AnilKumar Ch
2012-11-14 18:08     ` AnilKumar Ch
     [not found]     ` <1352916505-12343-3-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org>
2012-11-20 10:51       ` Marc Kleine-Budde
2012-11-20 10:51         ` Marc Kleine-Budde
2013-01-02 10:13         ` AnilKumar, Chimata
2013-01-02 10:13           ` AnilKumar, Chimata
2012-11-20  5:00   ` [PATCH 0/3] can: Add D_CAN raminit support to am335x-evm AnilKumar, Chimata
2012-11-20  5:00     ` AnilKumar, Chimata
2012-11-14 18:08 ` [PATCH 3/3] ARM: dts: AM33XX: Add memory resource to d_can node AnilKumar Ch
2012-11-14 18:08   ` AnilKumar Ch
2012-11-20 10:13   ` Marc Kleine-Budde
2012-11-20 10:13     ` Marc Kleine-Budde
2012-11-20 10:23     ` AnilKumar, Chimata
2012-11-20 10:23       ` AnilKumar, Chimata
     [not found]       ` <331ABD5ECB02734CA317220B2BBEABC13EA7701D-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-11-20 10:26         ` Marc Kleine-Budde
2012-11-20 10:26           ` Marc Kleine-Budde
2012-11-21  5:45           ` AnilKumar, Chimata
2012-11-21  5:45             ` AnilKumar, Chimata
     [not found]             ` <331ABD5ECB02734CA317220B2BBEABC13EA778F3-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-11-21  8:20               ` Marc Kleine-Budde
2012-11-21  8:20                 ` Marc Kleine-Budde
2012-11-21  8:20   ` Marc Kleine-Budde
2012-11-21  8:20     ` Marc Kleine-Budde
2013-01-02 10:14     ` AnilKumar, Chimata
2013-01-02 10:14       ` AnilKumar, Chimata
2013-01-09 12:16 ` [PATCH 0/3] can: Add D_CAN raminit support to am335x-evm Benoit Cousson
2013-01-09 12:16   ` Benoit Cousson
2013-01-09 12:20   ` AnilKumar, Chimata
2013-01-09 12:20     ` AnilKumar, Chimata

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=50AB899C.3040701@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=anilkumar@ti.com \
    --cc=b-cousson@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=swarren@wwwdotorg.org \
    --cc=tony@atomide.com \
    --cc=wg@grandegger.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.