summaryrefslogtreecommitdiff
path: root/drivers/isdn/hysdn/hycapi.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 08:04:47 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 08:04:47 +0400
commit3b59bf081622b6446db77ad06c93fe23677bc533 (patch)
tree3f4bb5a27c90cc86994a1f6d3c53fbf9208003cb /drivers/isdn/hysdn/hycapi.c
parente45836fafe157df137a837093037f741ad8f4c90 (diff)
parentbbdb32cb5b73597386913d052165423b9d736145 (diff)
downloadlinux-3b59bf081622b6446db77ad06c93fe23677bc533.tar.xz
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking merge from David Miller: "1) Move ixgbe driver over to purely page based buffering on receive. From Alexander Duyck. 2) Add receive packet steering support to e1000e, from Bruce Allan. 3) Convert TCP MD5 support over to RCU, from Eric Dumazet. 4) Reduce cpu usage in handling out-of-order TCP packets on modern systems, also from Eric Dumazet. 5) Support the IP{,V6}_UNICAST_IF socket options, making the wine folks happy, from Erich Hoover. 6) Support VLAN trunking from guests in hyperv driver, from Haiyang Zhang. 7) Support byte-queue-limtis in r8169, from Igor Maravic. 8) Outline code intended for IP_RECVTOS in IP_PKTOPTIONS existed but was never properly implemented, Jiri Benc fixed that. 9) 64-bit statistics support in r8169 and 8139too, from Junchang Wang. 10) Support kernel side dump filtering by ctmark in netfilter ctnetlink, from Pablo Neira Ayuso. 11) Support byte-queue-limits in gianfar driver, from Paul Gortmaker. 12) Add new peek socket options to assist with socket migration, from Pavel Emelyanov. 13) Add sch_plug packet scheduler whose queue is controlled by userland daemons using explicit freeze and release commands. From Shriram Rajagopalan. 14) Fix FCOE checksum offload handling on transmit, from Yi Zou." * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1846 commits) Fix pppol2tp getsockname() Remove printk from rds_sendmsg ipv6: fix incorrent ipv6 ipsec packet fragment cpsw: Hook up default ndo_change_mtu. net: qmi_wwan: fix build error due to cdc-wdm dependecy netdev: driver: ethernet: Add TI CPSW driver netdev: driver: ethernet: add cpsw address lookup engine support phy: add am79c874 PHY support mlx4_core: fix race on comm channel bonding: send igmp report for its master fs_enet: Add MPC5125 FEC support and PHY interface selection net: bpf_jit: fix BPF_S_LDX_B_MSH compilation net: update the usage of CHECKSUM_UNNECESSARY fcoe: use CHECKSUM_UNNECESSARY instead of CHECKSUM_PARTIAL on tx net: do not do gso for CHECKSUM_UNNECESSARY in netif_needs_gso ixgbe: Fix issues with SR-IOV loopback when flow control is disabled net/hyperv: Fix the code handling tx busy ixgbe: fix namespace issues when FCoE/DCB is not enabled rtlwifi: Remove unused ETH_ADDR_LEN defines igbvf: Use ETH_ALEN ... Fix up fairly trivial conflicts in drivers/isdn/gigaset/interface.c and drivers/net/usb/{Kconfig,qmi_wwan.c} as per David.
Diffstat (limited to 'drivers/isdn/hysdn/hycapi.c')
-rw-r--r--drivers/isdn/hysdn/hycapi.c374
1 files changed, 187 insertions, 187 deletions
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c
index 6299b06ae009..931f916c9c23 100644
--- a/drivers/isdn/hysdn/hycapi.c
+++ b/drivers/isdn/hysdn/hycapi.c
@@ -31,9 +31,9 @@
#include "hysdn_defs.h"
#include <linux/kernelcapi.h>
-static char hycapi_revision[]="$Revision: 1.8.6.4 $";
+static char hycapi_revision[] = "$Revision: 1.8.6.4 $";
-unsigned int hycapi_enable = 0xffffffff;
+unsigned int hycapi_enable = 0xffffffff;
module_param(hycapi_enable, uint, 0);
typedef struct _hycapi_appl {
@@ -48,18 +48,18 @@ static u16 hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
static inline int _hycapi_appCheck(int app_id, int ctrl_no)
{
- if((ctrl_no <= 0) || (ctrl_no > CAPI_MAXCONTR) || (app_id <= 0) ||
+ if ((ctrl_no <= 0) || (ctrl_no > CAPI_MAXCONTR) || (app_id <= 0) ||
(app_id > CAPI_MAXAPPL))
{
printk(KERN_ERR "HYCAPI: Invalid request app_id %d for controller %d", app_id, ctrl_no);
return -1;
}
- return ((hycapi_applications[app_id-1].ctrl_mask & (1 << (ctrl_no-1))) != 0);
+ return ((hycapi_applications[app_id - 1].ctrl_mask & (1 << (ctrl_no-1))) != 0);
}
/******************************
Kernel-Capi callback reset_ctr
-******************************/
+******************************/
static void
hycapi_reset_ctr(struct capi_ctr *ctrl)
@@ -75,7 +75,7 @@ hycapi_reset_ctr(struct capi_ctr *ctrl)
/******************************
Kernel-Capi callback remove_ctr
-******************************/
+******************************/
static void
hycapi_remove_ctr(struct capi_ctr *ctrl)
@@ -85,25 +85,25 @@ hycapi_remove_ctr(struct capi_ctr *ctrl)
hysdn_card *card = NULL;
#ifdef HYCAPI_PRINTFNAMES
printk(KERN_NOTICE "HYCAPI hycapi_remove_ctr\n");
-#endif
+#endif
cinfo = (hycapictrl_info *)(ctrl->driverdata);
- if(!cinfo) {
+ if (!cinfo) {
printk(KERN_ERR "No hycapictrl_info set!");
return;
- }
+ }
card = cinfo->card;
capi_ctr_suspend_output(ctrl);
- for(i=0; i<CAPI_MAXAPPL;i++) {
- if(hycapi_applications[i].listen_req[ctrl->cnr-1]) {
- kfree_skb(hycapi_applications[i].listen_req[ctrl->cnr-1]);
- hycapi_applications[i].listen_req[ctrl->cnr-1] = NULL;
+ for (i = 0; i < CAPI_MAXAPPL; i++) {
+ if (hycapi_applications[i].listen_req[ctrl->cnr - 1]) {
+ kfree_skb(hycapi_applications[i].listen_req[ctrl->cnr - 1]);
+ hycapi_applications[i].listen_req[ctrl->cnr - 1] = NULL;
}
}
detach_capi_ctr(ctrl);
ctrl->driverdata = NULL;
kfree(card->hyctrlinfo);
-
+
card->hyctrlinfo = NULL;
}
@@ -121,7 +121,7 @@ hycapi_sendmsg_internal(struct capi_ctr *ctrl, struct sk_buff *skb)
spin_lock_irq(&cinfo->lock);
#ifdef HYCAPI_PRINTFNAMES
- printk(KERN_NOTICE "hycapi_send_message\n");
+ printk(KERN_NOTICE "hycapi_send_message\n");
#endif
cinfo->skbs[cinfo->in_idx++] = skb; /* add to buffer list */
if (cinfo->in_idx >= HYSDN_MAX_CAPI_SKB)
@@ -130,7 +130,7 @@ hycapi_sendmsg_internal(struct capi_ctr *ctrl, struct sk_buff *skb)
if (cinfo->sk_count >= HYSDN_MAX_CAPI_SKB) {
/* inform upper layers we're full */
printk(KERN_ERR "HYSDN Card%d: CAPI-buffer overrun!\n",
- card->myid);
+ card->myid);
capi_ctr_suspend_output(ctrl);
}
cinfo->tx_skb = skb;
@@ -147,7 +147,7 @@ re-register any applications in the private list.
************************************************************/
-static void
+static void
hycapi_register_internal(struct capi_ctr *ctrl, __u16 appl,
capi_register_params *rp)
{
@@ -161,9 +161,9 @@ hycapi_register_internal(struct capi_ctr *ctrl, __u16 appl,
__u16 MessageBufferSize = 0;
int slen = strlen(ExtFeatureDefaults);
#ifdef HYCAPI_PRINTFNAMES
- printk(KERN_NOTICE "hycapi_register_appl\n");
+ printk(KERN_NOTICE "hycapi_register_appl\n");
#endif
- MessageBufferSize = rp->level3cnt * rp->datablkcnt * rp->datablklen;
+ MessageBufferSize = rp->level3cnt * rp->datablkcnt * rp->datablklen;
len = CAPI_MSG_BASELEN + 8 + slen + 1;
if (!(skb = alloc_skb(len, GFP_ATOMIC))) {
@@ -171,18 +171,18 @@ hycapi_register_internal(struct capi_ctr *ctrl, __u16 appl,
card->myid);
return;
}
- memcpy(skb_put(skb,sizeof(__u16)), &len, sizeof(__u16));
- memcpy(skb_put(skb,sizeof(__u16)), &appl, sizeof(__u16));
- memcpy(skb_put(skb,sizeof(__u8)), &_command, sizeof(_command));
- memcpy(skb_put(skb,sizeof(__u8)), &_subcommand, sizeof(_subcommand));
- memcpy(skb_put(skb,sizeof(__u16)), &MessageNumber, sizeof(__u16));
- memcpy(skb_put(skb,sizeof(__u16)), &MessageBufferSize, sizeof(__u16));
- memcpy(skb_put(skb,sizeof(__u16)), &(rp->level3cnt), sizeof(__u16));
- memcpy(skb_put(skb,sizeof(__u16)), &(rp->datablkcnt), sizeof(__u16));
- memcpy(skb_put(skb,sizeof(__u16)), &(rp->datablklen), sizeof(__u16));
- memcpy(skb_put(skb,slen), ExtFeatureDefaults, slen);
- hycapi_applications[appl-1].ctrl_mask |= (1 << (ctrl->cnr-1));
- hycapi_send_message(ctrl, skb);
+ memcpy(skb_put(skb, sizeof(__u16)), &len, sizeof(__u16));
+ memcpy(skb_put(skb, sizeof(__u16)), &appl, sizeof(__u16));
+ memcpy(skb_put(skb, sizeof(__u8)), &_command, sizeof(_command));
+ memcpy(skb_put(skb, sizeof(__u8)), &_subcommand, sizeof(_subcommand));
+ memcpy(skb_put(skb, sizeof(__u16)), &MessageNumber, sizeof(__u16));
+ memcpy(skb_put(skb, sizeof(__u16)), &MessageBufferSize, sizeof(__u16));
+ memcpy(skb_put(skb, sizeof(__u16)), &(rp->level3cnt), sizeof(__u16));
+ memcpy(skb_put(skb, sizeof(__u16)), &(rp->datablkcnt), sizeof(__u16));
+ memcpy(skb_put(skb, sizeof(__u16)), &(rp->datablklen), sizeof(__u16));
+ memcpy(skb_put(skb, slen), ExtFeatureDefaults, slen);
+ hycapi_applications[appl - 1].ctrl_mask |= (1 << (ctrl->cnr - 1));
+ hycapi_send_message(ctrl, skb);
}
/************************************************************
@@ -200,12 +200,12 @@ static void hycapi_restart_internal(struct capi_ctr *ctrl)
#ifdef HYCAPI_PRINTFNAMES
printk(KERN_WARNING "HYSDN: hycapi_restart_internal");
#endif
- for(i=0; i<CAPI_MAXAPPL; i++) {
- if(_hycapi_appCheck(i+1, ctrl->cnr) == 1) {
- hycapi_register_internal(ctrl, i+1,
+ for (i = 0; i < CAPI_MAXAPPL; i++) {
+ if (_hycapi_appCheck(i + 1, ctrl->cnr) == 1) {
+ hycapi_register_internal(ctrl, i + 1,
&hycapi_applications[i].rp);
- if(hycapi_applications[i].listen_req[ctrl->cnr-1]) {
- skb = skb_copy(hycapi_applications[i].listen_req[ctrl->cnr-1], GFP_ATOMIC);
+ if (hycapi_applications[i].listen_req[ctrl->cnr - 1]) {
+ skb = skb_copy(hycapi_applications[i].listen_req[ctrl->cnr - 1], GFP_ATOMIC);
hycapi_sendmsg_internal(ctrl, skb);
}
}
@@ -220,35 +220,35 @@ The application is recorded in the internal list.
*************************************************************/
static void
-hycapi_register_appl(struct capi_ctr *ctrl, __u16 appl,
+hycapi_register_appl(struct capi_ctr *ctrl, __u16 appl,
capi_register_params *rp)
{
int MaxLogicalConnections = 0, MaxBDataBlocks = 0, MaxBDataLen = 0;
hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata);
hysdn_card *card = cinfo->card;
int chk = _hycapi_appCheck(appl, ctrl->cnr);
- if(chk < 0) {
+ if (chk < 0) {
return;
}
- if(chk == 1) {
+ if (chk == 1) {
printk(KERN_INFO "HYSDN: apl %d already registered\n", appl);
return;
}
MaxBDataBlocks = rp->datablkcnt > CAPI_MAXDATAWINDOW ? CAPI_MAXDATAWINDOW : rp->datablkcnt;
rp->datablkcnt = MaxBDataBlocks;
- MaxBDataLen = rp->datablklen < 1024 ? 1024 : rp->datablklen ;
+ MaxBDataLen = rp->datablklen < 1024 ? 1024 : rp->datablklen;
rp->datablklen = MaxBDataLen;
-
+
MaxLogicalConnections = rp->level3cnt;
if (MaxLogicalConnections < 0) {
- MaxLogicalConnections = card->bchans * -MaxLogicalConnections;
+ MaxLogicalConnections = card->bchans * -MaxLogicalConnections;
}
if (MaxLogicalConnections == 0) {
MaxLogicalConnections = card->bchans;
}
-
+
rp->level3cnt = MaxLogicalConnections;
- memcpy(&hycapi_applications[appl-1].rp,
+ memcpy(&hycapi_applications[appl - 1].rp,
rp, sizeof(capi_register_params));
}
@@ -279,19 +279,19 @@ static void hycapi_release_internal(struct capi_ctr *ctrl, __u16 appl)
card->myid);
return;
}
- memcpy(skb_put(skb,sizeof(__u16)), &len, sizeof(__u16));
- memcpy(skb_put(skb,sizeof(__u16)), &appl, sizeof(__u16));
- memcpy(skb_put(skb,sizeof(__u8)), &_command, sizeof(_command));
- memcpy(skb_put(skb,sizeof(__u8)), &_subcommand, sizeof(_subcommand));
- memcpy(skb_put(skb,sizeof(__u16)), &MessageNumber, sizeof(__u16));
- hycapi_send_message(ctrl, skb);
- hycapi_applications[appl-1].ctrl_mask &= ~(1 << (ctrl->cnr-1));
+ memcpy(skb_put(skb, sizeof(__u16)), &len, sizeof(__u16));
+ memcpy(skb_put(skb, sizeof(__u16)), &appl, sizeof(__u16));
+ memcpy(skb_put(skb, sizeof(__u8)), &_command, sizeof(_command));
+ memcpy(skb_put(skb, sizeof(__u8)), &_subcommand, sizeof(_subcommand));
+ memcpy(skb_put(skb, sizeof(__u16)), &MessageNumber, sizeof(__u16));
+ hycapi_send_message(ctrl, skb);
+ hycapi_applications[appl - 1].ctrl_mask &= ~(1 << (ctrl->cnr - 1));
}
/******************************************************************
hycapi_release_appl
-Release the application from the internal list an remove it's
+Release the application from the internal list an remove it's
registration at controller-level
******************************************************************/
@@ -301,15 +301,15 @@ hycapi_release_appl(struct capi_ctr *ctrl, __u16 appl)
int chk;
chk = _hycapi_appCheck(appl, ctrl->cnr);
- if(chk<0) {
+ if (chk < 0) {
printk(KERN_ERR "HYCAPI: Releasing invalid appl %d on controller %d\n", appl, ctrl->cnr);
return;
}
- if(hycapi_applications[appl-1].listen_req[ctrl->cnr-1]) {
- kfree_skb(hycapi_applications[appl-1].listen_req[ctrl->cnr-1]);
- hycapi_applications[appl-1].listen_req[ctrl->cnr-1] = NULL;
+ if (hycapi_applications[appl - 1].listen_req[ctrl->cnr - 1]) {
+ kfree_skb(hycapi_applications[appl - 1].listen_req[ctrl->cnr - 1]);
+ hycapi_applications[appl - 1].listen_req[ctrl->cnr - 1] = NULL;
}
- if(chk == 1)
+ if (chk == 1)
{
hycapi_release_internal(ctrl, appl);
}
@@ -327,7 +327,7 @@ int hycapi_capi_release(hysdn_card *card)
#ifdef HYCAPI_PRINTFNAMES
printk(KERN_NOTICE "hycapi_capi_release\n");
#endif
- if(cinfo) {
+ if (cinfo) {
ctrl = &cinfo->capi_ctrl;
hycapi_remove_ctr(ctrl);
}
@@ -347,7 +347,7 @@ int hycapi_capi_stop(hysdn_card *card)
#ifdef HYCAPI_PRINTFNAMES
printk(KERN_NOTICE "hycapi_capi_stop\n");
#endif
- if(cinfo) {
+ if (cinfo) {
ctrl = &cinfo->capi_ctrl;
/* ctrl->suspend_output(ctrl); */
capi_ctr_down(ctrl);
@@ -377,59 +377,59 @@ static u16 hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
u16 retval = CAPI_NOERROR;
appl_id = CAPIMSG_APPID(skb->data);
- switch(_hycapi_appCheck(appl_id, ctrl->cnr))
+ switch (_hycapi_appCheck(appl_id, ctrl->cnr))
{
- case 0:
+ case 0:
/* printk(KERN_INFO "Need to register\n"); */
- hycapi_register_internal(ctrl,
- appl_id,
- &(hycapi_applications[appl_id-1].rp));
- break;
- case 1:
- break;
- default:
- printk(KERN_ERR "HYCAPI: Controller mixup!\n");
- retval = CAPI_ILLAPPNR;
- goto out;
+ hycapi_register_internal(ctrl,
+ appl_id,
+ &(hycapi_applications[appl_id - 1].rp));
+ break;
+ case 1:
+ break;
+ default:
+ printk(KERN_ERR "HYCAPI: Controller mixup!\n");
+ retval = CAPI_ILLAPPNR;
+ goto out;
}
- switch(CAPIMSG_CMD(skb->data)) {
- case CAPI_DISCONNECT_B3_RESP:
- capilib_free_ncci(&cinfo->ncci_head, appl_id,
- CAPIMSG_NCCI(skb->data));
- break;
- case CAPI_DATA_B3_REQ:
- _len = CAPIMSG_LEN(skb->data);
- if (_len > 22) {
- _len2 = _len - 22;
- skb_copy_from_linear_data(skb, msghead, 22);
- skb_copy_to_linear_data_offset(skb, _len2,
- msghead, 22);
- skb_pull(skb, _len2);
- CAPIMSG_SETLEN(skb->data, 22);
- retval = capilib_data_b3_req(&cinfo->ncci_head,
- CAPIMSG_APPID(skb->data),
- CAPIMSG_NCCI(skb->data),
- CAPIMSG_MSGID(skb->data));
- }
- break;
- case CAPI_LISTEN_REQ:
- if(hycapi_applications[appl_id-1].listen_req[ctrl->cnr-1])
- {
- kfree_skb(hycapi_applications[appl_id-1].listen_req[ctrl->cnr-1]);
- hycapi_applications[appl_id-1].listen_req[ctrl->cnr-1] = NULL;
- }
- if (!(hycapi_applications[appl_id-1].listen_req[ctrl->cnr-1] = skb_copy(skb, GFP_ATOMIC)))
- {
- printk(KERN_ERR "HYSDN: memory squeeze in private_listen\n");
- }
- break;
- default:
- break;
+ switch (CAPIMSG_CMD(skb->data)) {
+ case CAPI_DISCONNECT_B3_RESP:
+ capilib_free_ncci(&cinfo->ncci_head, appl_id,
+ CAPIMSG_NCCI(skb->data));
+ break;
+ case CAPI_DATA_B3_REQ:
+ _len = CAPIMSG_LEN(skb->data);
+ if (_len > 22) {
+ _len2 = _len - 22;
+ skb_copy_from_linear_data(skb, msghead, 22);
+ skb_copy_to_linear_data_offset(skb, _len2,
+ msghead, 22);
+ skb_pull(skb, _len2);
+ CAPIMSG_SETLEN(skb->data, 22);
+ retval = capilib_data_b3_req(&cinfo->ncci_head,
+ CAPIMSG_APPID(skb->data),
+ CAPIMSG_NCCI(skb->data),
+ CAPIMSG_MSGID(skb->data));
+ }
+ break;
+ case CAPI_LISTEN_REQ:
+ if (hycapi_applications[appl_id - 1].listen_req[ctrl->cnr - 1])
+ {
+ kfree_skb(hycapi_applications[appl_id - 1].listen_req[ctrl->cnr - 1]);
+ hycapi_applications[appl_id - 1].listen_req[ctrl->cnr - 1] = NULL;
+ }
+ if (!(hycapi_applications[appl_id -1].listen_req[ctrl->cnr - 1] = skb_copy(skb, GFP_ATOMIC)))
+ {
+ printk(KERN_ERR "HYSDN: memory squeeze in private_listen\n");
+ }
+ break;
+ default:
+ break;
}
- out:
+out:
if (retval == CAPI_NOERROR)
hycapi_sendmsg_internal(ctrl, skb);
- else
+ else
dev_kfree_skb_any(skb);
return retval;
@@ -445,14 +445,14 @@ static int hycapi_proc_show(struct seq_file *m, void *v)
seq_printf(m, "%-16s %s\n", "name", cinfo->cardname);
seq_printf(m, "%-16s 0x%x\n", "io", card->iobase);
seq_printf(m, "%-16s %d\n", "irq", card->irq);
-
+
switch (card->brdtype) {
- case BD_PCCARD: s = "HYSDN Hycard"; break;
- case BD_ERGO: s = "HYSDN Ergo2"; break;
- case BD_METRO: s = "HYSDN Metro4"; break;
- case BD_CHAMP2: s = "HYSDN Champ2"; break;
- case BD_PLEXUS: s = "HYSDN Plexus30"; break;
- default: s = "???"; break;
+ case BD_PCCARD: s = "HYSDN Hycard"; break;
+ case BD_ERGO: s = "HYSDN Ergo2"; break;
+ case BD_METRO: s = "HYSDN Metro4"; break;
+ case BD_CHAMP2: s = "HYSDN Champ2"; break;
+ case BD_PLEXUS: s = "HYSDN Plexus30"; break;
+ default: s = "???"; break;
}
seq_printf(m, "%-16s %s\n", "type", s);
if ((s = cinfo->version[VER_DRIVER]) != NULL)
@@ -461,9 +461,9 @@ static int hycapi_proc_show(struct seq_file *m, void *v)
seq_printf(m, "%-16s %s\n", "ver_cardtype", s);
if ((s = cinfo->version[VER_SERIAL]) != NULL)
seq_printf(m, "%-16s %s\n", "ver_serial", s);
-
+
seq_printf(m, "%-16s %s\n", "cardname", cinfo->cardname);
-
+
return 0;
}
@@ -491,7 +491,7 @@ on capi-interface registration.
static int hycapi_load_firmware(struct capi_ctr *ctrl, capiloaddata *data)
{
#ifdef HYCAPI_PRINTFNAMES
- printk(KERN_NOTICE "hycapi_load_firmware\n");
+ printk(KERN_NOTICE "hycapi_load_firmware\n");
#endif
return 0;
}
@@ -501,7 +501,7 @@ static char *hycapi_procinfo(struct capi_ctr *ctrl)
{
hycapictrl_info *cinfo = (hycapictrl_info *)(ctrl->driverdata);
#ifdef HYCAPI_PRINTFNAMES
- printk(KERN_NOTICE "hycapi_proc_info\n");
+ printk(KERN_NOTICE "hycapi_proc_info\n");
#endif
if (!cinfo)
return "";
@@ -525,7 +525,7 @@ New nccis are created if necessary.
*******************************************************************/
void
-hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len)
+hycapi_rx_capipkt(hysdn_card *card, unsigned char *buf, unsigned short len)
{
struct sk_buff *skb;
hycapictrl_info *cinfo = card->hyctrlinfo;
@@ -533,24 +533,24 @@ hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len)
__u16 ApplId;
__u16 MsgLen, info;
__u16 len2, CapiCmd;
- __u32 CP64[2] = {0,0};
+ __u32 CP64[2] = {0, 0};
#ifdef HYCAPI_PRINTFNAMES
- printk(KERN_NOTICE "hycapi_rx_capipkt\n");
+ printk(KERN_NOTICE "hycapi_rx_capipkt\n");
#endif
- if(!cinfo) {
+ if (!cinfo) {
return;
}
ctrl = &cinfo->capi_ctrl;
- if(len < CAPI_MSG_BASELEN) {
+ if (len < CAPI_MSG_BASELEN) {
printk(KERN_ERR "HYSDN Card%d: invalid CAPI-message, length %d!\n",
card->myid, len);
return;
- }
+ }
MsgLen = CAPIMSG_LEN(buf);
ApplId = CAPIMSG_APPID(buf);
CapiCmd = CAPIMSG_CMD(buf);
-
- if((CapiCmd == CAPI_DATA_B3_IND) && (MsgLen < 30)) {
+
+ if ((CapiCmd == CAPI_DATA_B3_IND) && (MsgLen < 30)) {
len2 = len + (30 - MsgLen);
if (!(skb = alloc_skb(len2, GFP_ATOMIC))) {
printk(KERN_ERR "HYSDN Card%d: incoming packet dropped\n",
@@ -558,7 +558,7 @@ hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len)
return;
}
memcpy(skb_put(skb, MsgLen), buf, MsgLen);
- memcpy(skb_put(skb, 2*sizeof(__u32)), CP64, 2* sizeof(__u32));
+ memcpy(skb_put(skb, 2 * sizeof(__u32)), CP64, 2 * sizeof(__u32));
memcpy(skb_put(skb, len - MsgLen), buf + MsgLen,
len - MsgLen);
CAPIMSG_SETLEN(skb->data, 30);
@@ -570,54 +570,54 @@ hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len)
}
memcpy(skb_put(skb, len), buf, len);
}
- switch(CAPIMSG_CMD(skb->data))
+ switch (CAPIMSG_CMD(skb->data))
{
- case CAPI_CONNECT_B3_CONF:
+ case CAPI_CONNECT_B3_CONF:
/* Check info-field for error-indication: */
- info = CAPIMSG_U16(skb->data, 12);
- switch(info)
- {
- case 0:
- capilib_new_ncci(&cinfo->ncci_head, ApplId, CAPIMSG_NCCI(skb->data),
- hycapi_applications[ApplId-1].rp.datablkcnt);
-
- break;
- case 0x0001:
- printk(KERN_ERR "HYSDN Card%d: NCPI not supported by current "
- "protocol. NCPI ignored.\n", card->myid);
- break;
- case 0x2001:
- printk(KERN_ERR "HYSDN Card%d: Message not supported in"
- " current state\n", card->myid);
- break;
- case 0x2002:
- printk(KERN_ERR "HYSDN Card%d: invalid PLCI\n", card->myid);
- break;
- case 0x2004:
- printk(KERN_ERR "HYSDN Card%d: out of NCCI\n", card->myid);
- break;
- case 0x3008:
- printk(KERN_ERR "HYSDN Card%d: NCPI not supported\n",
- card->myid);
- break;
- default:
- printk(KERN_ERR "HYSDN Card%d: Info in CONNECT_B3_CONF: %d\n",
- card->myid, info);
- break;
- }
+ info = CAPIMSG_U16(skb->data, 12);
+ switch (info)
+ {
+ case 0:
+ capilib_new_ncci(&cinfo->ncci_head, ApplId, CAPIMSG_NCCI(skb->data),
+ hycapi_applications[ApplId - 1].rp.datablkcnt);
+
+ break;
+ case 0x0001:
+ printk(KERN_ERR "HYSDN Card%d: NCPI not supported by current "
+ "protocol. NCPI ignored.\n", card->myid);
break;
- case CAPI_CONNECT_B3_IND:
- capilib_new_ncci(&cinfo->ncci_head, ApplId,
- CAPIMSG_NCCI(skb->data),
- hycapi_applications[ApplId-1].rp.datablkcnt);
+ case 0x2001:
+ printk(KERN_ERR "HYSDN Card%d: Message not supported in"
+ " current state\n", card->myid);
break;
- case CAPI_DATA_B3_CONF:
- capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
- CAPIMSG_NCCI(skb->data),
- CAPIMSG_MSGID(skb->data));
+ case 0x2002:
+ printk(KERN_ERR "HYSDN Card%d: invalid PLCI\n", card->myid);
+ break;
+ case 0x2004:
+ printk(KERN_ERR "HYSDN Card%d: out of NCCI\n", card->myid);
+ break;
+ case 0x3008:
+ printk(KERN_ERR "HYSDN Card%d: NCPI not supported\n",
+ card->myid);
break;
default:
+ printk(KERN_ERR "HYSDN Card%d: Info in CONNECT_B3_CONF: %d\n",
+ card->myid, info);
break;
+ }
+ break;
+ case CAPI_CONNECT_B3_IND:
+ capilib_new_ncci(&cinfo->ncci_head, ApplId,
+ CAPIMSG_NCCI(skb->data),
+ hycapi_applications[ApplId - 1].rp.datablkcnt);
+ break;
+ case CAPI_DATA_B3_CONF:
+ capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
+ CAPIMSG_NCCI(skb->data),
+ CAPIMSG_MSGID(skb->data));
+ break;
+ default:
+ break;
}
capi_ctr_handle_message(ctrl, ApplId, skb);
}
@@ -630,13 +630,13 @@ internal queue.
*******************************************************************/
-void hycapi_tx_capiack(hysdn_card * card)
+void hycapi_tx_capiack(hysdn_card *card)
{
hycapictrl_info *cinfo = card->hyctrlinfo;
#ifdef HYCAPI_PRINTFNAMES
- printk(KERN_NOTICE "hycapi_tx_capiack\n");
+ printk(KERN_NOTICE "hycapi_tx_capiack\n");
#endif
- if(!cinfo) {
+ if (!cinfo) {
return;
}
spin_lock_irq(&cinfo->lock);
@@ -661,7 +661,7 @@ struct sk_buff *
hycapi_tx_capiget(hysdn_card *card)
{
hycapictrl_info *cinfo = card->hyctrlinfo;
- if(!cinfo) {
+ if (!cinfo) {
return (struct sk_buff *)NULL;
}
if (!cinfo->sk_count)
@@ -681,10 +681,10 @@ attach the capi-driver to the kernel-capi.
int hycapi_init(void)
{
int i;
- for(i=0;i<CAPI_MAXAPPL;i++) {
+ for (i = 0; i < CAPI_MAXAPPL; i++) {
memset(&(hycapi_applications[i]), 0, sizeof(hycapi_appl));
}
- return(0);
+ return (0);
}
/**************************************************************
@@ -694,7 +694,7 @@ detach the capi-driver to the kernel-capi. Actually this should
free some more ressources. Do that later.
**************************************************************/
-void
+void
hycapi_cleanup(void)
{
}
@@ -710,9 +710,9 @@ static void hycapi_fill_profile(hysdn_card *card)
hycapictrl_info *cinfo = NULL;
struct capi_ctr *ctrl = NULL;
cinfo = card->hyctrlinfo;
- if(!cinfo) return;
+ if (!cinfo) return;
ctrl = &cinfo->capi_ctrl;
- strcpy(ctrl->manu, "Hypercope");
+ strcpy(ctrl->manu, "Hypercope");
ctrl->version.majorversion = 2;
ctrl->version.minorversion = 0;
ctrl->version.majormanuversion = 3;
@@ -732,18 +732,18 @@ static void hycapi_fill_profile(hysdn_card *card)
(card->faxchans ? B3_PROT_T30 : 0) |
(card->faxchans ? B3_PROT_T30EXT : 0) |
B3_PROT_ISO8208;
-}
+}
-int
+int
hycapi_capi_create(hysdn_card *card)
{
hycapictrl_info *cinfo = NULL;
struct capi_ctr *ctrl = NULL;
int retval;
#ifdef HYCAPI_PRINTFNAMES
- printk(KERN_NOTICE "hycapi_capi_create\n");
+ printk(KERN_NOTICE "hycapi_capi_create\n");
#endif
- if((hycapi_enable & (1 << card->myid)) == 0) {
+ if ((hycapi_enable & (1 << card->myid)) == 0) {
return 1;
}
if (!card->hyctrlinfo) {
@@ -758,12 +758,12 @@ hycapi_capi_create(hysdn_card *card)
INIT_LIST_HEAD(&cinfo->ncci_head);
switch (card->brdtype) {
- case BD_PCCARD: strcpy(cinfo->cardname,"HYSDN Hycard"); break;
- case BD_ERGO: strcpy(cinfo->cardname,"HYSDN Ergo2"); break;
- case BD_METRO: strcpy(cinfo->cardname,"HYSDN Metro4"); break;
- case BD_CHAMP2: strcpy(cinfo->cardname,"HYSDN Champ2"); break;
- case BD_PLEXUS: strcpy(cinfo->cardname,"HYSDN Plexus30"); break;
- default: strcpy(cinfo->cardname,"HYSDN ???"); break;
+ case BD_PCCARD: strcpy(cinfo->cardname, "HYSDN Hycard"); break;
+ case BD_ERGO: strcpy(cinfo->cardname, "HYSDN Ergo2"); break;
+ case BD_METRO: strcpy(cinfo->cardname, "HYSDN Metro4"); break;
+ case BD_CHAMP2: strcpy(cinfo->cardname, "HYSDN Champ2"); break;
+ case BD_PLEXUS: strcpy(cinfo->cardname, "HYSDN Plexus30"); break;
+ default: strcpy(cinfo->cardname, "HYSDN ???"); break;
}
ctrl = &cinfo->capi_ctrl;
@@ -792,7 +792,7 @@ hycapi_capi_create(hysdn_card *card)
ctrl = &card->hyctrlinfo->capi_ctrl;
hycapi_fill_profile(card);
capi_ctr_ready(ctrl);
- hycapi_restart_internal(ctrl);
+ hycapi_restart_internal(ctrl);
/* ctrl->resume_output(ctrl); */
}
return 0;