Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | net/nfc/core.c | struct nfc_dev *nfc_allocate_device(const struct nfc_ops *ops,
u32 supported_protocols, int tx_headroom,
int tx_tailroom) {
struct nfc_dev *dev;
int rc;
if (!ops->start_poll || !ops->stop_poll || !ops->activate_target ||
!ops->deactiva... | [
0,
0
] |
Linux Kernel | net/nfc/digital.h | static inline int digital_in_send_cmd(struct nfc_digital_dev *ddev,
struct sk_buff *skb, u16 timeout,
nfc_digital_cmd_complete_t cmd_cb,
void *cb_context) {
return digital_send_cmd(ddev, DIGITAL_CMD_IN_SE... | [
0,
0
] |
Linux Kernel | net/nfc/digital.h |
static inline void digital_skb_add_crc_b(struct sk_buff *skb) {
digital_skb_add_crc(skb, crc_ccitt, CRC_B_INIT, 1, 0);
} | [
0,
0
] |
Linux Kernel | net/nfc/digital.h |
static inline void digital_skb_add_crc_f(struct sk_buff *skb) {
digital_skb_add_crc(skb, crc_itu_t, CRC_F_INIT, 0, 1);
} | [
0,
0
] |
Linux Kernel | net/nfc/digital.h |
static inline int digital_skb_check_crc_a(struct sk_buff *skb) {
return digital_skb_check_crc(skb, crc_ccitt, CRC_A_INIT, 0, 0);
} | [
0,
0
] |
Linux Kernel | net/nfc/digital.h |
static inline int digital_skb_check_crc_none(struct sk_buff *skb) { return 0; } | [
0,
0
] |
Linux Kernel | net/nfc/digital_core.c |
static void digital_send_cmd_complete(struct nfc_digital_dev *ddev, void *arg,
struct sk_buff *resp) {
struct digital_cmd *cmd = arg;
cmd->resp = resp;
schedule_work(&ddev->cmd_complete_work);
} | [
0,
0
] |
Linux Kernel | net/nfc/digital_core.c |
int digital_send_cmd(struct nfc_digital_dev *ddev, u8 cmd_type,
struct sk_buff *skb, struct digital_tg_mdaa_params *params,
u16 timeout, nfc_digital_cmd_complete_t cmd_cb,
void *cb_context) {
struct digital_cmd *cmd;
cmd = kzalloc(sizeof(*cmd), GFP_KE... | [
0,
0
] |
Linux Kernel | net/nfc/digital_core.c |
static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) {
struct digital_tg_mdaa_params *params;
int rc;
params = kzalloc(sizeof(*params), GFP_KERNEL);
if (!params)
return -ENOMEM;
params->sens_res = DIGITAL_SENS_RES_NFC_DEP;
get_random_bytes(params->nfcid1, sizeof(params->nfcid1)... | [
1,
0
] |
Linux Kernel | net/nfc/digital_core.c |
static int digital_tg_listen_md(struct nfc_digital_dev *ddev, u8 rf_tech) {
return digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MD, NULL, NULL, 500,
digital_tg_recv_md_req, NULL);
} | [
0,
0
] |
Linux Kernel | net/nfc/digital_core.c |
void digital_poll_next_tech(struct nfc_digital_dev *ddev) {
u8 rand_mod;
digital_switch_rf(ddev, 0);
mutex_lock(&ddev->poll_lock);
if (!ddev->poll_tech_count) {
mutex_unlock(&ddev->poll_lock);
return;
}
get_random_bytes(&rand_mod, sizeof(rand_mod));
ddev->poll_tech_index = rand_mod % ddev->po... | [
1,
0
] |
Linux Kernel | net/nfc/digital_core.c |
static int digital_dev_up(struct nfc_dev *nfc_dev) {
struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
digital_switch_rf(ddev, 1);
return 0;
} | [
0,
0
] |
Linux Kernel | net/nfc/digital_core.c |
static int digital_dep_link_down(struct nfc_dev *nfc_dev) {
struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
digital_abort_cmd(ddev);
ddev->curr_protocol = 0;
return 0;
} | [
0,
0
] |
Linux Kernel | net/nfc/digital_core.c |
static int digital_tg_send(struct nfc_dev *dev, struct sk_buff *skb) {
struct nfc_digital_dev *ddev = nfc_get_drvdata(dev);
return digital_tg_send_dep_res(ddev, skb);
} | [
0,
0
] |
Linux Kernel | net/nfc/digital_core.c |
static int digital_in_send(struct nfc_dev *nfc_dev, struct nfc_target *target,
struct sk_buff *skb, data_exchange_cb_t cb,
void *cb_context) {
struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
struct digital_data_exch *data_exch;
int rc;
data_exch =... | [
0,
0
] |
Linux Kernel | net/nfc/digital_core.c |
int nfc_digital_register_device(struct nfc_digital_dev *ddev) {
return nfc_register_device(ddev->nfc_dev);
} | [
0,
0
] |
Linux Kernel | net/nfc/digital_dep.c |
static int digital_in_send_atn(struct nfc_digital_dev *ddev,
struct digital_data_exch *data_exch) {
struct digital_dep_req_res *dep_req;
struct sk_buff *skb;
int rc;
skb = digital_skb_alloc(ddev, 1);
if (!skb)
return -ENOMEM;
skb_push(skb, sizeof(struct digital_dep_req_... | [
1,
0
] |
Linux Kernel | net/nfc/digital_dep.c |
static int digital_in_send_rtox(struct nfc_digital_dev *ddev,
struct digital_data_exch *data_exch, u8 rtox) {
struct digital_dep_req_res *dep_req;
struct sk_buff *skb;
int rc;
u16 rwt_int;
rwt_int = ddev->dep_rwt * rtox;
if (rwt_int > digital_rwt_map[DIGITAL_NFC_DEP_IN_MAX_... | [
1,
0
] |
Linux Kernel | net/nfc/digital_dep.c |
static int digital_in_send_saved_skb(struct nfc_digital_dev *ddev,
struct digital_data_exch *data_exch) {
int rc;
if (!ddev->saved_skb)
return -EINVAL;
skb_get(ddev->saved_skb);
rc = digital_in_send_cmd(ddev, ddev->saved_skb, ddev->dep_rwt,
... | [
0,
0
] |
Linux Kernel | net/nfc/digital_dep.c |
static int digital_tg_send_ack(struct nfc_digital_dev *ddev,
struct digital_data_exch *data_exch) {
struct digital_dep_req_res *dep_res;
struct sk_buff *skb;
int rc;
skb = digital_skb_alloc(ddev, 1);
if (!skb)
return -ENOMEM;
skb_push(skb, sizeof(struct digital_dep_req_... | [
1,
0
] |
Linux Kernel | net/nfc/digital_dep.c |
int digital_tg_send_dep_res(struct nfc_digital_dev *ddev, struct sk_buff *skb) {
struct digital_dep_req_res *dep_res;
struct sk_buff *chaining_skb, *tmp_skb;
int rc;
skb_push(skb, sizeof(struct digital_dep_req_res));
dep_res = (struct digital_dep_req_res *)skb->data;
dep_res->dir = DIGITAL_NFC_DEP_FRAME... | [
1,
0
] |
Linux Kernel | net/nfc/digital_dep.c |
static void digital_tg_send_atr_res_complete(struct nfc_digital_dev *ddev,
void *arg, struct sk_buff *resp) {
int offset;
if (IS_ERR(resp)) {
digital_poll_next_tech(ddev);
return;
}
offset = 2;
if (resp->data[0] == DIGITAL_NFC_DEP_NFCA_SOD_SB)
offset... | [
0,
0
] |
Linux Kernel | net/nfc/digital_technology.c |
static int digital_in_send_rats(struct nfc_digital_dev *ddev,
struct nfc_target *target) {
int rc;
struct sk_buff *skb;
skb = digital_skb_alloc(ddev, 2);
if (!skb)
return -ENOMEM;
skb_put_u8(skb, DIGITAL_RATS_BYTE1);
skb_put_u8(skb, DIGITAL_RATS_PARAM);
rc = digital... | [
0,
0
] |
Linux Kernel | net/nfc/digital_technology.c |
static void digital_in_recv_sdd_res(struct nfc_digital_dev *ddev, void *arg,
struct sk_buff *resp) {
struct nfc_target *target = arg;
struct digital_sdd_res *sdd_res;
int rc;
u8 offset, size;
u8 i, bcc;
if (IS_ERR(resp)) {
rc = PTR_ERR(resp);
resp = NULL;
go... | [
1,
0
] |
Linux Kernel | net/nfc/digital_technology.c |
static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev,
struct nfc_target *target) {
int rc;
struct sk_buff *skb;
u8 sel_cmd;
rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING,
NFC_DIGITAL_FRAMING_NFCA_STANDARD);
if (rc)
... | [
0,
0
] |
Linux Kernel | net/nfc/digital_technology.c |
static void digital_in_recv_sens_res(struct nfc_digital_dev *ddev, void *arg,
struct sk_buff *resp) {
struct nfc_target *target = NULL;
int rc;
if (IS_ERR(resp)) {
rc = PTR_ERR(resp);
resp = NULL;
goto exit;
}
if (resp->len < sizeof(u16)) {
rc = -EIO;
... | [
1,
0
] |
Linux Kernel | net/nfc/digital_technology.c |
static void digital_in_recv_attrib_res(struct nfc_digital_dev *ddev, void *arg,
struct sk_buff *resp) {
struct nfc_target *target = arg;
struct digital_attrib_res *attrib_res;
int rc;
if (IS_ERR(resp)) {
rc = PTR_ERR(resp);
resp = NULL;
goto exit;
}
if (... | [
1,
0
] |
Linux Kernel | net/nfc/digital_technology.c | int digital_in_send_iso15693_inv_req(struct nfc_digital_dev *ddev, u8 rf_tech) {
struct digital_iso15693_inv_req *req;
struct sk_buff *skb;
int rc;
rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH,
NFC_DIGITAL_RF_TECH_ISO15693);
if (rc)
return rc;
rc = digit... | [
1,
0
] |
Linux Kernel | net/nfc/digital_technology.c | static void digital_tg_recv_sel_req(struct nfc_digital_dev *ddev, void *arg,
struct sk_buff *resp) {
int rc;
if (IS_ERR(resp)) {
rc = PTR_ERR(resp);
resp = NULL;
goto exit;
}
if (!DIGITAL_DRV_CAPS_TG_CRC(ddev)) {
rc = digital_skb_check_crc_a(resp);
if (r... | [
0,
0
] |
Linux Kernel | net/nfc/digital_technology.c |
static void digital_tg_recv_sdd_req(struct nfc_digital_dev *ddev, void *arg,
struct sk_buff *resp) {
u8 *sdd_req;
int rc;
if (IS_ERR(resp)) {
rc = PTR_ERR(resp);
resp = NULL;
goto exit;
}
sdd_req = resp->data;
if (resp->len < 2 || sdd_req[0] != DIGITAL_CMD... | [
1,
0
] |
Linux Kernel | net/nfc/digital_technology.c |
static int digital_tg_send_sens_res(struct nfc_digital_dev *ddev) {
struct sk_buff *skb;
u8 *sens_res;
int rc;
skb = digital_skb_alloc(ddev, 2);
if (!skb)
return -ENOMEM;
sens_res = skb_put(skb, 2);
sens_res[0] = (DIGITAL_SENS_RES_NFC_DEP >> 8) & 0xFF;
sens_res[1] = DIGITAL_SENS_RES_NFC_DEP & 0x... | [
1,
0
] |
Linux Kernel | net/nfc/hci/command.c | static int nfc_hci_execute_cmd(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
const u8 *param, size_t param_len,
struct sk_buff **skb) {
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(ew_wq);
struct hcp_exec_waiter hcp_ew;
hcp_ew.wq = &ew_wq;
hcp_ew.exec_complete = fal... | [
0,
1
] |
Linux Kernel | net/nfc/hci/command.c |
int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event,
const u8 *param, size_t param_len) {
u8 pipe;
pr_debug("%d to gate %d\n", event, gate);
pipe = hdev->gate2pipe[gate];
if (pipe == NFC_HCI_INVALID_PIPE)
return -EADDRNOTAVAIL;
return nfc_hci_hcp_message_tx(hdev, ... | [
0,
0
] |
Linux Kernel | net/nfc/hci/command.c | int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd, const u8 *param,
size_t param_len, struct sk_buff **skb) {
u8 pipe;
pipe = hdev->gate2pipe[gate];
if (pipe == NFC_HCI_INVALID_PIPE)
return -EADDRNOTAVAIL;
return nfc_hci_execute_cmd(hdev, pipe, cmd, param, param_len, skb)... | [
0,
0
] |
Linux Kernel | net/nfc/hci/command.c | int nfc_hci_set_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx,
const u8 *param, size_t param_len) {
int r;
u8 *tmp;
/* TODO ELa: reg idx must be inserted before param, but we don't want
* to ask the caller to do it to keep a simpler API.
* For now, just create a new temporary param ... | [
1,
1
] |
Linux Kernel | net/nfc/hci/command.c | static int nfc_hci_open_pipe(struct nfc_hci_dev *hdev, u8 pipe) {
struct sk_buff *skb;
int r;
pr_debug("pipe=%d\n", pipe);
r = nfc_hci_execute_cmd(hdev, pipe, NFC_HCI_ANY_OPEN_PIPE, NULL, 0, &skb);
if (r == 0) {
kfree_skb(skb);
}
return r;
} | [
0,
0
] |
Linux Kernel | net/nfc/hci/command.c |
static int nfc_hci_delete_pipe(struct nfc_hci_dev *hdev, u8 pipe) {
return nfc_hci_execute_cmd(hdev, NFC_HCI_ADMIN_PIPE, NFC_HCI_ADM_DELETE_PIPE,
&pipe, 1, NULL);
} | [
0,
0
] |
Linux Kernel | net/nfc/hci/core.c |
int nfc_hci_result_to_errno(u8 result) {
switch (result) {
case NFC_HCI_ANY_OK:
return 0;
case NFC_HCI_ANY_E_REG_PAR_UNKNOWN:
return -EOPNOTSUPP;
case NFC_HCI_ANY_E_TIMEOUT:
return -ETIME;
default:
return -1;
}
} | [
0,
0
] |
Linux Kernel | net/nfc/hci/core.c |
void nfc_hci_reset_pipes(struct nfc_hci_dev *hdev) {
int i = 0;
for (i = 0; i < NFC_HCI_MAX_PIPES; i++) {
hdev->pipes[i].gate = NFC_HCI_INVALID_GATE;
hdev->pipes[i].dest_host = NFC_HCI_INVALID_HOST;
}
memset(hdev->gate2pipe, NFC_HCI_INVALID_PIPE, sizeof(hdev->gate2pipe));
} | [
1,
0
] |
Linux Kernel | net/nfc/hci/core.c |
static void nfc_hci_msg_rx_work(struct work_struct *work) {
struct nfc_hci_dev *hdev =
container_of(work, struct nfc_hci_dev, msg_rx_work);
struct sk_buff *skb;
const struct hcp_message *message;
u8 pipe;
u8 type;
u8 instruction;
while ((skb = skb_dequeue(&hdev->msg_rx_queue)) != NULL) {
pipe ... | [
0,
0
] |
Linux Kernel | net/nfc/hci/core.c |
u32 nfc_hci_sak_to_protocol(u8 sak) {
switch (NFC_HCI_TYPE_A_SEL_PROT(sak)) {
case NFC_HCI_TYPE_A_SEL_PROT_MIFARE:
return NFC_PROTO_MIFARE_MASK;
case NFC_HCI_TYPE_A_SEL_PROT_ISO14443:
return NFC_PROTO_ISO14443_MASK;
case NFC_HCI_TYPE_A_SEL_PROT_DEP:
return NFC_PROTO_NFC_DEP_MASK;
case NFC_HCI_TYP... | [
0,
0
] |
Linux Kernel | net/nfc/hci/core.c |
static int hci_dev_connect_gates(struct nfc_hci_dev *hdev, u8 gate_count,
const struct nfc_hci_gate *gates) {
int r;
while (gate_count--) {
r = nfc_hci_connect_gate(hdev, NFC_HCI_HOST_CONTROLLER_ID, gates->gate,
gates->pipe);
if (r < 0)
re... | [
0,
0
] |
Linux Kernel | net/nfc/hci/core.c |
static int hci_dev_up(struct nfc_dev *nfc_dev) {
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
int r = 0;
if (hdev->ops->open) {
r = hdev->ops->open(hdev);
if (r < 0)
return r;
}
r = nfc_llc_start(hdev->llc);
if (r < 0)
goto exit_close;
r = hci_dev_session_init(hdev);
if (r ... | [
0,
0
] |
Linux Kernel | net/nfc/hci/core.c |
static int hci_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
__u8 comm_mode, __u8 *gb, size_t gb_len) {
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
if (!hdev->ops->dep_link_up)
return 0;
return hdev->ops->dep_link_up(hdev, target, comm_mode, gb, gb_len)... | [
1,
0
] |
Linux Kernel | net/nfc/hci/core.c | static int hci_transceive(struct nfc_dev *nfc_dev, struct nfc_target *target,
struct sk_buff *skb, data_exchange_cb_t cb,
void *cb_context) {
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
int r;
pr_debug("target_idx=%d\n", target->idx);
switch (target... | [
1,
0
] |
Linux Kernel | net/nfc/hci/core.c |
static int hci_discover_se(struct nfc_dev *nfc_dev) {
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
if (hdev->ops->discover_se)
return hdev->ops->discover_se(hdev);
return 0;
} | [
0,
0
] |
Linux Kernel | net/nfc/hci/core.c |
void nfc_hci_free_device(struct nfc_hci_dev *hdev) {
nfc_free_device(hdev->ndev);
nfc_llc_free(hdev->llc);
kfree(hdev);
} | [
0,
0
] |
Linux Kernel | net/nfc/hci/core.c |
static int __init nfc_hci_init(void) { return nfc_llc_init(); } | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc.c |
int __init nfc_llc_init(void) {
int r;
r = nfc_llc_nop_register();
if (r)
goto exit;
r = nfc_llc_shdlc_register();
if (r)
goto exit;
return 0;
exit:
nfc_llc_exit();
return r;
} | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc.c |
void nfc_llc_exit(void) {
struct nfc_llc_engine *llc_engine, *n;
list_for_each_entry_safe(llc_engine, n, &llc_engines, entry) {
list_del(&llc_engine->entry);
kfree(llc_engine->name);
kfree(llc_engine);
}
} | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc.c |
int nfc_llc_start(struct nfc_llc *llc) { return llc->ops->start(llc); } | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc.c |
int nfc_llc_xmit_from_hci(struct nfc_llc *llc, struct sk_buff *skb) {
return llc->ops->xmit_from_hci(llc, skb);
} | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc_nop.c |
static int llc_nop_start(struct nfc_llc *llc) { return 0; } | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc_nop.c |
static void llc_nop_rcv_from_drv(struct nfc_llc *llc, struct sk_buff *skb) {
struct llc_nop *llc_nop = nfc_llc_get_data(llc);
llc_nop->rcv_to_hci(llc_nop->hdev, skb);
} | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc_shdlc.c | static int llc_shdlc_send_s_frame(const struct llc_shdlc *shdlc,
enum sframe_type sframe_type, int nr) {
int r;
struct sk_buff *skb;
pr_debug("sframe_type=%d nr=%d\n", sframe_type, nr);
skb = llc_shdlc_alloc_skb(shdlc, 0);
if (skb == NULL)
return -ENOMEM;
*(u8 *)skb_... | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc_shdlc.c | static int llc_shdlc_send_u_frame(const struct llc_shdlc *shdlc,
struct sk_buff *skb,
enum uframe_modifier uframe_modifier) {
int r;
pr_debug("uframe_modifier=%d\n", uframe_modifier);
*(u8 *)skb_push(skb, 1) = SHDLC_CONTROL_HEAD_U | uframe_modi... | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc_shdlc.c | static void llc_shdlc_reset_t2(struct llc_shdlc *shdlc, int y_nr) {
struct sk_buff *skb;
int dnr = shdlc->dnr;
pr_debug("release ack pending up to frame %d excluded\n", y_nr);
while (dnr != y_nr) {
pr_debug("release ack pending frame %d\n", dnr);
skb = skb_dequeue(&shdlc->ack_pending_q);
kfree_sk... | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc_shdlc.c |
static void llc_shdlc_connect_complete(struct llc_shdlc *shdlc, int r) {
pr_debug("result=%d\n", r);
del_timer_sync(&shdlc->connect_timer);
if (r == 0) {
shdlc->ns = 0;
shdlc->nr = 0;
shdlc->dnr = 0;
shdlc->state = SHDLC_HALF_CONNECTED;
} else {
shdlc->state = SHDLC_DISCONNECTED;
}
... | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc_shdlc.c |
static void llc_shdlc_connect_timeout(struct timer_list *t) {
struct llc_shdlc *shdlc = from_timer(shdlc, t, connect_timer);
schedule_work(&shdlc->sm_work);
} | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc_shdlc.c |
static void llc_shdlc_t2_timeout(struct timer_list *t) {
struct llc_shdlc *shdlc = from_timer(shdlc, t, t2_timer);
pr_debug("SoftIRQ: need to retransmit\n");
schedule_work(&shdlc->sm_work);
} | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc_shdlc.c | static int llc_shdlc_connect(struct llc_shdlc *shdlc) {
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(connect_wq);
mutex_lock(&shdlc->state_mutex);
shdlc->state = SHDLC_CONNECTING;
shdlc->connect_wq = &connect_wq;
shdlc->connect_tries = 0;
shdlc->connect_result = 1;
mutex_unlock(&shdlc->state_mutex);
schedule_wor... | [
0,
0
] |
Linux Kernel | net/nfc/hci/llc_shdlc.c |
static int llc_shdlc_xmit_from_hci(struct nfc_llc *llc, struct sk_buff *skb) {
struct llc_shdlc *shdlc = nfc_llc_get_data(llc);
skb_queue_tail(&shdlc->send_q, skb);
schedule_work(&shdlc->sm_work);
return 0;
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_commands.c |
static u16 llcp_tlv_miux(const u8 *tlv) {
return llcp_tlv16(tlv, LLCP_TLV_MIUX) & 0x7ff;
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_commands.c |
static u8 llcp_tlv_rw(const u8 *tlv) {
return llcp_tlv8(tlv, LLCP_TLV_RW) & 0xf;
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_commands.c |
void nfc_llcp_free_sdp_tlv_list(struct hlist_head *head) {
struct nfc_llcp_sdp_tlv *sdp;
struct hlist_node *n;
hlist_for_each_entry_safe(sdp, n, head, node) {
hlist_del(&sdp->node);
nfc_llcp_free_sdp_tlv(sdp);
}
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_commands.c |
int nfc_llcp_send_disconnect(struct nfc_llcp_sock *sock) {
struct sk_buff *skb;
struct nfc_dev *dev;
struct nfc_llcp_local *local;
local = sock->local;
if (local == NULL)
return -ENODEV;
dev = sock->dev;
if (dev == NULL)
return -ENODEV;
skb = llcp_allocate_pdu(sock, LLCP_PDU_DISC, 0);
if (... | [
0,
0
] |
Linux Kernel | net/nfc/llcp_commands.c |
int nfc_llcp_send_snl_sdres(struct nfc_llcp_local *local,
struct hlist_head *tlv_list, size_t tlvs_len) {
struct nfc_llcp_sdp_tlv *sdp;
struct hlist_node *n;
struct sk_buff *skb;
skb = nfc_llcp_allocate_snl(local, tlvs_len);
if (IS_ERR(skb))
return PTR_ERR(skb);
hlist_for_... | [
0,
0
] |
Linux Kernel | net/nfc/llcp_commands.c | int nfc_llcp_send_ui_frame(struct nfc_llcp_sock *sock, u8 ssap, u8 dsap,
struct msghdr *msg, size_t len) {
struct sk_buff *pdu;
struct nfc_llcp_local *local;
size_t frag_len = 0, remaining_len;
u8 *msg_ptr, *msg_data;
u16 remote_miu;
int err;
pr_debug("Send UI frame len %zd\n",... | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
void nfc_llcp_socket_remote_param_init(struct nfc_llcp_sock *sock) {
sock->remote_rw = LLCP_DEFAULT_RW;
sock->remote_miu = LLCP_MAX_MIU + 1;
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local) {
kref_get(&local->ref);
return local;
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
static void local_release(struct kref *ref) {
struct nfc_llcp_local *local;
local = container_of(ref, struct nfc_llcp_local, ref);
list_del(&local->list);
local_cleanup(local);
kfree(local);
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
int nfc_llcp_local_put(struct nfc_llcp_local *local) {
if (local == NULL)
return 0;
return kref_put(&local->ref, local_release);
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
struct nfc_llcp_local *nfc_llcp_find_local(struct nfc_dev *dev) {
struct nfc_llcp_local *local;
list_for_each_entry(local, &llcp_devices,
list) if (local->dev == dev) return local;
pr_debug("No device found\n");
return NULL;
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
u8 nfc_llcp_get_local_ssap(struct nfc_llcp_local *local) {
u8 local_ssap;
mutex_lock(&local->sdp_lock);
local_ssap = find_first_zero_bit(&local->local_sap, LLCP_LOCAL_NUM_SAP);
if (local_ssap == LLCP_LOCAL_NUM_SAP) {
mutex_unlock(&local->sdp_lock);
return LLCP_SAP_MAX;
}
set_bit(local_ssap, &loc... | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
static u8 nfc_llcp_reserve_sdp_ssap(struct nfc_llcp_local *local) {
u8 ssap;
mutex_lock(&local->sdp_lock);
ssap = find_first_zero_bit(&local->local_sdp, LLCP_SDP_NUM_SAP);
if (ssap == LLCP_SDP_NUM_SAP) {
mutex_unlock(&local->sdp_lock);
return LLCP_SAP_MAX;
}
pr_debug("SDP ssap %d\n", LLCP_WKS_N... | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
static u8 nfc_llcp_ptype(const struct sk_buff *pdu) {
return ((pdu->data[0] & 0x03) << 2) | ((pdu->data[1] & 0xc0) >> 6);
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
static u8 nfc_llcp_ssap(const struct sk_buff *pdu) {
return pdu->data[1] & 0x3f;
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
static void nfc_llcp_set_nrns(struct nfc_llcp_sock *sock, struct sk_buff *pdu) {
pdu->data[2] = (sock->send_n << 4) | (sock->recv_n);
sock->send_n = (sock->send_n + 1) % 16;
sock->recv_ack_n = (sock->recv_n - 1) % 16;
} | [
1,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
static struct nfc_llcp_sock *
nfc_llcp_connecting_sock_get(struct nfc_llcp_local *local, u8 ssap) {
struct sock *sk;
struct nfc_llcp_sock *llcp_sock;
read_lock(&local->connecting_sockets.lock);
sk_for_each(sk, &local->connecting_sockets.head) {
llcp_sock = nfc_llcp_sock(sk);
if (llcp_sock->ssap == s... | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c | static void nfc_llcp_recv_ui(struct nfc_llcp_local *local,
struct sk_buff *skb) {
struct nfc_llcp_sock *llcp_sock;
struct nfc_llcp_ui_cb *ui_cb;
u8 dsap, ssap;
dsap = nfc_llcp_dsap(skb);
ssap = nfc_llcp_ssap(skb);
ui_cb = nfc_llcp_ui_skb_cb(skb);
ui_cb->dsap = dsap;
ui_cb-... | [
1,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
static void nfc_llcp_recv_disc(struct nfc_llcp_local *local,
const struct sk_buff *skb) {
struct nfc_llcp_sock *llcp_sock;
struct sock *sk;
u8 dsap, ssap;
dsap = nfc_llcp_dsap(skb);
ssap = nfc_llcp_ssap(skb);
if ((dsap == 0) && (ssap == 0)) {
pr_debug("Connection termin... | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
static void nfc_llcp_recv_agf(struct nfc_llcp_local *local,
struct sk_buff *skb) {
u8 ptype;
u16 pdu_len;
struct sk_buff *new_skb;
if (skb->len <= LLCP_HEADER_SIZE) {
pr_err("Malformed AGF PDU\n");
return;
}
skb_pull(skb, LLCP_HEADER_SIZE);
while (skb->len > LLCP_... | [
1,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
static void __nfc_llcp_recv(struct nfc_llcp_local *local, struct sk_buff *skb) {
local->rx_pending = skb;
del_timer(&local->link_timer);
schedule_work(&local->rx_work);
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
int nfc_llcp_data_received(struct nfc_dev *dev, struct sk_buff *skb) {
struct nfc_llcp_local *local;
local = nfc_llcp_find_local(dev);
if (local == NULL) {
kfree_skb(skb);
return -ENODEV;
}
__nfc_llcp_recv(local, skb);
return 0;
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c | void nfc_llcp_mac_is_down(struct nfc_dev *dev) {
struct nfc_llcp_local *local;
local = nfc_llcp_find_local(dev);
if (local == NULL)
return;
local->remote_miu = LLCP_DEFAULT_MIU;
local->remote_lto = LLCP_DEFAULT_LTO;
nfc_llcp_socket_release(local, true, 0);
} | [
0,
0
] |
Linux Kernel | net/nfc/llcp_core.c |
int __init nfc_llcp_init(void) { return nfc_llcp_sock_init(); } | [
0,
0
] |
Linux Kernel | net/nfc/llcp_sock.c | static int llcp_sock_accept(struct socket *sock, struct socket *newsock,
int flags, bool kern) {
DECLARE_WAITQUEUE(wait, current);
struct sock *sk = sock->sk, *new_sk;
long timeo;
int ret = 0;
pr_debug("parent %p\n", sk);
lock_sock_nested(sk, SINGLE_DEPTH_NESTING);
if (sk->s... | [
0,
0
] |
Linux Kernel | net/nfc/llcp_sock.c |
static int llcp_sock_getname(struct socket *sock, struct sockaddr *uaddr,
int peer) {
struct sock *sk = sock->sk;
struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, llcp_addr, uaddr);
if (llcp_sock == NULL || llcp_sock->dev == NULL)
... | [
1,
0
] |
Linux Kernel | net/nfc/llcp_sock.c |
static int llcp_sock_sendmsg(struct socket *sock, struct msghdr *msg,
size_t len) {
struct sock *sk = sock->sk;
struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
int ret;
pr_debug("sock %p sk %p", sock, sk);
ret = sock_error(sk);
if (ret)
return ret;
if (msg->msg_fl... | [
1,
0
] |
Linux Kernel | net/nfc/llcp_sock.c |
static void llcp_sock_destruct(struct sock *sk) {
struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
pr_debug("%p\n", sk);
if (sk->sk_state == LLCP_CONNECTED)
nfc_put_device(llcp_sock->dev);
skb_queue_purge(&sk->sk_receive_queue);
nfc_llcp_sock_free(llcp_sock);
if (!sock_flag(sk, SOCK_DEAD)) {
... | [
0,
0
] |
Linux Kernel | net/nfc/llcp_sock.c |
void nfc_llcp_sock_exit(void) { nfc_proto_unregister(&llcp_nfc_proto); } | [
0,
0
] |
Linux Kernel | net/nfc/nci/core.c | void nci_req_complete(struct nci_dev *ndev, int result) {
if (ndev->req_status == NCI_REQ_PEND) {
ndev->req_result = result;
ndev->req_status = NCI_REQ_DONE;
complete(&ndev->req_completion);
}
} | [
0,
0
] |
Linux Kernel | net/nfc/nci/core.c | inline int nci_request(struct nci_dev *ndev,
void (*req)(struct nci_dev *ndev, const void *opt),
const void *opt, __u32 timeout) {
int rc;
mutex_lock(&ndev->req_lock);
/* check the state after obtaing the lock against any races
* from nci_close_device when the dev... | [
0,
0
] |
Linux Kernel | net/nfc/nci/core.c |
static void nci_reset_req(struct nci_dev *ndev, const void *opt) {
struct nci_core_reset_cmd cmd;
cmd.reset_type = NCI_RESET_TYPE_RESET_CONFIG;
nci_send_cmd(ndev, NCI_OP_CORE_RESET_CMD, 1, &cmd);
} | [
0,
0
] |
Linux Kernel | net/nfc/nci/core.c |
static void nci_generic_req(struct nci_dev *ndev, const void *opt) {
const struct nci_cmd_param *param = opt;
nci_send_cmd(ndev, param->opcode, param->len, param->payload);
} | [
0,
0
] |
Linux Kernel | net/nfc/nci/core.c |
int nci_core_reset(struct nci_dev *ndev) {
return __nci_request(ndev, nci_reset_req, (void *)0,
msecs_to_jiffies(NCI_RESET_TIMEOUT));
} | [
0,
0
] |
Linux Kernel | net/nfc/nci/core.c | static void nci_data_timer(struct timer_list *t) {
struct nci_dev *ndev = from_timer(ndev, t, data_timer);
set_bit(NCI_DATA_EXCHANGE_TO, &ndev->flags);
queue_work(ndev->rx_wq, &ndev->rx_work);
} | [
0,
0
] |
Linux Kernel | net/nfc/nci/core.c |
static int nci_dev_down(struct nfc_dev *nfc_dev) {
struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
return nci_close_device(ndev);
} | [
0,
0
] |
Linux Kernel | net/nfc/nci/core.c |
int nci_nfcee_mode_set(struct nci_dev *ndev, u8 nfcee_id, u8 nfcee_mode) {
struct nci_nfcee_mode_set_cmd cmd;
cmd.nfcee_id = nfcee_id;
cmd.nfcee_mode = nfcee_mode;
return __nci_request(ndev, nci_nfcee_mode_set_req, &cmd,
msecs_to_jiffies(NCI_CMD_TIMEOUT));
} | [
0,
0
] |
Linux Kernel | net/nfc/nci/core.c |
int nci_core_conn_close(struct nci_dev *ndev, u8 conn_id) {
unsigned long opt = conn_id;
ndev->cur_conn_id = conn_id;
return __nci_request(ndev, nci_core_conn_close_req, (void *)opt,
msecs_to_jiffies(NCI_CMD_TIMEOUT));
} | [
1,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.