[openib-general] Re: [PATCH 03/22] pHype specific stuff

Christoph Hellwig hch at infradead.org
Sat Feb 18 04:23:17 PST 2006


> +u64 hipz_galpa_load(struct h_galpa galpa, u32 offset)
> +{
> +	u64 addr = galpa.fw_handle + offset;
> +	u64 out;
> +	EDEB_EN(7, "addr=%lx offset=%x ", addr, offset);
> +	out = *(u64 *) addr;

why does this cast an u64 to a pointer?

> +#ifndef EHCA_USERDRIVER
> +inline static int hcall_map_page(u64 physaddr, u64 * mapaddr)
> +{
> +	*mapaddr = (u64)(ioremap(physaddr, 4096));
> +
> +	EDEB(7, "ioremap physaddr=%lx mapaddr=%lx", physaddr, *mapaddr);
> +	return 0;

ioremap returns void __iomem * and casting that to any integer type is
wrong.

> +inline static int hcall_unmap_page(u64 mapaddr)
> +{
> +	EDEB(7, "mapaddr=%lx", mapaddr);
> +	iounmap((void *)(mapaddr));
> +	return 0;

dito for iounmap and casting back.

guys, please run this driver through sparse, thanks.

> +	/* if phype returns LongBusyXXX,
> +	 * we retry several times, but not forever */
> +	for (i = 0; i < 5; i++) {
> +		__asm__ __volatile__("mr 3,%10\n"
> +				     "mr 4,%11\n"
> +				     "mr 5,%12\n"

assembly code under drivers/ is not acceptable.  please create
and <asm/ehca.h> for it or something similar.




More information about the general mailing list