Commit 765db0a3 authored by 吴智聪(John Wu)'s avatar 吴智聪(John Wu)

clean up neuros_ir and neuros_ir_blaster code

parent 67fc7be9
...@@ -61,7 +61,8 @@ ...@@ -61,7 +61,8 @@
#define IR_RETRY_COUNT 3 #define IR_RETRY_COUNT 3
#define FACTORY_TEST_DELAY 6 #define FACTORY_TEST_DELAY 6
struct irrtc_device { struct irrtc_device
{
int key; int key;
}; };
static struct irrtc_device device; static struct irrtc_device device;
...@@ -71,18 +72,18 @@ static wait_queue_head_t poll_queue; ...@@ -71,18 +72,18 @@ static wait_queue_head_t poll_queue;
static char *devname = "neuros_ir"; static char *devname = "neuros_ir";
static struct input_dev *ir_input_dev; static struct input_dev *ir_input_dev;
static int factory_test=0; static int factory_test = 0;
static int osd_key=0; static int osd_key = 0;
static int is_learning=0; static int is_learning = 0;
#if USE_WORKQUEUE #if USE_WORKQUEUE
#define KEYBUF_SIZE 2 #define KEYBUF_SIZE 2
static int keybuf[KEYBUF_SIZE]; static int keybuf[KEYBUF_SIZE];
static int roffset=0; static int roffset = 0;
static int woffset=0; static int woffset = 0;
static int numOfKeys=0; static int numOfKeys = 0;
#else #else
static int keyin=0; static int keyin = 0;
#endif #endif
static void irrtc_report_key(int ir_key); static void irrtc_report_key(int ir_key);
...@@ -105,7 +106,7 @@ EXPORT_SYMBOL(unlock_data_protect); ...@@ -105,7 +106,7 @@ EXPORT_SYMBOL(unlock_data_protect);
static void set_factory_test(int value) static void set_factory_test(int value)
{ {
factory_test=value; factory_test = value;
} }
EXPORT_SYMBOL(set_factory_test); EXPORT_SYMBOL(set_factory_test);
...@@ -117,13 +118,13 @@ EXPORT_SYMBOL(get_osd_key); ...@@ -117,13 +118,13 @@ EXPORT_SYMBOL(get_osd_key);
static void set_osd_key(int value) static void set_osd_key(int value)
{ {
osd_key=value; osd_key = value;
} }
EXPORT_SYMBOL(set_osd_key); EXPORT_SYMBOL(set_osd_key);
static void set_is_learning(int value) static void set_is_learning(int value)
{ {
is_learning=value; is_learning = value;
} }
EXPORT_SYMBOL(set_is_learning); EXPORT_SYMBOL(set_is_learning);
...@@ -140,7 +141,7 @@ static int read_keybuf(void) ...@@ -140,7 +141,7 @@ static int read_keybuf(void)
{ {
numOfKeys--; numOfKeys--;
key = keybuf[roffset]; key = keybuf[roffset];
if(++roffset >= KEYBUF_SIZE) roffset = 0; if (++roffset >= KEYBUF_SIZE) roffset = 0;
} }
up(&keybuf_sem); up(&keybuf_sem);
...@@ -158,14 +159,14 @@ static void write_keybuf(int key) ...@@ -158,14 +159,14 @@ static void write_keybuf(int key)
// Display some more sober debug message on key presses but don't bother with key releases. // Display some more sober debug message on key presses but don't bother with key releases.
if (key != 0x00) printk("{IR:key:%02x}\n", key); if (key != 0x00) printk("{IR:key:%02x}\n", key);
if(++numOfKeys > KEYBUF_SIZE) if (++numOfKeys > KEYBUF_SIZE)
{ {
numOfKeys = KEYBUF_SIZE; numOfKeys = KEYBUF_SIZE;
if(++roffset >= KEYBUF_SIZE) roffset = 0; if (++roffset >= KEYBUF_SIZE) roffset = 0;
} }
keybuf[woffset]=key; keybuf[woffset] = key;
if(++woffset >= KEYBUF_SIZE) woffset = 0; if (++woffset >= KEYBUF_SIZE) woffset = 0;
up(&keybuf_sem); up(&keybuf_sem);
} }
...@@ -224,7 +225,7 @@ static irqreturn_t handle_irrtc_irqs(int irq, void * dev_id) ...@@ -224,7 +225,7 @@ static irqreturn_t handle_irrtc_irqs(int irq, void * dev_id)
set_factory_test(0); set_factory_test(0);
} }
#else #else
keyin=1; keyin = 1;
#endif #endif
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -273,31 +274,34 @@ static ssize_t irrtc_read(struct file *filp, char __user *buff, size_t count, lo ...@@ -273,31 +274,34 @@ static ssize_t irrtc_read(struct file *filp, char __user *buff, size_t count, lo
key = read_keybuf(); key = read_keybuf();
dbg("key=%d\n", key); dbg("key=%d\n", key);
if (key!=-1) //none key if (key != -1) //none key
r=copy_to_user(buff, &key, sizeof(int)); r = copy_to_user(buff, &key, sizeof(int));
else else
count=0; count = 0;
#else #else
if (-EINTR == down_interruptible(&keybuf_sem)) if (-EINTR == down_interruptible(&keybuf_sem))
return 0; return 0;
if (count > KEYBUF_SIZE * sizeof(int)) { if (count > KEYBUF_SIZE * sizeof(int))
{
if (roffset <= woffset) if (roffset <= woffset)
count = (woffset - roffset) * sizeof(int); count = (woffset - roffset) * sizeof(int);
else else
count = (KEYBUF_SIZE - (roffset - woffset + 1)) * sizeof(int); count = (KEYBUF_SIZE - (roffset - woffset + 1)) * sizeof(int);
} }
if (count == 0) { if (count == 0)
{
printk("buffer empty\n"); printk("buffer empty\n");
goto out; goto out;
} }
if (roffset < woffset) if (roffset < woffset)
r=copy_to_user(buff, keybuf + roffset, count); r = copy_to_user(buff, keybuf + roffset, count);
else { else
r=copy_to_user(buff, &keybuf[roffset], (KEYBUF_SIZE - roffset + 1) * sizeof(int)); {
r=copy_to_user(buff + (KEYBUF_SIZE - roffset + 1) * sizeof(int), keybuf, woffset * sizeof(int)); r = copy_to_user(buff, &keybuf[roffset], (KEYBUF_SIZE - roffset + 1) * sizeof(int));
r = copy_to_user(buff + (KEYBUF_SIZE - roffset + 1) * sizeof(int), keybuf, woffset * sizeof(int));
} }
out: out:
......
...@@ -64,9 +64,9 @@ ...@@ -64,9 +64,9 @@
#define GIO_CAP (1<<7) #define GIO_CAP (1<<7)
static int learning_status = 0; static int learning_status = 0;
static int bls_wave_count; static int bls_wave_count;
static int bls_status=BLS_COMPLETE; static int bls_status = BLS_COMPLETE;
static int timer_int_counter=0; static int timer_int_counter = 0;
static int wave_len=0; static int wave_len = 0;
static int int_type; static int int_type;
static struct timer_list learning_key_timer; static struct timer_list learning_key_timer;
static struct blaster_data_type *BlsKey; static struct blaster_data_type *BlsKey;
...@@ -108,50 +108,50 @@ static void set_timer1_div(struct blaster_data_pack *blsdat) ...@@ -108,50 +108,50 @@ static void set_timer1_div(struct blaster_data_pack *blsdat)
unsigned int div; unsigned int div;
int count; int count;
static int sbit; static int sbit;
if(wave_len) if (wave_len)
{ {
div=wave_len; div = wave_len;
if(div>MAX_COUNTER) if (div > MAX_COUNTER)
div=MAX_COUNTER; div = MAX_COUNTER;
wave_len-=div; wave_len -= div;
} }
else else
{ {
count=blsdat->bitstimes&BITS_COUNT_MASK; count = blsdat->bitstimes&BITS_COUNT_MASK;
if(count==bls_wave_count) if (count == bls_wave_count)
sbit=0; sbit = 0;
if(keybit_get(blsdat->mbits, (count-bls_wave_count))) if (keybit_get(blsdat->mbits, (count - bls_wave_count)))
{ {
if(keybit_get(blsdat->dbits, (count-bls_wave_count))) if (keybit_get(blsdat->dbits, (count - bls_wave_count)))
{ {
div=blsdat->specbits[sbit]; div = blsdat->specbits[sbit];
sbit++; sbit++;
} }
else else
{ {
div=blsdat->bit2; div = blsdat->bit2;
} }
} }
else else
{ {
if(keybit_get(blsdat->dbits, (count-bls_wave_count))) if (keybit_get(blsdat->dbits, (count - bls_wave_count)))
{ {
div=blsdat->bit1; div = blsdat->bit1;
} }
else else
{ {
div=blsdat->bit0; div = blsdat->bit0;
} }
} }
} }
//div-=div>>5; // The ideal situation is that set the timer prescale to let the timer cycle is 1us //div-=div>>5; // The ideal situation is that set the timer prescale to let the timer cycle is 1us
// but the nearest setting make the cycle 1.032us so do this adjustment with // but the nearest setting make the cycle 1.032us so do this adjustment with
// divider value // divider value
div-=INT_TIMER1_TIME_WASTE; div -= INT_TIMER1_TIME_WASTE;
if(div>MAX_COUNTER) if (div > MAX_COUNTER)
{ {
wave_len=div-MAX_COUNTER; wave_len = div - MAX_COUNTER;
div=MAX_COUNTER; div = MAX_COUNTER;
} }
div--; div--;
TIMER1_TCR &= ~(3<<22); //disable timer1 34 TIMER1_TCR &= ~(3<<22); //disable timer1 34
...@@ -169,34 +169,34 @@ static void set_timer1_div(struct blaster_data_pack *blsdat) ...@@ -169,34 +169,34 @@ static void set_timer1_div(struct blaster_data_pack *blsdat)
static void blaster_key(struct blaster_data_pack* blsdat) static void blaster_key(struct blaster_data_pack* blsdat)
{ {
uint16_t bitset2; uint16_t bitset2;
wave_len=0; wave_len = 0;
bls_status=BLS_START; bls_status = BLS_START;
bls_wave_count=blsdat->bitstimes&BITS_COUNT_MASK; bls_wave_count = blsdat->bitstimes & BITS_COUNT_MASK;
if(bls_wave_count>BLASTER_MAX_CHANGE || bls_wave_count<=0) if (bls_wave_count > BLASTER_MAX_CHANGE || bls_wave_count <= 0)
{ {
bls_status=BLS_ERROR; bls_status = BLS_ERROR;
if(bls_data_pack) if (bls_data_pack)
{ {
kfree(bls_data_pack); kfree(bls_data_pack);
bls_data_pack=NULL; bls_data_pack = NULL;
} }
return; return;
} }
GPIO23_DIR &= ~GIO_BLS; //gio 47 direction output GPIO23_DIR &= ~GIO_BLS; //gio 47 direction output
GPIO23_CLR_DATA |= GIO_BLS; GPIO23_CLR_DATA |= GIO_BLS;
/*check if the io port status correct if not correct set it's logic to reverse of start level and hold for a momemt*/ /*check if the io port status correct if not correct set it's logic to reverse of start level and hold for a momemt*/
bitset2=GPIO23_OUT_DATA; bitset2 = GPIO23_OUT_DATA;
if(((bitset2 & GIO_BLS)!=0)&&((bls_data_pack->bitstimes&BITS_COUNT_MASK)!=0)) if (((bitset2 & GIO_BLS) != 0) && ((bls_data_pack->bitstimes & BITS_COUNT_MASK) != 0))
{ {
GPIO23_CLR_DATA |= GIO_BLS; GPIO23_CLR_DATA |= GIO_BLS;
msleep(WAIT_HARDWARE_RESET); msleep(WAIT_HARDWARE_RESET);
} }
else if(((bitset2 & GIO_BLS)==0)&&((bls_data_pack->bitstimes&BITS_COUNT_MASK)==0)) else if (((bitset2 & GIO_BLS) == 0) && ((bls_data_pack->bitstimes & BITS_COUNT_MASK) == 0))
{ {
GPIO23_SET_DATA |= GIO_BLS; GPIO23_SET_DATA |= GIO_BLS;
msleep(WAIT_HARDWARE_RESET); msleep(WAIT_HARDWARE_RESET);
} }
if(blsdat->bitstimes & FIRST_LEVEL_BIT_MASK) if (blsdat->bitstimes & FIRST_LEVEL_BIT_MASK)
GPIO23_SET_DATA |= GIO_BLS; GPIO23_SET_DATA |= GIO_BLS;
else else
GPIO23_CLR_DATA |= GIO_BLS; GPIO23_CLR_DATA |= GIO_BLS;
...@@ -208,12 +208,12 @@ void timer_handle(unsigned long data) ...@@ -208,12 +208,12 @@ void timer_handle(unsigned long data)
{ {
int osd_key; int osd_key;
dbg("bitstimes=%d\n", BlsKey->bitstimes); dbg("bitstimes=%d\n", BlsKey->bitstimes);
if(learning_status & WAIT_LEARN_COMPLETE) if (learning_status & WAIT_LEARN_COMPLETE)
{ {
lock_data_protect(); lock_data_protect();
osd_key=get_osd_key(); osd_key=get_osd_key();
unlock_data_protect(); unlock_data_protect();
if(!osd_key ) if (!osd_key )
{ {
disable_irq(IRQ_TINT1_TINT34); disable_irq(IRQ_TINT1_TINT34);
TIMER1_TCR &= ~(3<<22); //disable timer1 34 TIMER1_TCR &= ~(3<<22); //disable timer1 34
...@@ -226,9 +226,9 @@ void timer_handle(unsigned long data) ...@@ -226,9 +226,9 @@ void timer_handle(unsigned long data)
learning_key_timer.function = timer_handle; learning_key_timer.function = timer_handle;
mod_timer(&learning_key_timer, jiffies + POLL_RELEASE_DELAY); mod_timer(&learning_key_timer, jiffies + POLL_RELEASE_DELAY);
} }
else if(learning_status & WAIT_RELEASE_REMOTE) else if (learning_status & WAIT_RELEASE_REMOTE)
{ {
if(learning_status & KEY_WAVE_PRESENT) if (learning_status & KEY_WAVE_PRESENT)
{ {
learning_status &= ~KEY_WAVE_PRESENT; learning_status &= ~KEY_WAVE_PRESENT;
learning_key_timer.function = timer_handle; learning_key_timer.function = timer_handle;
...@@ -238,9 +238,9 @@ void timer_handle(unsigned long data) ...@@ -238,9 +238,9 @@ void timer_handle(unsigned long data)
{ {
disable_learning(); disable_learning();
lock_data_protect(); lock_data_protect();
osd_key=get_osd_key(); osd_key = get_osd_key();
unlock_data_protect(); unlock_data_protect();
if(!osd_key ) if (!osd_key )
{ {
report_key(RELEASE_REMOTE_KEY); report_key(RELEASE_REMOTE_KEY);
//report_key(UP_KEY); //report_key(UP_KEY);
...@@ -251,22 +251,22 @@ void timer_handle(unsigned long data) ...@@ -251,22 +251,22 @@ void timer_handle(unsigned long data)
static int capture_key(struct blaster_data_type* blsdat) static int capture_key(struct blaster_data_type* blsdat)
{ {
static int times=0; static int times = 0;
static int old_counter; static int old_counter;
static int old_int_counter; static int old_int_counter;
int counter; int counter;
int td; int td;
if(!(learning_status & WAIT_RELEASE_REMOTE)) if (!(learning_status & WAIT_RELEASE_REMOTE))
{ {
counter=TIMER1_TIM34; counter = TIMER1_TIM34;
if(old_int_counter==timer_int_counter) if (old_int_counter == timer_int_counter)
td=counter - old_counter; td = counter - old_counter;
else else
td=MAX_COUNTER - old_counter - INT_CAPTURE_TIME_WASTE + counter ; td = MAX_COUNTER - old_counter - INT_CAPTURE_TIME_WASTE + counter ;
old_counter=counter; old_counter = counter;
old_int_counter=timer_int_counter; old_int_counter = timer_int_counter;
if(learning_status == 0) if (learning_status == 0)
{ {
times = 0; times = 0;
learning_key_timer.function = timer_handle; learning_key_timer.function = timer_handle;
...@@ -274,14 +274,14 @@ static int capture_key(struct blaster_data_type* blsdat) ...@@ -274,14 +274,14 @@ static int capture_key(struct blaster_data_type* blsdat)
learning_status |= WAIT_LEARN_COMPLETE; learning_status |= WAIT_LEARN_COMPLETE;
} }
if(0 == times++) if (0 == times++)
{ {
blsdat->bitstimes |= ((SET_GPIO01_IN_DATA & GIO_CAP) << 8); blsdat->bitstimes |= ((SET_GPIO01_IN_DATA & GIO_CAP) << 8);
return 0; return 0;
} }
blsdat->bits[times-2]=td; blsdat->bits[times-2] = td;
blsdat->bitstimes++; blsdat->bitstimes++;
if(times == BLASTER_MAX_CHANGE+1) if (times == BLASTER_MAX_CHANGE+1)
{ {
disable_irq(IRQ_TINT1_TINT34); disable_irq(IRQ_TINT1_TINT34);
TIMER1_TCR &= ~(3<<22); //disable timer1 34 TIMER1_TCR &= ~(3<<22); //disable timer1 34
...@@ -301,32 +301,32 @@ static int capture_key(struct blaster_data_type* blsdat) ...@@ -301,32 +301,32 @@ static int capture_key(struct blaster_data_type* blsdat)
static irqreturn_t handle_bls_timer1_irqs(int irq, void * dev_id) static irqreturn_t handle_bls_timer1_irqs(int irq, void * dev_id)
{ {
uint32_t bitset2; uint32_t bitset2;
if(int_type==CAPTURE) if (int_type == CAPTURE)
{ {
timer_int_counter++; timer_int_counter++;
return IRQ_HANDLED; return IRQ_HANDLED;
} }
if(bls_wave_count==0) if (bls_wave_count == 0)
return IRQ_HANDLED; return IRQ_HANDLED;
if(!wave_len) if (!wave_len)
{ {
bitset2=GPIO23_OUT_DATA; bitset2 = GPIO23_OUT_DATA;
if(bitset2 & GIO_BLS) if (bitset2 & GIO_BLS)
GPIO23_CLR_DATA |= GIO_BLS; GPIO23_CLR_DATA |= GIO_BLS;
else else
GPIO23_SET_DATA |= GIO_BLS; GPIO23_SET_DATA |= GIO_BLS;
bls_wave_count--; bls_wave_count--;
} }
if(bls_wave_count==0) if (bls_wave_count == 0)
{ {
disable_irq(IRQ_TINT1_TINT34); disable_irq(IRQ_TINT1_TINT34);
TIMER1_TCR &= ~(3<<22); //disable timer1 34 TIMER1_TCR &= ~(3<<22); //disable timer1 34
GPIO23_DIR |= GIO_BLS; //gio 47 direction input GPIO23_DIR |= GIO_BLS; //gio 47 direction input
bls_status=BLS_COMPLETE; bls_status = BLS_COMPLETE;
if(bls_data_pack) if (bls_data_pack)
{ {
kfree(bls_data_pack); kfree(bls_data_pack);
bls_data_pack=NULL; bls_data_pack = NULL;
} }
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -348,7 +348,7 @@ static irqreturn_t handle_capture_irqs(int irq, void * dev_id, struct pt_regs * ...@@ -348,7 +348,7 @@ static irqreturn_t handle_capture_irqs(int irq, void * dev_id, struct pt_regs *
static int irrtc_open(struct inode * inode, struct file * file) static int irrtc_open(struct inode * inode, struct file * file)
{ {
#ifdef ONLYOPENONE #ifdef ONLYOPENONE
if(opened) if (opened)
return -EBUSY; return -EBUSY;
opened = 1; opened = 1;
#endif #endif
...@@ -359,7 +359,7 @@ static int irrtc_open(struct inode * inode, struct file * file) ...@@ -359,7 +359,7 @@ static int irrtc_open(struct inode * inode, struct file * file)
static int irrtc_release(struct inode * inode, struct file * file) static int irrtc_release(struct inode * inode, struct file * file)
{ {
#ifdef ONLYOPENONE #ifdef ONLYOPENONE
if(!opened) if (!opened)
return -ERESTARTSYS; return -ERESTARTSYS;
opened = 0; opened = 0;
...@@ -373,27 +373,27 @@ static int irrtc_ioctl(struct inode * inode, struct file * file, ...@@ -373,27 +373,27 @@ static int irrtc_ioctl(struct inode * inode, struct file * file,
{ {
int ret = 0; int ret = 0;
int arg_size; int arg_size;
if(_IOC_TYPE(cmd) != NEUROS_IR_BLASTER_IOC_MAGIC) if (_IOC_TYPE(cmd) != NEUROS_IR_BLASTER_IOC_MAGIC)
{ {
ret = -EINVAL; ret = -EINVAL;
goto bail; goto bail;
} }
arg_size = _IOC_SIZE(cmd); arg_size = _IOC_SIZE(cmd);
if(_IOC_DIR(cmd) & _IOC_READ) if (_IOC_DIR(cmd) & _IOC_READ)
ret = !access_ok(VERIFY_WRITE, (void *)arg, arg_size); ret = !access_ok(VERIFY_WRITE, (void *)arg, arg_size);
else if(_IOC_DIR(cmd) & _IOC_WRITE) else if (_IOC_DIR(cmd) & _IOC_WRITE)
ret = !access_ok(VERIFY_READ, (void *)arg, arg_size); ret = !access_ok(VERIFY_READ, (void *)arg, arg_size);
if(ret) goto bail; if (ret) goto bail;
switch(cmd) switch (cmd)
{ {
case RRB_BLASTER_KEY: case RRB_BLASTER_KEY:
{ {
if(bls_status!=BLS_START) if (bls_status != BLS_START)
{ {
int_type=BLASTER; int_type = BLASTER;
bls_data_pack=kmalloc(sizeof(struct blaster_data_pack), GFP_KERNEL); bls_data_pack = kmalloc(sizeof(struct blaster_data_pack), GFP_KERNEL);
if(bls_data_pack==NULL) if (bls_data_pack == NULL)
{ {
ret = -EINVAL; ret = -EINVAL;
break; break;
...@@ -405,17 +405,17 @@ static int irrtc_ioctl(struct inode * inode, struct file * file, ...@@ -405,17 +405,17 @@ static int irrtc_ioctl(struct inode * inode, struct file * file,
break; break;
case RRB_CAPTURE_KEY: case RRB_CAPTURE_KEY:
{ {
BlsKey=kmalloc(sizeof(struct blaster_data_type), GFP_KERNEL); BlsKey = kmalloc(sizeof(struct blaster_data_type), GFP_KERNEL);
if(BlsKey==NULL) if (BlsKey == NULL)
{ {
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
memset(BlsKey, 0, sizeof(struct blaster_data_type)); memset(BlsKey, 0, sizeof(struct blaster_data_type));
set_osd_key(0); set_osd_key(0);
int_type=CAPTURE; int_type = CAPTURE;
timer_int_counter=0; timer_int_counter = 0;
learning_status=0; learning_status = 0;
TIMER1_TGCR &= ~(3<<2); //clear timer1 mode TIMER1_TGCR &= ~(3<<2); //clear timer1 mode
TIMER1_TGCR |= (1<<2); //set timer1 unchained mode TIMER1_TGCR |= (1<<2); //set timer1 unchained mode
TIMER1_TGCR &= ~(1<<1); //reset timer1 34 TIMER1_TGCR &= ~(1<<1); //reset timer1 34
...@@ -431,11 +431,11 @@ static int irrtc_ioctl(struct inode * inode, struct file * file, ...@@ -431,11 +431,11 @@ static int irrtc_ioctl(struct inode * inode, struct file * file,
break; break;
case RRB_READ_LEARNING_DATA: case RRB_READ_LEARNING_DATA:
{ {
if(BlsKey) if (BlsKey)
{ {
ret |= copy_to_user((void*)arg, BlsKey, sizeof(struct blaster_data_type)); ret |= copy_to_user((void*)arg, BlsKey, sizeof(struct blaster_data_type));
kfree(BlsKey); kfree(BlsKey);
BlsKey=NULL; BlsKey = NULL;
} }
} }
break; break;
...@@ -502,10 +502,10 @@ static int __init irrtc_init(void) ...@@ -502,10 +502,10 @@ static int __init irrtc_init(void)
printk(KERN_INFO "\t" MOD_DESC "\n"); printk(KERN_INFO "\t" MOD_DESC "\n");
status = register_chrdev(NEUROS_IR_BLASTER_MAJOR, "neuros_ir_blaster", &irrtc_fops); status = register_chrdev(NEUROS_IR_BLASTER_MAJOR, "neuros_ir_blaster", &irrtc_fops);
if(status != 0) if (status != 0)
{ {
if(status == -EINVAL) printk(KERN_ERR "%s Couldn't register device: invalid major number %d.\n", pname, NEUROS_IR_BLASTER_MAJOR); if (status == -EINVAL) printk(KERN_ERR "%s Couldn't register device: invalid major number %d.\n", pname, NEUROS_IR_BLASTER_MAJOR);
else if(status == -EBUSY) printk(KERN_ERR "%s Couldn't register device: major number %d already busy.\n", pname, NEUROS_IR_BLASTER_MAJOR); else if (status == -EBUSY) printk(KERN_ERR "%s Couldn't register device: major number %d already busy.\n", pname, NEUROS_IR_BLASTER_MAJOR);
else printk(KERN_ERR "%s Couldn't register device: error %d.\n", pname, status); else printk(KERN_ERR "%s Couldn't register device: error %d.\n", pname, status);
status = -1; status = -1;
goto out; goto out;
......
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