From patchwork Fri Dec 23 02:59:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 132942 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3CB1FB71CB for ; Fri, 23 Dec 2011 13:59:03 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756286Ab1LWC7B (ORCPT ); Thu, 22 Dec 2011 21:59:01 -0500 Received: from mga09.intel.com ([134.134.136.24]:11985 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756259Ab1LWC7A (ORCPT ); Thu, 22 Dec 2011 21:59:00 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 22 Dec 2011 18:59:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,351,1309762800"; d="scan'208";a="90709673" Received: from dwillia2-linux.jf.intel.com (HELO dwillia2-linux.localdomain) ([10.23.45.73]) by orsmga002.jf.intel.com with ESMTP; 22 Dec 2011 18:59:00 -0800 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by dwillia2-linux.localdomain (Postfix) with ESMTP id 46F38500440; Thu, 22 Dec 2011 18:59:00 -0800 (PST) Subject: [PATCH v2 06/28] libsas: convert ha->state to flags To: linux-scsi@vger.kernel.org From: Dan Williams Cc: linux-ide@vger.kernel.org Date: Thu, 22 Dec 2011 18:59:00 -0800 Message-ID: <20111223025900.21827.7539.stgit@localhost6.localdomain6> In-Reply-To: <20111223025350.21827.85779.stgit@localhost6.localdomain6> References: <20111223025350.21827.85779.stgit@localhost6.localdomain6> User-Agent: StGit/0.15-7-g9bfb-dirty MIME-Version: 1.0 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org In preparation for adding new states (SAS_HA_DRAINING, SAS_HA_FROZEN), convert ha->state into a set of flags. Signed-off-by: Dan Williams --- drivers/scsi/libsas/sas_init.c | 4 ++-- drivers/scsi/libsas/sas_internal.h | 2 +- include/scsi/libsas.h | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index a435876..da244e6 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c @@ -112,7 +112,7 @@ int sas_register_ha(struct sas_ha_struct *sas_ha) else if (sas_ha->lldd_queue_size == -1) sas_ha->lldd_queue_size = 128; /* Sanity */ - sas_ha->state = SAS_HA_REGISTERED; + set_bit(SAS_HA_REGISTERED, &sas_ha->state); spin_lock_init(&sas_ha->state_lock); error = sas_register_phys(sas_ha); @@ -160,7 +160,7 @@ int sas_unregister_ha(struct sas_ha_struct *sas_ha) /* Set the state to unregistered to avoid further * events to be queued */ spin_lock_irqsave(&sas_ha->state_lock, flags); - sas_ha->state = SAS_HA_UNREGISTERED; + clear_bit(SAS_HA_REGISTERED, &sas_ha->state); spin_unlock_irqrestore(&sas_ha->state_lock, flags); scsi_flush_work(sas_ha->core.shost); diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h index 7fe4ede..1fd84b3 100644 --- a/drivers/scsi/libsas/sas_internal.h +++ b/drivers/scsi/libsas/sas_internal.h @@ -100,7 +100,7 @@ static inline void sas_queue_event(int event, unsigned long *pending, unsigned long flags; spin_lock_irqsave(&sas_ha->state_lock, flags); - if (sas_ha->state != SAS_HA_UNREGISTERED) + if (test_bit(SAS_HA_REGISTERED, &sas_ha->state)) scsi_queue_work(sas_ha->core.shost, work); spin_unlock_irqrestore(&sas_ha->state_lock, flags); } diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index de63a66..8e402d5 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h @@ -330,7 +330,6 @@ struct sas_ha_event { enum sas_ha_state { SAS_HA_REGISTERED, - SAS_HA_UNREGISTERED }; struct sas_ha_struct { @@ -338,7 +337,7 @@ struct sas_ha_struct { struct sas_ha_event ha_events[HA_NUM_EVENTS]; unsigned long pending; - enum sas_ha_state state; + unsigned long state; spinlock_t state_lock; struct scsi_core core;