staging: mei: mei_dev - use type bool instead of int
authorTomas Winkler <tomas.winkler@intel.com>
Wed, 25 May 2011 14:28:22 +0000 (17:28 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 28 Jun 2011 20:20:33 +0000 (13:20 -0700)
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>
drivers/staging/mei/init.c
drivers/staging/mei/interrupt.c
drivers/staging/mei/iorw.c
drivers/staging/mei/main.c
drivers/staging/mei/mei_dev.h
drivers/staging/mei/wd.c

index 4492bc3bf331903eb434d0ab4892f39bfb115acf..73c298883c6ee284e92ee4b62acb5de9f4a2f989 100644 (file)
@@ -106,8 +106,8 @@ static void mei_reset_iamthif_params(struct mei_device *dev)
        dev->iamthif_current_cb = NULL;
        dev->iamthif_msg_buf_size = 0;
        dev->iamthif_msg_buf_index = 0;
-       dev->iamthif_canceled = 0;
-       dev->iamthif_ioctl = 0;
+       dev->iamthif_canceled = false;
+       dev->iamthif_ioctl = false;
        dev->iamthif_state = MEI_IAMTHIF_IDLE;
        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)
                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");
 
        mei_reset(dev, 1);
@@ -223,7 +223,7 @@ int mei_hw_init(struct mei_device *dev)
                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->host_hw_state, dev->me_hw_state);
        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;
 
        if (dev->mei_state == MEI_RECOVERING_FROM_RESET) {
-               dev->need_reset = 1;
+               dev->need_reset = true;
                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->host_hw_state);
 
-       dev->need_reset = 0;
+       dev->need_reset = false;
 
        if (dev->mei_state != MEI_INITIALIZING) {
                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->rd_msg_hdr = 0;
-       dev->stop = 0;
-       dev->wd_pending = 0;
+       dev->stop = false;
+       dev->wd_pending = false;
 
        /* update the state of the registers after reset */
        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->host_version.major_version = HBM_MAJOR_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,
                                       (unsigned char *) (host_start_req),
                                       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->major_file_operations = MEI_CLOSE;
        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)) {
                        mdelay(10); /* Wait for hardware disconnection ready */
                        list_add_tail(&cb->cb_list,
index 058079df417320c398d586740335b90e73c864ff..534b0b0a2745ee404f500bba6d77c8b0bb358ae4 100644 (file)
@@ -280,7 +280,7 @@ static int _mei_irq_thread_iamthif_read(struct mei_device *dev, s32 *slots)
                } else {
                        dev_dbg(&dev->pdev->dev, "iamthif flow control success\n");
                        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_size = 0;
                        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;
                        if (cl_pos == &dev->wd_cl) {
                                dev->wd_due_counter = 0;
-                               dev->wd_pending = 0;
+                               dev->wd_pending = false;
                        } else if (cl_pos == &dev->iamthif_cl)
                                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;
                                mei_host_enum_clients_message(dev);
                        } 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");
                                mei_reset(dev, 1);
                                return;
@@ -690,7 +690,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev,
                        return;
                }
 
-               dev->recvd_msg = 1;
+               dev->recvd_msg = true;
                dev_dbg(&dev->pdev->dev, "host start response message received.\n");
                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;
                        cl->status = 0;
                        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 */
                        dev->iamthif_current_cb = cb_pos;
                        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) {
-               dev->wd_stopped = 1;
+               dev->wd_stopped = true;
                wake_up_interruptible(&dev->wait_stop_wd);
                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))
                                        return -ENODEV;
 
-                       dev->wd_pending = 0;
+                       dev->wd_pending = false;
 
                        if (dev->wd_timeout) {
                                *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->mei_host_buffer_is_empty &&
                            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");
 
                                if (mei_wd_send(dev))
@@ -1442,7 +1442,7 @@ void mei_wd_timer(struct work_struct *work)
                                        dev->wd_due_counter = 0;
 
                        } 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);
                        dev->iamthif_msg_buf_size = 0;
                        dev->iamthif_msg_buf_index = 0;
-                       dev->iamthif_canceled = 0;
-                       dev->iamthif_ioctl = 1;
+                       dev->iamthif_canceled = false;
+                       dev->iamthif_ioctl = true;
                        dev->iamthif_state = MEI_IAMTHIF_IDLE;
                        dev->iamthif_timer = 0;
 
index 3adc6b11445e6e253033efc48d2385a2dfee0c6e..dcc05c0475818326958e38e4689fac5865379c2c 100644 (file)
@@ -161,7 +161,7 @@ int mei_ioctl_connect_client(struct file *file,
        if (dev->mei_host_buffer_is_empty
            && !mei_other_client_is_connecting(dev, cl)) {
                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)) {
                        dev_dbg(&dev->pdev->dev, "Sending connect message - failed\n");
                        rets = -ENODEV;
@@ -439,7 +439,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl)
        cb->file_private = (void *) cl;
        cl->read_cb = cb;
        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)) {
                        rets = -ENODEV;
                        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_current_cb = cb;
        dev->iamthif_file_object = cb->file_object;
-       dev->iamthif_canceled = 0;
-       dev->iamthif_ioctl = 1;
+       dev->iamthif_canceled = false;
+       dev->iamthif_ioctl = true;
        dev->iamthif_msg_buf_size = cb->request_buffer.size;
        memcpy(dev->iamthif_msg_buf, cb->request_buffer.data,
            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) {
                ret = 0;
-               dev->mei_host_buffer_is_empty = 0;
+               dev->mei_host_buffer_is_empty = false;
                if (cb->request_buffer.size >
                        (((dev->host_hw_state & H_CBD) >> 24) * sizeof(u32))
                                -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_flow_ctrl_reduce(dev, &dev->iamthif_cl))
                                return -ENODEV;
-                       dev->iamthif_flow_control_pending = 1;
+                       dev->iamthif_flow_control_pending = true;
                        dev->iamthif_state = MEI_IAMTHIF_FLOW_CONTROL;
                        dev_dbg(&dev->pdev->dev, "add amthi cb to write waiting list\n");
                        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_index = 0;
-       dev->iamthif_canceled = 0;
-       dev->iamthif_ioctl = 1;
+       dev->iamthif_canceled = false;
+       dev->iamthif_ioctl = true;
        dev->iamthif_state = MEI_IAMTHIF_IDLE;
        dev->iamthif_timer = 0;
        dev->iamthif_file_object = NULL;
index 210aa8e49ba5e9d481263048e0a83de95f9c7f55..c2331cefa380a19734ab786b5aa5d71ef4f31505 100644 (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->iamthif_state);
-                       dev->iamthif_canceled = 1;
+                       dev->iamthif_canceled = true;
                        if (dev->iamthif_state == MEI_IAMTHIF_READ_COMPLETE) {
                                dev_dbg(&dev->pdev->dev, "run next amthi iamthif cb\n");
                                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) {
                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) *
                        sizeof(u32)) - sizeof(struct mei_msg_hdr))) {
 
index 5613ddf2b015785184c1f4097a7bb56e0ae5fae6..5aae6fd6e2c148420bcb0948bf210ed4286d7c02 100644 (file)
@@ -193,6 +193,7 @@ struct mei_device {
         * list of files
         */
        struct list_head file_list;
+       long open_handle_count;
        /*
         * memory of device
         */
@@ -203,8 +204,8 @@ struct mei_device {
         * lock for the device
         */
        struct mutex device_lock; /* device lock */
-       int recvd_msg;
        struct delayed_work wd_work;    /* watch dog deleye work */
+       bool recvd_msg;
        /*
         * hw states of host and fw(ME)
         */
@@ -222,7 +223,8 @@ struct mei_device {
        enum mei_states mei_state;
        enum mei_init_clients_states init_clients_state;
        u16 init_clients_timer;
-       int stop;
+       bool stop;
+       bool need_reset;
 
        u32 extra_write_index;
        u32 rd_msg_buf[128];    /* used for control messages */
@@ -232,41 +234,38 @@ struct mei_device {
 
        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 */
        DECLARE_BITMAP(me_clients_map, MEI_CLIENTS_MAX);
        DECLARE_BITMAP(host_clients_map, MEI_CLIENTS_MAX);
        u8 num_mei_me_clients;
        u8 me_client_presentation_num;
        u8 me_client_index;
+       bool mei_host_buffer_is_empty;
 
-       int wd_pending;
-       int wd_stopped;
+       struct mei_cl wd_cl;
+       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_due_counter;
        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 mei_cl iamthif_cl;
-       int iamthif_ioctl;
-       int iamthif_canceled;
+       struct mei_cl_cb *iamthif_current_cb;
        int iamthif_mtu;
        unsigned long iamthif_timer;
        u32 iamthif_stall_timer;
        unsigned char *iamthif_msg_buf; /* Note: memory has to be allocated */
        u32 iamthif_msg_buf_size;
        u32 iamthif_msg_buf_index;
-       int iamthif_flow_control_pending;
        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;
-       int need_reset;
-       long open_handle_count;
-
 };
 
 
index 2566ee1bc6b6ec8febec9498787bb9027bb50e15..18516a8670f677ae5af74e6336c5b85649ef2c5d 100644 (file)
@@ -141,7 +141,7 @@ int mei_wd_stop(struct mei_device *dev, bool preserve)
        dev->wd_timeout = 0;
        dev->wd_due_counter = 0;
        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);
        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) {
                ret = 0;
-               dev->mei_host_buffer_is_empty = 0;
+               dev->mei_host_buffer_is_empty = false;
 
                if (!mei_wd_send(dev)) {
                        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->wd_pending = 0;
+               dev->wd_pending = false;
        } else {
-               dev->wd_pending = 1;
+               dev->wd_pending = true;
        }
-       dev->wd_stopped = 0;
+       dev->wd_stopped = false;
        mutex_unlock(&dev->device_lock);
 
        ret = wait_event_interruptible_timeout(dev->wait_stop_wd,