linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Ryan Mallon <rmallon@gmail.com>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 13/18] ARM: at91/rtc-at91sam9: pass the GPBR to use via ressources
Date: Mon, 20 Feb 2012 12:21:48 +0100	[thread overview]
Message-ID: <4F422CCC.7070900@atmel.com> (raw)
In-Reply-To: <20120220100437.GD22562@n2100.arm.linux.org.uk>

On 02/20/2012 11:04 AM, Russell King - ARM Linux :
> On Mon, Feb 20, 2012 at 10:16:47AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
>> On 07:36 Mon 20 Feb     , Russell King - ARM Linux wrote:
>>> On Mon, Feb 20, 2012 at 02:20:10AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
>>>> On 11:43 Mon 20 Feb     , Ryan Mallon wrote:
>>>>> On 18/02/12 04:50, Nicolas Ferre wrote:
>>>>>
>>>>>> From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>>>>>>
>>>>>> The GPBR registers are used for storing RTC values. The GPBR registers
>>>>>> to use are now provided using standard resource entry. The array is
>>>>>> filled in SoC specific code.
>>>>>> rtc-at91sam9 RTT as RTC driver is modified to retrieve this information.
>>>>>>
>>>>>> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>>>>>> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>>>>>> ---
>>>>>>  arch/arm/mach-at91/at91sam9260_devices.c      |   10 +++++++-
>>>>>>  arch/arm/mach-at91/at91sam9261_devices.c      |    8 ++++++-
>>>>>>  arch/arm/mach-at91/at91sam9263_devices.c      |   16 +++++++++++--
>>>>>>  arch/arm/mach-at91/at91sam9g45_devices.c      |    8 ++++++-
>>>>>>  arch/arm/mach-at91/at91sam9rl_devices.c       |    8 ++++++-
>>>>>>  arch/arm/mach-at91/include/mach/at91sam9260.h |    5 +--
>>>>>>  arch/arm/mach-at91/include/mach/at91sam9261.h |    5 +--
>>>>>>  arch/arm/mach-at91/include/mach/at91sam9263.h |    5 +--
>>>>>>  arch/arm/mach-at91/include/mach/at91sam9g45.h |    5 +--
>>>>>>  arch/arm/mach-at91/include/mach/at91sam9rl.h  |    2 +-
>>>>>>  drivers/rtc/rtc-at91sam9.c                    |   29 +++++++++++++++++++++---
>>>>>>  11 files changed, 76 insertions(+), 25 deletions(-)
>>>>>>
>>>>>> diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
>>>>>> index 2071017..ae2b648 100644
>>>>>> --- a/arch/arm/mach-at91/at91sam9260_devices.c
>>>>>> +++ b/arch/arm/mach-at91/at91sam9260_devices.c
>>>>>> @@ -718,14 +718,16 @@ static struct resource rtt_resources[] = {
>>>>>>  		.start	= AT91SAM9260_BASE_RTT,
>>>>>>  		.end	= AT91SAM9260_BASE_RTT + SZ_16 - 1,
>>>>>>  		.flags	= IORESOURCE_MEM,
>>>>>> -	}
>>>>>> +	}, {
>>>>>> +		.flags	= IORESOURCE_MEM,
>>>>>> +	},
>>>>>>  };
>>>>>>  
>>>>>>  static struct platform_device at91sam9260_rtt_device = {
>>>>>>  	.name		= "at91_rtt",
>>>>>>  	.id		= 0,
>>>>>>  	.resource	= rtt_resources,
>>>>>> -	.num_resources	= ARRAY_SIZE(rtt_resources),
>>>>>> +	.num_resources	= 1,
>>>>>
>>>>>
>>>>> Why this change? The device has two resources, and the rtc driver
>>>>> request both of them, so why are you saying there is only one resource
>>>>> here. It either needs to be changed back to use ARRAY_SIZE, or needs a
>>>>> comment explaining what magic is in use.
>>>> because the number of resources depends on the user of rtt
>>>> we must not hardcode the GPBR reg as this resource will be present only if the
>>>> rtc-at91sam9 is enabled
>>>
>>> Better would be to leave .num_resources uninitalized and set that
>>> appropriately elsewhere when you make the decision whether GPBR is
>>> present or not.  That may help to avoid people trying to "fix" this
>>> for you via static checking tools.
>>>
>>> As Ryan mentions, a comment in the code would be a good idea too.
>> the comment is in the drivers code and Kconfig
> 
> Not good enough.  It needs to explain at the at91sam9260_rtt_device
> definition why there is a disparity between the number of resources
> and the number in the device definition.
> 
> People running static checking tools or reading this code aren't going
> to look in the Kconfig nor the corresponding driver source for this
> information.

Absolutely, I am in favor of clear documentation.
Moreover, it seems that some lines of explanation have been lost during
the reworking process.

So, we cook another patch series now...

Best regards,
-- 
Nicolas Ferre

  reply	other threads:[~2012-02-20 11:22 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-17 17:49 [PATCH 00/18] at91 first cleanup series for 3.4 Nicolas Ferre
2012-02-17 17:49 ` [PATCH 01/18] ARM: at91: factorise duplicated at91sam9 idle Nicolas Ferre
2012-02-17 17:49   ` [PATCH 02/18] ARM: at91/at91x40: remove use of at91_sys_read/write Nicolas Ferre
2012-02-17 17:49   ` [PATCH 03/18] ARM: at91: make matrix register base soc independent Nicolas Ferre
2012-02-17 17:49   ` [PATCH 04/18] ARM: at91: make ST (System Timer) " Nicolas Ferre
2012-02-20  0:22     ` Ryan Mallon
2012-02-20  1:38       ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20  1:52         ` Ryan Mallon
2012-02-20  3:02           ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20  3:16             ` Ryan Mallon
2012-02-20  3:23               ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20  3:48                 ` Ryan Mallon
2012-02-20  3:49                   ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20  7:33             ` Russell King - ARM Linux
2012-02-20  9:18               ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-17 17:49   ` [PATCH 05/18] ARM: at91/pm_slowclock: rename register to named define Nicolas Ferre
2012-02-17 17:49   ` [PATCH 06/18] ARM: at91/pm_slowclock: function slow_clock() accepts parameters Nicolas Ferre
2012-02-17 17:49   ` [PATCH 07/18] ARM: at91: move at91rm9200 sdramc defines to at91rm9200_sdramc.h Nicolas Ferre
2012-02-17 17:50   ` [PATCH 08/18] ARM: at91: make sdram/ddr register base soc independent Nicolas Ferre
2012-02-17 17:50   ` [PATCH 09/18] ARM: at91/pm_slowclock: add runtime detection of memory contoller Nicolas Ferre
2012-02-17 17:50   ` [PATCH 10/18] ARM: at91/PMC: make register base soc independent Nicolas Ferre
2012-02-20  0:27     ` Ryan Mallon
2012-02-17 17:50   ` [PATCH 11/18] ARM: at91/rtc-at91sam9: each SoC can select the RTT device to use Nicolas Ferre
2012-02-20  0:32     ` Ryan Mallon
2012-02-20  1:25       ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-17 17:50   ` [PATCH 12/18] ARM: at91:rtc/rtc-at91sam9: ioremap register bank Nicolas Ferre
2012-02-17 17:50   ` [PATCH 13/18] ARM: at91/rtc-at91sam9: pass the GPBR to use via ressources Nicolas Ferre
2012-02-20  0:43     ` Ryan Mallon
2012-02-20  1:20       ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20  7:36         ` Russell King - ARM Linux
2012-02-20  9:16           ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20 10:04             ` Russell King - ARM Linux
2012-02-20 11:21               ` Nicolas Ferre [this message]
2012-02-20 14:45               ` [PATCH] ARM: at91/rtc-at91sam9: rework resources assignment Nicolas Ferre
2012-02-20 15:06                 ` Russell King - ARM Linux
2012-02-20 20:04                 ` Ryan Mallon
2012-02-17 17:50   ` [PATCH 14/18] ARM: at91: finally drop at91_sys_read/write Nicolas Ferre
2012-02-17 17:50   ` [PATCH 15/18] ARM: at91: merge SRAM Memory banks thanks to mirroring Nicolas Ferre
2012-02-17 17:50   ` [PATCH 16/18] Atmel: move console default platform_device to serial driver Nicolas Ferre
2012-02-18  9:17     ` Hans-Christian Egtvedt
2012-02-19  7:07       ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-17 17:50   ` [PATCH 17/18] ARM: at91/board-dt: drop default console Nicolas Ferre
2012-02-17 17:50   ` [PATCH 18/18] ARM: at91/board-dt: move at91_initialize() to init_irq() Nicolas Ferre

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=4F422CCC.7070900@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=plagnioj@jcrosoft.com \
    --cc=rmallon@gmail.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 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).