Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * bsg endpoint that supports UPIUs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2018 Western Digital Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include "ufs_bsg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) static int ufs_bsg_get_query_desc_size(struct ufs_hba *hba, int *desc_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 				       struct utp_upiu_query *qr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 	int desc_size = be16_to_cpu(qr->length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	int desc_id = qr->idn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	if (desc_size <= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	ufshcd_map_desc_id_to_length(hba, desc_id, desc_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	if (!*desc_len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	*desc_len = min_t(int, *desc_len, desc_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) static int ufs_bsg_verify_query_size(struct ufs_hba *hba,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 				     unsigned int request_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 				     unsigned int reply_len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	int min_req_len = sizeof(struct ufs_bsg_request);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	int min_rsp_len = sizeof(struct ufs_bsg_reply);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	if (min_req_len > request_len || min_rsp_len > reply_len) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 		dev_err(hba->dev, "not enough space assigned\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) static int ufs_bsg_alloc_desc_buffer(struct ufs_hba *hba, struct bsg_job *job,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 				     uint8_t **desc_buff, int *desc_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 				     enum query_opcode desc_op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	struct ufs_bsg_request *bsg_request = job->request;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	struct utp_upiu_query *qr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	u8 *descp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	if (desc_op != UPIU_QUERY_OPCODE_WRITE_DESC &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	    desc_op != UPIU_QUERY_OPCODE_READ_DESC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	qr = &bsg_request->upiu_req.qr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	if (ufs_bsg_get_query_desc_size(hba, desc_len, qr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		dev_err(hba->dev, "Illegal desc size\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	if (*desc_len > job->request_payload.payload_len) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		dev_err(hba->dev, "Illegal desc size\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	descp = kzalloc(*desc_len, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	if (!descp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	if (desc_op == UPIU_QUERY_OPCODE_WRITE_DESC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		sg_copy_to_buffer(job->request_payload.sg_list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 				  job->request_payload.sg_cnt, descp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 				  *desc_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	*desc_buff = descp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) static int ufs_bsg_request(struct bsg_job *job)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	struct ufs_bsg_request *bsg_request = job->request;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	struct ufs_bsg_reply *bsg_reply = job->reply;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	struct ufs_hba *hba = shost_priv(dev_to_shost(job->dev->parent));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	unsigned int req_len = job->request_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	unsigned int reply_len = job->reply_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	struct uic_command uc = {};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	int msgcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	uint8_t *desc_buff = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	int desc_len = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	enum query_opcode desc_op = UPIU_QUERY_OPCODE_NOP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	ret = ufs_bsg_verify_query_size(hba, req_len, reply_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	bsg_reply->reply_payload_rcv_len = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	pm_runtime_get_sync(hba->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	msgcode = bsg_request->msgcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	switch (msgcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	case UPIU_TRANSACTION_QUERY_REQ:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		desc_op = bsg_request->upiu_req.qr.opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		ret = ufs_bsg_alloc_desc_buffer(hba, job, &desc_buff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 						&desc_len, desc_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			pm_runtime_put_sync(hba->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 			goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		fallthrough;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	case UPIU_TRANSACTION_NOP_OUT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	case UPIU_TRANSACTION_TASK_REQ:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		ret = ufshcd_exec_raw_upiu_cmd(hba, &bsg_request->upiu_req,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 					       &bsg_reply->upiu_rsp, msgcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 					       desc_buff, &desc_len, desc_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 			dev_err(hba->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 				"exe raw upiu: error code %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	case UPIU_TRANSACTION_UIC_CMD:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		memcpy(&uc, &bsg_request->upiu_req.uc, UIC_CMD_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		ret = ufshcd_send_uic_cmd(hba, &uc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 			dev_err(hba->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 				"send uic cmd: error code %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		memcpy(&bsg_reply->upiu_rsp.uc, &uc, UIC_CMD_SIZE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		ret = -ENOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		dev_err(hba->dev, "unsupported msgcode 0x%x\n", msgcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	pm_runtime_put_sync(hba->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	if (!desc_buff)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	if (desc_op == UPIU_QUERY_OPCODE_READ_DESC && desc_len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		bsg_reply->reply_payload_rcv_len =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 			sg_copy_from_buffer(job->request_payload.sg_list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 					    job->request_payload.sg_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 					    desc_buff, desc_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	kfree(desc_buff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	bsg_reply->result = ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	job->reply_len = sizeof(struct ufs_bsg_reply);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	/* complete the job here only if no error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	if (ret == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 		bsg_job_done(job, ret, bsg_reply->reply_payload_rcv_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  * ufs_bsg_remove - detach and remove the added ufs-bsg node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  * @hba: per adapter object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  * Should be called when unloading the driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) void ufs_bsg_remove(struct ufs_hba *hba)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	struct device *bsg_dev = &hba->bsg_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	if (!hba->bsg_queue)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	bsg_remove_queue(hba->bsg_queue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	device_del(bsg_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	put_device(bsg_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static inline void ufs_bsg_node_release(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	put_device(dev->parent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  * ufs_bsg_probe - Add ufs bsg device node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  * @hba: per adapter object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  * Called during initial loading of the driver, and before scsi_scan_host.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) int ufs_bsg_probe(struct ufs_hba *hba)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	struct device *bsg_dev = &hba->bsg_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	struct Scsi_Host *shost = hba->host;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	struct device *parent = &shost->shost_gendev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	struct request_queue *q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	device_initialize(bsg_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	bsg_dev->parent = get_device(parent);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	bsg_dev->release = ufs_bsg_node_release;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	dev_set_name(bsg_dev, "ufs-bsg%u", shost->host_no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	ret = device_add(bsg_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	q = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), ufs_bsg_request, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	if (IS_ERR(q)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		ret = PTR_ERR(q);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	hba->bsg_queue = q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	dev_err(bsg_dev, "fail to initialize a bsg dev %d\n", shost->host_no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	put_device(bsg_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) }