cfsrvl.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (C) ST-Ericsson AB 2010
  3. * Author: Sjur Brendeland
  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. #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. void cfsrvl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl,
  33. int phyid);
  34. bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
  35. void cfsrvl_init(struct cfsrvl *service,
  36. u8 channel_id,
  37. struct dev_info *dev_info,
  38. bool supports_flowctrl);
  39. bool cfsrvl_ready(struct cfsrvl *service, int *err);
  40. u8 cfsrvl_getphyid(struct cflayer *layer);
  41. static inline void cfsrvl_get(struct cflayer *layr)
  42. {
  43. struct cfsrvl *s = container_of(layr, struct cfsrvl, layer);
  44. if (layr == NULL || layr->up == NULL || s->hold == NULL)
  45. return;
  46. s->hold(layr->up);
  47. }
  48. static inline void cfsrvl_put(struct cflayer *layr)
  49. {
  50. struct cfsrvl *s = container_of(layr, struct cfsrvl, layer);
  51. if (layr == NULL || layr->up == NULL || s->hold == NULL)
  52. return;
  53. s->put(layr->up);
  54. }
  55. #endif /* CFSRVL_H_ */