Skip to contentSkip to conversation

+ add-cpia2-camera-support.patch added to -mm tree

DISCUSSION Arjan van de Ven 3 participants 3 messages Feb 24, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 28 lines
(quoted diff) +27 -0
+
+/* Here we want the physical address of the memory.
+ * This is used when initializing the contents of the
+ * area and marking the pages as reserved.
+ */
+static inline unsigned long kvirt_to_pa(unsigned long adr)
+{
+	unsigned long kva, ret;
+
+        kva = (unsigned long) page_address(vmalloc_to_page((void *)adr));
+        kva |= adr & (PAGE_SIZE-1); /* restore the offset */
+	ret = __pa(kva);
+	return ret;
+}
+
+static void *rvmalloc(unsigned long size)
+{
+	void *mem;
+	unsigned long adr;
+
+	/* Round it off to PAGE_SIZE */
+	size = PAGE_ALIGN(size);
+
+	mem = vmalloc_32(size);
+	if (!mem)
+		return NULL;
+

Review

Quoted 10 lines
(quoted diff) +10 -0
+	memset(mem, 0, size);	/* Clear the ram out, no junk to the user */
+	adr = (unsigned long) mem;
+
+	while ((long)size > 0) {
+		SetPageReserved(vmalloc_to_page((void *)adr));
+		adr += PAGE_SIZE;
+		size -= PAGE_SIZE;
+	}
+	return mem;
+}

you are adding rvmalloc copy number 14; seems you own the task to make it generic now ;)
Also I thought SetPageReserved and friends are deprecated :)

Review

Quoted 5 lines
(quoted diff) +5 -0
+struct camera_data {
+	/* locks */
+	struct semaphore busy_lock;	/* guard against SMP multithreading */
+	struct v4l2_prio_state prio;
+

please make this use mutexes; adding new semaphores for no reason is not a good idea...

#2 lore raw
Quoted 3 lines · Arjan van de Ven

you are adding rvmalloc copy number 14; seems you own the task to make it generic now ;)
Also I thought SetPageReserved and friends are deprecated :)

Heading that way, which is fine by me.

Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+struct camera_data {
+	/* locks */
+	struct semaphore busy_lock;	/* guard against SMP multithreading */
+	struct v4l2_prio_state prio;
+

please make this use mutexes; adding new semaphores for no reason is not a good idea...

Good idea.

#3 lore raw
Quoted 6 lines · Alan Cox
Quoted 3 lines · Arjan van de Ven

you are adding rvmalloc copy number 14; seems you own the task to make it generic now ;)
Also I thought SetPageReserved and friends are deprecated :)

Heading that way, which is fine by me.

Just go with what you have: one day one of us will come along and vanish all those rvmallocs and SetPageReserveds; but until that day it's easiest for everyone if you continue with your rvmalloc #14.

Hugh