cfsrvl.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) ST-Ericsson AB 2010
  4. * Author: Sjur Brendeland
  5. */
  6. #ifndef CFSRVL_H_
  7. #define CFSRVL_H_
  8. #include <linux/list.h>
  9. #include <linux/stddef.h>
  10. #include <linux/types.h>
  11. #include <linux/kref.h>
  12. #include <linux/rculist.h>
  13. struct cfsrvl {
  14. struct cflayer layer;
  15. bool open;
  16. bool phy_flow_on;
  17. bool modem_flow_on;
  18. bool supports_flowctrl;
  19. void (*release)(struct cflayer *layer);
  20. struct dev_info dev_info;
  21. void (*hold)(struct cflayer *lyr);
  22. void (*put)(struct cflayer *lyr);
  23. struct rcu_head rcu;
  24. };
  25. struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
  26. struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
  27. struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
  28. struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info);
  29. struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info,
  30. int mtu_size);
  31. struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
  32. bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
  33. void cfsrvl_init(struct cfsrvl *service,
  34. u8 channel_id,
  35. struct dev_info *dev_info,
  36. bool supports_flowctrl);
  37. bool cfsrvl_ready(struct cfsrvl *service, int *err);
  38. static inline void cfsrvl_get(struct cflayer *layr)
  39. {
  40. struct cfsrvl *s = container_of(layr, struct cfsrvl, layer);
  41. if (layr == NULL || layr->up == NULL || s->hold == NULL)
  42. return;
  43. s->hold(layr->up);
  44. }
  45. static inline void cfsrvl_put(struct cflayer *layr)
  46. {
  47. struct cfsrvl *s = container_of(layr, struct cfsrvl, layer);
  48. if (layr == NULL || layr->up == NULL || s->hold == NULL)
  49. return;
  50. s->put(layr->up);
  51. }
  52. #endif /* CFSRVL_H_ */