mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
Blackfin RTC driver: use dev_dbg() rather than pr_stamp()
Signed-off-by: Mike Frysinger <michael.frysinger@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com> Acked-by: Alessandro Zummo <alessandro.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
640611608f
commit
5438de4422
1 changed files with 22 additions and 26 deletions
|
@ -45,8 +45,7 @@
|
||||||
|
|
||||||
#include <asm/blackfin.h>
|
#include <asm/blackfin.h>
|
||||||
|
|
||||||
#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
|
#define dev_dbg_stamp(dev) dev_dbg(dev, "%s:%i: here i am\n", __func__, __LINE__)
|
||||||
#define stampit() stamp("here i am")
|
|
||||||
|
|
||||||
struct bfin_rtc {
|
struct bfin_rtc {
|
||||||
struct rtc_device *rtc_dev;
|
struct rtc_device *rtc_dev;
|
||||||
|
@ -120,7 +119,6 @@ static inline void rtc_bfin_to_tm(u32 rtc_bfin, struct rtc_time *tm)
|
||||||
*/
|
*/
|
||||||
static void rtc_bfin_sync_pending(void)
|
static void rtc_bfin_sync_pending(void)
|
||||||
{
|
{
|
||||||
stampit();
|
|
||||||
while (!(bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_COMPLETE)) {
|
while (!(bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_COMPLETE)) {
|
||||||
if (!(bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING))
|
if (!(bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING))
|
||||||
break;
|
break;
|
||||||
|
@ -128,8 +126,9 @@ static void rtc_bfin_sync_pending(void)
|
||||||
bfin_write_RTC_ISTAT(RTC_ISTAT_WRITE_COMPLETE);
|
bfin_write_RTC_ISTAT(RTC_ISTAT_WRITE_COMPLETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rtc_bfin_reset(struct bfin_rtc *rtc)
|
static void rtc_bfin_reset(struct device *dev)
|
||||||
{
|
{
|
||||||
|
struct bfin_rtc *rtc = dev_get_drvdata(dev);
|
||||||
/* Initialize the RTC. Enable pre-scaler to scale RTC clock
|
/* Initialize the RTC. Enable pre-scaler to scale RTC clock
|
||||||
* to 1Hz and clear interrupt/status registers. */
|
* to 1Hz and clear interrupt/status registers. */
|
||||||
spin_lock_irq(&rtc->lock);
|
spin_lock_irq(&rtc->lock);
|
||||||
|
@ -149,7 +148,7 @@ static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id)
|
||||||
unsigned long events = 0;
|
unsigned long events = 0;
|
||||||
u16 rtc_istat;
|
u16 rtc_istat;
|
||||||
|
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
|
|
||||||
spin_lock_irq(&rtc->lock);
|
spin_lock_irq(&rtc->lock);
|
||||||
|
|
||||||
|
@ -180,10 +179,9 @@ static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id)
|
||||||
|
|
||||||
static int bfin_rtc_open(struct device *dev)
|
static int bfin_rtc_open(struct device *dev)
|
||||||
{
|
{
|
||||||
struct bfin_rtc *rtc = dev_get_drvdata(dev);
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
|
|
||||||
ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_DISABLED, "rtc-bfin", dev);
|
ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_DISABLED, "rtc-bfin", dev);
|
||||||
if (unlikely(ret)) {
|
if (unlikely(ret)) {
|
||||||
|
@ -191,16 +189,15 @@ static int bfin_rtc_open(struct device *dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_bfin_reset(rtc);
|
rtc_bfin_reset(dev);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bfin_rtc_release(struct device *dev)
|
static void bfin_rtc_release(struct device *dev)
|
||||||
{
|
{
|
||||||
struct bfin_rtc *rtc = dev_get_drvdata(dev);
|
dev_dbg_stamp(dev);
|
||||||
stampit();
|
rtc_bfin_reset(dev);
|
||||||
rtc_bfin_reset(rtc);
|
|
||||||
free_irq(IRQ_RTC, dev);
|
free_irq(IRQ_RTC, dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,11 +205,11 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar
|
||||||
{
|
{
|
||||||
struct bfin_rtc *rtc = dev_get_drvdata(dev);
|
struct bfin_rtc *rtc = dev_get_drvdata(dev);
|
||||||
|
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case RTC_PIE_ON:
|
case RTC_PIE_ON:
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
spin_lock_irq(&rtc->lock);
|
spin_lock_irq(&rtc->lock);
|
||||||
rtc_bfin_sync_pending();
|
rtc_bfin_sync_pending();
|
||||||
bfin_write_RTC_ISTAT(RTC_ISTAT_STOPWATCH);
|
bfin_write_RTC_ISTAT(RTC_ISTAT_STOPWATCH);
|
||||||
|
@ -221,7 +218,7 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar
|
||||||
spin_unlock_irq(&rtc->lock);
|
spin_unlock_irq(&rtc->lock);
|
||||||
return 0;
|
return 0;
|
||||||
case RTC_PIE_OFF:
|
case RTC_PIE_OFF:
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
spin_lock_irq(&rtc->lock);
|
spin_lock_irq(&rtc->lock);
|
||||||
rtc_bfin_sync_pending();
|
rtc_bfin_sync_pending();
|
||||||
bfin_write_RTC_SWCNT(0);
|
bfin_write_RTC_SWCNT(0);
|
||||||
|
@ -230,7 +227,7 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case RTC_UIE_ON:
|
case RTC_UIE_ON:
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
spin_lock_irq(&rtc->lock);
|
spin_lock_irq(&rtc->lock);
|
||||||
rtc_bfin_sync_pending();
|
rtc_bfin_sync_pending();
|
||||||
bfin_write_RTC_ISTAT(RTC_ISTAT_SEC);
|
bfin_write_RTC_ISTAT(RTC_ISTAT_SEC);
|
||||||
|
@ -238,7 +235,7 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar
|
||||||
spin_unlock_irq(&rtc->lock);
|
spin_unlock_irq(&rtc->lock);
|
||||||
return 0;
|
return 0;
|
||||||
case RTC_UIE_OFF:
|
case RTC_UIE_OFF:
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
spin_lock_irq(&rtc->lock);
|
spin_lock_irq(&rtc->lock);
|
||||||
rtc_bfin_sync_pending();
|
rtc_bfin_sync_pending();
|
||||||
bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() & ~RTC_ISTAT_SEC);
|
bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() & ~RTC_ISTAT_SEC);
|
||||||
|
@ -250,7 +247,7 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar
|
||||||
u16 which_alarm;
|
u16 which_alarm;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
|
|
||||||
spin_lock_irq(&rtc->lock);
|
spin_lock_irq(&rtc->lock);
|
||||||
|
|
||||||
|
@ -278,7 +275,7 @@ static int bfin_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long ar
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
case RTC_AIE_OFF:
|
case RTC_AIE_OFF:
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
spin_lock_irq(&rtc->lock);
|
spin_lock_irq(&rtc->lock);
|
||||||
rtc_bfin_sync_pending();
|
rtc_bfin_sync_pending();
|
||||||
bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() & ~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));
|
bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() & ~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));
|
||||||
|
@ -293,7 +290,7 @@ static int bfin_rtc_read_time(struct device *dev, struct rtc_time *tm)
|
||||||
{
|
{
|
||||||
struct bfin_rtc *rtc = dev_get_drvdata(dev);
|
struct bfin_rtc *rtc = dev_get_drvdata(dev);
|
||||||
|
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
|
|
||||||
spin_lock_irq(&rtc->lock);
|
spin_lock_irq(&rtc->lock);
|
||||||
rtc_bfin_sync_pending();
|
rtc_bfin_sync_pending();
|
||||||
|
@ -309,7 +306,7 @@ static int bfin_rtc_set_time(struct device *dev, struct rtc_time *tm)
|
||||||
int ret;
|
int ret;
|
||||||
unsigned long now;
|
unsigned long now;
|
||||||
|
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
|
|
||||||
spin_lock_irq(&rtc->lock);
|
spin_lock_irq(&rtc->lock);
|
||||||
|
|
||||||
|
@ -327,7 +324,7 @@ static int bfin_rtc_set_time(struct device *dev, struct rtc_time *tm)
|
||||||
static int bfin_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
static int bfin_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
||||||
{
|
{
|
||||||
struct bfin_rtc *rtc = dev_get_drvdata(dev);
|
struct bfin_rtc *rtc = dev_get_drvdata(dev);
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
memcpy(&alrm->time, &rtc->rtc_alarm, sizeof(struct rtc_time));
|
memcpy(&alrm->time, &rtc->rtc_alarm, sizeof(struct rtc_time));
|
||||||
alrm->pending = !!(bfin_read_RTC_ICTL() & (RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));
|
alrm->pending = !!(bfin_read_RTC_ICTL() & (RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -336,7 +333,7 @@ static int bfin_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
||||||
static int bfin_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
static int bfin_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
|
||||||
{
|
{
|
||||||
struct bfin_rtc *rtc = dev_get_drvdata(dev);
|
struct bfin_rtc *rtc = dev_get_drvdata(dev);
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
memcpy(&rtc->rtc_alarm, &alrm->time, sizeof(struct rtc_time));
|
memcpy(&rtc->rtc_alarm, &alrm->time, sizeof(struct rtc_time));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -345,7 +342,7 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq)
|
||||||
{
|
{
|
||||||
#define yesno(x) ((x) ? "yes" : "no")
|
#define yesno(x) ((x) ? "yes" : "no")
|
||||||
u16 ictl = bfin_read_RTC_ICTL();
|
u16 ictl = bfin_read_RTC_ICTL();
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
seq_printf(seq,
|
seq_printf(seq,
|
||||||
"alarm_IRQ\t: %s\n"
|
"alarm_IRQ\t: %s\n"
|
||||||
"wkalarm_IRQ\t: %s\n"
|
"wkalarm_IRQ\t: %s\n"
|
||||||
|
@ -369,7 +366,7 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq)
|
||||||
*/
|
*/
|
||||||
static int bfin_irq_set_freq(struct device *dev, int freq)
|
static int bfin_irq_set_freq(struct device *dev, int freq)
|
||||||
{
|
{
|
||||||
stampit();
|
dev_dbg_stamp(dev);
|
||||||
return -ENOTTY;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +387,7 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
|
||||||
struct bfin_rtc *rtc;
|
struct bfin_rtc *rtc;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
stampit();
|
dev_dbg_stamp(&pdev->dev);
|
||||||
|
|
||||||
rtc = kzalloc(sizeof(*rtc), GFP_KERNEL);
|
rtc = kzalloc(sizeof(*rtc), GFP_KERNEL);
|
||||||
if (unlikely(!rtc))
|
if (unlikely(!rtc))
|
||||||
|
@ -436,7 +433,6 @@ static struct platform_driver bfin_rtc_driver = {
|
||||||
|
|
||||||
static int __init bfin_rtc_init(void)
|
static int __init bfin_rtc_init(void)
|
||||||
{
|
{
|
||||||
stampit();
|
|
||||||
return platform_driver_register(&bfin_rtc_driver);
|
return platform_driver_register(&bfin_rtc_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue