Re: [patch -mm series] ia64 specific /dev/mem handlers

From: Christoph Hellwig <hch_at_infradead.org>
Date: 2005-02-24 09:34:04
> +		page = pfn_to_page(p >> PAGE_SHIFT);
> +		/*
> +		 * On ia64 if a page has been mapped somewhere as
> +		 * uncached, then it must also be accessed uncached
> +		 * by the kernel or data corruption may occur
> +		 */
> +#ifdef ARCH_HAS_TRANSLATE_MEM_PTR
> +		ptr = arch_translate_mem_ptr(page, p);
> +#else
> +		ptr = __va(p);
> +#endif

Please remove the ifdef by letting every architecture implement a
arch_translate_mem_ptr (and give it a saner name while you're at it).

Also shouldn't the pfn_to_page be done inside arch_translate_mem_ptr?
The struct page * isn't used anywhere else.

> +	if (!range_is_allowed(p, p + count))

isn't the name a little too generic?

> +
> +	written = 0;
> +
> +#if defined(__sparc__) || (defined(__mc68000__) && defined(CONFIG_MMU))
> +	/* we don't have page 0 mapped on sparc and m68k.. */
> +	if (p < PAGE_SIZE) {
> +		unsigned long sz = PAGE_SIZE - p;
> +		if (sz > count)
> +			sz = count; 
> +		/* Hmm. Do something? */
> +		buf += sz;
> +		p += sz;
> +		count -= sz;
> +		written += sz;
> +	}
> +#endif

While you're at it replace the ifdef mania with a #ifdef
__HAVE_ARCH_PAGE_ZERO_MAPPED or something similar.

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Feb 23 17:39:56 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:36 EST