isci: remove SCIC_DEBUG_ENABLED, and fixup an odd macro

This will be replaced by state machine tracepoints and should have been a part
of the logger removal.

Ran across scic_sds_port_decrement_request_count() which is an ugly macro
which silently hides accounting errors.  Turn it into a WARN_ONCE to see if it
ever triggers.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
Dan Williams 2011-02-17 15:01:46 -08:00
parent f7d36e1872
commit 11c8898629
4 changed files with 15 additions and 168 deletions

View file

@ -267,101 +267,6 @@ static void scic_sds_phy_sata_timeout(void *phy)
);
}
/*
* *****************************************************************************
* * SCIC SDS PHY External Methods
* ***************************************************************************** */
/**
* This method returns the object size for a phy object.
*
* u32
*/
/**
* This method returns the minimum number of timers required for a phy object.
*
* u32
*/
/**
* This method returns the maximum number of timers required for a phy object.
*
* u32
*/
#ifdef SCIC_DEBUG_ENABLED
/**
* scic_sds_phy_observe_state_change() -
* @our_observer:
*
* Debug code to record the state transitions in the phy
*/
void scic_sds_phy_observe_state_change(
struct sci_base_observer *our_observer,
struct sci_base_subject *the_subject)
{
struct scic_sds_phy *this_phy;
struct sci_base_state_machine *the_state_machine;
u8 transition_requestor;
u32 base_state_id;
u32 starting_substate_id;
the_state_machine = (struct sci_base_state_machine *)the_subject;
this_phy = (struct scic_sds_phy *)the_state_machine->state_machine_owner;
if (the_state_machine == &this_phy->parent.state_machine) {
transition_requestor = 0x01;
} else if (the_state_machine == &this_phy->starting_substate_machine) {
transition_requestor = 0x02;
} else {
transition_requestor = 0xFF;
}
base_state_id =
sci_base_state_machine_get_state(&this_phy->parent.state_machine);
starting_substate_id =
sci_base_state_machine_get_state(&this_phy->starting_substate_machine);
this_phy->state_record.state_transition_table[
this_phy->state_record.index++] = ((transition_requestor << 24)
| ((u8)base_state_id << 8)
| ((u8)starting_substate_id));
this_phy->state_record.index =
this_phy->state_record.index & (MAX_STATE_TRANSITION_RECORD - 1);
}
#endif /* SCIC_DEBUG_ENABLED */
#ifdef SCIC_DEBUG_ENABLED
/**
* scic_sds_phy_initialize_state_recording() -
*
* This method initializes the state record debug information for the phy
* object. The state machines for the phy object must be constructed before
* this function is called.
*/
void scic_sds_phy_initialize_state_recording(
struct scic_sds_phy *this_phy)
{
this_phy->state_record.index = 0;
sci_base_observer_initialize(
&this_phy->state_record.base_state_observer,
scic_sds_phy_observe_state_change,
&this_phy->parent.state_machine.parent
);
sci_base_observer_initialize(
&this_phy->state_record.starting_state_observer,
scic_sds_phy_observe_state_change,
&this_phy->starting_substate_machine.parent
);
}
#endif /* SCIC_DEBUG_ENABLED */
/**
* This method will construct the struct scic_sds_phy object
* @this_phy:
@ -400,10 +305,6 @@ void scic_sds_phy_construct(
scic_sds_phy_starting_substates,
SCIC_SDS_PHY_STARTING_SUBSTATE_INITIAL
);
#ifdef SCIC_DEBUG_ENABLED
scic_sds_phy_initialize_state_recording(this_phy);
#endif /* SCIC_DEBUG_ENABLED */
}
/**

View file

@ -156,25 +156,6 @@ enum SCIC_SDS_PHY_STARTING_SUBSTATES {
struct scic_sds_port;
struct scic_sds_controller;
#ifdef SCIC_DEBUG_ENABLED
#define MAX_STATE_TRANSITION_RECORD (256)
/**
*
*
* Debug code to record the state transitions for the phy object
*/
struct scic_sds_phy_state_record {
struct sci_base_observer base_state_observer;
struct sci_base_observer starting_state_observer;
u16 index;
u32 state_transition_table[MAX_STATE_TRANSITION_RECORD];
};
#endif /* SCIC_DEBUG_ENABLED */
/**
* This enumeration provides a named phy type for the state machine
*
@ -271,10 +252,6 @@ struct scic_sds_phy {
struct sci_base_state_machine starting_substate_machine;
#ifdef SCIC_DEBUG_ENABLED
struct scic_sds_phy_state_record state_record;
#endif /* SCIC_DEBUG_ENABLED */
/**
* This field points to the link layer register set within the SCU.
*/

View file

@ -974,19 +974,6 @@ static void scic_sds_port_timeout_handler(void *port)
/* --------------------------------------------------------------------------- */
#ifdef SCIC_DEBUG_ENABLED
void scic_sds_port_decrement_request_count(struct scic_sds_port *this_port)
{
if (this_port->started_request_count == 0)
dev_warn(sciport_to_dev(this_port),
__func__,
"%s: SCIC Port object requested to decrement started "
"io count past zero.\n");
else
this_port->started_request_count--;
}
#endif
/**
* This function updates the hardwares VIIT entry for this port.
*

View file

@ -63,6 +63,7 @@
*
*/
#include <linux/kernel.h>
#include "sci_controller_constants.h"
#include "intel_sas.h"
#include "sci_base_port.h"
@ -286,40 +287,21 @@ extern struct scic_sds_port_state_handler scic_sds_port_ready_substate_handler_t
#define scic_sds_port_get_index(this_port) \
((this_port)->physical_port_index)
/**
* scic_sds_port_increment_request_count() -
*
* Helper macro to increment the started request count
*/
#define scic_sds_port_increment_request_count(this_port) \
((this_port)->started_request_count++)
#ifdef SCIC_DEBUG_ENABLED
/**
* scic_sds_port_decrement_request_count() - This method decrements the started
* io request count. The method will not decrment the started io request
* count below 0 and will log a debug message if this is attempted.
*
*
*/
void scic_sds_port_decrement_request_count(
struct scic_sds_port *this_port);
#else
/**
* scic_sds_port_decrement_request_count() -
*
* Helper macro to decrement the started io request count. The macro will not
* decrement the started io request count below 0.
*/
#define scic_sds_port_decrement_request_count(this_port) \
(\
(this_port)->started_request_count = (\
((this_port)->started_request_count == 0) ? \
(this_port)->started_request_count : \
((this_port)->started_request_count - 1) \
) \
)
#endif
static inline void scic_sds_port_increment_request_count(struct scic_sds_port *sci_port)
{
sci_port->started_request_count++;
}
static inline void scic_sds_port_decrement_request_count(struct scic_sds_port *sci_port)
{
if (WARN_ONCE(sci_port->started_request_count == 0,
"%s: tried to decrement started_request_count past 0!?",
__func__))
/* pass */;
else
sci_port->started_request_count--;
}
/**
* scic_sds_port_write_phy_assignment() -