public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb•de>
To: linuxppc-dev@ozlabs•org
Subject: Re: [PATCH 1/9] powerpc/44x: Add PowerPC 44x simple platform support
Date: Wed, 20 Aug 2008 15:33:21 +0200	[thread overview]
Message-ID: <200808201533.22258.arnd@arndb.de> (raw)
In-Reply-To: <496103659f7b122a8301703b055ef4c6bd3092af.1219160188.git.jwboyer@linux.vnet.ibm.com>

On Tuesday 19 August 2008, Josh Boyer wrote:
> This adds a common board file for almost all of the "simple" PowerPC 44x
> boards that exist today.  This is intended to be a single place to add
> support for boards that do not differ in platform support from most of the
> evaluation boards that are used as reference platforms.  Boards that have
> specific requirements or custom hardware setup should still have their own
> board.c file.

The code looks correct, but since this is going to be example code
that may get copied into other platforms, I would take extra care
for coding style:

> +#include <linux/init.h>
> +#include <linux/of_platform.h>
> +
> +#include <asm/machdep.h>
> +#include <asm/prom.h>
> +#include <asm/udbg.h>
> +#include <asm/time.h>
> +#include <asm/uic.h>
> +#include <asm/pci-bridge.h>
> +#include <asm/ppc4xx.h>

#include lines should be ordered alphabetically in an ideal world.

> +static char *board[] __initdata = {
> +	"amcc,bamboo",
> +	"amcc,cayonlands",
> +	"ibm,ebony",
> +	"amcc,katmai",
> +	"amcc,rainier",
> +	"amcc,sequoia",
> +	"amcc,taishan",
> +	NULL
> +};

You don't need the NULL termination here, since the array is only
used statically and you can use ARRAY_SIZE().

> +static int __init ppc44x_probe(void)
> +{
> +	unsigned long root = of_get_flat_dt_root();
> +	int i = 0;
> +
> +	while (board[i]) {
> +		if (of_flat_dt_is_compatible(root, board[i]))
> +			break;
> +		i++;
> +	}

This looks like a for() loop in disguise, so you can better write
it as

	int i;
	for (i = 0; i < ARRAY_SIZE(board); i++) {
		if (of_flat_dt_is_compatible(root, board[i])) {
			ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC;
			return 1;
		}
	}
	return 0;


	Arnd <><

  reply	other threads:[~2008-08-20 13:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-19 15:36 [PATCH 0/9] Rework PowerPC 44x board support Josh Boyer
2008-08-19 15:25 ` [PATCH 1/9] powerpc/44x: Add PowerPC 44x simple platform support Josh Boyer
2008-08-20 13:33   ` Arnd Bergmann [this message]
2008-08-20 14:03     ` Josh Boyer
2008-08-20 14:15     ` Grant Likely
2008-08-20 14:45       ` Josh Boyer
2008-08-20 15:19         ` Josh Boyer
2008-08-20 16:33         ` Roland Dreier
2008-08-20 17:11           ` Josh Boyer
2008-08-20 17:19             ` Roland Dreier
2008-08-20 17:35               ` Josh Boyer
2008-08-20 21:15                 ` Roland Dreier
2008-08-19 15:26 ` [PATCH 2/9] powerpc/44x: Migrate Bamboo support to ppc44x_simple Josh Boyer
2008-08-19 15:26 ` [PATCH 3/9] powerpc/44x: Migrate Canyonlands " Josh Boyer
2008-08-19 15:26 ` [PATCH 4/9] powerpc/44x: Migrate Katmai " Josh Boyer
2008-08-19 15:26 ` [PATCH 5/9] powerpc/44x: Migrate Rainier " Josh Boyer
2008-08-19 15:26 ` [PATCH 6/9] powerpc/44x: Migrate Sequoia " Josh Boyer
2008-08-19 15:26 ` [PATCH 7/9] powerpc/44x: Migrate Taishan " Josh Boyer
2008-08-19 15:27 ` [PATCH 8/9] powerpc/44x: Add explicit support for AMCC Glacier Josh Boyer
2008-08-19 15:27 ` [PATCH 9/9] powerpc/44x: Add explicit Yosemite support Josh Boyer
2008-08-19 18:26 ` [PATCH 0/9] Rework PowerPC 44x board support Stefan Roese
2008-08-19 18:45   ` Josh Boyer
2008-08-20 16:54     ` prodyut hazarika
2008-08-20 17:09       ` Josh Boyer
2008-08-20 16:51 ` Valentine Barshak
2008-08-20 17:08   ` Josh Boyer

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=200808201533.22258.arnd@arndb.de \
    --to=arnd@arndb$(echo .)de \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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