Re: [PATCH 03/22] pHype specific stuff

From: Christoph Hellwig
Date: Sat Feb 18 2006 - 07:21:06 EST


> +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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/