Skip to content
Snippets Groups Projects
Commit 8e9064b4 authored by Luis Gerhorst's avatar Luis Gerhorst Committed by Bernhard Heinloth
Browse files

Improve bottom handler type variable naming

parent 0582049e
Branches
No related tags found
No related merge requests found
......@@ -85,21 +85,24 @@ enum memo_bottom_handler {
MMBH_SOFTIRQ
};
static char *bottom_handler_map_strings[] = {"workqueue\n", "tasklet\n", "softirq\n", NULL};
static enum memo_bottom_handler bottom_handler_map[] = {MMBH_WORKQUEUE, MMBH_TASKLET, MMBH_SOFTIRQ};
static char *debugfs_bottom_handler_map_strings[] = {"workqueue\n", "tasklet\n",
"softirq\n", NULL};
static enum memo_bottom_handler debugfs_bottom_handler_map[] = {MMBH_WORKQUEUE,
MMBH_TASKLET,
MMBH_SOFTIRQ};
static const char *option_bottom_handler_str = "tasklet\n";
static enum memo_bottom_handler option_bottom_handler = MMBH_TASKLET;
static const char *debugfs_bottom_handler_str = "tasklet\n";
static enum memo_bottom_handler debugfs_bottom_handler = MMBH_TASKLET;
static ssize_t bottom_handler_read(struct file *fp, char __user *user_buffer,
static ssize_t debugfs_bottom_handler_read(struct file *fp, char __user *user_buffer,
size_t count, loff_t *position)
{
return simple_read_from_buffer(user_buffer, count, position,
option_bottom_handler_str,
strlen(option_bottom_handler_str));
debugfs_bottom_handler_str,
strlen(debugfs_bottom_handler_str));
}
static ssize_t bottom_handler_write(struct file *fp,
static ssize_t debugfs_bottom_handler_write(struct file *fp,
const char __user *user_buffer,
size_t count, loff_t *position)
{
......@@ -109,10 +112,10 @@ static ssize_t bottom_handler_write(struct file *fp,
BUG();
}
for (int i = 0; bottom_handler_map_strings[i]; i++) {
if (strcmp(bottom_handler_map_strings[i], buf) == 0) {
option_bottom_handler = bottom_handler_map[i];
option_bottom_handler_str = bottom_handler_map_strings[i];
for (int i = 0; debugfs_bottom_handler_map_strings[i]; i++) {
if (strcmp(debugfs_bottom_handler_map_strings[i], buf) == 0) {
debugfs_bottom_handler = debugfs_bottom_handler_map[i];
debugfs_bottom_handler_str = debugfs_bottom_handler_map_strings[i];
return count;
}
}
......@@ -123,8 +126,8 @@ static ssize_t bottom_handler_write(struct file *fp,
static const struct file_operations debugfs_bottom_handler_fops = {
/* TODO: Not sure if this is legit, can't read/write only ask for a
* portion of the string? */
.read = bottom_handler_read,
.write = bottom_handler_write,
.read = debugfs_bottom_handler_read,
.write = debugfs_bottom_handler_write,
};
/***********
......@@ -193,9 +196,9 @@ static u64 debugfs_cp_capacity = 25;
static irqreturn_t memo_irq_handler(int irq, void *dev_id)
{
memo_checkpoint("irq");
switch (option_bottom_handler) {
switch (debugfs_bottom_handler) {
case MMBH_WORKQUEUE:
queue_work(system_highpri_wq, &memo_work);
queue_work(system_wq, &memo_work);
break;
case MMBH_TASKLET:
tasklet_schedule(&memo_tasklet);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment