/* Allocate a hostinfo pointer backed by memory with @data_size and bind it to to this @hl driver and @host. If @data_size is zero, then the return here is only valid for error checking.  */
void* hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, size_t data_size)
/* Allocate a hostinfo pointer backed by memory with @data_size and bind it to to this @hl driver and @host. If @data_size is zero, then the return here is only valid for error checking.  */
void* hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, size_t data_size)
{
	struct hl_host_info *hi;
	void *data;
	unsigned long flags;
	hi = hl_get_hostinfo(hl, host);
	if (hi) {
		HPSB_ERR("%s called hpsb_create_hostinfo when hostinfo already"
			 " exists", hl->name);
		return NULL;
	}
	hi = kzalloc(sizeof(*hi) + data_size, GFP_ATOMIC);
	if (!hi)
		return NULL;
	if (data_size) {
		data = hi->data = hi + 1;
		hi->size = data_size;
	} else
		data = hi;
	hi->host = host;
	write_lock_irqsave(&hl->host_info_lock, flags);
	list_add_tail(&hi->list, &hl->host_info_list);
	write_unlock_irqrestore(&hl->host_info_lock, flags);
	return data;
}