Lines Matching +full:sync +full:- +full:2

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) ST-Ericsson AB 2010
25 spinlock_t sync; member
45 this->layer.receive = cfserl_receive; in cfserl_create()
46 this->layer.transmit = cfserl_transmit; in cfserl_create()
47 this->layer.ctrlcmd = cfserl_ctrlcmd; in cfserl_create()
48 this->usestx = use_stx; in cfserl_create()
49 spin_lock_init(&this->sync); in cfserl_create()
50 snprintf(this->layer.name, CAIF_LAYER_NAME_SZ, "ser1"); in cfserl_create()
51 return &this->layer; in cfserl_create()
67 spin_lock(&layr->sync); in cfserl_receive()
69 if (layr->incomplete_frm != NULL) { in cfserl_receive()
70 layr->incomplete_frm = in cfserl_receive()
71 cfpkt_append(layr->incomplete_frm, newpkt, expectlen); in cfserl_receive()
72 pkt = layr->incomplete_frm; in cfserl_receive()
74 spin_unlock(&layr->sync); in cfserl_receive()
75 return -ENOMEM; in cfserl_receive()
80 layr->incomplete_frm = NULL; in cfserl_receive()
84 if (layr->usestx) { in cfserl_receive()
93 layr->incomplete_frm = NULL; in cfserl_receive()
94 spin_unlock(&layr->sync); in cfserl_receive()
95 return -EPROTO; in cfserl_receive()
108 if (pkt_len < 2) { in cfserl_receive()
109 if (layr->usestx) in cfserl_receive()
111 layr->incomplete_frm = pkt; in cfserl_receive()
112 spin_unlock(&layr->sync); in cfserl_receive()
120 cfpkt_peek_head(pkt, &tmp, 2); in cfserl_receive()
121 expectlen = le16_to_cpu(tmp) + 2; in cfserl_receive()
127 if (!layr->usestx) { in cfserl_receive()
130 layr->incomplete_frm = NULL; in cfserl_receive()
131 spin_unlock(&layr->sync); in cfserl_receive()
132 return -EPROTO; in cfserl_receive()
139 if (layr->usestx) in cfserl_receive()
141 layr->incomplete_frm = pkt; in cfserl_receive()
142 spin_unlock(&layr->sync); in cfserl_receive()
156 spin_unlock(&layr->sync); in cfserl_receive()
157 ret = layr->layer.up->receive(layr->layer.up, pkt); in cfserl_receive()
158 spin_lock(&layr->sync); in cfserl_receive()
159 if (ret == -EILSEQ) { in cfserl_receive()
160 if (layr->usestx) { in cfserl_receive()
175 spin_unlock(&layr->sync); in cfserl_receive()
183 if (layr->usestx) in cfserl_transmit()
185 return layer->dn->transmit(layer->dn, newpkt); in cfserl_transmit()
191 layr->up->ctrlcmd(layr->up, ctrl, phyid); in cfserl_ctrlcmd()