cfsrvl.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (C) ST-Ericsson AB 2010
  3. * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
  4. * License terms: GNU General Public License (GPL) version 2
  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. struct cfsrvl {
  13. struct cflayer layer;
  14. bool open;
  15. bool phy_flow_on;
  16. bool modem_flow_on;
  17. bool supports_flowctrl;
  18. void (*release)(struct kref *);
  19. struct dev_info dev_info;
  20. struct kref ref;
  21. };
  22. void cfsrvl_release(struct kref *kref);
  23. struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
  24. struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
  25. struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
  26. struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info);
  27. struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info,
  28. int mtu_size);
  29. struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
  30. bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
  31. void cfservl_destroy(struct cflayer *layer);
  32. void cfsrvl_init(struct cfsrvl *service,
  33. u8 channel_id,
  34. struct dev_info *dev_info,
  35. bool supports_flowctrl);
  36. bool cfsrvl_ready(struct cfsrvl *service, int *err);
  37. u8 cfsrvl_getphyid(struct cflayer *layer);
  38. static inline void cfsrvl_get(struct cflayer *layr)
  39. {
  40. struct cfsrvl *s;
  41. if (layr == NULL)
  42. return;
  43. s = container_of(layr, struct cfsrvl, layer);
  44. kref_get(&s->ref);
  45. }
  46. static inline void cfsrvl_put(struct cflayer *layr)
  47. {
  48. struct cfsrvl *s;
  49. if (layr == NULL)
  50. return;
  51. s = container_of(layr, struct cfsrvl, layer);
  52. WARN_ON(!s->release);
  53. if (s->release)
  54. kref_put(&s->ref, s->release);
  55. }
  56. #endif /* CFSRVL_H_ */