Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 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 | |
| 7 | #ifndef CFSRVL_H_ |
| 8 | #define CFSRVL_H_ |
| 9 | #include <linux/list.h> |
| 10 | #include <linux/stddef.h> |
| 11 | #include <linux/types.h> |
Sjur Braendeland | 5b20865 | 2010-04-28 08:54:36 +0000 | [diff] [blame] | 12 | #include <linux/kref.h> |
| 13 | |
Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 14 | struct cfsrvl { |
| 15 | struct cflayer layer; |
| 16 | bool open; |
| 17 | bool phy_flow_on; |
| 18 | bool modem_flow_on; |
Sjur Braendeland | b1c7424 | 2010-06-17 06:55:38 +0000 | [diff] [blame^] | 19 | bool supports_flowctrl; |
Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 20 | struct dev_info dev_info; |
Sjur Braendeland | 5b20865 | 2010-04-28 08:54:36 +0000 | [diff] [blame] | 21 | struct kref ref; |
Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 22 | }; |
| 23 | |
Sjur Braendeland | 5b20865 | 2010-04-28 08:54:36 +0000 | [diff] [blame] | 24 | void cfsrvl_release(struct kref *kref); |
Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 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 | struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info); |
| 31 | bool cfsrvl_phyid_match(struct cflayer *layer, int phyid); |
| 32 | void cfservl_destroy(struct cflayer *layer); |
| 33 | void cfsrvl_init(struct cfsrvl *service, |
Sjur Braendeland | b1c7424 | 2010-06-17 06:55:38 +0000 | [diff] [blame^] | 34 | u8 channel_id, |
| 35 | struct dev_info *dev_info, |
| 36 | bool supports_flowctrl); |
Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 37 | bool cfsrvl_ready(struct cfsrvl *service, int *err); |
| 38 | u8 cfsrvl_getphyid(struct cflayer *layer); |
| 39 | |
Sjur Braendeland | 5b20865 | 2010-04-28 08:54:36 +0000 | [diff] [blame] | 40 | static inline void cfsrvl_get(struct cflayer *layr) |
| 41 | { |
| 42 | struct cfsrvl *s; |
| 43 | if (layr == NULL) |
| 44 | return; |
| 45 | s = container_of(layr, struct cfsrvl, layer); |
| 46 | kref_get(&s->ref); |
| 47 | } |
| 48 | |
| 49 | static inline void cfsrvl_put(struct cflayer *layr) |
| 50 | { |
| 51 | struct cfsrvl *s; |
| 52 | if (layr == NULL) |
| 53 | return; |
| 54 | s = container_of(layr, struct cfsrvl, layer); |
| 55 | kref_put(&s->ref, cfsrvl_release); |
| 56 | } |
| 57 | |
Sjur Braendeland | 09009f3 | 2010-03-30 13:56:21 +0000 | [diff] [blame] | 58 | #endif /* CFSRVL_H_ */ |