From mboxrd@z Thu Jan 1 00:00:00 1970 From: vignesh babu Date: Tue, 12 Jun 2007 05:36:41 +0000 Subject: [KJ] [PATCH]is_power_of_2-scsi/esp_scsi.c Message-Id: <1181625881.11780.25.camel@merlin.linuxcoe.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: James.Bottomley@SteelEye.com Cc: linux-scsi@vger.kernel.org, Kernel Janitors List Replacing (n & (n-1)) in the context of power of 2 checks with is_power_of_2 Signed-off-by: vignesh babu --- diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index ec71061..c416154 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -1130,7 +1131,7 @@ static int esp_reconnect(struct esp *esp) if (!(bits & esp->scsi_id_mask)) goto do_reset; bits &= ~esp->scsi_id_mask; - if (!bits || (bits & (bits - 1))) + if (!is_power_of_2(bits)) goto do_reset; target = ffs(bits) - 1; -- Vignesh Babu BM _____________________________________________________________ "Why is it that every time I'm with you, makes me believe in magic?" _______________________________________________ Kernel-janitors mailing list Kernel-janitors@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors From mboxrd@z Thu Jan 1 00:00:00 1970 From: vignesh babu Subject: [PATCH]is_power_of_2-scsi/esp_scsi.c Date: Tue, 12 Jun 2007 10:54:41 +0530 Message-ID: <1181625881.11780.25.camel@merlin.linuxcoe.com> Reply-To: vignesh.babu@wipro.com Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: Received: from wip-cdc-wd.wipro.com ([203.91.201.26]:40062 "EHLO wip-cdc-wd.wipro.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753262AbXFLF3c (ORCPT ); Tue, 12 Jun 2007 01:29:32 -0400 Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: James.Bottomley@SteelEye.com Cc: linux-scsi@vger.kernel.org, Kernel Janitors List Replacing (n & (n-1)) in the context of power of 2 checks with is_power_of_2 Signed-off-by: vignesh babu --- diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index ec71061..c416154 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -1130,7 +1131,7 @@ static int esp_reconnect(struct esp *esp) if (!(bits & esp->scsi_id_mask)) goto do_reset; bits &= ~esp->scsi_id_mask; - if (!bits || (bits & (bits - 1))) + if (!is_power_of_2(bits)) goto do_reset; target = ffs(bits) - 1; -- Vignesh Babu BM _____________________________________________________________ "Why is it that every time I'm with you, makes me believe in magic?"