~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to include/net/caif/cfsrvl.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#include <linux/stddef.h>
11
11
#include <linux/types.h>
12
12
#include <linux/kref.h>
 
13
#include <linux/rculist.h>
13
14
 
14
15
struct cfsrvl {
15
16
        struct cflayer layer;
17
18
        bool phy_flow_on;
18
19
        bool modem_flow_on;
19
20
        bool supports_flowctrl;
20
 
        void (*release)(struct kref *);
 
21
        void (*release)(struct cflayer *layer);
21
22
        struct dev_info dev_info;
22
 
        struct kref ref;
 
23
        void (*hold)(struct cflayer *lyr);
 
24
        void (*put)(struct cflayer *lyr);
 
25
        struct rcu_head rcu;
23
26
};
24
27
 
25
 
void cfsrvl_release(struct kref *kref);
26
28
struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);
27
29
struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);
28
30
struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info);
30
32
struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info,
31
33
                                int mtu_size);
32
34
struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info);
 
35
 
 
36
void cfsrvl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl,
 
37
                     int phyid);
 
38
 
33
39
bool cfsrvl_phyid_match(struct cflayer *layer, int phyid);
34
 
void cfservl_destroy(struct cflayer *layer);
 
40
 
35
41
void cfsrvl_init(struct cfsrvl *service,
36
42
                        u8 channel_id,
37
43
                        struct dev_info *dev_info,
41
47
 
42
48
static inline void cfsrvl_get(struct cflayer *layr)
43
49
{
44
 
        struct cfsrvl *s;
45
 
        if (layr == NULL)
 
50
        struct cfsrvl *s = container_of(layr, struct cfsrvl, layer);
 
51
        if (layr == NULL || layr->up == NULL || s->hold == NULL)
46
52
                return;
47
 
        s = container_of(layr, struct cfsrvl, layer);
48
 
        kref_get(&s->ref);
 
53
 
 
54
        s->hold(layr->up);
49
55
}
50
56
 
51
57
static inline void cfsrvl_put(struct cflayer *layr)
52
58
{
53
 
        struct cfsrvl *s;
54
 
        if (layr == NULL)
 
59
        struct cfsrvl *s = container_of(layr, struct cfsrvl, layer);
 
60
        if (layr == NULL || layr->up == NULL || s->hold == NULL)
55
61
                return;
56
 
        s = container_of(layr, struct cfsrvl, layer);
57
62
 
58
 
        WARN_ON(!s->release);
59
 
        if (s->release)
60
 
                kref_put(&s->ref, s->release);
 
63
        s->put(layr->up);
61
64
}
62
 
 
63
65
#endif                          /* CFSRVL_H_ */