rendered paste bodyIndex: drivers/dahdi/xpp/card_fxs.c
===================================================================
--- drivers/dahdi/xpp/card_fxs.c (revision 5819)
+++ drivers/dahdi/xpp/card_fxs.c (working copy)
@@ -758,6 +758,23 @@
return ret;
}
+static int FXS_set_vmwi(xpd_t *xpd, int messages, int pos)
+{
+ if (!vmwi_ioctl) {
+ LINE_NOTICE(xpd, pos, "Got DAHDI_VMWI notification but "\
+ "vmwi_ioctl parameter is off. Ignoring.\n");
+ return 0;
+ }
+ /* Digital inputs/outputs don't have VM leds */
+ if (IS_SET(xpd->digital_inputs | xpd->digital_outputs, pos))
+ return 0;
+ if (messages)
+ BIT_SET(xpd->msg_waiting, pos);
+ else
+ BIT_CLR(xpd->msg_waiting, pos);
+ return 0;
+}
+
/*
* Private ioctl()
* We don't need it now, since we detect vmwi via FSK patterns
@@ -868,20 +885,20 @@
return 0;
#ifdef DAHDI_VMWI
case DAHDI_VMWI: /* message-waiting led control */
+ {
+ struct dahdi_vmwi_info vmwisetting;
+ if (copy_from_user(&vmwisetting,
+ (__user void *)arg, sizeof(vmwisetting)))
+ return -EFAULT;
+ /* This driver only supports DAHDI_VMWI_HVAC mode. */
+ if (DAHDI_VMWI_HVAC != vmwisetting.vmwi_type)
+ return -EINVAL;
+ return FXS_set_vmwi(xpd, vmwisetting.messages, pos);
+ }
+ case DAHDI_VMWI_V1:
if (get_user(val, (int __user *)arg))
return -EFAULT;
- if(!vmwi_ioctl) {
- LINE_NOTICE(xpd, pos, "Got DAHDI_VMWI notification but vmwi_ioctl parameter is off. Ignoring.\n");
- return 0;
- }
- /* Digital inputs/outputs don't have VM leds */
- if (IS_SET(xpd->digital_inputs | xpd->digital_outputs, pos))
- return 0;
- if (val)
- BIT_SET(xpd->msg_waiting, pos);
- else
- BIT_CLR(xpd->msg_waiting, pos);
- return 0;
+ return FXS_set_vmwi(xpd, val, pos);
#endif
default:
report_bad_ioctl(THIS_MODULE->name, xpd, pos, cmd);