public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH] rtc: m48t59: Remove division condition with direct comparison
@ 2024-08-09 15:56 Abhishek Tamboli
  2024-08-27 16:51 ` Abhishek Tamboli
  2024-09-11 22:49 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Abhishek Tamboli @ 2024-08-09 15:56 UTC (permalink / raw)
  To: alexandre.belloni
  Cc: linux-rtc, linux-kernel, skhan, rbmarliere, linux-kernel-mentees

Replace 'year / 100' with a direct comparison 'year >= 100'
in m48t59_rtc_set_time() function. Improve the code clarity
and eliminate division overhead.

Fix the following smatch warning:
drivers/rtc/rtc-m48t59.c:135 m48t59_rtc_set_time() warn:
replace divide condition 'year / 100' with 'year >= 100'

Signed-off-by: Abhishek Tamboli <abhishektamboli9@gmail.com>
---
 drivers/rtc/rtc-m48t59.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index f0f6b9b6daec..cd2ca49805d8 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -132,7 +132,7 @@ static int m48t59_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	M48T59_WRITE((bin2bcd(tm->tm_mon + 1) & 0x1F), M48T59_MONTH);
 	M48T59_WRITE(bin2bcd(year % 100), M48T59_YEAR);

-	if (pdata->type == M48T59RTC_TYPE_M48T59 && (year / 100))
+	if (pdata->type == M48T59RTC_TYPE_M48T59 && (year >= 100))
 		val = (M48T59_WDAY_CEB | M48T59_WDAY_CB);
 	val |= (bin2bcd(tm->tm_wday) & 0x07);
 	M48T59_WRITE(val, M48T59_WDAY);
--
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] rtc: m48t59: Remove division condition with direct comparison
  2024-08-09 15:56 [PATCH] rtc: m48t59: Remove division condition with direct comparison Abhishek Tamboli
@ 2024-08-27 16:51 ` Abhishek Tamboli
  2024-09-11 22:49 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Abhishek Tamboli @ 2024-08-27 16:51 UTC (permalink / raw)
  To: alexandre.belloni
  Cc: linux-kernel-mentees, linux-kernel, linux-rtc, rbmarliere, skhan,
	abhishektamboli9

Hi Alexandre,

I wanted to check if you had a chance to review the patch I sent to you [1]. 
I understand you may have a busy schedule, but I would appreciate 
any feedback you can provide when you have time.

The patch is available here:
[1]: https://lore.kernel.org/all/20240809155631.548044-1-abhishektamboli9@gmail.com/

Thank you for your time. 

Best regards,
Abhishek


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: m48t59: Remove division condition with direct comparison
  2024-08-09 15:56 [PATCH] rtc: m48t59: Remove division condition with direct comparison Abhishek Tamboli
  2024-08-27 16:51 ` Abhishek Tamboli
@ 2024-09-11 22:49 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2024-09-11 22:49 UTC (permalink / raw)
  To: Abhishek Tamboli
  Cc: linux-rtc, linux-kernel, skhan, rbmarliere, linux-kernel-mentees

On Fri, 09 Aug 2024 21:26:31 +0530, Abhishek Tamboli wrote:
> Replace 'year / 100' with a direct comparison 'year >= 100'
> in m48t59_rtc_set_time() function. Improve the code clarity
> and eliminate division overhead.
> 
> Fix the following smatch warning:
> drivers/rtc/rtc-m48t59.c:135 m48t59_rtc_set_time() warn:
> replace divide condition 'year / 100' with 'year >= 100'
> 
> [...]

Applied, thanks!

[1/1] rtc: m48t59: Remove division condition with direct comparison
      https://git.kernel.org/abelloni/c/60a06efc56d7

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-11 22:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09 15:56 [PATCH] rtc: m48t59: Remove division condition with direct comparison Abhishek Tamboli
2024-08-27 16:51 ` Abhishek Tamboli
2024-09-11 22:49 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox