cfsrvl.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
  23. struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
  24. struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
  25. struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info);
  26. struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info,
  27. int mtu_size);
  28. struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
  29. bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
  30. void cfsrvl_init(struct cfsrvl *service,
  31. u8 channel_id,
  32. struct dev_info *dev_info,
  33. bool supports_flowctrl);
  34. bool cfsrvl_ready(struct cfsrvl *service, int *err);
  35. u8 cfsrvl_getphyid(struct cflayer *layer);
  36. static inline void cfsrvl_get(struct cflayer *layr)
  37. {
  38. struct cfsrvl *s;
  39. if (layr == NULL)
  40. return;
  41. s = container_of(layr, struct cfsrvl, layer);
  42. kref_get(&s->ref);
  43. }
  44. static inline void cfsrvl_put(struct cflayer *layr)
  45. {
  46. struct cfsrvl *s;
  47. if (layr == NULL)
  48. return;
  49. s = container_of(layr, struct cfsrvl, layer);
  50. WARN_ON(!s->release);
  51. if (s->release)
  52. kref_put(&s->ref, s->release);
  53. }
  54. #endif /* CFSRVL_H_ */