1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2013 Broadcom Corporation
7 #include <linux/types.h>
8 #include <linux/slab.h>
9 #include <linux/netdevice.h>
11 #include <brcmu_wifi.h>
20 int brcmf_proto_attach(struct brcmf_pub *drvr)
22 struct brcmf_proto *proto;
24 brcmf_dbg(TRACE, "Enter\n");
26 proto = kzalloc(sizeof(*proto), GFP_ATOMIC);
32 if (drvr->bus_if->proto_type == BRCMF_PROTO_BCDC) {
33 if (brcmf_proto_bcdc_attach(drvr))
35 } else if (drvr->bus_if->proto_type == BRCMF_PROTO_MSGBUF) {
36 if (brcmf_proto_msgbuf_attach(drvr))
39 bphy_err(drvr, "Unsupported proto type %d\n",
40 drvr->bus_if->proto_type);
43 if (!proto->tx_queue_data || (proto->hdrpull == NULL) ||
44 (proto->query_dcmd == NULL) || (proto->set_dcmd == NULL) ||
45 (proto->configure_addr_mode == NULL) ||
46 (proto->delete_peer == NULL) || (proto->add_tdls_peer == NULL) ||
47 (proto->debugfs_create == NULL)) {
48 bphy_err(drvr, "Not all proto handlers have been installed\n");
59 void brcmf_proto_detach_post_delif(struct brcmf_pub *drvr)
61 brcmf_dbg(TRACE, "Enter\n");
64 if (drvr->bus_if->proto_type == BRCMF_PROTO_BCDC)
65 brcmf_proto_bcdc_detach_post_delif(drvr);
66 else if (drvr->bus_if->proto_type == BRCMF_PROTO_MSGBUF)
67 brcmf_proto_msgbuf_detach(drvr);
73 void brcmf_proto_detach_pre_delif(struct brcmf_pub *drvr)
75 if (drvr->proto && drvr->bus_if->proto_type == BRCMF_PROTO_BCDC)
76 brcmf_proto_bcdc_detach_pre_delif(drvr);