aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2016-07-25 18:06:04 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-30 08:39:42 -0400
commit4034b81ba38967ad0056781572a9d9a95d39f02e (patch)
tree9ea066ed43585589fec148831e316cf210879d2b /drivers/misc
parent46978ada7dc669bf13f860798664b587dbc05ce5 (diff)
mei: use consistent naming for TX control flow credits
With the introduction of the receive control flow credits prefixed with rx_ we add tx_ prefix to the variables and function used for tracking the transmit control flow credits. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/mei/client.c39
-rw-r--r--drivers/misc/mei/hbm.c41
-rw-r--r--drivers/misc/mei/mei_dev.h8
3 files changed, 43 insertions, 45 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
index ded11de90a26..89425a8795a8 100644
--- a/drivers/misc/mei/client.c
+++ b/drivers/misc/mei/client.c
@@ -734,8 +734,8 @@ void mei_cl_set_disconnected(struct mei_cl *cl)
734 mei_io_list_flush(&dev->ctrl_rd_list, cl); 734 mei_io_list_flush(&dev->ctrl_rd_list, cl);
735 mei_io_list_flush(&dev->ctrl_wr_list, cl); 735 mei_io_list_flush(&dev->ctrl_wr_list, cl);
736 mei_cl_wake_all(cl); 736 mei_cl_wake_all(cl);
737 cl->mei_flow_ctrl_creds = 0;
738 cl->rx_flow_ctrl_creds = 0; 737 cl->rx_flow_ctrl_creds = 0;
738 cl->tx_flow_ctrl_creds = 0;
739 cl->timer_count = 0; 739 cl->timer_count = 0;
740 740
741 if (!cl->me_cl) 741 if (!cl->me_cl)
@@ -745,7 +745,7 @@ void mei_cl_set_disconnected(struct mei_cl *cl)
745 cl->me_cl->connect_count--; 745 cl->me_cl->connect_count--;
746 746
747 if (cl->me_cl->connect_count == 0) 747 if (cl->me_cl->connect_count == 0)
748 cl->me_cl->mei_flow_ctrl_creds = 0; 748 cl->me_cl->tx_flow_ctrl_creds = 0;
749 749
750 mei_me_cl_put(cl->me_cl); 750 mei_me_cl_put(cl->me_cl);
751 cl->me_cl = NULL; 751 cl->me_cl = NULL;
@@ -1140,43 +1140,42 @@ err:
1140 return ERR_PTR(ret); 1140 return ERR_PTR(ret);
1141} 1141}
1142 1142
1143
1144
1145/** 1143/**
1146 * mei_cl_flow_ctrl_creds - checks flow_control credits for cl. 1144 * mei_cl_tx_flow_ctrl_creds - checks flow_control credits for cl.
1147 * 1145 *
1148 * @cl: host client 1146 * @cl: host client
1149 * 1147 *
1150 * Return: 1 if mei_flow_ctrl_creds >0, 0 - otherwise. 1148 * Return: 1 if tx_flow_ctrl_creds >0, 0 - otherwise.
1151 */ 1149 */
1152static int mei_cl_flow_ctrl_creds(struct mei_cl *cl) 1150static int mei_cl_tx_flow_ctrl_creds(struct mei_cl *cl)
1153{ 1151{
1154 if (WARN_ON(!cl || !cl->me_cl)) 1152 if (WARN_ON(!cl || !cl->me_cl))
1155 return -EINVAL; 1153 return -EINVAL;
1156 1154
1157 if (cl->mei_flow_ctrl_creds > 0) 1155 if (cl->tx_flow_ctrl_creds > 0)
1158 return 1; 1156 return 1;
1159 1157
1160 if (mei_cl_is_fixed_address(cl)) 1158 if (mei_cl_is_fixed_address(cl))
1161 return 1; 1159 return 1;
1162 1160
1163 if (mei_cl_is_single_recv_buf(cl)) { 1161 if (mei_cl_is_single_recv_buf(cl)) {
1164 if (cl->me_cl->mei_flow_ctrl_creds > 0) 1162 if (cl->me_cl->tx_flow_ctrl_creds > 0)
1165 return 1; 1163 return 1;
1166 } 1164 }
1167 return 0; 1165 return 0;
1168} 1166}
1169 1167
1170/** 1168/**
1171 * mei_cl_flow_ctrl_reduce - reduces flow_control. 1169 * mei_cl_tx_flow_ctrl_creds_reduce - reduces transmit flow control credits
1170 * for a client
1172 * 1171 *
1173 * @cl: private data of the file object 1172 * @cl: host client
1174 * 1173 *
1175 * Return: 1174 * Return:
1176 * 0 on success 1175 * 0 on success
1177 * -EINVAL when ctrl credits are <= 0 1176 * -EINVAL when ctrl credits are <= 0
1178 */ 1177 */
1179static int mei_cl_flow_ctrl_reduce(struct mei_cl *cl) 1178static int mei_cl_tx_flow_ctrl_creds_reduce(struct mei_cl *cl)
1180{ 1179{
1181 if (WARN_ON(!cl || !cl->me_cl)) 1180 if (WARN_ON(!cl || !cl->me_cl))
1182 return -EINVAL; 1181 return -EINVAL;
@@ -1185,13 +1184,13 @@ static int mei_cl_flow_ctrl_reduce(struct mei_cl *cl)
1185 return 0; 1184 return 0;
1186 1185
1187 if (mei_cl_is_single_recv_buf(cl)) { 1186 if (mei_cl_is_single_recv_buf(cl)) {
1188 if (WARN_ON(cl->me_cl->mei_flow_ctrl_creds <= 0)) 1187 if (WARN_ON(cl->me_cl->tx_flow_ctrl_creds <= 0))
1189 return -EINVAL; 1188 return -EINVAL;
1190 cl->me_cl->mei_flow_ctrl_creds--; 1189 cl->me_cl->tx_flow_ctrl_creds--;
1191 } else { 1190 } else {
1192 if (WARN_ON(cl->mei_flow_ctrl_creds <= 0)) 1191 if (WARN_ON(cl->tx_flow_ctrl_creds <= 0))
1193 return -EINVAL; 1192 return -EINVAL;
1194 cl->mei_flow_ctrl_creds--; 1193 cl->tx_flow_ctrl_creds--;
1195 } 1194 }
1196 return 0; 1195 return 0;
1197} 1196}
@@ -1511,7 +1510,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
1511 1510
1512 first_chunk = cb->buf_idx == 0; 1511 first_chunk = cb->buf_idx == 0;
1513 1512
1514 rets = first_chunk ? mei_cl_flow_ctrl_creds(cl) : 1; 1513 rets = first_chunk ? mei_cl_tx_flow_ctrl_creds(cl) : 1;
1515 if (rets < 0) 1514 if (rets < 0)
1516 return rets; 1515 return rets;
1517 1516
@@ -1559,7 +1558,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
1559 cb->completed = mei_hdr.msg_complete == 1; 1558 cb->completed = mei_hdr.msg_complete == 1;
1560 1559
1561 if (first_chunk) { 1560 if (first_chunk) {
1562 if (mei_cl_flow_ctrl_reduce(cl)) 1561 if (mei_cl_tx_flow_ctrl_creds_reduce(cl))
1563 return -EIO; 1562 return -EIO;
1564 } 1563 }
1565 1564
@@ -1617,7 +1616,7 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
1617 mei_hdr.msg_complete = 0; 1616 mei_hdr.msg_complete = 0;
1618 mei_hdr.internal = cb->internal; 1617 mei_hdr.internal = cb->internal;
1619 1618
1620 rets = mei_cl_flow_ctrl_creds(cl); 1619 rets = mei_cl_tx_flow_ctrl_creds(cl);
1621 if (rets < 0) 1620 if (rets < 0)
1622 goto err; 1621 goto err;
1623 1622
@@ -1645,7 +1644,7 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
1645 if (rets) 1644 if (rets)
1646 goto err; 1645 goto err;
1647 1646
1648 rets = mei_cl_flow_ctrl_reduce(cl); 1647 rets = mei_cl_tx_flow_ctrl_creds_reduce(cl);
1649 if (rets) 1648 if (rets)
1650 goto err; 1649 goto err;
1651 1650
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
index b1697a329af1..c8e8a8d22019 100644
--- a/drivers/misc/mei/hbm.c
+++ b/drivers/misc/mei/hbm.c
@@ -340,7 +340,7 @@ static int mei_hbm_me_cl_add(struct mei_device *dev,
340 340
341 me_cl->props = res->client_properties; 341 me_cl->props = res->client_properties;
342 me_cl->client_id = res->me_addr; 342 me_cl->client_id = res->me_addr;
343 me_cl->mei_flow_ctrl_creds = 0; 343 me_cl->tx_flow_ctrl_creds = 0;
344 344
345 mei_me_cl_add(dev, me_cl); 345 mei_me_cl_add(dev, me_cl);
346 346
@@ -637,23 +637,22 @@ int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl)
637} 637}
638 638
639/** 639/**
640 * mei_hbm_add_single_flow_creds - adds single buffer credentials. 640 * mei_hbm_add_single_tx_flow_ctrl_creds - adds single buffer credentials.
641 * 641 *
642 * @dev: the device structure 642 * @dev: the device structure
643 * @flow: flow control. 643 * @fctrl: flow control response bus message
644 * 644 *
645 * Return: 0 on success, < 0 otherwise 645 * Return: 0 on success, < 0 otherwise
646 */ 646 */
647static int mei_hbm_add_single_flow_creds(struct mei_device *dev, 647static int mei_hbm_add_single_tx_flow_ctrl_creds(struct mei_device *dev,
648 struct hbm_flow_control *flow) 648 struct hbm_flow_control *fctrl)
649{ 649{
650 struct mei_me_client *me_cl; 650 struct mei_me_client *me_cl;
651 int rets; 651 int rets;
652 652
653 me_cl = mei_me_cl_by_id(dev, flow->me_addr); 653 me_cl = mei_me_cl_by_id(dev, fctrl->me_addr);
654 if (!me_cl) { 654 if (!me_cl) {
655 dev_err(dev->dev, "no such me client %d\n", 655 dev_err(dev->dev, "no such me client %d\n", fctrl->me_addr);
656 flow->me_addr);
657 return -ENOENT; 656 return -ENOENT;
658 } 657 }
659 658
@@ -662,9 +661,9 @@ static int mei_hbm_add_single_flow_creds(struct mei_device *dev,
662 goto out; 661 goto out;
663 } 662 }
664 663
665 me_cl->mei_flow_ctrl_creds++; 664 me_cl->tx_flow_ctrl_creds++;
666 dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n", 665 dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n",
667 flow->me_addr, me_cl->mei_flow_ctrl_creds); 666 fctrl->me_addr, me_cl->tx_flow_ctrl_creds);
668 667
669 rets = 0; 668 rets = 0;
670out: 669out:
@@ -676,24 +675,24 @@ out:
676 * mei_hbm_cl_flow_control_res - flow control response from me 675 * mei_hbm_cl_flow_control_res - flow control response from me
677 * 676 *
678 * @dev: the device structure 677 * @dev: the device structure
679 * @flow_control: flow control response bus message 678 * @fctrl: flow control response bus message
680 */ 679 */
681static void mei_hbm_cl_flow_control_res(struct mei_device *dev, 680static void mei_hbm_cl_tx_flow_ctrl_creds_res(struct mei_device *dev,
682 struct hbm_flow_control *flow_control) 681 struct hbm_flow_control *fctrl)
683{ 682{
684 struct mei_cl *cl; 683 struct mei_cl *cl;
685 684
686 if (!flow_control->host_addr) { 685 if (!fctrl->host_addr) {
687 /* single receive buffer */ 686 /* single receive buffer */
688 mei_hbm_add_single_flow_creds(dev, flow_control); 687 mei_hbm_add_single_tx_flow_ctrl_creds(dev, fctrl);
689 return; 688 return;
690 } 689 }
691 690
692 cl = mei_hbm_cl_find_by_cmd(dev, flow_control); 691 cl = mei_hbm_cl_find_by_cmd(dev, fctrl);
693 if (cl) { 692 if (cl) {
694 cl->mei_flow_ctrl_creds++; 693 cl->tx_flow_ctrl_creds++;
695 cl_dbg(dev, cl, "flow control creds = %d.\n", 694 cl_dbg(dev, cl, "flow control creds = %d.\n",
696 cl->mei_flow_ctrl_creds); 695 cl->tx_flow_ctrl_creds);
697 } 696 }
698} 697}
699 698
@@ -1023,7 +1022,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
1023 1022
1024 struct mei_hbm_cl_cmd *cl_cmd; 1023 struct mei_hbm_cl_cmd *cl_cmd;
1025 struct hbm_client_connect_request *disconnect_req; 1024 struct hbm_client_connect_request *disconnect_req;
1026 struct hbm_flow_control *flow_control; 1025 struct hbm_flow_control *fctrl;
1027 1026
1028 /* read the message to our buffer */ 1027 /* read the message to our buffer */
1029 BUG_ON(hdr->length >= sizeof(dev->rd_msg_buf)); 1028 BUG_ON(hdr->length >= sizeof(dev->rd_msg_buf));
@@ -1103,8 +1102,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
1103 case MEI_FLOW_CONTROL_CMD: 1102 case MEI_FLOW_CONTROL_CMD:
1104 dev_dbg(dev->dev, "hbm: client flow control response: message received.\n"); 1103 dev_dbg(dev->dev, "hbm: client flow control response: message received.\n");
1105 1104
1106 flow_control = (struct hbm_flow_control *) mei_msg; 1105 fctrl = (struct hbm_flow_control *)mei_msg;
1107 mei_hbm_cl_flow_control_res(dev, flow_control); 1106 mei_hbm_cl_tx_flow_ctrl_creds_res(dev, fctrl);
1108 break; 1107 break;
1109 1108
1110 case MEI_PG_ISOLATION_ENTRY_RES_CMD: 1109 case MEI_PG_ISOLATION_ENTRY_RES_CMD:
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index 8bdb28054423..7c8fa8d70e11 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -144,7 +144,7 @@ struct mei_fw_status {
144 * @refcnt: struct reference count 144 * @refcnt: struct reference count
145 * @props: client properties 145 * @props: client properties
146 * @client_id: me client id 146 * @client_id: me client id
147 * @mei_flow_ctrl_creds: flow control credits 147 * @tx_flow_ctrl_creds: flow control credits
148 * @connect_count: number connections to this client 148 * @connect_count: number connections to this client
149 * @bus_added: added to bus 149 * @bus_added: added to bus
150 */ 150 */
@@ -153,7 +153,7 @@ struct mei_me_client {
153 struct kref refcnt; 153 struct kref refcnt;
154 struct mei_client_properties props; 154 struct mei_client_properties props;
155 u8 client_id; 155 u8 client_id;
156 u8 mei_flow_ctrl_creds; 156 u8 tx_flow_ctrl_creds;
157 u8 connect_count; 157 u8 connect_count;
158 u8 bus_added; 158 u8 bus_added;
159}; 159};
@@ -202,7 +202,7 @@ struct mei_cl_cb {
202 * @me_cl: fw client connected 202 * @me_cl: fw client connected
203 * @fp: file associated with client 203 * @fp: file associated with client
204 * @host_client_id: host id 204 * @host_client_id: host id
205 * @mei_flow_ctrl_creds: transmit flow credentials 205 * @tx_flow_ctrl_creds: transmit flow credentials
206 * @rx_flow_ctrl_creds: receive flow credentials 206 * @rx_flow_ctrl_creds: receive flow credentials
207 * @timer_count: watchdog timer for operation completion 207 * @timer_count: watchdog timer for operation completion
208 * @notify_en: notification - enabled/disabled 208 * @notify_en: notification - enabled/disabled
@@ -226,7 +226,7 @@ struct mei_cl {
226 struct mei_me_client *me_cl; 226 struct mei_me_client *me_cl;
227 const struct file *fp; 227 const struct file *fp;
228 u8 host_client_id; 228 u8 host_client_id;
229 u8 mei_flow_ctrl_creds; 229 u8 tx_flow_ctrl_creds;
230 u8 rx_flow_ctrl_creds; 230 u8 rx_flow_ctrl_creds;
231 u8 timer_count; 231 u8 timer_count;
232 u8 notify_en; 232 u8 notify_en;