Commit 1eb5b23a authored by David Howells's avatar David Howells Committed by Al Viro

cris: Don't use create_proc_read_entry()

Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Acked-by: default avatarJesper Nilsson <jesper.nilsson@axis.com>
cc: Mikael Starvik <starvik@axis.com>
cc: linux-cris-kernel@axis.com
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 210b834a
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <arch/svinto.h> #include <arch/svinto.h>
#include <asm/fasttimer.h> #include <asm/fasttimer.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#define DEBUG_LOG_INCLUDED #define DEBUG_LOG_INCLUDED
...@@ -489,59 +490,33 @@ void schedule_usleep(unsigned long us) ...@@ -489,59 +490,33 @@ void schedule_usleep(unsigned long us)
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
,int *eof, void *data_unused);
#endif /* CONFIG_PROC_FS */
#ifdef CONFIG_PROC_FS
/* This value is very much based on testing */ /* This value is very much based on testing */
#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) #define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len static int proc_fasttimer_show(struct seq_file *m, void *v)
,int *eof, void *data_unused)
{ {
unsigned long flags; unsigned long flags;
int i = 0; int i = 0;
int num_to_show; int num_to_show;
struct fasttime_t tv; struct fasttime_t tv;
struct fast_timer *t, *nextt; struct fast_timer *t, *nextt;
static char *bigbuf = NULL;
static unsigned long used;
if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE)))
{
used = 0;
if (buf)
buf[0] = '\0';
return 0;
}
if (!offset || !used)
{
do_gettimeofday_fast(&tv); do_gettimeofday_fast(&tv);
used = 0; seq_printf(m, "Fast timers added: %i\n", fast_timers_added);
used += sprintf(bigbuf + used, "Fast timers added: %i\n", seq_printf(m, "Fast timers started: %i\n", fast_timers_started);
fast_timers_added); seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints);
used += sprintf(bigbuf + used, "Fast timers started: %i\n", seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired);
fast_timers_started); seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted);
used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n", seq_printf(m, "Fast timer running: %s\n",
fast_timer_ints);
used += sprintf(bigbuf + used, "Fast timers expired: %i\n",
fast_timers_expired);
used += sprintf(bigbuf + used, "Fast timers deleted: %i\n",
fast_timers_deleted);
used += sprintf(bigbuf + used, "Fast timer running: %s\n",
fast_timer_running ? "yes" : "no"); fast_timer_running ? "yes" : "no");
used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n", seq_printf(m, "Current time: %lu.%06lu\n",
(unsigned long)tv.tv_jiff, (unsigned long)tv.tv_jiff,
(unsigned long)tv.tv_usec); (unsigned long)tv.tv_usec);
#ifdef FAST_TIMER_SANITY_CHECKS #ifdef FAST_TIMER_SANITY_CHECKS
used += sprintf(bigbuf + used, "Sanity failed: %i\n", seq_printf(m, "Sanity failed: %i\n", sanity_failed);
sanity_failed);
#endif #endif
used += sprintf(bigbuf + used, "\n"); seq_putc(m, '\n');
#ifdef DEBUG_LOG_INCLUDED #ifdef DEBUG_LOG_INCLUDED
{ {
...@@ -549,39 +524,33 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len ...@@ -549,39 +524,33 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
i = 0; i = 0;
if (debug_log_cnt_wrapped) if (debug_log_cnt_wrapped)
{
i = debug_log_cnt; i = debug_log_cnt;
}
while ((i != end_i || (debug_log_cnt_wrapped && !used)) && while (i != end_i || debug_log_cnt_wrapped) {
used+100 < BIG_BUF_SIZE) if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0)
{ return 0;
used += sprintf(bigbuf + used, debug_log_string[i],
debug_log_value[i]);
i = (i+1) % DEBUG_LOG_MAX; i = (i+1) % DEBUG_LOG_MAX;
} }
} }
used += sprintf(bigbuf + used, "\n"); seq_putc(m, '\n');
#endif #endif
num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started: num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
NUM_TIMER_STATS); NUM_TIMER_STATS);
used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started); seq_printf(m, "Timers started: %i\n", fast_timers_started);
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++) for (i = 0; i < num_to_show; i++) {
{
int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS; int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
#if 1 //ndef FAST_TIMER_LOG #if 1 //ndef FAST_TIMER_LOG
used += sprintf(bigbuf + used, "div: %i freq: %i delay: %i" seq_printf(m, "div: %i freq: %i delay: %i"
"\n", "\n",
timer_div_settings[cur], timer_div_settings[cur],
timer_freq_settings[cur], timer_freq_settings[cur],
timer_delay_settings[cur] timer_delay_settings[cur]);
);
#endif #endif
#ifdef FAST_TIMER_LOG #ifdef FAST_TIMER_LOG
t = &timer_started_log[cur]; t = &timer_started_log[cur];
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
"d: %6li us data: 0x%08lX" "d: %6li us data: 0x%08lX"
"\n", "\n",
t->name, t->name,
...@@ -590,20 +559,19 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len ...@@ -590,20 +559,19 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
(unsigned long)t->tv_expires.tv_jiff, (unsigned long)t->tv_expires.tv_jiff,
(unsigned long)t->tv_expires.tv_usec, (unsigned long)t->tv_expires.tv_usec,
t->delay_us, t->delay_us,
t->data t->data) < 0)
); return 0;
#endif #endif
} }
used += sprintf(bigbuf + used, "\n"); seq_putc(m, '\n');
#ifdef FAST_TIMER_LOG #ifdef FAST_TIMER_LOG
num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added: num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
NUM_TIMER_STATS); NUM_TIMER_STATS);
used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added); seq_printf(m, "Timers added: %i\n", fast_timers_added);
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) for (i = 0; i < num_to_show; i++) {
{
t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
"d: %6li us data: 0x%08lX" "d: %6li us data: 0x%08lX"
"\n", "\n",
t->name, t->name,
...@@ -612,18 +580,17 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len ...@@ -612,18 +580,17 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
(unsigned long)t->tv_expires.tv_jiff, (unsigned long)t->tv_expires.tv_jiff,
(unsigned long)t->tv_expires.tv_usec, (unsigned long)t->tv_expires.tv_usec,
t->delay_us, t->delay_us,
t->data t->data) < 0)
); return 0;
} }
used += sprintf(bigbuf + used, "\n"); seq_putc(m, '\n');
num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
NUM_TIMER_STATS); NUM_TIMER_STATS);
used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired); seq_printf(m, "Timers expired: %i\n", fast_timers_expired);
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) for (i = 0; i < num_to_show; i++) {
{
t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
"d: %6li us data: 0x%08lX" "d: %6li us data: 0x%08lX"
"\n", "\n",
t->name, t->name,
...@@ -632,20 +599,19 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len ...@@ -632,20 +599,19 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
(unsigned long)t->tv_expires.tv_jiff, (unsigned long)t->tv_expires.tv_jiff,
(unsigned long)t->tv_expires.tv_usec, (unsigned long)t->tv_expires.tv_usec,
t->delay_us, t->delay_us,
t->data t->data) < 0)
); return 0;
} }
used += sprintf(bigbuf + used, "\n"); seq_putc(m, '\n');
#endif #endif
used += sprintf(bigbuf + used, "Active timers:\n"); seq_puts(m, "Active timers:\n");
local_irq_save(flags); local_irq_save(flags);
t = fast_timer_list; t = fast_timer_list;
while (t != NULL && (used+100 < BIG_BUF_SIZE)) while (t) {
{
nextt = t->next; nextt = t->next;
local_irq_restore(flags); local_irq_restore(flags);
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
"d: %6li us data: 0x%08lX" "d: %6li us data: 0x%08lX"
/* " func: 0x%08lX" */ /* " func: 0x%08lX" */
"\n", "\n",
...@@ -657,28 +623,29 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len ...@@ -657,28 +623,29 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
t->delay_us, t->delay_us,
t->data t->data
/* , t->function */ /* , t->function */
); ) < 0)
return 0;
local_irq_save(flags); local_irq_save(flags);
if (t->next != nextt) if (t->next != nextt)
{
printk(KERN_WARNING "timer removed!\n"); printk(KERN_WARNING "timer removed!\n");
}
t = nextt; t = nextt;
} }
local_irq_restore(flags); local_irq_restore(flags);
}
if (used - offset < len) return 0;
{ }
len = used - offset;
}
memcpy(buf, bigbuf + offset, len);
*start = buf;
*eof = 1;
return len; static int proc_fasttimer_open(struct inode *inode, struct file *file)
{
return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE);
} }
static const struct file_operations proc_fasttimer_fops = {
.open = proc_fasttimer_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#endif /* PROC_FS */ #endif /* PROC_FS */
#ifdef FAST_TIMER_TEST #ifdef FAST_TIMER_TEST
...@@ -856,7 +823,7 @@ int fast_timer_init(void) ...@@ -856,7 +823,7 @@ int fast_timer_init(void)
} }
#endif #endif
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
create_proc_read_entry("fasttimer", 0, NULL, proc_fasttimer_read, NULL); proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops);
#endif /* PROC_FS */ #endif /* PROC_FS */
if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0, if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0,
"fast timer int", NULL)) "fast timer int", NULL))
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <hwregs/timer_defs.h> #include <hwregs/timer_defs.h>
#include <asm/fasttimer.h> #include <asm/fasttimer.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
/* /*
* timer0 is running at 100MHz and generating jiffies timer ticks * timer0 is running at 100MHz and generating jiffies timer ticks
...@@ -463,60 +464,33 @@ void schedule_usleep(unsigned long us) ...@@ -463,60 +464,33 @@ void schedule_usleep(unsigned long us)
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
,int *eof, void *data_unused);
#endif /* CONFIG_PROC_FS */
#ifdef CONFIG_PROC_FS
/* This value is very much based on testing */ /* This value is very much based on testing */
#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300) #define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len static int proc_fasttimer_show(struct seq_file *m, void *v)
,int *eof, void *data_unused)
{ {
unsigned long flags; unsigned long flags;
int i = 0; int i = 0;
int num_to_show; int num_to_show;
struct fasttime_t tv; struct fasttime_t tv;
struct fast_timer *t, *nextt; struct fast_timer *t, *nextt;
static char *bigbuf = NULL;
static unsigned long used;
if (!bigbuf) {
bigbuf = vmalloc(BIG_BUF_SIZE);
if (!bigbuf) {
used = 0;
if (buf)
buf[0] = '\0';
return 0;
}
}
if (!offset || !used) {
do_gettimeofday_fast(&tv); do_gettimeofday_fast(&tv);
used = 0; seq_printf(m, "Fast timers added: %i\n", fast_timers_added);
used += sprintf(bigbuf + used, "Fast timers added: %i\n", seq_printf(m, "Fast timers started: %i\n", fast_timers_started);
fast_timers_added); seq_printf(m, "Fast timer interrupts: %i\n", fast_timer_ints);
used += sprintf(bigbuf + used, "Fast timers started: %i\n", seq_printf(m, "Fast timers expired: %i\n", fast_timers_expired);
fast_timers_started); seq_printf(m, "Fast timers deleted: %i\n", fast_timers_deleted);
used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n", seq_printf(m, "Fast timer running: %s\n",
fast_timer_ints);
used += sprintf(bigbuf + used, "Fast timers expired: %i\n",
fast_timers_expired);
used += sprintf(bigbuf + used, "Fast timers deleted: %i\n",
fast_timers_deleted);
used += sprintf(bigbuf + used, "Fast timer running: %s\n",
fast_timer_running ? "yes" : "no"); fast_timer_running ? "yes" : "no");
used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n", seq_printf(m, "Current time: %lu.%06lu\n",
(unsigned long)tv.tv_jiff, (unsigned long)tv.tv_jiff,
(unsigned long)tv.tv_usec); (unsigned long)tv.tv_usec);
#ifdef FAST_TIMER_SANITY_CHECKS #ifdef FAST_TIMER_SANITY_CHECKS
used += sprintf(bigbuf + used, "Sanity failed: %i\n", seq_printf(m, "Sanity failed: %i\n", sanity_failed);
sanity_failed);
#endif #endif
used += sprintf(bigbuf + used, "\n"); seq_putc(m, '\n');
#ifdef DEBUG_LOG_INCLUDED #ifdef DEBUG_LOG_INCLUDED
{ {
...@@ -526,34 +500,30 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len ...@@ -526,34 +500,30 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
if (debug_log_cnt_wrapped) if (debug_log_cnt_wrapped)
i = debug_log_cnt; i = debug_log_cnt;
while ((i != end_i || (debug_log_cnt_wrapped && !used)) && while ((i != end_i || debug_log_cnt_wrapped)) {
used+100 < BIG_BUF_SIZE) if (seq_printf(m, debug_log_string[i], debug_log_value[i]) < 0)
{ return 0;
used += sprintf(bigbuf + used, debug_log_string[i],
debug_log_value[i]);
i = (i+1) % DEBUG_LOG_MAX; i = (i+1) % DEBUG_LOG_MAX;
} }
} }
used += sprintf(bigbuf + used, "\n"); seq_putc(m, '\n');
#endif #endif
num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started: num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
NUM_TIMER_STATS); NUM_TIMER_STATS);
used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started); seq_printf(m, "Timers started: %i\n", fast_timers_started);
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++) for (i = 0; i < num_to_show; i++) {
{
int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS; int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
#if 1 //ndef FAST_TIMER_LOG #if 1 //ndef FAST_TIMER_LOG
used += sprintf(bigbuf + used, "div: %i delay: %i" seq_printf(m, "div: %i delay: %i"
"\n", "\n",
timer_div_settings[cur], timer_div_settings[cur],
timer_delay_settings[cur] timer_delay_settings[cur]);
);
#endif #endif
#ifdef FAST_TIMER_LOG #ifdef FAST_TIMER_LOG
t = &timer_started_log[cur]; t = &timer_started_log[cur];
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
"d: %6li us data: 0x%08lX" "d: %6li us data: 0x%08lX"
"\n", "\n",
t->name, t->name,
...@@ -562,20 +532,19 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len ...@@ -562,20 +532,19 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
(unsigned long)t->tv_expires.tv_jiff, (unsigned long)t->tv_expires.tv_jiff,
(unsigned long)t->tv_expires.tv_usec, (unsigned long)t->tv_expires.tv_usec,
t->delay_us, t->delay_us,
t->data t->data) < 0)
); return 0;
#endif #endif
} }
used += sprintf(bigbuf + used, "\n"); seq_putc(m, '\n');
#ifdef FAST_TIMER_LOG #ifdef FAST_TIMER_LOG
num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added: num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
NUM_TIMER_STATS); NUM_TIMER_STATS);
used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added); seq_printf(m, "Timers added: %i\n", fast_timers_added);
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) for (i = 0; i < num_to_show; i++) {
{
t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS]; t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
"d: %6li us data: 0x%08lX" "d: %6li us data: 0x%08lX"
"\n", "\n",
t->name, t->name,
...@@ -584,18 +553,17 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len ...@@ -584,18 +553,17 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
(unsigned long)t->tv_expires.tv_jiff, (unsigned long)t->tv_expires.tv_jiff,
(unsigned long)t->tv_expires.tv_usec, (unsigned long)t->tv_expires.tv_usec,
t->delay_us, t->delay_us,
t->data t->data) < 0)
); return 0;
} }
used += sprintf(bigbuf + used, "\n"); seq_putc(m, '\n');
num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired: num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
NUM_TIMER_STATS); NUM_TIMER_STATS);
used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired); seq_printf(m, "Timers expired: %i\n", fast_timers_expired);
for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++) for (i = 0; i < num_to_show; i++){
{
t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS]; t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
"d: %6li us data: 0x%08lX" "d: %6li us data: 0x%08lX"
"\n", "\n",
t->name, t->name,
...@@ -604,20 +572,19 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len ...@@ -604,20 +572,19 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
(unsigned long)t->tv_expires.tv_jiff, (unsigned long)t->tv_expires.tv_jiff,
(unsigned long)t->tv_expires.tv_usec, (unsigned long)t->tv_expires.tv_usec,
t->delay_us, t->delay_us,
t->data t->data) < 0)
); return 0;
} }
used += sprintf(bigbuf + used, "\n"); seq_putc(m, '\n');
#endif #endif
used += sprintf(bigbuf + used, "Active timers:\n"); seq_puts(m, "Active timers:\n");
local_irq_save(flags); local_irq_save(flags);
t = fast_timer_list; t = fast_timer_list;
while (t != NULL && (used+100 < BIG_BUF_SIZE)) while (t != NULL){
{
nextt = t->next; nextt = t->next;
local_irq_restore(flags); local_irq_restore(flags);
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " if (seq_printf(m, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
"d: %6li us data: 0x%08lX" "d: %6li us data: 0x%08lX"
/* " func: 0x%08lX" */ /* " func: 0x%08lX" */
"\n", "\n",
...@@ -629,28 +596,29 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len ...@@ -629,28 +596,29 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
t->delay_us, t->delay_us,
t->data t->data
/* , t->function */ /* , t->function */
); ) < 0)
return 0;
local_irq_save(flags); local_irq_save(flags);
if (t->next != nextt) if (t->next != nextt)
{
printk("timer removed!\n"); printk("timer removed!\n");
}
t = nextt; t = nextt;
} }
local_irq_restore(flags); local_irq_restore(flags);
} return 0;
}
if (used - offset < len) static int proc_fasttimer_open(struct inode *inode, struct file *file)
{ {
len = used - offset; return single_open_size(file, proc_fasttimer_show, PDE_DATA(inode), BIG_BUF_SIZE);
} }
memcpy(buf, bigbuf + offset, len); static const struct file_operations proc_fasttimer_fops = {
*start = buf; .open = proc_fasttimer_open,
*eof = 1; .read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
return len;
}
#endif /* PROC_FS */ #endif /* PROC_FS */
#ifdef FAST_TIMER_TEST #ifdef FAST_TIMER_TEST
...@@ -815,7 +783,7 @@ int fast_timer_init(void) ...@@ -815,7 +783,7 @@ int fast_timer_init(void)
printk("fast_timer_init()\n"); printk("fast_timer_init()\n");
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
create_proc_read_entry("fasttimer", 0, NULL, proc_fasttimer_read, NULL); proc_create("fasttimer", 0, NULL, &proc_fasttimer_fops);
#endif /* PROC_FS */ #endif /* PROC_FS */
if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt, if (request_irq(TIMER0_INTR_VECT, timer_trig_interrupt,
IRQF_SHARED | IRQF_DISABLED, IRQF_SHARED | IRQF_DISABLED,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment