LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Cc: linuxppc-dev@ozlabs.org, git-dev@xilinx.com
Subject: Re: [PATCH] [RFC][POWERPC] refactor dcr code
Date: Tue, 25 Mar 2008 13:37:37 +1100	[thread overview]
Message-ID: <20080325133737.21b8724d.sfr@canb.auug.org.au> (raw)
In-Reply-To: <20080324232835.A0AFA1B58093@mail17-dub.bigfish.com>

[-- Attachment #1: Type: text/plain, Size: 2587 bytes --]

Hi Stephen,

Just some trivial issues ...

On Mon, 24 Mar 2008 16:28:33 -0700 Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> wrote:
>
> +++ b/arch/powerpc/sysdev/dcr.c
> @@ -23,6 +23,67 @@
>  #include <asm/prom.h>
>  #include <asm/dcr.h>
>  
> +#if defined(CONFIG_PPC_DCR_NATIVE) && defined(CONFIG_PPC_DCR_MMIO)
> +
> +bool dcr_map_ok_generic(dcr_host_t host) {
> +	if(host.type == INVALID) {
          ^
Space, please.

> +		return 0;
> +	} else if(host.type == NATIVE) {

And again.  And more below.

> +		return dcr_map_ok_native(host.host.native);
> +	} else {
> +		return dcr_map_ok_mmio(host.host.mmio);
> +	}

You don't need the braces around each if/else clause. Again, more below.

> +dcr_host_t dcr_map_generic(struct device_node *dev, unsigned int dcr_n,
> +				 unsigned int dcr_c) {
> +	dcr_host_t host;
> +	const char *prop = of_get_property(dev, "dcr-access-method", NULL);
> +       	if(!strcmp(prop, "native")) {

Indentation.  We also usually separate declarations from code with a a
blank line.

> -dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
> +dcr_host_mmio_t dcr_map_mmio(struct device_node *dev, unsigned int dcr_n,
>  		   unsigned int dcr_c)
>  {
> -	dcr_host_t ret = { .token = NULL, .stride = 0, .base = dcr_n };
> +	dcr_host_mmio_t ret = { .token = NULL, .stride = 0, .base = dcr_n };
>  	u64 addr;
>  
>  	pr_debug("dcr_map(%s, 0x%x, 0x%x)\n",
>  		 dev->full_name, dcr_n, dcr_c);
>  
>  	addr = of_translate_dcr_address(dev, dcr_n, &ret.stride);
> -	pr_debug("translates to addr: 0x%lx, stride: 0x%x\n",
> +	pr_debug("translates to addr: 0x%p, stride: 0x%x\n",
>  		 addr, ret.stride);

This change should cause a warning because you are passing a u64 where
printk is expecting a pointer.  We usually use %llx and cast the u64 to
unsigned long long.

> +++ b/include/asm-powerpc/dcr-mmio.h
> @@ -27,20 +27,20 @@ typedef struct {
>  	void __iomem *token;
>  	unsigned int stride;
>  	unsigned int base;
> -} dcr_host_t;
> +} dcr_host_mmio_t;
>  
> -#define DCR_MAP_OK(host)	((host).token != NULL)
> +#define dcr_map_ok_mmio(host)	((host).token != NULL)

This could be a static inline function.

> +++ b/include/asm-powerpc/dcr-native.h
> @@ -24,14 +24,14 @@
>  
>  typedef struct {
>  	unsigned int base;
> -} dcr_host_t;
> +} dcr_host_native_t;
>  
> -#define DCR_MAP_OK(host)	(1)
> +#define dcr_map_ok_native(host)	(1)

As could this.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

      reply	other threads:[~2008-03-25  2:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-24 23:28 [PATCH] [RFC][POWERPC] refactor dcr code Stephen Neuendorffer
2008-03-25  2:37 ` Stephen Rothwell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080325133737.21b8724d.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=git-dev@xilinx.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=stephen.neuendorffer@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox