staging/mei: normalize prototypes of all read buffers
1. convert all read buffers to unsigned char and drop useless castings 2. simplify mei_read_slots implementation Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
733ba91cc0
commit
edf1eed466
4 changed files with 18 additions and 30 deletions
|
@ -215,26 +215,17 @@ int mei_count_full_read_slots(struct mei_device *dev)
|
|||
* @buffer: message buffer will be written
|
||||
* @buffer_length: message size will be read
|
||||
*/
|
||||
void mei_read_slots(struct mei_device *dev,
|
||||
unsigned char *buffer, unsigned long buffer_length)
|
||||
void mei_read_slots(struct mei_device *dev, unsigned char *buffer,
|
||||
unsigned long buffer_length)
|
||||
{
|
||||
u32 i = 0;
|
||||
unsigned char temp_buf[sizeof(u32)];
|
||||
u32 *reg_buf = (u32 *)buffer;
|
||||
|
||||
while (buffer_length >= sizeof(u32)) {
|
||||
((u32 *) buffer)[i] = mei_mecbrw_read(dev);
|
||||
|
||||
dev_dbg(&dev->pdev->dev,
|
||||
"buffer[%d]= %d\n",
|
||||
i, ((u32 *) buffer)[i]);
|
||||
|
||||
i++;
|
||||
buffer_length -= sizeof(u32);
|
||||
}
|
||||
for (; buffer_length >= sizeof(u32); buffer_length -= sizeof(u32))
|
||||
*reg_buf++ = mei_mecbrw_read(dev);
|
||||
|
||||
if (buffer_length > 0) {
|
||||
*((u32 *) &temp_buf) = mei_mecbrw_read(dev);
|
||||
memcpy(&buffer[i * 4], temp_buf, buffer_length);
|
||||
u32 reg = mei_mecbrw_read(dev);
|
||||
memcpy(reg_buf, ®, buffer_length);
|
||||
}
|
||||
|
||||
dev->host_hw_state |= H_IG;
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
|
||||
|
||||
void mei_read_slots(struct mei_device *dev,
|
||||
unsigned char *buffer, unsigned long buffer_length);
|
||||
unsigned char *buffer,
|
||||
unsigned long buffer_length);
|
||||
|
||||
int mei_write_message(struct mei_device *dev,
|
||||
struct mei_msg_hdr *header,
|
||||
|
|
|
@ -123,8 +123,7 @@ static int mei_irq_thread_read_amthi_message(struct mei_io_list *complete_list,
|
|||
BUG_ON(mei_hdr->me_addr != dev->iamthif_cl.me_client_id);
|
||||
BUG_ON(dev->iamthif_state != MEI_IAMTHIF_READING);
|
||||
|
||||
buffer = (unsigned char *) (dev->iamthif_msg_buf +
|
||||
dev->iamthif_msg_buf_index);
|
||||
buffer = dev->iamthif_msg_buf + dev->iamthif_msg_buf_index;
|
||||
BUG_ON(dev->iamthif_mtu < dev->iamthif_msg_buf_index + mei_hdr->length);
|
||||
|
||||
mei_read_slots(dev, buffer, mei_hdr->length);
|
||||
|
@ -206,9 +205,7 @@ static int mei_irq_thread_read_client_message(struct mei_io_list *complete_list,
|
|||
cl = (struct mei_cl *)cb_pos->file_private;
|
||||
if (cl && _mei_irq_thread_state_ok(cl, mei_hdr)) {
|
||||
cl->reading_state = MEI_READING;
|
||||
buffer = (unsigned char *)
|
||||
(cb_pos->response_buffer.data +
|
||||
cb_pos->information);
|
||||
buffer = cb_pos->response_buffer.data + cb_pos->information;
|
||||
|
||||
if (cb_pos->response_buffer.size <
|
||||
mei_hdr->length + cb_pos->information) {
|
||||
|
@ -247,8 +244,7 @@ static int mei_irq_thread_read_client_message(struct mei_io_list *complete_list,
|
|||
quit:
|
||||
dev_dbg(&dev->pdev->dev, "message read\n");
|
||||
if (!buffer) {
|
||||
mei_read_slots(dev, (unsigned char *) dev->rd_msg_buf,
|
||||
mei_hdr->length);
|
||||
mei_read_slots(dev, dev->rd_msg_buf, mei_hdr->length);
|
||||
dev_dbg(&dev->pdev->dev, "discarding message, header =%08x.\n",
|
||||
*(u32 *) dev->rd_msg_buf);
|
||||
}
|
||||
|
@ -632,13 +628,11 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
|
|||
struct hbm_host_stop_request *host_stop_req;
|
||||
int res;
|
||||
|
||||
unsigned char *buffer;
|
||||
|
||||
/* read the message to our buffer */
|
||||
buffer = (unsigned char *) dev->rd_msg_buf;
|
||||
BUG_ON(mei_hdr->length >= sizeof(dev->rd_msg_buf));
|
||||
mei_read_slots(dev, buffer, mei_hdr->length);
|
||||
mei_msg = (struct mei_bus_message *) buffer;
|
||||
mei_read_slots(dev, dev->rd_msg_buf, mei_hdr->length);
|
||||
mei_msg = (struct mei_bus_message *)dev->rd_msg_buf;
|
||||
|
||||
switch (*(u8 *) mei_msg) {
|
||||
case HOST_START_RES_CMD:
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#define MEI_WD_PARAMS_SIZE 4
|
||||
#define MEI_WD_STATE_INDEPENDENCE_MSG_SENT (1 << 0)
|
||||
|
||||
#define MEI_RD_MSG_BUF_SIZE (128 * sizeof(u32))
|
||||
|
||||
/*
|
||||
* MEI PCI Device object
|
||||
*/
|
||||
|
@ -125,7 +127,7 @@ enum mei_cb_major_types {
|
|||
*/
|
||||
struct mei_message_data {
|
||||
u32 size;
|
||||
char *data;
|
||||
unsigned char *data;
|
||||
} __packed;
|
||||
|
||||
|
||||
|
@ -219,7 +221,7 @@ struct mei_device {
|
|||
bool need_reset;
|
||||
|
||||
u32 extra_write_index;
|
||||
u32 rd_msg_buf[128]; /* used for control messages */
|
||||
unsigned char rd_msg_buf[MEI_RD_MSG_BUF_SIZE]; /* control messages */
|
||||
u32 wr_msg_buf[128]; /* used for control messages */
|
||||
u32 ext_msg_buf[8]; /* for control responses */
|
||||
u32 rd_msg_hdr;
|
||||
|
|
Loading…
Reference in a new issue