Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 330dd7da authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman
Browse files

mei: rename to mei_host_buffer_is_empty to hbuf_is_ready



we rename the mei_host_buffer_is_empty to keep naming
convention of hbuf and also make the query more generic
to be correct also for other under laying hardware

Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 06ecd645
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -297,9 +297,9 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
	if (ret < 0)
		return ret;

	if (ret && dev->mei_host_buffer_is_empty) {
	if (ret && dev->hbuf_is_ready) {
		ret = 0;
		dev->mei_host_buffer_is_empty = false;
		dev->hbuf_is_ready = false;
		if (cb->request_buffer.size > mei_hbuf_max_len(dev)) {
			mei_hdr.length = mei_hbuf_max_len(dev);
			mei_hdr.msg_complete = 0;
@@ -330,7 +330,7 @@ static int mei_amthif_send_cmd(struct mei_device *dev, struct mei_cl_cb *cb)
			list_add_tail(&cb->list, &dev->write_list.list);
		}
	} else {
		if (!(dev->mei_host_buffer_is_empty))
		if (!dev->hbuf_is_ready)
			dev_dbg(&dev->pdev->dev, "host buffer is not empty");

		dev_dbg(&dev->pdev->dev, "No flow control credentials, so add iamthif cb to write list.\n");
@@ -583,7 +583,7 @@ int mei_amthif_irq_read(struct mei_device *dev, s32 *slots)
	dev->iamthif_msg_buf_index = 0;
	dev->iamthif_msg_buf_size = 0;
	dev->iamthif_stall_timer = MEI_IAMTHIF_STALL_TIMER;
	dev->mei_host_buffer_is_empty = mei_hbuf_is_ready(dev);
	dev->hbuf_is_ready = mei_hbuf_is_ready(dev);
	return 0;
}

+6 −7
Original line number Diff line number Diff line
@@ -393,8 +393,8 @@ int mei_cl_disconnect(struct mei_cl *cl)
		return -ENOMEM;

	cb->fop_type = MEI_FOP_CLOSE;
	if (dev->mei_host_buffer_is_empty) {
		dev->mei_host_buffer_is_empty = false;
	if (dev->hbuf_is_ready) {
		dev->hbuf_is_ready = false;
		if (mei_hbm_cl_disconnect_req(dev, cl)) {
			rets = -ENODEV;
			dev_err(&dev->pdev->dev, "failed to disconnect.\n");
@@ -496,9 +496,8 @@ int mei_cl_connect(struct mei_cl *cl, struct file *file)

	cb->fop_type = MEI_FOP_IOCTL;

	if (dev->mei_host_buffer_is_empty &&
	    !mei_cl_is_other_connecting(cl)) {
		dev->mei_host_buffer_is_empty = false;
	if (dev->hbuf_is_ready && !mei_cl_is_other_connecting(cl)) {
		dev->hbuf_is_ready = false;

		if (mei_hbm_cl_connect_req(dev, cl)) {
			rets = -ENODEV;
@@ -661,8 +660,8 @@ int mei_cl_read_start(struct mei_cl *cl)

	cb->fop_type = MEI_FOP_READ;
	cl->read_cb = cb;
	if (dev->mei_host_buffer_is_empty) {
		dev->mei_host_buffer_is_empty = false;
	if (dev->hbuf_is_ready) {
		dev->hbuf_is_ready = false;
		if (mei_hbm_cl_flow_control_req(dev, cl)) {
			rets = -ENODEV;
			goto err;
+1 −1
Original line number Diff line number Diff line
@@ -486,7 +486,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
	rets = mei_irq_write_handler(dev, &complete_list);
end:
	dev_dbg(&dev->pdev->dev, "end of bottom half function.\n");
	dev->mei_host_buffer_is_empty = mei_hbuf_is_ready(dev);
	dev->hbuf_is_ready = mei_hbuf_is_ready(dev);

	bus_message_received = false;
	if (dev->recvd_msg && waitqueue_active(&dev->wait_recvd_msg)) {
+2 −2
Original line number Diff line number Diff line
@@ -454,14 +454,14 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
	if (rets < 0)
		goto err;

	if (rets == 0 || dev->mei_host_buffer_is_empty == false) {
	if (rets == 0 || !dev->hbuf_is_ready) {
		write_cb->buf_idx = 0;
		mei_hdr.msg_complete = 0;
		cl->writing_state = MEI_WRITING;
		goto out;
	}

	dev->mei_host_buffer_is_empty = false;
	dev->hbuf_is_ready = false;
	if (length >  mei_hbuf_max_len(dev)) {
		mei_hdr.length = mei_hbuf_max_len(dev);
		mei_hdr.msg_complete = 0;
+10 −4
Original line number Diff line number Diff line
@@ -265,9 +265,13 @@ struct mei_hw_ops {

/**
 * struct mei_device -  MEI private device struct

 * @mem_addr - mem mapped base register address
 * @hbuf_depth - depth of host(write) buffer
 * @wr_ext_msg - buffer for hbm control responses (set in read cycle)

 * @hbuf_depth - depth of hardware host/write buffer is slots
 * @hbuf_is_ready - query if the host host/write buffer is ready
 * @wr_msg - the buffer for hbm control messages
 * @wr_ext_msg - the buffer for hbm control responses (set in read cycle)
 */
struct mei_device {
	struct pci_dev *pdev;	/* pointer to pci device struct */
@@ -294,7 +298,6 @@ struct mei_device {
	struct delayed_work timer_work;	/* MEI timer delayed work (timeouts) */
	bool recvd_msg;

	u8  hbuf_depth;
	/*
	 * waiting queue for receive message from FW
	 */
@@ -311,6 +314,10 @@ struct mei_device {
	unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE];	/* control messages */
	u32 rd_msg_hdr;

	/* write buffer */
	u8 hbuf_depth;
	bool hbuf_is_ready;

	/* used for control messages */
	struct {
		struct mei_msg_hdr hdr;
@@ -330,7 +337,6 @@ struct mei_device {
	u8 me_clients_num;
	u8 me_client_presentation_num;
	u8 me_client_index;
	bool mei_host_buffer_is_empty;

	struct mei_cl wd_cl;
	enum mei_wd_states wd_state;
Loading