ipmi_ssif: Rename idle state and check
commit 8230831c43 upstream.
Rename the SSIF_IDLE() to IS_SSIF_IDLE(), since that is more clear, and
rename SSIF_NORMAL to SSIF_IDLE, since that's more accurate.
Cc: stable@vger.kernel.org
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
66b40f8756
commit
be2dad7bc9
@@ -92,7 +92,7 @@
|
|||||||
#define SSIF_WATCH_WATCHDOG_TIMEOUT msecs_to_jiffies(250)
|
#define SSIF_WATCH_WATCHDOG_TIMEOUT msecs_to_jiffies(250)
|
||||||
|
|
||||||
enum ssif_intf_state {
|
enum ssif_intf_state {
|
||||||
SSIF_NORMAL,
|
SSIF_IDLE,
|
||||||
SSIF_GETTING_FLAGS,
|
SSIF_GETTING_FLAGS,
|
||||||
SSIF_GETTING_EVENTS,
|
SSIF_GETTING_EVENTS,
|
||||||
SSIF_CLEARING_FLAGS,
|
SSIF_CLEARING_FLAGS,
|
||||||
@@ -100,8 +100,8 @@ enum ssif_intf_state {
|
|||||||
/* FIXME - add watchdog stuff. */
|
/* FIXME - add watchdog stuff. */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SSIF_IDLE(ssif) ((ssif)->ssif_state == SSIF_NORMAL \
|
#define IS_SSIF_IDLE(ssif) ((ssif)->ssif_state == SSIF_IDLE \
|
||||||
&& (ssif)->curr_msg == NULL)
|
&& (ssif)->curr_msg == NULL)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Indexes into stats[] in ssif_info below.
|
* Indexes into stats[] in ssif_info below.
|
||||||
@@ -348,9 +348,9 @@ static void return_hosed_msg(struct ssif_info *ssif_info,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Must be called with the message lock held. This will release the
|
* Must be called with the message lock held. This will release the
|
||||||
* message lock. Note that the caller will check SSIF_IDLE and start a
|
* message lock. Note that the caller will check IS_SSIF_IDLE and
|
||||||
* new operation, so there is no need to check for new messages to
|
* start a new operation, so there is no need to check for new
|
||||||
* start in here.
|
* messages to start in here.
|
||||||
*/
|
*/
|
||||||
static void start_clear_flags(struct ssif_info *ssif_info, unsigned long *flags)
|
static void start_clear_flags(struct ssif_info *ssif_info, unsigned long *flags)
|
||||||
{
|
{
|
||||||
@@ -367,7 +367,7 @@ static void start_clear_flags(struct ssif_info *ssif_info, unsigned long *flags)
|
|||||||
|
|
||||||
if (start_send(ssif_info, msg, 3) != 0) {
|
if (start_send(ssif_info, msg, 3) != 0) {
|
||||||
/* Error, just go to normal state. */
|
/* Error, just go to normal state. */
|
||||||
ssif_info->ssif_state = SSIF_NORMAL;
|
ssif_info->ssif_state = SSIF_IDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,7 +382,7 @@ static void start_flag_fetch(struct ssif_info *ssif_info, unsigned long *flags)
|
|||||||
mb[0] = (IPMI_NETFN_APP_REQUEST << 2);
|
mb[0] = (IPMI_NETFN_APP_REQUEST << 2);
|
||||||
mb[1] = IPMI_GET_MSG_FLAGS_CMD;
|
mb[1] = IPMI_GET_MSG_FLAGS_CMD;
|
||||||
if (start_send(ssif_info, mb, 2) != 0)
|
if (start_send(ssif_info, mb, 2) != 0)
|
||||||
ssif_info->ssif_state = SSIF_NORMAL;
|
ssif_info->ssif_state = SSIF_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_start_send(struct ssif_info *ssif_info, unsigned long *flags,
|
static void check_start_send(struct ssif_info *ssif_info, unsigned long *flags,
|
||||||
@@ -393,7 +393,7 @@ static void check_start_send(struct ssif_info *ssif_info, unsigned long *flags,
|
|||||||
|
|
||||||
flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
|
flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
|
||||||
ssif_info->curr_msg = NULL;
|
ssif_info->curr_msg = NULL;
|
||||||
ssif_info->ssif_state = SSIF_NORMAL;
|
ssif_info->ssif_state = SSIF_IDLE;
|
||||||
ipmi_ssif_unlock_cond(ssif_info, flags);
|
ipmi_ssif_unlock_cond(ssif_info, flags);
|
||||||
ipmi_free_smi_msg(msg);
|
ipmi_free_smi_msg(msg);
|
||||||
}
|
}
|
||||||
@@ -407,7 +407,7 @@ static void start_event_fetch(struct ssif_info *ssif_info, unsigned long *flags)
|
|||||||
|
|
||||||
msg = ipmi_alloc_smi_msg();
|
msg = ipmi_alloc_smi_msg();
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
ssif_info->ssif_state = SSIF_NORMAL;
|
ssif_info->ssif_state = SSIF_IDLE;
|
||||||
ipmi_ssif_unlock_cond(ssif_info, flags);
|
ipmi_ssif_unlock_cond(ssif_info, flags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -430,7 +430,7 @@ static void start_recv_msg_fetch(struct ssif_info *ssif_info,
|
|||||||
|
|
||||||
msg = ipmi_alloc_smi_msg();
|
msg = ipmi_alloc_smi_msg();
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
ssif_info->ssif_state = SSIF_NORMAL;
|
ssif_info->ssif_state = SSIF_IDLE;
|
||||||
ipmi_ssif_unlock_cond(ssif_info, flags);
|
ipmi_ssif_unlock_cond(ssif_info, flags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -448,9 +448,9 @@ static void start_recv_msg_fetch(struct ssif_info *ssif_info,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Must be called with the message lock held. This will release the
|
* Must be called with the message lock held. This will release the
|
||||||
* message lock. Note that the caller will check SSIF_IDLE and start a
|
* message lock. Note that the caller will check IS_SSIF_IDLE and
|
||||||
* new operation, so there is no need to check for new messages to
|
* start a new operation, so there is no need to check for new
|
||||||
* start in here.
|
* messages to start in here.
|
||||||
*/
|
*/
|
||||||
static void handle_flags(struct ssif_info *ssif_info, unsigned long *flags)
|
static void handle_flags(struct ssif_info *ssif_info, unsigned long *flags)
|
||||||
{
|
{
|
||||||
@@ -466,7 +466,7 @@ static void handle_flags(struct ssif_info *ssif_info, unsigned long *flags)
|
|||||||
/* Events available. */
|
/* Events available. */
|
||||||
start_event_fetch(ssif_info, flags);
|
start_event_fetch(ssif_info, flags);
|
||||||
else {
|
else {
|
||||||
ssif_info->ssif_state = SSIF_NORMAL;
|
ssif_info->ssif_state = SSIF_IDLE;
|
||||||
ipmi_ssif_unlock_cond(ssif_info, flags);
|
ipmi_ssif_unlock_cond(ssif_info, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -579,7 +579,7 @@ static void watch_timeout(struct timer_list *t)
|
|||||||
if (ssif_info->watch_timeout) {
|
if (ssif_info->watch_timeout) {
|
||||||
mod_timer(&ssif_info->watch_timer,
|
mod_timer(&ssif_info->watch_timer,
|
||||||
jiffies + ssif_info->watch_timeout);
|
jiffies + ssif_info->watch_timeout);
|
||||||
if (SSIF_IDLE(ssif_info)) {
|
if (IS_SSIF_IDLE(ssif_info)) {
|
||||||
start_flag_fetch(ssif_info, flags); /* Releases lock */
|
start_flag_fetch(ssif_info, flags); /* Releases lock */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -782,7 +782,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (ssif_info->ssif_state) {
|
switch (ssif_info->ssif_state) {
|
||||||
case SSIF_NORMAL:
|
case SSIF_IDLE:
|
||||||
ipmi_ssif_unlock_cond(ssif_info, flags);
|
ipmi_ssif_unlock_cond(ssif_info, flags);
|
||||||
if (!msg)
|
if (!msg)
|
||||||
break;
|
break;
|
||||||
@@ -800,7 +800,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
|
|||||||
* Error fetching flags, or invalid length,
|
* Error fetching flags, or invalid length,
|
||||||
* just give up for now.
|
* just give up for now.
|
||||||
*/
|
*/
|
||||||
ssif_info->ssif_state = SSIF_NORMAL;
|
ssif_info->ssif_state = SSIF_IDLE;
|
||||||
ipmi_ssif_unlock_cond(ssif_info, flags);
|
ipmi_ssif_unlock_cond(ssif_info, flags);
|
||||||
dev_warn(&ssif_info->client->dev,
|
dev_warn(&ssif_info->client->dev,
|
||||||
"Error getting flags: %d %d, %x\n",
|
"Error getting flags: %d %d, %x\n",
|
||||||
@@ -835,7 +835,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
|
|||||||
"Invalid response clearing flags: %x %x\n",
|
"Invalid response clearing flags: %x %x\n",
|
||||||
data[0], data[1]);
|
data[0], data[1]);
|
||||||
}
|
}
|
||||||
ssif_info->ssif_state = SSIF_NORMAL;
|
ssif_info->ssif_state = SSIF_IDLE;
|
||||||
ipmi_ssif_unlock_cond(ssif_info, flags);
|
ipmi_ssif_unlock_cond(ssif_info, flags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -913,7 +913,7 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
|
flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
|
||||||
if (SSIF_IDLE(ssif_info) && !ssif_info->stopping) {
|
if (IS_SSIF_IDLE(ssif_info) && !ssif_info->stopping) {
|
||||||
if (ssif_info->req_events)
|
if (ssif_info->req_events)
|
||||||
start_event_fetch(ssif_info, flags);
|
start_event_fetch(ssif_info, flags);
|
||||||
else if (ssif_info->req_flags)
|
else if (ssif_info->req_flags)
|
||||||
@@ -1087,7 +1087,7 @@ static void start_next_msg(struct ssif_info *ssif_info, unsigned long *flags)
|
|||||||
unsigned long oflags;
|
unsigned long oflags;
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
if (!SSIF_IDLE(ssif_info)) {
|
if (!IS_SSIF_IDLE(ssif_info)) {
|
||||||
ipmi_ssif_unlock_cond(ssif_info, flags);
|
ipmi_ssif_unlock_cond(ssif_info, flags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1310,7 +1310,7 @@ static void shutdown_ssif(void *send_info)
|
|||||||
dev_set_drvdata(&ssif_info->client->dev, NULL);
|
dev_set_drvdata(&ssif_info->client->dev, NULL);
|
||||||
|
|
||||||
/* make sure the driver is not looking for flags any more. */
|
/* make sure the driver is not looking for flags any more. */
|
||||||
while (ssif_info->ssif_state != SSIF_NORMAL)
|
while (ssif_info->ssif_state != SSIF_IDLE)
|
||||||
schedule_timeout(1);
|
schedule_timeout(1);
|
||||||
|
|
||||||
ssif_info->stopping = true;
|
ssif_info->stopping = true;
|
||||||
@@ -1882,7 +1882,7 @@ static int ssif_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_init(&ssif_info->lock);
|
spin_lock_init(&ssif_info->lock);
|
||||||
ssif_info->ssif_state = SSIF_NORMAL;
|
ssif_info->ssif_state = SSIF_IDLE;
|
||||||
timer_setup(&ssif_info->retry_timer, retry_timeout, 0);
|
timer_setup(&ssif_info->retry_timer, retry_timeout, 0);
|
||||||
timer_setup(&ssif_info->watch_timer, watch_timeout, 0);
|
timer_setup(&ssif_info->watch_timer, watch_timeout, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user