linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libata-2.6] AHCI: compiler warning fix
@ 2005-03-11 21:21 Brett Russ
  2005-03-12  4:58 ` Jeff Garzik
  2005-03-23  5:15 ` Jeff Garzik
  0 siblings, 2 replies; 4+ messages in thread
From: Brett Russ @ 2005-03-11 21:21 UTC (permalink / raw)
  To: linux-ide

This fixes the compile warning below, which seems due to the enum
being signed:
drivers/scsi/ahci.c:199: warning: overflow in implicit constant
conversion

Signed-off-by: Brett Russ <russb@emc.com>

===== drivers/scsi/ahci.c 1.17 vs edited =====
--- 1.17/drivers/scsi/ahci.c	Thu Feb 24 14:52:41 2005
+++ edited/drivers/scsi/ahci.c	Wed Mar  9 17:29:36 2005
@@ -44,7 +44,6 @@
 enum {
 	AHCI_PCI_BAR		= 5,
 	AHCI_MAX_SG		= 168, /* hardware max is 64K */
-	AHCI_DMA_BOUNDARY	= 0xffffffff,
 	AHCI_USE_CLUSTERING	= 0,
 	AHCI_CMD_SLOT_SZ	= 32 * 32,
 	AHCI_RX_FIS_SZ		= 256,
@@ -135,6 +134,8 @@
 	PORT_CMD_ICC_SLUMBER	= (0x6 << 28), /* Put i/f in slumber state */
 };
 
+#define AHCI_DMA_BOUNDARY	0xffffffff
+
 struct ahci_cmd_hdr {
 	u32			opts;
 	u32			status;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH libata-2.6] AHCI: compiler warning fix
  2005-03-11 21:21 [PATCH libata-2.6] AHCI: compiler warning fix Brett Russ
@ 2005-03-12  4:58 ` Jeff Garzik
  2005-03-23  5:15 ` Jeff Garzik
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2005-03-12  4:58 UTC (permalink / raw)
  To: Brett Russ; +Cc: linux-ide

Brett Russ wrote:
> This fixes the compile warning below, which seems due to the enum
> being signed:
> drivers/scsi/ahci.c:199: warning: overflow in implicit constant
> conversion
> 
> Signed-off-by: Brett Russ <russb@emc.com>
> 
> ===== drivers/scsi/ahci.c 1.17 vs edited =====
> --- 1.17/drivers/scsi/ahci.c	Thu Feb 24 14:52:41 2005
> +++ edited/drivers/scsi/ahci.c	Wed Mar  9 17:29:36 2005
> @@ -44,7 +44,6 @@
>  enum {
>  	AHCI_PCI_BAR		= 5,
>  	AHCI_MAX_SG		= 168, /* hardware max is 64K */
> -	AHCI_DMA_BOUNDARY	= 0xffffffff,
>  	AHCI_USE_CLUSTERING	= 0,
>  	AHCI_CMD_SLOT_SZ	= 32 * 32,
>  	AHCI_RX_FIS_SZ		= 256,
> @@ -135,6 +134,8 @@
>  	PORT_CMD_ICC_SLUMBER	= (0x6 << 28), /* Put i/f in slumber state */
>  };
>  
> +#define AHCI_DMA_BOUNDARY	0xffffffff

hmmmm, I think there's a better way to fix this.  A separate enum, and 
adding the suffix 'UL' to 0xffffffff should work, I would think.

In general, I try to avoid adding #defines of any nature.  It's just as 
efficient as an enum, and type/symbol information is available to the 
compiler and debugger when you use an enum.

	Jeff




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH libata-2.6] AHCI: compiler warning fix
  2005-03-11 21:21 [PATCH libata-2.6] AHCI: compiler warning fix Brett Russ
  2005-03-12  4:58 ` Jeff Garzik
@ 2005-03-23  5:15 ` Jeff Garzik
  2005-03-23 22:01   ` Brett Russ
  1 sibling, 1 reply; 4+ messages in thread
From: Jeff Garzik @ 2005-03-23  5:15 UTC (permalink / raw)
  To: Brett Russ; +Cc: linux-ide

Brett Russ wrote:
> This fixes the compile warning below, which seems due to the enum
> being signed:
> drivers/scsi/ahci.c:199: warning: overflow in implicit constant
> conversion
> 
> Signed-off-by: Brett Russ <russb@emc.com>
> 
> ===== drivers/scsi/ahci.c 1.17 vs edited =====
> --- 1.17/drivers/scsi/ahci.c	Thu Feb 24 14:52:41 2005
> +++ edited/drivers/scsi/ahci.c	Wed Mar  9 17:29:36 2005
> @@ -44,7 +44,6 @@
>  enum {
>  	AHCI_PCI_BAR		= 5,
>  	AHCI_MAX_SG		= 168, /* hardware max is 64K */
> -	AHCI_DMA_BOUNDARY	= 0xffffffff,
>  	AHCI_USE_CLUSTERING	= 0,
>  	AHCI_CMD_SLOT_SZ	= 32 * 32,
>  	AHCI_RX_FIS_SZ		= 256,
> @@ -135,6 +134,8 @@
>  	PORT_CMD_ICC_SLUMBER	= (0x6 << 28), /* Put i/f in slumber state */
>  };
>  
> +#define AHCI_DMA_BOUNDARY	0xffffffff
> +

I really don't like defines.  They aren't visible to debuggers and other 
post-cpp checking tools.

It should kill the warning if you move it into a separate enum, and add 
a UL suffix to the constant, I should think?

	Jeff




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH libata-2.6] AHCI: compiler warning fix
  2005-03-23  5:15 ` Jeff Garzik
@ 2005-03-23 22:01   ` Brett Russ
  0 siblings, 0 replies; 4+ messages in thread
From: Brett Russ @ 2005-03-23 22:01 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide

Jeff,

This fixes the compile warning below:
drivers/scsi/ahci.c:199: warning: overflow in implicit constant
conversion

This has been sitting in my dir for a while now, sorry for not sending
it sooner.  It turns out that moving the AHCI_DMA_BOUNDARY to the
*bottom* of the current enum also works, since by that point the
compiler can determine that there is no signed data in the enum.
However, I think your suggestion (implemented below) is cleaner
because it doesn't rely on luck to keep the current enum unsigned--it
instead creates a new one intended for unsigned data only.

Signed-off-by: Brett Russ <russb@emc.com>

===== drivers/scsi/ahci.c 1.17 vs edited =====
Index: libata-2.6/drivers/scsi/ahci.c
===================================================================
--- libata-2.6.orig/drivers/scsi/ahci.c	2005-03-11 13:57:22.000000000 -0500
+++ libata-2.6/drivers/scsi/ahci.c	2005-03-12 15:35:58.000000000 -0500
@@ -44,7 +44,6 @@
 enum {
 	AHCI_PCI_BAR		= 5,
 	AHCI_MAX_SG		= 168, /* hardware max is 64K */
-	AHCI_DMA_BOUNDARY	= 0xffffffff,
 	AHCI_USE_CLUSTERING	= 0,
 	AHCI_CMD_SLOT_SZ	= 32 * 32,
 	AHCI_RX_FIS_SZ		= 256,
@@ -135,6 +134,12 @@
 	PORT_CMD_ICC_SLUMBER	= (0x6 << 28), /* Put i/f in slumber state */
 };
 
+/* This enum is intended to be strictly for unsigned data
+ */
+enum {
+	AHCI_DMA_BOUNDARY	= 0xffffffffUL
+};
+
 struct ahci_cmd_hdr {
 	u32			opts;
 	u32			status;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-23 22:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-11 21:21 [PATCH libata-2.6] AHCI: compiler warning fix Brett Russ
2005-03-12  4:58 ` Jeff Garzik
2005-03-23  5:15 ` Jeff Garzik
2005-03-23 22:01   ` Brett Russ

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).