diff options
Diffstat (limited to 'include/net/caif')
| -rw-r--r-- | include/net/caif/caif_dev.h | 17 | ||||
| -rw-r--r-- | include/net/caif/cfcnfg.h | 17 | ||||
| -rw-r--r-- | include/net/caif/cfctrl.h | 7 | ||||
| -rw-r--r-- | include/net/caif/cfsrvl.h | 22 | 
4 files changed, 53 insertions, 10 deletions
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h index 42a7c786784..318ab9478a4 100644 --- a/include/net/caif/caif_dev.h +++ b/include/net/caif/caif_dev.h @@ -23,17 +23,19 @@ struct caif_param {  };  /** - * caif_connect_request - Request data for CAIF channel setup. + * struct caif_connect_request - Request data for CAIF channel setup. + * @protocol:		Type of CAIF protocol to use (at, datagram etc)   * @sockaddr:		Socket address to connect.   * @priority:		Priority of the connection.   * @link_selector:	Link selector (high bandwidth or low latency)   * @link_name:		Name of the CAIF Link Layer to use. + * @param:		Connect Request parameters (CAIF_SO_REQ_PARAM).   *   * This struct is used when connecting a CAIF channel.   * It contains all CAIF channel configuration options.   */  struct caif_connect_request { -	int protocol; +	enum caif_protocol_type protocol;  	struct sockaddr_caif sockaddr;  	enum caif_channel_priority priority;  	enum caif_link_selector link_selector; @@ -68,6 +70,17 @@ int caif_connect_client(struct caif_connect_request *config,  int caif_disconnect_client(struct cflayer *client_layer);  /** + * caif_release_client - Release adaptation layer reference to client. + * + * @client_layer: Client layer. + * + * Releases a client/adaptation layer use of the caif stack. + * This function must be used after caif_disconnect_client to + * decrease the reference count of the service layer. + */ +void caif_release_client(struct cflayer *client_layer); + +/**   * connect_req_to_link_param - Translate configuration parameters   *				from socket format to internal format.   * @cnfg:	Pointer to configuration handler diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h index 366082c5d43..9fc2fc20b88 100644 --- a/include/net/caif/cfcnfg.h +++ b/include/net/caif/cfcnfg.h @@ -87,13 +87,21 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,  int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer);  /** - * cfcnfg_del_adapt_layer - Deletes an adaptation layer from the CAIF stack. + * cfcnfg_disconn_adapt_layer - Disconnects an adaptation layer.   *   * @cnfg:	Pointer to a CAIF configuration object, created by   *		cfcnfg_create().   * @adap_layer: Adaptation layer to be removed.   */ -int cfcnfg_del_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer); +int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, +			struct cflayer *adap_layer); + +/** + * cfcnfg_release_adap_layer - Used by client to release the adaptation layer. + * + * @adap_layer: Adaptation layer. + */ +void cfcnfg_release_adap_layer(struct cflayer *adap_layer);  /**   * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack. @@ -102,14 +110,13 @@ int cfcnfg_del_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer);   * driver functionality is implemented.   *   * @cnfg:		Pointer to a CAIF configuration object, created by - *				cfcnfg_create(). + *			cfcnfg_create().   * @param:		Link setup parameters.   * @adap_layer:		Specify the adaptation layer; the receive and   *			flow-control functions MUST be set in the structure.   *   */ -int -cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, +int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,  			    struct cfctrl_link_param *param,  			    struct cflayer *adap_layer); diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h index dee25b86caa..997603f2bf4 100644 --- a/include/net/caif/cfctrl.h +++ b/include/net/caif/cfctrl.h @@ -43,8 +43,7 @@ struct cfctrl_rsp {  	void (*linksetup_rsp)(struct cflayer *layer, u8 linkid,  			      enum cfctrl_srv serv, u8 phyid,  			      struct cflayer *adapt_layer); -	void (*linkdestroy_rsp)(struct cflayer *layer, u8 linkid, -				struct cflayer *client_layer); +	void (*linkdestroy_rsp)(struct cflayer *layer, u8 linkid);  	void (*linkerror_ind)(void);  	void (*enum_rsp)(void);  	void (*sleep_rsp)(void); @@ -117,7 +116,7 @@ struct cfctrl {  };  void cfctrl_enum_req(struct cflayer *cfctrl, u8 physlinkid); -void cfctrl_linkup_request(struct cflayer *cfctrl, +int cfctrl_linkup_request(struct cflayer *cfctrl,  			   struct cfctrl_link_param *param,  			   struct cflayer *user_layer);  int  cfctrl_linkdown_req(struct cflayer *cfctrl, u8 linkid, @@ -135,4 +134,6 @@ void cfctrl_insert_req(struct cfctrl *ctrl,  			      struct cfctrl_request_info *req);  struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl,  					      struct cfctrl_request_info *req); +void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer); +  #endif				/* CFCTRL_H_ */ diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h index b2a12db20cd..2dc9eb193ec 100644 --- a/include/net/caif/cfsrvl.h +++ b/include/net/caif/cfsrvl.h @@ -9,14 +9,18 @@  #include <linux/list.h>  #include <linux/stddef.h>  #include <linux/types.h> +#include <linux/kref.h> +  struct cfsrvl {  	struct cflayer layer;  	bool open;  	bool phy_flow_on;  	bool modem_flow_on;  	struct dev_info dev_info; +	struct kref ref;  }; +void cfsrvl_release(struct kref *kref);  struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info);  struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info);  struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info); @@ -31,4 +35,22 @@ void cfsrvl_init(struct cfsrvl *service,  bool cfsrvl_ready(struct cfsrvl *service, int *err);  u8 cfsrvl_getphyid(struct cflayer *layer); +static inline void cfsrvl_get(struct cflayer *layr) +{ +	struct cfsrvl *s; +	if (layr == NULL) +		return; +	s = container_of(layr, struct cfsrvl, layer); +	kref_get(&s->ref); +} + +static inline void cfsrvl_put(struct cflayer *layr) +{ +	struct cfsrvl *s; +	if (layr == NULL) +		return; +	s = container_of(layr, struct cfsrvl, layer); +	kref_put(&s->ref, cfsrvl_release); +} +  #endif				/* CFSRVL_H_ */  |