Skip to contentSkip to conversation

rtc-proc: replace "rtcN" name creation with dev_name() call

PATCH New Pawel Wieczorkiewicz 1 participant 1 message Feb 19, 2013 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc-proc: replace "rtcN" name creation with dev_name() call

From: Pawel Wieczorkiewicz <[email protected]>

Instead of creating rtc device name basing on rtc->id in local array, make use of existing one using dev_name() call to compare against CONFIG_RTC_HCTOSYS_DEVICE.

---
 drivers/rtc/rtc-proc.c |   15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/rtc/rtc-proc.c +3 -12
index e96236a..473d017 100644
@@ -18,22 +18,13 @@
 
 #include "rtc-core.h"
 
-#define NAME_SIZE	10
-
 #if defined(CONFIG_RTC_HCTOSYS_DEVICE)
-static bool is_rtc_hctosys(struct rtc_device *rtc)
+static inline bool is_rtc_hctosys(struct rtc_device *rtc)
 {
-	int size;
-	char name[NAME_SIZE];
-
-	size = scnprintf(name, NAME_SIZE, "rtc%d", rtc->id);
-	if (size > NAME_SIZE)
-		return false;
-
-	return !strncmp(name, CONFIG_RTC_HCTOSYS_DEVICE, NAME_SIZE);
+	return !strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE);
 }
 #else
-static bool is_rtc_hctosys(struct rtc_device *rtc)
+static inline bool is_rtc_hctosys(struct rtc_device *rtc)
 {
 	return (rtc->id == 0);
 }
Signature · 1 line
1.7.9.5