Fix client-side ctrl interface helpers

* remove unused ctrl_interface_connect() which is not part of public API
* add default read callback to osmo_ctrl_conn_alloc()

Change-Id: Iaa209e34a849ce0dfe2e29b482c3208ade1a32a4
Related: OS#1615
diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index d78b513..de49d16 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -388,6 +388,7 @@
 
 	ccon->write_queue.bfd.data = data;
 	ccon->write_queue.write_cb = control_write_cb;
+	ccon->write_queue.read_cb = handle_control_read;
 
 	return ccon;
 }
@@ -431,7 +432,6 @@
 
 	ccon->write_queue.bfd.fd = fd;
 	ccon->write_queue.bfd.when = BSC_FD_READ;
-	ccon->write_queue.read_cb = handle_control_read;
 
 	ret = osmo_fd_register(&ccon->write_queue.bfd);
 	if (ret < 0) {
@@ -655,45 +655,6 @@
 	return 0;
 }
 
-/*! \brief Setup CTRL interface connection to a given address
- *  \param[in] data Pointer which will be made available to each
-               set_..() get_..() verify_..() control command function
- *  \param[in] addr Address to which we shall connect
- *  \param[in] port Port to which we shall connect
- *  \param[in] lookup Lookup function pointer, can be NULL
- *  \returns ctrl_handle pointer or NULL in case of errors
- */
-struct ctrl_handle *ctrl_interface_connect(void *data, const char *addr,
-					   uint16_t port,
-					   ctrl_cmd_lookup lookup)
-{
-	int ret;
-	struct ctrl_handle *ctrl;
-
-	ctrl = talloc_zero(data, struct ctrl_handle);
-	if (!ctrl)
-		return NULL;
-
-	INIT_LLIST_HEAD(&ctrl->ccon_list);
-
-	ctrl->data = data;
-	ctrl->lookup = lookup;
-
-	ctrl->listen_fd.cb = NULL;
-	ctrl->listen_fd.data = ctrl;
-	ret = osmo_sock_init_ofd(&ctrl->listen_fd, AF_INET, SOCK_STREAM,
-				 IPPROTO_TCP, addr, port, OSMO_SOCK_F_CONNECT);
-	if (ret < 0) {
-		LOGP(DLCTRL, LOGL_ERROR, "Cannot connect to CTRL at %s:%u\n",
-		     addr, port);
-		talloc_free(ctrl);
-		return NULL;
-	}
-	LOGP(DLCTRL, LOGL_NOTICE, "CTRL connected to %s:%u\n", addr, port);
-
-	return ctrl;
-}
-
 struct ctrl_handle *ctrl_interface_setup(void *data, uint16_t port,
 					 ctrl_cmd_lookup lookup)
 {