isci: remove SCIC_DEBUG_ENABLED, and fixup an odd macro
authorDan Williams <dan.j.williams@intel.com>
Thu, 17 Feb 2011 23:01:46 +0000 (15:01 -0800)
committerDan Williams <dan.j.williams@intel.com>
Sun, 3 Jul 2011 10:55:27 +0000 (03:55 -0700)
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>
drivers/scsi/isci/core/scic_sds_phy.c
drivers/scsi/isci/core/scic_sds_phy.h
drivers/scsi/isci/core/scic_sds_port.c
drivers/scsi/isci/core/scic_sds_port.h

index 01da46ae270a64a50ecd1000e546f3a3d601299d..d9213e215beb796252d78dd77b2bbd002794c017 100644 (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 */
 }
 
 /**
index d9691b30e4575171c0b763585732a6b254921adb..3b88259d7c87d4801a3305c3b6c3a86786270193 100644 (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.
         */
index 9749e3abbf8e4c84b7cebc71b24bf26068ec4804..ff06f8cb15b817a996faa532a545b7265feaa2ab 100644 (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.
  *
index bbb9de5228ed64430c78252e539e48691ab7e0c0..56c15fcbeb8dde8c9e31e514565bd93beb158529 100644 (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() -