staging: mei: mei_dev - use type bool instead of int

use type bool for boolean variables in struct mei_dev
this should save some space providing boolean is 8 bits

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Tomas Winkler 2011-05-25 17:28:22 +03:00 committed by Greg Kroah-Hartman
parent c95efb741f
commit eb9af0acec
6 changed files with 50 additions and 51 deletions

View file

@ -106,8 +106,8 @@ static void mei_reset_iamthif_params(struct mei_device *dev)
dev->iamthif_current_cb = NULL; dev->iamthif_current_cb = NULL;
dev->iamthif_msg_buf_size = 0; dev->iamthif_msg_buf_size = 0;
dev->iamthif_msg_buf_index = 0; dev->iamthif_msg_buf_index = 0;
dev->iamthif_canceled = 0; dev->iamthif_canceled = false;
dev->iamthif_ioctl = 0; dev->iamthif_ioctl = false;
dev->iamthif_state = MEI_IAMTHIF_IDLE; dev->iamthif_state = MEI_IAMTHIF_IDLE;
dev->iamthif_timer = 0; dev->iamthif_timer = 0;
} }
@ -173,7 +173,7 @@ int mei_hw_init(struct mei_device *dev)
if ((dev->host_hw_state & H_IS) == H_IS) if ((dev->host_hw_state & H_IS) == H_IS)
mei_reg_write(dev, H_CSR, dev->host_hw_state); mei_reg_write(dev, H_CSR, dev->host_hw_state);
dev->recvd_msg = 0; dev->recvd_msg = false;
dev_dbg(&dev->pdev->dev, "reset in start the mei device.\n"); dev_dbg(&dev->pdev->dev, "reset in start the mei device.\n");
mei_reset(dev, 1); mei_reset(dev, 1);
@ -223,7 +223,7 @@ int mei_hw_init(struct mei_device *dev)
goto out; goto out;
} }
dev->recvd_msg = 0; dev->recvd_msg = false;
dev_dbg(&dev->pdev->dev, "host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n", dev_dbg(&dev->pdev->dev, "host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n",
dev->host_hw_state, dev->me_hw_state); dev->host_hw_state, dev->me_hw_state);
dev_dbg(&dev->pdev->dev, "ME turn on ME_RDY and host turn on H_RDY.\n"); dev_dbg(&dev->pdev->dev, "ME turn on ME_RDY and host turn on H_RDY.\n");
@ -267,7 +267,7 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
bool unexpected; bool unexpected;
if (dev->mei_state == MEI_RECOVERING_FROM_RESET) { if (dev->mei_state == MEI_RECOVERING_FROM_RESET) {
dev->need_reset = 1; dev->need_reset = true;
return; return;
} }
@ -291,7 +291,7 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
dev_dbg(&dev->pdev->dev, "currently saved host_hw_state = 0x%08x.\n", dev_dbg(&dev->pdev->dev, "currently saved host_hw_state = 0x%08x.\n",
dev->host_hw_state); dev->host_hw_state);
dev->need_reset = 0; dev->need_reset = false;
if (dev->mei_state != MEI_INITIALIZING) { if (dev->mei_state != MEI_INITIALIZING) {
if (dev->mei_state != MEI_DISABLED && if (dev->mei_state != MEI_DISABLED &&
@ -320,8 +320,8 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
dev->num_mei_me_clients = 0; dev->num_mei_me_clients = 0;
dev->rd_msg_hdr = 0; dev->rd_msg_hdr = 0;
dev->stop = 0; dev->stop = false;
dev->wd_pending = 0; dev->wd_pending = false;
/* update the state of the registers after reset */ /* update the state of the registers after reset */
dev->host_hw_state = mei_hcsr_read(dev); dev->host_hw_state = mei_hcsr_read(dev);
@ -382,7 +382,7 @@ void mei_host_start_message(struct mei_device *dev)
host_start_req->cmd.cmd = HOST_START_REQ_CMD; host_start_req->cmd.cmd = HOST_START_REQ_CMD;
host_start_req->host_version.major_version = HBM_MAJOR_VERSION; host_start_req->host_version.major_version = HBM_MAJOR_VERSION;
host_start_req->host_version.minor_version = HBM_MINOR_VERSION; host_start_req->host_version.minor_version = HBM_MINOR_VERSION;
dev->recvd_msg = 0; dev->recvd_msg = false;
if (!mei_write_message(dev, mei_hdr, if (!mei_write_message(dev, mei_hdr,
(unsigned char *) (host_start_req), (unsigned char *) (host_start_req),
mei_hdr->length)) { mei_hdr->length)) {
@ -701,7 +701,7 @@ int mei_disconnect_host_client(struct mei_device *dev, struct mei_cl *cl)
cb->file_private = cl; cb->file_private = cl;
cb->major_file_operations = MEI_CLOSE; cb->major_file_operations = MEI_CLOSE;
if (dev->mei_host_buffer_is_empty) { if (dev->mei_host_buffer_is_empty) {
dev->mei_host_buffer_is_empty = 0; dev->mei_host_buffer_is_empty = false;
if (mei_disconnect(dev, cl)) { if (mei_disconnect(dev, cl)) {
mdelay(10); /* Wait for hardware disconnection ready */ mdelay(10); /* Wait for hardware disconnection ready */
list_add_tail(&cb->cb_list, list_add_tail(&cb->cb_list,

View file

@ -280,7 +280,7 @@ static int _mei_irq_thread_iamthif_read(struct mei_device *dev, s32 *slots)
} else { } else {
dev_dbg(&dev->pdev->dev, "iamthif flow control success\n"); dev_dbg(&dev->pdev->dev, "iamthif flow control success\n");
dev->iamthif_state = MEI_IAMTHIF_READING; dev->iamthif_state = MEI_IAMTHIF_READING;
dev->iamthif_flow_control_pending = 0; dev->iamthif_flow_control_pending = false;
dev->iamthif_msg_buf_index = 0; dev->iamthif_msg_buf_index = 0;
dev->iamthif_msg_buf_size = 0; dev->iamthif_msg_buf_size = 0;
dev->iamthif_stall_timer = IAMTHIF_STALL_TIMER; dev->iamthif_stall_timer = IAMTHIF_STALL_TIMER;
@ -593,7 +593,7 @@ static void mei_client_disconnect_request(struct mei_device *dev,
cl_pos->timer_count = 0; cl_pos->timer_count = 0;
if (cl_pos == &dev->wd_cl) { if (cl_pos == &dev->wd_cl) {
dev->wd_due_counter = 0; dev->wd_due_counter = 0;
dev->wd_pending = 0; dev->wd_pending = false;
} else if (cl_pos == &dev->iamthif_cl) } else if (cl_pos == &dev->iamthif_cl)
dev->iamthif_timer = 0; dev->iamthif_timer = 0;
@ -661,7 +661,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
dev->init_clients_timer = 0; dev->init_clients_timer = 0;
mei_host_enum_clients_message(dev); mei_host_enum_clients_message(dev);
} else { } else {
dev->recvd_msg = 0; dev->recvd_msg = false;
dev_dbg(&dev->pdev->dev, "IMEI reset due to received host start response bus message.\n"); dev_dbg(&dev->pdev->dev, "IMEI reset due to received host start response bus message.\n");
mei_reset(dev, 1); mei_reset(dev, 1);
return; return;
@ -690,7 +690,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
return; return;
} }
dev->recvd_msg = 1; dev->recvd_msg = true;
dev_dbg(&dev->pdev->dev, "host start response message received.\n"); dev_dbg(&dev->pdev->dev, "host start response message received.\n");
break; break;
@ -1028,7 +1028,7 @@ static int _mei_irq_thread_cmpl_iamthif(struct mei_device *dev, s32 *slots,
cb_pos->information = dev->iamthif_msg_buf_index; cb_pos->information = dev->iamthif_msg_buf_index;
cl->status = 0; cl->status = 0;
dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL; dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL;
dev->iamthif_flow_control_pending = 1; dev->iamthif_flow_control_pending = true;
/* save iamthif cb sent to amthi client */ /* save iamthif cb sent to amthi client */
dev->iamthif_current_cb = cb_pos; dev->iamthif_current_cb = cb_pos;
list_move_tail(&cb_pos->cb_list, list_move_tail(&cb_pos->cb_list,
@ -1232,7 +1232,7 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,
} }
if (dev->stop && !dev->wd_pending) { if (dev->stop && !dev->wd_pending) {
dev->wd_stopped = 1; dev->wd_stopped = true;
wake_up_interruptible(&dev->wait_stop_wd); wake_up_interruptible(&dev->wait_stop_wd);
return 0; return 0;
} }
@ -1256,7 +1256,7 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list,
if (mei_flow_ctrl_reduce(dev, &dev->wd_cl)) if (mei_flow_ctrl_reduce(dev, &dev->wd_cl))
return -ENODEV; return -ENODEV;
dev->wd_pending = 0; dev->wd_pending = false;
if (dev->wd_timeout) { if (dev->wd_timeout) {
*slots -= (sizeof(struct mei_msg_hdr) + *slots -= (sizeof(struct mei_msg_hdr) +
@ -1427,7 +1427,7 @@ void mei_wd_timer(struct work_struct *work)
if (--dev->wd_due_counter == 0) { if (--dev->wd_due_counter == 0) {
if (dev->mei_host_buffer_is_empty && if (dev->mei_host_buffer_is_empty &&
mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) { mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) {
dev->mei_host_buffer_is_empty = 0; dev->mei_host_buffer_is_empty = false;
dev_dbg(&dev->pdev->dev, "send watchdog.\n"); dev_dbg(&dev->pdev->dev, "send watchdog.\n");
if (mei_wd_send(dev)) if (mei_wd_send(dev))
@ -1442,7 +1442,7 @@ void mei_wd_timer(struct work_struct *work)
dev->wd_due_counter = 0; dev->wd_due_counter = 0;
} else } else
dev->wd_pending = 1; dev->wd_pending = true;
} }
} }
@ -1452,8 +1452,8 @@ void mei_wd_timer(struct work_struct *work)
mei_reset(dev, 1); mei_reset(dev, 1);
dev->iamthif_msg_buf_size = 0; dev->iamthif_msg_buf_size = 0;
dev->iamthif_msg_buf_index = 0; dev->iamthif_msg_buf_index = 0;
dev->iamthif_canceled = 0; dev->iamthif_canceled = false;
dev->iamthif_ioctl = 1; dev->iamthif_ioctl = true;
dev->iamthif_state = MEI_IAMTHIF_IDLE; dev->iamthif_state = MEI_IAMTHIF_IDLE;
dev->iamthif_timer = 0; dev->iamthif_timer = 0;

View file

@ -161,7 +161,7 @@ int mei_ioctl_connect_client(struct file *file,
if (dev->mei_host_buffer_is_empty if (dev->mei_host_buffer_is_empty
&& !mei_other_client_is_connecting(dev, cl)) { && !mei_other_client_is_connecting(dev, cl)) {
dev_dbg(&dev->pdev->dev, "Sending Connect Message\n"); dev_dbg(&dev->pdev->dev, "Sending Connect Message\n");
dev->mei_host_buffer_is_empty = 0; dev->mei_host_buffer_is_empty = false;
if (!mei_connect(dev, cl)) { if (!mei_connect(dev, cl)) {
dev_dbg(&dev->pdev->dev, "Sending connect message - failed\n"); dev_dbg(&dev->pdev->dev, "Sending connect message - failed\n");
rets = -ENODEV; rets = -ENODEV;
@ -439,7 +439,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl)
cb->file_private = (void *) cl; cb->file_private = (void *) cl;
cl->read_cb = cb; cl->read_cb = cb;
if (dev->mei_host_buffer_is_empty) { if (dev->mei_host_buffer_is_empty) {
dev->mei_host_buffer_is_empty = 0; dev->mei_host_buffer_is_empty = false;
if (!mei_send_flow_control(dev, cl)) { if (!mei_send_flow_control(dev, cl)) {
rets = -ENODEV; rets = -ENODEV;
goto unlock; goto unlock;
@ -478,8 +478,8 @@ int amthi_write(struct mei_device *dev, struct mei_cl_cb *cb)
dev->iamthif_state = MEI_IAMTHIF_WRITING; dev->iamthif_state = MEI_IAMTHIF_WRITING;
dev->iamthif_current_cb = cb; dev->iamthif_current_cb = cb;
dev->iamthif_file_object = cb->file_object; dev->iamthif_file_object = cb->file_object;
dev->iamthif_canceled = 0; dev->iamthif_canceled = false;
dev->iamthif_ioctl = 1; dev->iamthif_ioctl = true;
dev->iamthif_msg_buf_size = cb->request_buffer.size; dev->iamthif_msg_buf_size = cb->request_buffer.size;
memcpy(dev->iamthif_msg_buf, cb->request_buffer.data, memcpy(dev->iamthif_msg_buf, cb->request_buffer.data,
cb->request_buffer.size); cb->request_buffer.size);
@ -490,7 +490,7 @@ int amthi_write(struct mei_device *dev, struct mei_cl_cb *cb)
if (ret && dev->mei_host_buffer_is_empty) { if (ret && dev->mei_host_buffer_is_empty) {
ret = 0; ret = 0;
dev->mei_host_buffer_is_empty = 0; dev->mei_host_buffer_is_empty = false;
if (cb->request_buffer.size > if (cb->request_buffer.size >
(((dev->host_hw_state & H_CBD) >> 24) * sizeof(u32)) (((dev->host_hw_state & H_CBD) >> 24) * sizeof(u32))
-sizeof(struct mei_msg_hdr)) { -sizeof(struct mei_msg_hdr)) {
@ -515,7 +515,7 @@ int amthi_write(struct mei_device *dev, struct mei_cl_cb *cb)
if (mei_hdr.msg_complete) { if (mei_hdr.msg_complete) {
if (mei_flow_ctrl_reduce(dev, &dev->iamthif_cl)) if (mei_flow_ctrl_reduce(dev, &dev->iamthif_cl))
return -ENODEV; return -ENODEV;
dev->iamthif_flow_control_pending = 1; dev->iamthif_flow_control_pending = true;
dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL; dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL;
dev_dbg(&dev->pdev->dev, "add amthi cb to write waiting list\n"); dev_dbg(&dev->pdev->dev, "add amthi cb to write waiting list\n");
dev->iamthif_current_cb = cb; dev->iamthif_current_cb = cb;
@ -559,8 +559,8 @@ void mei_run_next_iamthif_cmd(struct mei_device *dev)
dev->iamthif_msg_buf_size = 0; dev->iamthif_msg_buf_size = 0;
dev->iamthif_msg_buf_index = 0; dev->iamthif_msg_buf_index = 0;
dev->iamthif_canceled = 0; dev->iamthif_canceled = false;
dev->iamthif_ioctl = 1; dev->iamthif_ioctl = true;
dev->iamthif_state = MEI_IAMTHIF_IDLE; dev->iamthif_state = MEI_IAMTHIF_IDLE;
dev->iamthif_timer = 0; dev->iamthif_timer = 0;
dev->iamthif_file_object = NULL; dev->iamthif_file_object = NULL;

View file

@ -519,7 +519,7 @@ static int mei_release(struct inode *inode, struct file *file)
dev_dbg(&dev->pdev->dev, "amthi canceled iamthif state %d\n", dev_dbg(&dev->pdev->dev, "amthi canceled iamthif state %d\n",
dev->iamthif_state); dev->iamthif_state);
dev->iamthif_canceled = 1; dev->iamthif_canceled = true;
if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE) { if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE) {
dev_dbg(&dev->pdev->dev, "run next amthi iamthif cb\n"); dev_dbg(&dev->pdev->dev, "run next amthi iamthif cb\n");
mei_run_next_iamthif_cmd(dev); mei_run_next_iamthif_cmd(dev);
@ -893,7 +893,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
if (rets && dev->mei_host_buffer_is_empty) { if (rets && dev->mei_host_buffer_is_empty) {
rets = 0; rets = 0;
dev->mei_host_buffer_is_empty = 0; dev->mei_host_buffer_is_empty = false;
if (length > ((((dev->host_hw_state & H_CBD) >> 24) * if (length > ((((dev->host_hw_state & H_CBD) >> 24) *
sizeof(u32)) - sizeof(struct mei_msg_hdr))) { sizeof(u32)) - sizeof(struct mei_msg_hdr))) {

View file

@ -193,6 +193,7 @@ struct mei_device {
* list of files * list of files
*/ */
struct list_head file_list; struct list_head file_list;
long open_handle_count;
/* /*
* memory of device * memory of device
*/ */
@ -203,8 +204,8 @@ struct mei_device {
* lock for the device * lock for the device
*/ */
struct mutex device_lock; /* device lock */ struct mutex device_lock; /* device lock */
int recvd_msg;
struct delayed_work wd_work; /* watch dog deleye work */ struct delayed_work wd_work; /* watch dog deleye work */
bool recvd_msg;
/* /*
* hw states of host and fw(ME) * hw states of host and fw(ME)
*/ */
@ -222,7 +223,8 @@ struct mei_device {
enum mei_states mei_state; enum mei_states mei_state;
enum mei_init_clients_states init_clients_state; enum mei_init_clients_states init_clients_state;
u16 init_clients_timer; u16 init_clients_timer;
int stop; bool stop;
bool need_reset;
u32 extra_write_index; u32 extra_write_index;
u32 rd_msg_buf[128]; /* used for control messages */ u32 rd_msg_buf[128]; /* used for control messages */
@ -232,41 +234,38 @@ struct mei_device {
struct hbm_version version; struct hbm_version version;
int mei_host_buffer_is_empty;
struct mei_cl wd_cl;
struct mei_me_client *me_clients; /* Note: memory has to be allocated */ struct mei_me_client *me_clients; /* Note: memory has to be allocated */
DECLARE_BITMAP(me_clients_map, MEI_CLIENTS_MAX); DECLARE_BITMAP(me_clients_map, MEI_CLIENTS_MAX);
DECLARE_BITMAP(host_clients_map, MEI_CLIENTS_MAX); DECLARE_BITMAP(host_clients_map, MEI_CLIENTS_MAX);
u8 num_mei_me_clients; u8 num_mei_me_clients;
u8 me_client_presentation_num; u8 me_client_presentation_num;
u8 me_client_index; u8 me_client_index;
bool mei_host_buffer_is_empty;
int wd_pending; struct mei_cl wd_cl;
int wd_stopped; bool wd_pending;
bool wd_stopped;
bool wd_bypass; /* if false, don't refresh watchdog ME client */
u16 wd_timeout; /* seconds ((wd_data[1] << 8) + wd_data[0]) */ u16 wd_timeout; /* seconds ((wd_data[1] << 8) + wd_data[0]) */
u16 wd_due_counter;
unsigned char wd_data[MEI_START_WD_DATA_SIZE]; unsigned char wd_data[MEI_START_WD_DATA_SIZE];
u16 wd_due_counter;
bool wd_bypass; /* if false, don't refresh watchdog ME client */
struct file *iamthif_file_object; struct file *iamthif_file_object;
struct mei_cl iamthif_cl; struct mei_cl iamthif_cl;
int iamthif_ioctl; struct mei_cl_cb *iamthif_current_cb;
int iamthif_canceled;
int iamthif_mtu; int iamthif_mtu;
unsigned long iamthif_timer; unsigned long iamthif_timer;
u32 iamthif_stall_timer; u32 iamthif_stall_timer;
unsigned char *iamthif_msg_buf; /* Note: memory has to be allocated */ unsigned char *iamthif_msg_buf; /* Note: memory has to be allocated */
u32 iamthif_msg_buf_size; u32 iamthif_msg_buf_size;
u32 iamthif_msg_buf_index; u32 iamthif_msg_buf_index;
int iamthif_flow_control_pending;
enum iamthif_states iamthif_state; enum iamthif_states iamthif_state;
struct mei_cl_cb *iamthif_current_cb; bool iamthif_flow_control_pending;
bool iamthif_ioctl;
bool iamthif_canceled;
u8 write_hang; u8 write_hang;
int need_reset;
long open_handle_count;
}; };

View file

@ -141,7 +141,7 @@ int mei_wd_stop(struct mei_device *dev, bool preserve)
dev->wd_timeout = 0; dev->wd_timeout = 0;
dev->wd_due_counter = 0; dev->wd_due_counter = 0;
memcpy(dev->wd_data, mei_stop_wd_params, MEI_WD_PARAMS_SIZE); memcpy(dev->wd_data, mei_stop_wd_params, MEI_WD_PARAMS_SIZE);
dev->stop = 1; dev->stop = true;
ret = mei_flow_ctrl_creds(dev, &dev->wd_cl); ret = mei_flow_ctrl_creds(dev, &dev->wd_cl);
if (ret < 0) if (ret < 0)
@ -149,7 +149,7 @@ int mei_wd_stop(struct mei_device *dev, bool preserve)
if (ret && dev->mei_host_buffer_is_empty) { if (ret && dev->mei_host_buffer_is_empty) {
ret = 0; ret = 0;
dev->mei_host_buffer_is_empty = 0; dev->mei_host_buffer_is_empty = false;
if (!mei_wd_send(dev)) { if (!mei_wd_send(dev)) {
ret = mei_flow_ctrl_reduce(dev, &dev->wd_cl); ret = mei_flow_ctrl_reduce(dev, &dev->wd_cl);
@ -159,11 +159,11 @@ int mei_wd_stop(struct mei_device *dev, bool preserve)
dev_dbg(&dev->pdev->dev, "send stop WD failed\n"); dev_dbg(&dev->pdev->dev, "send stop WD failed\n");
} }
dev->wd_pending = 0; dev->wd_pending = false;
} else { } else {
dev->wd_pending = 1; dev->wd_pending = true;
} }
dev->wd_stopped = 0; dev->wd_stopped = false;
mutex_unlock(&dev->device_lock); mutex_unlock(&dev->device_lock);
ret = wait_event_interruptible_timeout(dev->wait_stop_wd, ret = wait_event_interruptible_timeout(dev->wait_stop_wd,