diff mbox series

[v2,3/3] clocksource/drivers/exynos_mct: bump up number of local timer

Message ID 20220220133824.33837-3-alim.akhtar@samsung.com
State New
Headers show
Series [v2,1/3] clocksource/drivers/exynos_mct: Remove mct interrupt index enum | expand

Commit Message

Alim Akhtar Feb. 20, 2022, 1:38 p.m. UTC
As per the dt binding, maximum number of local timer can be
up to 16. Increase the array size of the _name_ variable
which holds the number of local timer name per CPU to
reflect the binding. While at it, change the magic number to a
meaningful macro.

Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
---
 drivers/clocksource/exynos_mct.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Krzysztof Kozlowski Feb. 20, 2022, 3:33 p.m. UTC | #1
On 20/02/2022 14:38, Alim Akhtar wrote:
> As per the dt binding, maximum number of local timer can be
> up to 16. Increase the array size of the _name_ variable
> which holds the number of local timer name per CPU to
> reflect the binding. While at it, change the magic number to a
> meaningful macro.

This still does not make sense. Let's say you have 16 local timers, so
why the name of clock event device should be maximum 16? How are these
related?

> 
> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
> ---
>  drivers/clocksource/exynos_mct.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
> index 0c7931f7f99a..8d63a9376701 100644
> --- a/drivers/clocksource/exynos_mct.c
> +++ b/drivers/clocksource/exynos_mct.c
> @@ -66,6 +66,8 @@
>  #define MCT_L0_IRQ	4
>  /* Max number of IRQ as per DT binding document */
>  #define MCT_NR_IRQS	20
> +/* Max number of local timers */
> +#define MCT_NR_LOCAL_TIMERS	16
>  
>  enum {
>  	MCT_INT_SPI,
> @@ -80,7 +82,7 @@ static int mct_irqs[MCT_NR_IRQS];
>  struct mct_clock_event_device {
>  	struct clock_event_device evt;
>  	unsigned long base;
> -	char name[10];
> +	char name[MCT_NR_LOCAL_TIMERS];
>  };
>  
>  static void exynos4_mct_write(unsigned int value, unsigned long offset)


Best regards,
Krzysztof
Alim Akhtar Feb. 20, 2022, 4:59 p.m. UTC | #2
>-----Original Message-----
>From: Krzysztof Kozlowski [mailto:krzysztof.kozlowski@canonical.com]
>Sent: Sunday, February 20, 2022 9:03 PM
>To: Alim Akhtar <alim.akhtar@samsung.com>; linux-arm-
>kernel@lists.infradead.org; linux-kernel@vger.kernel.org
>Cc: linux-samsung-soc@vger.kernel.org; daniel.lezcano@linaro.org;
>tglx@linutronix.de; pankaj.dubey@samsung.com;
>m.szyprowski@samsung.com
>Subject: Re: [PATCH v2 3/3] clocksource/drivers/exynos_mct: bump up
>number of local timer
>
>On 20/02/2022 14:38, Alim Akhtar wrote:
>> As per the dt binding, maximum number of local timer can be up to 16.
>> Increase the array size of the _name_ variable which holds the number
>> of local timer name per CPU to reflect the binding. While at it,
>> change the magic number to a meaningful macro.
>
>This still does not make sense. Let's say you have 16 local timers, so why the
>name of clock event device should be maximum 16? How are these related?
>
As you rightly commented on v1 and it is mainly for "mct_tick%d" with number of local timers and
local timer is per cpu. With increase in cpu number, name[10] restrict the scalability.
So either we can change to 11, or use some reference (as local timer number in this patch). 
Let me know your thought on this.

>>
>> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
>> ---
>>  drivers/clocksource/exynos_mct.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/clocksource/exynos_mct.c
>> b/drivers/clocksource/exynos_mct.c
>> index 0c7931f7f99a..8d63a9376701 100644
>> --- a/drivers/clocksource/exynos_mct.c
>> +++ b/drivers/clocksource/exynos_mct.c
>> @@ -66,6 +66,8 @@
>>  #define MCT_L0_IRQ	4
>>  /* Max number of IRQ as per DT binding document */
>>  #define MCT_NR_IRQS	20
>> +/* Max number of local timers */
>> +#define MCT_NR_LOCAL_TIMERS	16
>>
>>  enum {
>>  	MCT_INT_SPI,
>> @@ -80,7 +82,7 @@ static int mct_irqs[MCT_NR_IRQS];  struct
>> mct_clock_event_device {
>>  	struct clock_event_device evt;
>>  	unsigned long base;
>> -	char name[10];
>> +	char name[MCT_NR_LOCAL_TIMERS];
>>  };
>>
>>  static void exynos4_mct_write(unsigned int value, unsigned long
>> offset)
>
>
>Best regards,
>Krzysztof
Krzysztof Kozlowski Feb. 20, 2022, 5:34 p.m. UTC | #3
On 20/02/2022 17:59, Alim Akhtar wrote:
> 
> 
>> -----Original Message-----
>> From: Krzysztof Kozlowski [mailto:krzysztof.kozlowski@canonical.com]
>> Sent: Sunday, February 20, 2022 9:03 PM
>> To: Alim Akhtar <alim.akhtar@samsung.com>; linux-arm-
>> kernel@lists.infradead.org; linux-kernel@vger.kernel.org
>> Cc: linux-samsung-soc@vger.kernel.org; daniel.lezcano@linaro.org;
>> tglx@linutronix.de; pankaj.dubey@samsung.com;
>> m.szyprowski@samsung.com
>> Subject: Re: [PATCH v2 3/3] clocksource/drivers/exynos_mct: bump up
>> number of local timer
>>
>> On 20/02/2022 14:38, Alim Akhtar wrote:
>>> As per the dt binding, maximum number of local timer can be up to 16.
>>> Increase the array size of the _name_ variable which holds the number
>>> of local timer name per CPU to reflect the binding. While at it,
>>> change the magic number to a meaningful macro.
>>
>> This still does not make sense. Let's say you have 16 local timers, so why the
>> name of clock event device should be maximum 16? How are these related?
>>
> As you rightly commented on v1 and it is mainly for "mct_tick%d" with number of local timers and
> local timer is per cpu. With increase in cpu number, name[10] restrict the scalability.
> So either we can change to 11, or use some reference (as local timer number in this patch). 
> Let me know your thought on this.

There could be some reference, like dedicated define. However length is
not directly related to the number of local irqs, but only number of
digits in decimal representation. If MCT_NR_LOCAL_TIMERS is increased
from 12 to 20, or from 20 to 80, the length should stay the same.

I propose to keep it at 11 and add a comment that length of the name
must be adjusted if number of interrupts grow over two digits.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index 0c7931f7f99a..8d63a9376701 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -66,6 +66,8 @@ 
 #define MCT_L0_IRQ	4
 /* Max number of IRQ as per DT binding document */
 #define MCT_NR_IRQS	20
+/* Max number of local timers */
+#define MCT_NR_LOCAL_TIMERS	16
 
 enum {
 	MCT_INT_SPI,
@@ -80,7 +82,7 @@  static int mct_irqs[MCT_NR_IRQS];
 struct mct_clock_event_device {
 	struct clock_event_device evt;
 	unsigned long base;
-	char name[10];
+	char name[MCT_NR_LOCAL_TIMERS];
 };
 
 static void exynos4_mct_write(unsigned int value, unsigned long offset)