All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] unify DMA_..BIT_MASK definitions: v3
@ 2007-09-18 19:27 Borislav Petkov
  2007-09-18 19:41 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 2+ messages in thread
From: Borislav Petkov @ 2007-09-18 19:27 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton
  Cc: Jeremy Fitzhardinge, Muli Ben-Yehuda, Satyam Sharma, amitkale,
	achim_leubner

These patches remove redundant DMA_..BIT_MASK definitions across two
drivers. The computation of the majority of the bitmasks is done by the
compiler. The initial split of the patch touching each a different file got
removed due to possible git bisect breakage.

Andrew, can you please apply this patch for it touches drivers maintained by
different people and there might be responsibility issues, imho.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Muli Ben-Yehuda <muli@il.ibm.com>

 drivers/net/netxen/netxen_nic_main.c |    3 ---
 drivers/scsi/gdth.c                  |    5 -----
 include/linux/dma-mapping.h          |   23 +++++++++++++----------
 3 files changed, 13 insertions(+), 18 deletions(-)

--
Index: b/include/linux/dma-mapping.h
===================================================================
--- a/include/linux/dma-mapping.h	2007-09-18 21:12:30.000000000 +0200
+++ b/include/linux/dma-mapping.h	2007-09-18 21:13:17.000000000 +0200
@@ -13,16 +13,19 @@
 	DMA_NONE = 3,
 };
 
-#define DMA_64BIT_MASK	0xffffffffffffffffULL
-#define DMA_48BIT_MASK	0x0000ffffffffffffULL
-#define DMA_40BIT_MASK	0x000000ffffffffffULL
-#define DMA_39BIT_MASK	0x0000007fffffffffULL
-#define DMA_32BIT_MASK	0x00000000ffffffffULL
-#define DMA_31BIT_MASK	0x000000007fffffffULL
-#define DMA_30BIT_MASK	0x000000003fffffffULL
-#define DMA_29BIT_MASK	0x000000001fffffffULL
-#define DMA_28BIT_MASK	0x000000000fffffffULL
-#define DMA_24BIT_MASK	0x0000000000ffffffULL
+#define DMA_BIT_MASK(n)	((1ULL<<(n))-1)
+
+#define DMA_64BIT_MASK	~0ULL
+#define DMA_48BIT_MASK	DMA_BIT_MASK(48)
+#define DMA_40BIT_MASK	DMA_BIT_MASK(40)
+#define DMA_39BIT_MASK	DMA_BIT_MASK(39)
+#define DMA_35BIT_MASK	DMA_BIT_MASK(35)
+#define DMA_32BIT_MASK	DMA_BIT_MASK(32)
+#define DMA_31BIT_MASK	DMA_BIT_MASK(31)
+#define DMA_30BIT_MASK	DMA_BIT_MASK(30)
+#define DMA_29BIT_MASK	DMA_BIT_MASK(29)
+#define DMA_28BIT_MASK	DMA_BIT_MASK(28)
+#define DMA_24BIT_MASK	DMA_BIT_MASK(24)
 
 static inline int valid_dma_direction(int dma_direction)
 {
Index: b/drivers/net/netxen/netxen_nic_main.c
===================================================================
--- a/drivers/net/netxen/netxen_nic_main.c	2007-09-18 21:13:06.000000000 +0200
+++ b/drivers/net/netxen/netxen_nic_main.c	2007-09-18 21:13:46.000000000 +0200
@@ -54,9 +54,6 @@
 #define NETXEN_ADAPTER_UP_MAGIC 777
 #define NETXEN_NIC_PEG_TUNE 0
 
-#define DMA_32BIT_MASK	0x00000000ffffffffULL
-#define DMA_35BIT_MASK	0x00000007ffffffffULL
-
 /* Local functions to NetXen NIC driver */
 static int __devinit netxen_nic_probe(struct pci_dev *pdev,
 				      const struct pci_device_id *ent);
Index: b/drivers/scsi/gdth.c
===================================================================
--- a/drivers/scsi/gdth.c	2007-09-18 21:12:43.000000000 +0200
+++ b/drivers/scsi/gdth.c	2007-09-18 21:14:06.000000000 +0200
@@ -392,12 +392,7 @@
 #include <linux/proc_fs.h>
 #include <linux/time.h>
 #include <linux/timer.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,6)
 #include <linux/dma-mapping.h>
-#else
-#define DMA_32BIT_MASK	0x00000000ffffffffULL
-#define DMA_64BIT_MASK	0xffffffffffffffffULL
-#endif
 
 #ifdef GDTH_RTC
 #include <linux/mc146818rtc.h>

-- 
Regards/Gruß,
    Boris.

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

* Re: [PATCH 1/1] unify DMA_..BIT_MASK definitions: v3
  2007-09-18 19:27 [PATCH 1/1] unify DMA_..BIT_MASK definitions: v3 Borislav Petkov
@ 2007-09-18 19:41 ` Jeremy Fitzhardinge
  0 siblings, 0 replies; 2+ messages in thread
From: Jeremy Fitzhardinge @ 2007-09-18 19:41 UTC (permalink / raw)
  To: bbpetkov
  Cc: linux-kernel, Andrew Morton, Muli Ben-Yehuda, Satyam Sharma,
	amitkale, achim_leubner

Borislav Petkov wrote:
> +#define DMA_64BIT_MASK	~0ULL
>   

One more tiny nit: this should probably be (parenthesized).

    J

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

end of thread, other threads:[~2007-09-18 19:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-18 19:27 [PATCH 1/1] unify DMA_..BIT_MASK definitions: v3 Borislav Petkov
2007-09-18 19:41 ` Jeremy Fitzhardinge

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.