diff options
Diffstat (limited to 'drivers/isdn/hardware/eicon/mntfunc.c')
-rw-r--r-- | drivers/isdn/hardware/eicon/mntfunc.c | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/drivers/isdn/hardware/eicon/mntfunc.c b/drivers/isdn/hardware/eicon/mntfunc.c index a564b7560031..d6072607305c 100644 --- a/drivers/isdn/hardware/eicon/mntfunc.c +++ b/drivers/isdn/hardware/eicon/mntfunc.c @@ -27,7 +27,7 @@ static dword notify_handle; static DESCRIPTOR DAdapter; static DESCRIPTOR MAdapter; static DESCRIPTOR MaintDescriptor = - { IDI_DIMAINT, 0, 0, (IDI_CALL) diva_maint_prtComp }; +{ IDI_DIMAINT, 0, 0, (IDI_CALL) diva_maint_prtComp }; extern int diva_os_copy_to_user(void *os_handle, void __user *dst, const void *src, int length); @@ -44,7 +44,7 @@ static void no_printf(unsigned char *x, ...) /* * DIDD callback function */ -static void *didd_callback(void *context, DESCRIPTOR * adapter, +static void *didd_callback(void *context, DESCRIPTOR *adapter, int removal) { if (adapter->type == IDI_DADAPTER) { @@ -87,20 +87,20 @@ static int DIVA_INIT_FUNCTION connect_didd(void) memcpy(&DAdapter, &DIDD_Table[x], sizeof(DAdapter)); req.didd_notify.e.Req = 0; req.didd_notify.e.Rc = - IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY; + IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY; req.didd_notify.info.callback = (void *)didd_callback; req.didd_notify.info.context = NULL; - DAdapter.request((ENTITY *) & req); + DAdapter.request((ENTITY *)&req); if (req.didd_notify.e.Rc != 0xff) return (0); notify_handle = req.didd_notify.info.handle; /* Register MAINT (me) */ req.didd_add_adapter.e.Req = 0; req.didd_add_adapter.e.Rc = - IDI_SYNC_REQ_DIDD_ADD_ADAPTER; + IDI_SYNC_REQ_DIDD_ADD_ADAPTER; req.didd_add_adapter.info.descriptor = - (void *) &MaintDescriptor; - DAdapter.request((ENTITY *) & req); + (void *) &MaintDescriptor; + DAdapter.request((ENTITY *)&req); if (req.didd_add_adapter.e.Rc != 0xff) return (0); } else if ((DIDD_Table[x].type > 0) @@ -121,13 +121,13 @@ static void DIVA_EXIT_FUNCTION disconnect_didd(void) req.didd_notify.e.Req = 0; req.didd_notify.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY; req.didd_notify.info.handle = notify_handle; - DAdapter.request((ENTITY *) & req); + DAdapter.request((ENTITY *)&req); req.didd_remove_adapter.e.Req = 0; req.didd_remove_adapter.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER; req.didd_remove_adapter.info.p_request = - (IDI_CALL) MaintDescriptor.request; - DAdapter.request((ENTITY *) & req); + (IDI_CALL) MaintDescriptor.request; + DAdapter.request((ENTITY *)&req); } /* @@ -147,9 +147,9 @@ int maint_read_write(void __user *buf, int count) return (-EFAULT); } - cmd = *(dword *) & data[0]; /* command */ - id = *(dword *) & data[4]; /* driver id */ - mask = *(dword *) & data[8]; /* mask or size */ + cmd = *(dword *)&data[0]; /* command */ + id = *(dword *)&data[4]; /* driver id */ + mask = *(dword *)&data[8]; /* mask or size */ switch (cmd) { case DITRACE_CMD_GET_DRIVER_INFO: @@ -178,19 +178,19 @@ int maint_read_write(void __user *buf, int count) } break; - /* - Filter commands will ignore the ID due to fact that filtering affects - the B- channel and Audio Tap trace levels only. Also MAINT driver will - select the right trace ID by itself - */ + /* + Filter commands will ignore the ID due to fact that filtering affects + the B- channel and Audio Tap trace levels only. Also MAINT driver will + select the right trace ID by itself + */ case DITRACE_WRITE_SELECTIVE_TRACE_FILTER: if (!mask) { - ret = diva_set_trace_filter (1, "*"); + ret = diva_set_trace_filter(1, "*"); } else if (mask < sizeof(data)) { - if (diva_os_copy_from_user(NULL, data, (char __user *)buf+12, mask)) { + if (diva_os_copy_from_user(NULL, data, (char __user *)buf + 12, mask)) { ret = -EFAULT; } else { - ret = diva_set_trace_filter ((int)mask, data); + ret = diva_set_trace_filter((int)mask, data); } } else { ret = -EINVAL; @@ -198,8 +198,8 @@ int maint_read_write(void __user *buf, int count) break; case DITRACE_READ_SELECTIVE_TRACE_FILTER: - if ((ret = diva_get_trace_filter (sizeof(data), data)) > 0) { - if (diva_os_copy_to_user (NULL, buf, data, ret)) + if ((ret = diva_get_trace_filter(sizeof(data), data)) > 0) { + if (diva_os_copy_to_user(NULL, buf, data, ret)) ret = -EFAULT; } else { ret = -ENODEV; @@ -207,88 +207,88 @@ int maint_read_write(void __user *buf, int count) break; case DITRACE_READ_TRACE_ENTRY:{ - diva_os_spin_lock_magic_t old_irql; - word size; - diva_dbg_entry_head_t *pmsg; - byte *pbuf; + diva_os_spin_lock_magic_t old_irql; + word size; + diva_dbg_entry_head_t *pmsg; + byte *pbuf; - if (!(pbuf = diva_os_malloc(0, mask))) { - return (-ENOMEM); - } + if (!(pbuf = diva_os_malloc(0, mask))) { + return (-ENOMEM); + } - for(;;) { - if (!(pmsg = - diva_maint_get_message(&size, &old_irql))) { - break; - } - if (size > mask) { - diva_maint_ack_message(0, &old_irql); - ret = -EINVAL; - break; - } - ret = size; - memcpy(pbuf, pmsg, size); - diva_maint_ack_message(1, &old_irql); - if ((count < size) || - diva_os_copy_to_user (NULL, buf, (void *) pbuf, size)) - ret = -EFAULT; + for (;;) { + if (!(pmsg = + diva_maint_get_message(&size, &old_irql))) { + break; + } + if (size > mask) { + diva_maint_ack_message(0, &old_irql); + ret = -EINVAL; break; } - diva_os_free(0, pbuf); + ret = size; + memcpy(pbuf, pmsg, size); + diva_maint_ack_message(1, &old_irql); + if ((count < size) || + diva_os_copy_to_user(NULL, buf, (void *) pbuf, size)) + ret = -EFAULT; + break; } + diva_os_free(0, pbuf); + } break; case DITRACE_READ_TRACE_ENTRYS:{ - diva_os_spin_lock_magic_t old_irql; - word size; - diva_dbg_entry_head_t *pmsg; - byte *pbuf = NULL; - int written = 0; + diva_os_spin_lock_magic_t old_irql; + word size; + diva_dbg_entry_head_t *pmsg; + byte *pbuf = NULL; + int written = 0; - if (mask < 4096) { - ret = -EINVAL; + if (mask < 4096) { + ret = -EINVAL; + break; + } + if (!(pbuf = diva_os_malloc(0, mask))) { + return (-ENOMEM); + } + + for (;;) { + if (!(pmsg = + diva_maint_get_message(&size, &old_irql))) { break; } - if (!(pbuf = diva_os_malloc(0, mask))) { - return (-ENOMEM); - } - - for (;;) { - if (!(pmsg = - diva_maint_get_message(&size, &old_irql))) { - break; - } - if ((size + 8) > mask) { - diva_maint_ack_message(0, &old_irql); - break; - } - /* - Write entry length - */ - pbuf[written++] = (byte) size; - pbuf[written++] = (byte) (size >> 8); - pbuf[written++] = 0; - pbuf[written++] = 0; - /* - Write message - */ - memcpy(&pbuf[written], pmsg, size); - diva_maint_ack_message(1, &old_irql); - written += size; - mask -= (size + 4); + if ((size + 8) > mask) { + diva_maint_ack_message(0, &old_irql); + break; } + /* + Write entry length + */ + pbuf[written++] = (byte) size; + pbuf[written++] = (byte) (size >> 8); pbuf[written++] = 0; pbuf[written++] = 0; - pbuf[written++] = 0; - pbuf[written++] = 0; + /* + Write message + */ + memcpy(&pbuf[written], pmsg, size); + diva_maint_ack_message(1, &old_irql); + written += size; + mask -= (size + 4); + } + pbuf[written++] = 0; + pbuf[written++] = 0; + pbuf[written++] = 0; + pbuf[written++] = 0; - if ((count < written) || diva_os_copy_to_user(NULL, buf, (void *) pbuf, written)) { - ret = -EFAULT; - } else { - ret = written; - } - diva_os_free(0, pbuf); + if ((count < written) || diva_os_copy_to_user(NULL, buf, (void *) pbuf, written)) { + ret = -EFAULT; + } else { + ret = written; } + diva_os_free(0, pbuf); + } break; default: @@ -316,7 +316,7 @@ int DIVA_INIT_FUNCTION mntfunc_init(int *buffer_length, void **buffer, } else { while ((*buffer_length >= (64 * 1024)) && - (!(*buffer = diva_os_malloc (0, *buffer_length)))) { + (!(*buffer = diva_os_malloc(0, *buffer_length)))) { *buffer_length -= 1024; } @@ -328,7 +328,7 @@ int DIVA_INIT_FUNCTION mntfunc_init(int *buffer_length, void **buffer, if (diva_maint_init(*buffer, *buffer_length, (diva_dbg_mem == 0))) { if (!diva_dbg_mem) { - diva_os_free (0, *buffer); + diva_os_free(0, *buffer); } DBG_ERR(("init: maint init failed")); return (0); @@ -338,7 +338,7 @@ int DIVA_INIT_FUNCTION mntfunc_init(int *buffer_length, void **buffer, DBG_ERR(("init: failed to connect to DIDD.")); diva_maint_finit(); if (!diva_dbg_mem) { - diva_os_free (0, *buffer); + diva_os_free(0, *buffer); } return (0); } @@ -362,7 +362,7 @@ void DIVA_EXIT_FUNCTION mntfunc_finit(void) disconnect_didd(); if ((buffer = diva_maint_finit())) { - diva_os_free (0, buffer); + diva_os_free(0, buffer); } memset(&MAdapter, 0, sizeof(MAdapter)); |