mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-25 12:24:35 +02:00
cleanup danube watchdog timer
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9729 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
bb4717095c
commit
e68c9c6464
@ -110,7 +110,7 @@ danube_wdt_disable (void)
|
|||||||
|
|
||||||
/* passed LPEN or DSEN */
|
/* passed LPEN or DSEN */
|
||||||
void
|
void
|
||||||
danube_wdt_low_power_or_debug (int en, int type)
|
danube_wdt_enable_feature (int en, int type)
|
||||||
{
|
{
|
||||||
unsigned int wdt_cr = 0;
|
unsigned int wdt_cr = 0;
|
||||||
|
|
||||||
@ -168,28 +168,27 @@ danube_wdt_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
int en = 0;
|
|
||||||
int istatus;
|
|
||||||
int pwl, clkdiv;
|
|
||||||
static int timeout = -1;
|
static int timeout = -1;
|
||||||
|
unsigned int user_arg;
|
||||||
|
|
||||||
|
if ((cmd != DANUBE_WDT_IOC_STOP) && (cmd != DANUBE_WDT_IOC_PING) && (cmd != DANUBE_WDT_IOC_GET_STATUS))
|
||||||
|
{
|
||||||
|
if (copy_from_user((void *) &user_arg, (void *) arg, sizeof (int)))
|
||||||
|
result = -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case DANUBE_WDT_IOC_START:
|
case DANUBE_WDT_IOC_START:
|
||||||
printk("enable watch dog timer!\n");
|
printk("enable watch dog timer!\n");
|
||||||
if (copy_from_user((void *) &timeout, (void *) arg, sizeof (int)))
|
if ((result = danube_wdt_enable(user_arg)) < 0)
|
||||||
{
|
timeout = -1;
|
||||||
printk ("invalid argument\n");
|
else
|
||||||
result = -EINVAL;
|
timeout = user_arg;
|
||||||
} else {
|
|
||||||
if ((result = danube_wdt_enable (timeout)) < 0)
|
|
||||||
timeout = -1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DANUBE_WDT_IOC_STOP:
|
case DANUBE_WDT_IOC_STOP:
|
||||||
printk("disable watch dog timer\n");
|
printk("disable watch dog timer\n");
|
||||||
timeout = -1;
|
|
||||||
danube_wdt_disable();
|
danube_wdt_disable();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -201,32 +200,24 @@ danube_wdt_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DANUBE_WDT_IOC_GET_STATUS:
|
case DANUBE_WDT_IOC_GET_STATUS:
|
||||||
istatus = readl(DANUBE_BIU_WDT_SR);
|
user_arg = readl(DANUBE_BIU_WDT_SR);
|
||||||
copy_to_user((int *) arg, (int *) &istatus, sizeof (int));
|
copy_to_user((int*)arg, (int*)&user_arg, sizeof(int));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DANUBE_WDT_IOC_SET_PWL:
|
case DANUBE_WDT_IOC_SET_PWL:
|
||||||
if (copy_from_user((void *) &pwl, (void *) arg, sizeof (int)))
|
danube_wdt_prewarning_limit(user_arg);
|
||||||
result = -EINVAL;
|
|
||||||
danube_wdt_prewarning_limit(pwl);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DANUBE_WDT_IOC_SET_DSEN:
|
case DANUBE_WDT_IOC_SET_DSEN:
|
||||||
if (copy_from_user((void *) &en, (void *) arg, sizeof (int)))
|
danube_wdt_enable_feature(user_arg, DANUBE_BIU_WDT_CR_DSEN);
|
||||||
result = -EINVAL;
|
|
||||||
danube_wdt_low_power_or_debug(en, DANUBE_BIU_WDT_CR_DSEN);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DANUBE_WDT_IOC_SET_LPEN:
|
case DANUBE_WDT_IOC_SET_LPEN:
|
||||||
if (copy_from_user((void *) &en, (void *) arg, sizeof (int)))
|
danube_wdt_enable_feature(user_arg, DANUBE_BIU_WDT_CR_LPEN);
|
||||||
result = -EINVAL;
|
|
||||||
danube_wdt_low_power_or_debug(en, DANUBE_BIU_WDT_CR_LPEN);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DANUBE_WDT_IOC_SET_CLKDIV:
|
case DANUBE_WDT_IOC_SET_CLKDIV:
|
||||||
if (copy_from_user((void *) &clkdiv, (void *) arg, sizeof (int)))
|
danube_wdt_set_clkdiv(user_arg);
|
||||||
result = -EINVAL;
|
|
||||||
danube_wdt_set_clkdiv(clkdiv);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user