From: Pawel Wieczorkiewicz <wpawel@gmail.com>
To: a.zummo@towertech.it
Cc: rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org,
Pawel Wieczorkiewicz <wpawel@gmail.com>
Subject: [PATCH 1/1] rtc-proc: replace "rtcN" name creation with dev_name() call
Date: Tue, 12 Feb 2013 18:57:52 +0100 [thread overview]
Message-ID: <1360691872-2848-1-git-send-email-wpawel@gmail.com> (raw)
From: Pawel Wieczorkiewicz <wpawel@gmail.com>
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.
Signed-off-by: Pawel Wieczorkiewicz <wpawel@gmail.com>
---
drivers/rtc/rtc-proc.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/drivers/rtc/rtc-proc.c b/drivers/rtc/rtc-proc.c
index e96236a..473d017 100644
--- a/drivers/rtc/rtc-proc.c
+++ b/drivers/rtc/rtc-proc.c
@@ -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);
}
--
1.7.9.5
reply other threads:[~2013-02-19 17:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1360691872-2848-1-git-send-email-wpawel@gmail.com \
--to=wpawel@gmail.com \
--cc=a.zummo@towertech.it \
--cc=linux-kernel@vger.kernel.org \
--cc=rtc-linux@googlegroups.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
all inboxes | Powered by JetHome®