drivers/char/sa1100-rtc.c에서 open()쪽을 보면...
if (test_and_set_bit (1, &rtc_status))
return -EBUSY;
rtc_irq_data = 0;
짜잔~ 다른 놈이 open하고 있으면 다시는 안 열린다.
RTC 동작방식을 생각하면 일견 이해가 되지만, 문제는 debugging...
sleep/wakeup에 문제가 있어 debugging하려니 영~불편하군.
임시로 return -EBUSY를 skip하게 만들어서 kernel을 올려서 test하다가 자주 이런 일이 발생할 것같기도 해서...
내친김에 run-time debugging feature를 만들어버렸다.
static __inline__ int mz_debug_on_p(void) {
return (mz_ops.stat & MZ_DEBUG_ON);
}
echo 1 > /proc/sys/debug/enable 이면 debugging-on
0이면 off하게...
가볍게 생각하고 다음과 같이 code를 고치고 룰루랄라했는데...
if (test_and_set_bit (1, &rtc_status))
+#ifdef CONFIG_MIZI
+ if (!mz_debug_on_p())
+#endif
return -EBUSY;
rtc_irq_data = 0;
이런... 한번 debugging feature를 on 시켜서 강제로 열면 계속 열리는 것이 아닌가!!! 헐헐헐... 가볍게 끝날 것같던 code가 결국 5시간이나 debugging을 해야했다. (중간에 점심시간을 생각해도 T.T)
close()쪽에서 rtc_status를 clear하는 것을 미쳐 생각 못한 것.
더하기 변수 하나 (open된 횟수 세는 놈) 추가하기 싫어서 rtc_status의 상위 16bit가지고 끄적거린다고 버린 시간이 5시간 된 것이다. --;;;
결국 변수하나 추가하고 (처음부터 그럴 것이지...) 해결봤다.
open()...
#ifdef CONFIG_MIZI
if (mz_debug_on_p()) {
rtc_open_cnt++;
if (!test_and_set_bit (1, &rtc_status))
rtc_irq_data = 0;
return 0;
}
#endif
if (test_and_set_bit (1, &rtc_status))
return -EBUSY;
#ifdef CONFIG_MIZI
rtc_open_cnt++;
#endif
rtc_irq_data = 0;
return 0;
close()...
#ifdef CONFIG_MIZI
rtc_open_cnt--;
if (mz_debug_on_p()) {
if (rtc_open_cnt > 0)
return 0;
}
#endif
spin_lock_irq (&rtc_lock);
RTSR = 0;
blah... blah...
if (test_and_set_bit (1, &rtc_status))
return -EBUSY;
rtc_irq_data = 0;
짜잔~ 다른 놈이 open하고 있으면 다시는 안 열린다.
RTC 동작방식을 생각하면 일견 이해가 되지만, 문제는 debugging...
sleep/wakeup에 문제가 있어 debugging하려니 영~불편하군.
임시로 return -EBUSY를 skip하게 만들어서 kernel을 올려서 test하다가 자주 이런 일이 발생할 것같기도 해서...
내친김에 run-time debugging feature를 만들어버렸다.
static __inline__ int mz_debug_on_p(void) {
return (mz_ops.stat & MZ_DEBUG_ON);
}
echo 1 > /proc/sys/debug/enable 이면 debugging-on
0이면 off하게...
가볍게 생각하고 다음과 같이 code를 고치고 룰루랄라했는데...
if (test_and_set_bit (1, &rtc_status))
+#ifdef CONFIG_MIZI
+ if (!mz_debug_on_p())
+#endif
return -EBUSY;
rtc_irq_data = 0;
이런... 한번 debugging feature를 on 시켜서 강제로 열면 계속 열리는 것이 아닌가!!! 헐헐헐... 가볍게 끝날 것같던 code가 결국 5시간이나 debugging을 해야했다. (중간에 점심시간을 생각해도 T.T)
close()쪽에서 rtc_status를 clear하는 것을 미쳐 생각 못한 것.
더하기 변수 하나 (open된 횟수 세는 놈) 추가하기 싫어서 rtc_status의 상위 16bit가지고 끄적거린다고 버린 시간이 5시간 된 것이다. --;;;
결국 변수하나 추가하고 (처음부터 그럴 것이지...) 해결봤다.
open()...
#ifdef CONFIG_MIZI
if (mz_debug_on_p()) {
rtc_open_cnt++;
if (!test_and_set_bit (1, &rtc_status))
rtc_irq_data = 0;
return 0;
}
#endif
if (test_and_set_bit (1, &rtc_status))
return -EBUSY;
#ifdef CONFIG_MIZI
rtc_open_cnt++;
#endif
rtc_irq_data = 0;
return 0;
close()...
#ifdef CONFIG_MIZI
rtc_open_cnt--;
if (mz_debug_on_p()) {
if (rtc_open_cnt > 0)
return 0;
}
#endif
spin_lock_irq (&rtc_lock);
RTSR = 0;
blah... blah...