[WATCHDOG] Coding style - Indentation - part 1
This brings the watchdog drivers into line with coding style. This patch takes cares of the indentation as described in chapter 1: The preferred way to ease multiple indentation levels in a switch statement is to align the "switch" and its subordinate "case" labels in the same column instead of "double-indenting" the "case" labels. Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
parent
0d7b101404
commit
5eb82498e3
|
@ -169,7 +169,7 @@ static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WDIOC_GETTIMEOUT:
|
case WDIOC_GETTIMEOUT:
|
||||||
return put_user(WATCHDOG_HEARTBEAT, p);
|
return put_user(WATCHDOG_HEARTBEAT, p);
|
||||||
|
|
||||||
case WDIOC_SETOPTIONS:
|
case WDIOC_SETOPTIONS:
|
||||||
{
|
{
|
||||||
|
|
|
@ -149,7 +149,7 @@ geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
||||||
.identity = WATCHDOG_NAME,
|
.identity = WATCHDOG_NAME,
|
||||||
};
|
};
|
||||||
|
|
||||||
switch(cmd) {
|
switch (cmd) {
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(argp, &ident,
|
return copy_to_user(argp, &ident,
|
||||||
sizeof(ident)) ? -EFAULT : 0;
|
sizeof(ident)) ? -EFAULT : 0;
|
||||||
|
|
|
@ -470,90 +470,90 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd,
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(argp, &ident,
|
return copy_to_user(argp, &ident,
|
||||||
sizeof (ident)) ? -EFAULT : 0;
|
sizeof (ident)) ? -EFAULT : 0;
|
||||||
|
|
||||||
case WDIOC_GETSTATUS:
|
case WDIOC_GETSTATUS:
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
pcipcwd_get_status(&status);
|
pcipcwd_get_status(&status);
|
||||||
return put_user(status, p);
|
return put_user(status, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
case WDIOC_GETBOOTSTATUS:
|
||||||
|
return put_user(pcipcwd_private.boot_status, p);
|
||||||
|
|
||||||
|
case WDIOC_GETTEMP:
|
||||||
|
{
|
||||||
|
int temperature;
|
||||||
|
|
||||||
|
if (pcipcwd_get_temperature(&temperature))
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
|
return put_user(temperature, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
case WDIOC_KEEPALIVE:
|
||||||
|
pcipcwd_keepalive();
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case WDIOC_SETOPTIONS:
|
||||||
|
{
|
||||||
|
int new_options, retval = -EINVAL;
|
||||||
|
|
||||||
|
if (get_user (new_options, p))
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
|
if (new_options & WDIOS_DISABLECARD) {
|
||||||
|
if (pcipcwd_stop())
|
||||||
|
return -EIO;
|
||||||
|
retval = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WDIOC_GETBOOTSTATUS:
|
if (new_options & WDIOS_ENABLECARD) {
|
||||||
return put_user(pcipcwd_private.boot_status, p);
|
if (pcipcwd_start())
|
||||||
|
return -EIO;
|
||||||
case WDIOC_GETTEMP:
|
retval = 0;
|
||||||
{
|
|
||||||
int temperature;
|
|
||||||
|
|
||||||
if (pcipcwd_get_temperature(&temperature))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
return put_user(temperature, p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case WDIOC_KEEPALIVE:
|
if (new_options & WDIOS_TEMPPANIC) {
|
||||||
pcipcwd_keepalive();
|
temp_panic = 1;
|
||||||
return 0;
|
retval = 0;
|
||||||
|
|
||||||
case WDIOC_SETOPTIONS:
|
|
||||||
{
|
|
||||||
int new_options, retval = -EINVAL;
|
|
||||||
|
|
||||||
if (get_user (new_options, p))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
if (new_options & WDIOS_DISABLECARD) {
|
|
||||||
if (pcipcwd_stop())
|
|
||||||
return -EIO;
|
|
||||||
retval = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_options & WDIOS_ENABLECARD) {
|
|
||||||
if (pcipcwd_start())
|
|
||||||
return -EIO;
|
|
||||||
retval = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_options & WDIOS_TEMPPANIC) {
|
|
||||||
temp_panic = 1;
|
|
||||||
retval = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case WDIOC_SETTIMEOUT:
|
return retval;
|
||||||
{
|
}
|
||||||
int new_heartbeat;
|
|
||||||
|
|
||||||
if (get_user(new_heartbeat, p))
|
case WDIOC_SETTIMEOUT:
|
||||||
return -EFAULT;
|
{
|
||||||
|
int new_heartbeat;
|
||||||
|
|
||||||
if (pcipcwd_set_heartbeat(new_heartbeat))
|
if (get_user(new_heartbeat, p))
|
||||||
return -EINVAL;
|
return -EFAULT;
|
||||||
|
|
||||||
pcipcwd_keepalive();
|
if (pcipcwd_set_heartbeat(new_heartbeat))
|
||||||
/* Fall */
|
return -EINVAL;
|
||||||
}
|
|
||||||
|
|
||||||
case WDIOC_GETTIMEOUT:
|
pcipcwd_keepalive();
|
||||||
return put_user(heartbeat, p);
|
/* Fall */
|
||||||
|
}
|
||||||
|
|
||||||
case WDIOC_GETTIMELEFT:
|
case WDIOC_GETTIMEOUT:
|
||||||
{
|
return put_user(heartbeat, p);
|
||||||
int time_left;
|
|
||||||
|
|
||||||
if (pcipcwd_get_timeleft(&time_left))
|
case WDIOC_GETTIMELEFT:
|
||||||
return -EFAULT;
|
{
|
||||||
|
int time_left;
|
||||||
|
|
||||||
return put_user(time_left, p);
|
if (pcipcwd_get_timeleft(&time_left))
|
||||||
}
|
return -EFAULT;
|
||||||
|
|
||||||
default:
|
return put_user(time_left, p);
|
||||||
return -ENOTTY;
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -382,77 +382,77 @@ static long usb_pcwd_ioctl(struct file *file, unsigned int cmd,
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(argp, &ident,
|
return copy_to_user(argp, &ident,
|
||||||
sizeof (ident)) ? -EFAULT : 0;
|
sizeof (ident)) ? -EFAULT : 0;
|
||||||
|
|
||||||
case WDIOC_GETSTATUS:
|
case WDIOC_GETSTATUS:
|
||||||
case WDIOC_GETBOOTSTATUS:
|
case WDIOC_GETBOOTSTATUS:
|
||||||
return put_user(0, p);
|
return put_user(0, p);
|
||||||
|
|
||||||
case WDIOC_GETTEMP:
|
case WDIOC_GETTEMP:
|
||||||
{
|
{
|
||||||
int temperature;
|
int temperature;
|
||||||
|
|
||||||
if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
|
if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
return put_user(temperature, p);
|
return put_user(temperature, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
case WDIOC_KEEPALIVE:
|
||||||
|
usb_pcwd_keepalive(usb_pcwd_device);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
case WDIOC_SETOPTIONS:
|
||||||
|
{
|
||||||
|
int new_options, retval = -EINVAL;
|
||||||
|
|
||||||
|
if (get_user (new_options, p))
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
|
if (new_options & WDIOS_DISABLECARD) {
|
||||||
|
usb_pcwd_stop(usb_pcwd_device);
|
||||||
|
retval = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WDIOC_KEEPALIVE:
|
if (new_options & WDIOS_ENABLECARD) {
|
||||||
usb_pcwd_keepalive(usb_pcwd_device);
|
usb_pcwd_start(usb_pcwd_device);
|
||||||
return 0;
|
retval = 0;
|
||||||
|
|
||||||
case WDIOC_SETOPTIONS:
|
|
||||||
{
|
|
||||||
int new_options, retval = -EINVAL;
|
|
||||||
|
|
||||||
if (get_user (new_options, p))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
if (new_options & WDIOS_DISABLECARD) {
|
|
||||||
usb_pcwd_stop(usb_pcwd_device);
|
|
||||||
retval = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (new_options & WDIOS_ENABLECARD) {
|
|
||||||
usb_pcwd_start(usb_pcwd_device);
|
|
||||||
retval = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case WDIOC_SETTIMEOUT:
|
return retval;
|
||||||
{
|
}
|
||||||
int new_heartbeat;
|
|
||||||
|
|
||||||
if (get_user(new_heartbeat, p))
|
case WDIOC_SETTIMEOUT:
|
||||||
return -EFAULT;
|
{
|
||||||
|
int new_heartbeat;
|
||||||
|
|
||||||
if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat))
|
if (get_user(new_heartbeat, p))
|
||||||
return -EINVAL;
|
return -EFAULT;
|
||||||
|
|
||||||
usb_pcwd_keepalive(usb_pcwd_device);
|
if (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat))
|
||||||
/* Fall */
|
return -EINVAL;
|
||||||
}
|
|
||||||
|
|
||||||
case WDIOC_GETTIMEOUT:
|
usb_pcwd_keepalive(usb_pcwd_device);
|
||||||
return put_user(heartbeat, p);
|
/* Fall */
|
||||||
|
}
|
||||||
|
|
||||||
case WDIOC_GETTIMELEFT:
|
case WDIOC_GETTIMEOUT:
|
||||||
{
|
return put_user(heartbeat, p);
|
||||||
int time_left;
|
|
||||||
|
|
||||||
if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left))
|
case WDIOC_GETTIMELEFT:
|
||||||
return -EFAULT;
|
{
|
||||||
|
int time_left;
|
||||||
|
|
||||||
return put_user(time_left, p);
|
if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left))
|
||||||
}
|
return -EFAULT;
|
||||||
|
|
||||||
default:
|
return put_user(time_left, p);
|
||||||
return -ENOTTY;
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,6 @@ static long sc1200wdt_ioctl(struct file *file, unsigned int cmd,
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
if (copy_to_user(argp, &ident, sizeof ident))
|
if (copy_to_user(argp, &ident, sizeof ident))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
|
@ -290,8 +290,7 @@ static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
.identity = "SC520",
|
.identity = "SC520",
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd) {
|
||||||
{
|
|
||||||
default:
|
default:
|
||||||
return -ENOTTY;
|
return -ENOTTY;
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
|
|
Loading…
Reference in New Issue