Skip to content

Commit

Permalink
[WATCHDOG] Coding style - Indentation - part 2
Browse files Browse the repository at this point in the history
This brings the watchdog drivers into line with coding style.
This patch takes cares of the indentation as described in chapter 1.
Main changes:
* Re-structure the ioctl switch call for all drivers as follows:
	switch (cmd) {
	case WDIOC_GETSUPPORT:
	case WDIOC_GETSTATUS:
	case WDIOC_GETBOOTSTATUS:
	case WDIOC_GETTEMP:
	case WDIOC_SETOPTIONS:
	case WDIOC_KEEPALIVE:
	case WDIOC_SETTIMEOUT:
	case WDIOC_GETTIMEOUT:
	case WDIOC_GETTIMELEFT:
	default:
	}

This to make the migration from the drivers to the uniform watchdog
device driver easier in the future.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
Wim Van Sebroeck committed Aug 6, 2008
1 parent 5eb8249 commit 0c06090
Show file tree
Hide file tree
Showing 54 changed files with 428 additions and 428 deletions.
14 changes: 7 additions & 7 deletions drivers/watchdog/acquirewdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,6 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);

case WDIOC_KEEPALIVE:
acq_keepalive();
return 0;

case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_HEARTBEAT, p);

case WDIOC_SETOPTIONS:
{
if (get_user(options, p))
Expand All @@ -185,6 +178,13 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}
return retval;
}
case WDIOC_KEEPALIVE:
acq_keepalive();
return 0;

case WDIOC_GETTIMEOUT:
return put_user(WATCHDOG_HEARTBEAT, p);

default:
return -ENOTTY;
}
Expand Down
26 changes: 13 additions & 13 deletions drivers/watchdog/advantechwdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,6 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);

case WDIOC_KEEPALIVE:
advwdt_ping();
break;

case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
if (advwdt_set_heartbeat(new_timeout))
return -EINVAL;
advwdt_ping();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
case WDIOC_SETOPTIONS:
{
int options, retval = -EINVAL;
Expand All @@ -181,6 +168,19 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}
return retval;
}
case WDIOC_KEEPALIVE:
advwdt_ping();
break;

case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, p))
return -EFAULT;
if (advwdt_set_heartbeat(new_timeout))
return -EINVAL;
advwdt_ping();
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
default:
return -ENOTTY;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/watchdog/alim1535_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);
case WDIOC_KEEPALIVE:
ali_keepalive();
return 0;
case WDIOC_SETOPTIONS:
{
int new_options, retval = -EINVAL;
Expand All @@ -214,6 +211,9 @@ static long ali_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}
return retval;
}
case WDIOC_KEEPALIVE:
ali_keepalive();
return 0;
case WDIOC_SETTIMEOUT:
{
int new_timeout;
Expand Down
6 changes: 3 additions & 3 deletions drivers/watchdog/alim7101_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,6 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETOPTIONS:
{
int new_options, retval = -EINVAL;
Expand All @@ -270,6 +267,9 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
}
return retval;
}
case WDIOC_KEEPALIVE:
wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT:
{
int new_timeout;
Expand Down
4 changes: 2 additions & 2 deletions drivers/watchdog/ar7_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ static long ar7_wdt_ioctl(struct file *file,
int new_margin;

switch (cmd) {
default:
return -ENOTTY;
case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident,
sizeof(ident)))
Expand Down Expand Up @@ -281,6 +279,8 @@ static long ar7_wdt_ioctl(struct file *file,
if (put_user(margin, (int *)arg))
return -EFAULT;
return 0;
default:
return -ENOTTY;
}
}

Expand Down
34 changes: 17 additions & 17 deletions drivers/watchdog/at32ap700x_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,27 +221,10 @@ static long at32_wdt_ioctl(struct file *file,
int __user *p = argp;

switch (cmd) {
case WDIOC_KEEPALIVE:
at32_wdt_pat();
ret = 0;
break;
case WDIOC_GETSUPPORT:
ret = copy_to_user(argp, &at32_wdt_info,
sizeof(at32_wdt_info)) ? -EFAULT : 0;
break;
case WDIOC_SETTIMEOUT:
ret = get_user(time, p);
if (ret)
break;
ret = at32_wdt_settimeout(time);
if (ret)
break;
/* Enable new time value */
at32_wdt_start();
/* fall through */
case WDIOC_GETTIMEOUT:
ret = put_user(wdt->timeout, p);
break;
case WDIOC_GETSTATUS:
ret = put_user(0, p);
break;
Expand All @@ -258,6 +241,23 @@ static long at32_wdt_ioctl(struct file *file,
at32_wdt_start();
ret = 0;
break;
case WDIOC_KEEPALIVE:
at32_wdt_pat();
ret = 0;
break;
case WDIOC_SETTIMEOUT:
ret = get_user(time, p);
if (ret)
break;
ret = at32_wdt_settimeout(time);
if (ret)
break;
/* Enable new time value */
at32_wdt_start();
/* fall through */
case WDIOC_GETTIMEOUT:
ret = put_user(wdt->timeout, p);
break;
}

return ret;
Expand Down
28 changes: 14 additions & 14 deletions drivers/watchdog/at91rm9200_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,9 @@ static long at91_wdt_ioct(struct file *file,
int new_value;

switch (cmd) {
case WDIOC_KEEPALIVE:
at91_wdt_reload(); /* pat the watchdog */
return 0;
case WDIOC_GETSUPPORT:
return copy_to_user(argp, &at91_wdt_info,
sizeof(at91_wdt_info)) ? -EFAULT : 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_value, p))
return -EFAULT;
if (at91_wdt_settimeout(new_value))
return -EINVAL;
/* Enable new time value */
at91_wdt_start();
/* Return current value */
return put_user(wdt_time, p);
case WDIOC_GETTIMEOUT:
return put_user(wdt_time, p);
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);
Expand All @@ -165,6 +151,20 @@ static long at91_wdt_ioct(struct file *file,
if (new_value & WDIOS_ENABLECARD)
at91_wdt_start();
return 0;
case WDIOC_KEEPALIVE:
at91_wdt_reload(); /* pat the watchdog */
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_value, p))
return -EFAULT;
if (at91_wdt_settimeout(new_value))
return -EINVAL;
/* Enable new time value */
at91_wdt_start();
/* Return current value */
return put_user(wdt_time, p);
case WDIOC_GETTIMEOUT:
return put_user(wdt_time, p);
default:
return -ENOTTY;
}
Expand Down
28 changes: 14 additions & 14 deletions drivers/watchdog/bfin_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,20 +265,6 @@ static long bfin_wdt_ioctl(struct file *file,
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p);
case WDIOC_KEEPALIVE:
bfin_wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT: {
int new_timeout;

if (get_user(new_timeout, p))
return -EFAULT;
if (bfin_wdt_set_timeout(new_timeout))
return -EINVAL;
}
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
case WDIOC_SETOPTIONS: {
unsigned long flags;
int options, ret = -EINVAL;
Expand All @@ -298,6 +284,20 @@ static long bfin_wdt_ioctl(struct file *file,
spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
return ret;
}
case WDIOC_KEEPALIVE:
bfin_wdt_keepalive();
return 0;
case WDIOC_SETTIMEOUT: {
int new_timeout;

if (get_user(new_timeout, p))
return -EFAULT;
if (bfin_wdt_set_timeout(new_timeout))
return -EINVAL;
}
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(timeout, p);
default:
return -ENOTTY;
}
Expand Down
18 changes: 9 additions & 9 deletions drivers/watchdog/booke_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ static long booke_wdt_ioctl(struct file *file,
tmp = mfspr(SPRN_TSR) & TSR_WRS(3);
/* returns 1 if last reset was caused by the WDT */
return (tmp ? 1 : 0);
case WDIOC_SETOPTIONS:
if (get_user(tmp, p))
return -EINVAL;
if (tmp == WDIOS_ENABLECARD) {
booke_wdt_ping();
break;
} else
return -EINVAL;
return 0;
case WDIOC_KEEPALIVE:
booke_wdt_ping();
return 0;
Expand All @@ -110,15 +119,6 @@ static long booke_wdt_ioctl(struct file *file,
return 0;
case WDIOC_GETTIMEOUT:
return put_user(booke_wdt_period, p);
case WDIOC_SETOPTIONS:
if (get_user(tmp, p))
return -EINVAL;
if (tmp == WDIOS_ENABLECARD) {
booke_wdt_ping();
break;
} else
return -EINVAL;
return 0;
default:
return -ENOTTY;
}
Expand Down
12 changes: 6 additions & 6 deletions drivers/watchdog/cpu5wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,16 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd,
};

switch (cmd) {
case WDIOC_KEEPALIVE:
cpu5wdt_reset();
case WDIOC_GETSUPPORT:
if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break;
case WDIOC_GETSTATUS:
value = inb(port + CPU5WDT_STATUS_REG);
value = (value >> 2) & 1;
return put_user(value, p);
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);
case WDIOC_GETSUPPORT:
if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
break;
case WDIOC_SETOPTIONS:
if (get_user(value, p))
return -EFAULT;
Expand All @@ -181,6 +178,9 @@ static long cpu5wdt_ioctl(struct file *file, unsigned int cmd,
if (value & WDIOS_DISABLECARD)
cpu5wdt_stop();
break;
case WDIOC_KEEPALIVE:
cpu5wdt_reset();
break;
default:
return -ENOTTY;
}
Expand Down
8 changes: 4 additions & 4 deletions drivers/watchdog/davinci_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ static long davinci_wdt_ioctl(struct file *file,
ret = put_user(0, (int *)arg);
break;

case WDIOC_GETTIMEOUT:
ret = put_user(heartbeat, (int *)arg);
break;

case WDIOC_KEEPALIVE:
wdt_service();
ret = 0;
break;

case WDIOC_GETTIMEOUT:
ret = put_user(heartbeat, (int *)arg);
break;
}
return ret;
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/watchdog/ep93xx_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ static long ep93xx_wdt_ioctl(struct file *file,
ret = put_user(boot_status, (int __user *)arg);
break;

case WDIOC_GETTIMEOUT:
/* actually, it is 0.250 seconds.... */
ret = put_user(1, (int __user *)arg);
break;

case WDIOC_KEEPALIVE:
wdt_keepalive();
ret = 0;
break;

case WDIOC_GETTIMEOUT:
/* actually, it is 0.250 seconds.... */
ret = put_user(1, (int __user *)arg);
break;
}
return ret;
}
Expand Down
Loading

0 comments on commit 0c06090

Please sign in to comment.