1 /* SPDX-License-Identifier: ISC */ 2 /* 3 * Copyright (c) 2022 Broadcom Corporation 4 */ 5 #ifndef FWVID_H_ 6 #define FWVID_H_ 7 8 #include "firmware.h" 9 10 struct brcmf_pub; 11 12 struct brcmf_fwvid_ops { 13 int (*attach)(struct brcmf_pub *drvr); 14 void (*detach)(struct brcmf_pub *drvr); 15 }; 16 17 /* exported functions */ 18 int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *mod, 19 const struct brcmf_fwvid_ops *ops); 20 int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod); 21 22 /* core driver functions */ 23 int brcmf_fwvid_attach_ops(struct brcmf_pub *drvr); 24 void brcmf_fwvid_detach_ops(struct brcmf_pub *drvr); 25 const char *brcmf_fwvid_vendor_name(struct brcmf_pub *drvr); 26 27 static inline int brcmf_fwvid_attach(struct brcmf_pub *drvr) 28 { 29 int ret; 30 31 ret = brcmf_fwvid_attach_ops(drvr); 32 if (ret) 33 return ret; 34 35 return drvr->vops->attach(drvr); 36 } 37 38 static inline void brcmf_fwvid_detach(struct brcmf_pub *drvr) 39 { 40 if (!drvr->vops) 41 return; 42 43 drvr->vops->detach(drvr); 44 brcmf_fwvid_detach_ops(drvr); 45 } 46 47 #endif /* FWVID_H_ */ 48