lkml.org 
[lkml]   [2000]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] [drivers/sound] ld2() moved to include

Hi

This is cleanup patch... 9 sound drivers use the same logarithm base 2
inline... so patch moves it to drivers/sound/ld2.h

BTW: drivers/usb/devio.c and audio.c also uses this ld2() inline

Regards
--
Bartlomiej Zolnierkiewicz
<bkz@linux-ide.org>
diff -uNr linux-240t11p2/drivers/sound/cmpci.c linux/drivers/sound/cmpci.c
--- linux-240t11p2/drivers/sound/cmpci.c Tue Oct 3 14:27:47 2000
+++ linux/drivers/sound/cmpci.c Fri Nov 10 22:50:44 2000
@@ -120,6 +120,7 @@
#include <asm/hardirq.h>

#include "dm.h"
+#include "ld2.h"

/* --------------------------------------------------------------------- */

@@ -315,31 +316,6 @@
static unsigned long wavetable_mem = 0;

/* --------------------------------------------------------------------- */
-
-extern __inline__ unsigned ld2(unsigned int x)
-{
- unsigned r = 0;
-
- if (x >= 0x10000) {
- x >>= 16;
- r += 16;
- }
- if (x >= 0x100) {
- x >>= 8;
- r += 8;
- }
- if (x >= 0x10) {
- x >>= 4;
- r += 4;
- }
- if (x >= 4) {
- x >>= 2;
- r += 2;
- }
- if (x >= 2)
- r++;
- return r;
-}

/*
* hweightN: returns the hamming weight (i.e. the number
diff -uNr linux-240t11p2/drivers/sound/cs46xx.c linux/drivers/sound/cs46xx.c
--- linux-240t11p2/drivers/sound/cs46xx.c Tue Oct 3 14:27:47 2000
+++ linux/drivers/sound/cs46xx.c Fri Nov 10 22:48:09 2000
@@ -50,6 +50,7 @@
#include <asm/hardirq.h>

#include "cs461x.h"
+#include "ld2.h"

#define ADC_RUNNING 1
#define DAC_RUNNING 2
@@ -225,32 +226,6 @@
static int cs_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg);
static loff_t cs_llseek(struct file *file, loff_t offset, int origin);
-
-extern __inline__ unsigned ld2(unsigned int x)
-{
- unsigned r = 0;
-
- if (x >= 0x10000) {
- x >>= 16;
- r += 16;
- }
- if (x >= 0x100) {
- x >>= 8;
- r += 8;
- }
- if (x >= 0x10) {
- x >>= 4;
- r += 4;
- }
- if (x >= 4) {
- x >>= 2;
- r += 2;
- }
- if (x >= 2)
- r++;
- return r;
-}
-

/*
* common I/O routines
diff -uNr linux-240t11p2/drivers/sound/es1370.c linux/drivers/sound/es1370.c
--- linux-240t11p2/drivers/sound/es1370.c Tue Oct 31 02:02:21 2000
+++ linux/drivers/sound/es1370.c Fri Nov 10 22:49:50 2000
@@ -158,6 +158,8 @@
#include <asm/uaccess.h>
#include <asm/hardirq.h>

+#include "ld2.h"
+
/* --------------------------------------------------------------------- */

#undef OSS_DOCUMENTED_MIXER_SEMANTICS
@@ -386,33 +388,6 @@
* cross a page boundary and ensures dword alignment for the DMA engine
*/
static unsigned char bugbuf[16] __attribute__ ((aligned (16)));
-
-/* --------------------------------------------------------------------- */
-
-extern inline unsigned ld2(unsigned int x)
-{
- unsigned r = 0;
-
- if (x >= 0x10000) {
- x >>= 16;
- r += 16;
- }
- if (x >= 0x100) {
- x >>= 8;
- r += 8;
- }
- if (x >= 0x10) {
- x >>= 4;
- r += 4;
- }
- if (x >= 4) {
- x >>= 2;
- r += 2;
- }
- if (x >= 2)
- r++;
- return r;
-}

/* --------------------------------------------------------------------- */

diff -uNr linux-240t11p2/drivers/sound/es1371.c linux/drivers/sound/es1371.c
--- linux-240t11p2/drivers/sound/es1371.c Tue Oct 31 02:02:21 2000
+++ linux/drivers/sound/es1371.c Fri Nov 10 22:49:28 2000
@@ -128,6 +128,8 @@
#include <asm/uaccess.h>
#include <asm/hardirq.h>

+#include "ld2.h"
+
/* --------------------------------------------------------------------- */

#undef OSS_DOCUMENTED_MIXER_SEMANTICS
@@ -450,33 +452,6 @@
/* --------------------------------------------------------------------- */

static LIST_HEAD(devs);
-
-/* --------------------------------------------------------------------- */
-
-extern inline unsigned ld2(unsigned int x)
-{
- unsigned r = 0;
-
- if (x >= 0x10000) {
- x >>= 16;
- r += 16;
- }
- if (x >= 0x100) {
- x >>= 8;
- r += 8;
- }
- if (x >= 0x10) {
- x >>= 4;
- r += 4;
- }
- if (x >= 4) {
- x >>= 2;
- r += 2;
- }
- if (x >= 2)
- r++;
- return r;
-}

/* --------------------------------------------------------------------- */

diff -uNr linux-240t11p2/drivers/sound/esssolo1.c linux/drivers/sound/esssolo1.c
--- linux-240t11p2/drivers/sound/esssolo1.c Tue Oct 3 14:27:48 2000
+++ linux/drivers/sound/esssolo1.c Fri Nov 10 22:51:01 2000
@@ -96,6 +96,7 @@
#include <asm/hardirq.h>

#include "dm.h"
+#include "ld2.h"

/* --------------------------------------------------------------------- */

@@ -297,33 +298,6 @@
{
outb(reg, s->sbbase+4);
return inb(s->sbbase+5);
-}
-
-/* --------------------------------------------------------------------- */
-
-extern inline unsigned ld2(unsigned int x)
-{
- unsigned r = 0;
-
- if (x >= 0x10000) {
- x >>= 16;
- r += 16;
- }
- if (x >= 0x100) {
- x >>= 8;
- r += 8;
- }
- if (x >= 0x10) {
- x >>= 4;
- r += 4;
- }
- if (x >= 4) {
- x >>= 2;
- r += 2;
- }
- if (x >= 2)
- r++;
- return r;
}

/* --------------------------------------------------------------------- */
diff -uNr linux-240t11p2/drivers/sound/i810_audio.c linux/drivers/sound/i810_audio.c
--- linux-240t11p2/drivers/sound/i810_audio.c Fri Nov 10 14:28:44 2000
+++ linux/drivers/sound/i810_audio.c Fri Nov 10 22:49:03 2000
@@ -87,6 +87,8 @@
#include <asm/uaccess.h>
#include <asm/hardirq.h>

+#include "ld2.h"
+
#ifndef PCI_DEVICE_ID_INTEL_82801
#define PCI_DEVICE_ID_INTEL_82801 0x2415
#endif
@@ -322,31 +324,6 @@
static int i810_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg);
static loff_t i810_llseek(struct file *file, loff_t offset, int origin);
-
-extern __inline__ unsigned ld2(unsigned int x)
-{
- unsigned r = 0;
-
- if (x >= 0x10000) {
- x >>= 16;
- r += 16;
- }
- if (x >= 0x100) {
- x >>= 8;
- r += 8;
- }
- if (x >= 0x10) {
- x >>= 4;
- r += 4;
- }
- if (x >= 4) {
- x >>= 2;
- r += 2;
- }
- if (x >= 2)
- r++;
- return r;
-}

static u16 i810_ac97_get(struct ac97_codec *dev, u8 reg);
static void i810_ac97_set(struct ac97_codec *dev, u8 reg, u16 data);
diff -uNr linux-240t11p2/drivers/sound/ld2.h linux/drivers/sound/ld2.h
--- linux-240t11p2/drivers/sound/ld2.h Thu Jan 1 01:00:00 1970
+++ linux/drivers/sound/ld2.h Fri Nov 10 22:46:19 2000
@@ -0,0 +1,30 @@
+
+#ifndef __LD2_H
+#define __LD2_H
+
+extern __inline__ unsigned ld2(unsigned int x)
+{
+ unsigned r = 0;
+
+ if (x >= 0x10000) {
+ x >>= 16;
+ r += 16;
+ }
+ if (x >= 0x100) {
+ x >>= 8;
+ r += 8;
+ }
+ if (x >= 0x10) {
+ x >>= 4;
+ r += 4;
+ }
+ if (x >= 4) {
+ x >>= 2;
+ r += 2;
+ }
+ if (x >= 2)
+ r++;
+ return r;
+}
+
+#endif __LD2_H
diff -uNr linux-240t11p2/drivers/sound/maestro.c linux/drivers/sound/maestro.c
--- linux-240t11p2/drivers/sound/maestro.c Tue Oct 3 00:18:26 2000
+++ linux/drivers/sound/maestro.c Fri Nov 10 22:50:24 2000
@@ -201,6 +201,8 @@
#include <linux/smp_lock.h>
#include <linux/wrapper.h>

+#include "ld2.h"
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)

#define DECLARE_WAITQUEUE(QUEUE,INIT) struct wait_queue QUEUE = {INIT, NULL}
@@ -476,33 +478,6 @@
int bob_freq;
char dsps_open;
};
-
-static unsigned
-ld2(unsigned int x)
-{
- unsigned r = 0;
-
- if (x >= 0x10000) {
- x >>= 16;
- r += 16;
- }
- if (x >= 0x100) {
- x >>= 8;
- r += 8;
- }
- if (x >= 0x10) {
- x >>= 4;
- r += 4;
- }
- if (x >= 4) {
- x >>= 2;
- r += 2;
- }
- if (x >= 2)
- r++;
- return r;
-}
-

/* --------------------------------------------------------------------- */

diff -uNr linux-240t11p2/drivers/sound/sonicvibes.c linux/drivers/sound/sonicvibes.c
--- linux-240t11p2/drivers/sound/sonicvibes.c Tue Oct 31 02:02:21 2000
+++ linux/drivers/sound/sonicvibes.c Fri Nov 10 22:51:17 2000
@@ -113,6 +113,7 @@
#include <asm/hardirq.h>

#include "dm.h"
+#include "ld2.h"

/* --------------------------------------------------------------------- */

@@ -362,31 +363,6 @@
static unsigned long wavetable_mem = 0;

/* --------------------------------------------------------------------- */
-
-extern __inline__ unsigned ld2(unsigned int x)
-{
- unsigned r = 0;
-
- if (x >= 0x10000) {
- x >>= 16;
- r += 16;
- }
- if (x >= 0x100) {
- x >>= 8;
- r += 8;
- }
- if (x >= 0x10) {
- x >>= 4;
- r += 4;
- }
- if (x >= 4) {
- x >>= 2;
- r += 2;
- }
- if (x >= 2)
- r++;
- return r;
-}

/*
* hweightN: returns the hamming weight (i.e. the number
diff -uNr linux-240t11p2/drivers/sound/trident.c linux/drivers/sound/trident.c
--- linux-240t11p2/drivers/sound/trident.c Fri Nov 10 14:28:44 2000
+++ linux/drivers/sound/trident.c Fri Nov 10 22:47:39 2000
@@ -125,6 +125,7 @@
#include <linux/proc_fs.h>

#include "trident.h"
+#include "ld2.h"

#include <linux/pm.h>

diff -uNr linux-240t11p2/drivers/sound/trident.h linux/drivers/sound/trident.h
--- linux-240t11p2/drivers/sound/trident.h Fri Oct 27 19:58:33 2000
+++ linux/drivers/sound/trident.h Fri Nov 10 22:47:18 2000
@@ -317,30 +317,5 @@
#define VALIDATE_STATE(a) VALIDATE_MAGIC(a,TRIDENT_STATE_MAGIC)
#define VALIDATE_CARD(a) VALIDATE_MAGIC(a,TRIDENT_CARD_MAGIC)

-extern __inline__ unsigned ld2(unsigned int x)
-{
- unsigned r = 0;
-
- if (x >= 0x10000) {
- x >>= 16;
- r += 16;
- }
- if (x >= 0x100) {
- x >>= 8;
- r += 8;
- }
- if (x >= 0x10) {
- x >>= 4;
- r += 4;
- }
- if (x >= 4) {
- x >>= 2;
- r += 2;
- }
- if (x >= 2)
- r++;
- return r;
-}
-
#endif /* __TRID4DWAVE_H */
\
 
 \ /
  Last update: 2005-03-22 12:45    [W:0.047 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site