Subject: Re: [PATCH 06/16] ehca: common include files

From: Arnd Bergmann <[email-masked]>
Date: Thu, 27 Apr 2006 13:19:06 +0200

On Thursday 27 April 2006 12:48, Heiko J Schick wrote:

> +/**
> + * ehca_adr_bad - Handle to be used for adress translation mechanisms,
> + * currently a placeholder.
> + */
> +inline static int ehca_adr_bad(void *adr)

'static inline', not 'inline static', by convention.

> +/* We will remove this lines in SVN when it is included in the Linux kernel.
> + * We don't want to introducte unnecessary dependencies to a patched kernel.
> + */
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)

Well, you should also remove this for submission, I guess ;-)

> +#define EHCA_EDEB_TRACE_MASK_SIZE 32
> +extern u8 ehca_edeb_mask[EHCA_EDEB_TRACE_MASK_SIZE];
> +#define EDEB_ID_TO_U32(str4) (str4[3] | (str4[2] << 8) | (str4[1] << 16) | \
> +			      (str4[0] << 24))
> +
> +inline static u64 ehca_edeb_filter(const u32 level,
> +				   const u32 id, const u32 line)

'static inline' again. best grep all your source for this, there are probably
more places.

> +{
> +	u64 ret = 0;
> +	u32 filenr = 0;
> +	u32 filter_level = 9;
> +	u32 dynamic_level = 0;
> +
> +	/* This is code written for the gcc -O2 optimizer which should colapse
> +	 * to two single ints filter_level is the first level kicked out by
> +	 * compiler means trace everythin below 6. */
> +	if (id == EDEB_ID_TO_U32("ehav")) {
> +		filenr = 0x01;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("clas")) {
> +		filenr = 0x02;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("cqeq")) {
> +		filenr = 0x03;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("shca")) {
> +		filenr = 0x05;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("eirq")) {
> +		filenr = 0x06;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("lMad")) {
> +		filenr = 0x07;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("mcas")) {
> +		filenr = 0x08;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("mrmw")) {
> +		filenr = 0x09;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("vpd ")) {
> +		filenr = 0x0a;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("e_qp")) {
> +		filenr = 0x0b;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("uqes")) {
> +		filenr = 0x0c;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("PHYP")) {
> +		filenr = 0x0d;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("hcpi")) {
> +		filenr = 0x0e;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("iptz")) {
> +		filenr = 0x0f;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("spta")) {
> +		filenr = 0x10;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("simp")) {
> +		filenr = 0x11;
> +		filter_level = 8;
> +	}
> +	if (id == EDEB_ID_TO_U32("reqs")) {
> +		filenr = 0x12;
> +		filter_level = 8;
> +	}

I guess you can convert that to

switch (id) {
	case EBEB_ID_CLAS:
		...
	case EDEB_ID_CQEQ:
		...
}

> +
> +#ifdef EHCA_USE_HCALL_KERNEL
> +#ifdef CONFIG_PPC_PSERIES
> +
> +#include <asm/paca.h>
> +

You could make everything down from here a separate header
for hcall.