Skip to contentSkip to conversation

Fix compilation for sound/oss/vwsnd.c

PATCH In review Eric Sesterhenn 3 participants 4 messages Mar 23, 2006 – Mar 25, 2006 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix compilation for sound/oss/vwsnd.c

hi,

this patch fixes compilation for sound/oss/vwsnd.o, by moving li_destroy() above li_create()

sound/oss/vwsnd.c:275: warning: conflicting types for ‘li_destroy’ sound/oss/vwsnd.c:275: error: static declaration of ‘li_destroy’ follows non-static declaration sound/oss/vwsnd.c:264: error: previous implicit declaration of ‘li_destroy’ was here

sound/oss/vwsnd.c +20 -20
@@ -247,6 +247,26 @@ typedef struct lithium {
 } lithium_t;
 
 /*
+ * li_destroy destroys the lithium_t structure and vm mappings.
+ */
+
+static void li_destroy(lithium_t *lith)
+{
+	if (lith->page0) {
+		iounmap(lith->page0);
+		lith->page0 = NULL;
+	}
+	if (lith->page1) {
+		iounmap(lith->page1);
+		lith->page1 = NULL;
+	}
+	if (lith->page2) {
+		iounmap(lith->page2);
+		lith->page2 = NULL;
+	}
+}
+
+/*
  * li_create initializes the lithium_t structure and sets up vm mappings
  * to access the registers.
  * Returns 0 on success, -errno on failure.
@@ -268,26 +288,6 @@ static int __init li_create(lithium_t *l
 }
 
 /*
- * li_destroy destroys the lithium_t structure and vm mappings.
- */
-
-static void li_destroy(lithium_t *lith)
-{
-	if (lith->page0) {
-		iounmap(lith->page0);
-		lith->page0 = NULL;
-	}
-	if (lith->page1) {
-		iounmap(lith->page1);
-		lith->page1 = NULL;
-	}
-	if (lith->page2) {
-		iounmap(lith->page2);
-		lith->page2 = NULL;
-	}
-}
-
-/*
  * basic register accessors - read/write long/byte
  */
 
#1 lore raw

sorry,

fixed patch below between all the switching i forgot to remove the declaration in li_create()

sound/oss/vwsnd.c +19 -21
@@ -247,27 +247,6 @@ typedef struct lithium {
 } lithium_t;
 
 /*
- * li_create initializes the lithium_t structure and sets up vm mappings
- * to access the registers.
- * Returns 0 on success, -errno on failure.
- */
-
-static int __init li_create(lithium_t *lith, unsigned long baseaddr)
-{
-	static void li_destroy(lithium_t *);
-
-	spin_lock_init(&lith->lock);
-	lith->page0 = ioremap_nocache(baseaddr + LI_PAGE0_OFFSET, PAGE_SIZE);
-	lith->page1 = ioremap_nocache(baseaddr + LI_PAGE1_OFFSET, PAGE_SIZE);
-	lith->page2 = ioremap_nocache(baseaddr + LI_PAGE2_OFFSET, PAGE_SIZE);
-	if (!lith->page0 || !lith->page1 || !lith->page2) {
-		li_destroy(lith);
-		return -ENOMEM;
-	}
-	return 0;
-}
-
-/*
  * li_destroy destroys the lithium_t structure and vm mappings.
  */
 
@@ -288,6 +267,25 @@ static void li_destroy(lithium_t *lith)
 }
 
 /*
+ * li_create initializes the lithium_t structure and sets up vm mappings
+ * to access the registers.
+ * Returns 0 on success, -errno on failure.
+ */
+
+static int __init li_create(lithium_t *lith, unsigned long baseaddr)
+{
+	spin_lock_init(&lith->lock);
+	lith->page0 = ioremap_nocache(baseaddr + LI_PAGE0_OFFSET, PAGE_SIZE);
+	lith->page1 = ioremap_nocache(baseaddr + LI_PAGE1_OFFSET, PAGE_SIZE);
+	lith->page2 = ioremap_nocache(baseaddr + LI_PAGE2_OFFSET, PAGE_SIZE);
+	if (!lith->page0 || !lith->page1 || !lith->page2) {
+		li_destroy(lith);
+		return -ENOMEM;
+	}
+	return 0;
+}
+
+/*
  * basic register accessors - read/write long/byte
  */
 
#2 lore raw
Quoted 5 lines

sorry,

fixed patch below between all the switching i forgot to remove the declaration in li_create()

It would have been a lot simpler to add a (proper) prototype.

Jan Engelhardt

#3 lore raw
Quoted 7 lines · Jan Engelhardt
Quoted 5 lines

sorry,

fixed patch below between all the switching i forgot to remove the declaration in li_create()

It would have been a lot simpler to add a (proper) prototype.

Eric's patch looks fine.

Quoted 1 line

Jan Engelhardt

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed