All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Nicolas DET <nd@bplan-gmbh.de>
Cc: linuxppc-dev@ozlabs.org, sl@bplan-gmbh.de, linuxppc-embedded@ozlabs.org
Subject: Re: [PATCH/RFC] powerpc: Add Efika platform support
Date: Sun, 05 Nov 2006 10:45:25 +1100	[thread overview]
Message-ID: <1162683925.28571.93.camel@localhost.localdomain> (raw)
In-Reply-To: <454A5A61.6080800@bplan-gmbh.de>

On Thu, 2006-11-02 at 21:52 +0100, Nicolas DET wrote:

> Well. there was other init done here before. However, I think it's good 
> to have this here, in case more code would be needed or in the 
> ppc_md.init_IRQ is changed. no ?

No. Hook it directly. Don't solve problems you don't have. If you ever
need to do other inits there, you can change it back.

> Well. It it doesn't hurt it can stay here. People are a little bit weird 
> today. Maybe they would try to solder a PCI southbridige to get a nice 
> PC speaker beep ;-)

Yeah, doesn't hurt.

On a general note about your patches: Don't reply and post a new patch
in the same email. Reply, then separately, post patches using the proper
format for patch submission. That is, a changelog comment, a
Signed-off-by: line followed by the patch.

If you want to have off-the-record comments, add "---" after the
Signed-off-by: line and insert your comments between that and the patch
itself, they will be stripped when commiting to git.

Ben.

> * Efika 5K2 platform setup
> + * Some code really inspired from the lite5200b platform.

No (c) ?

> + * 
> + * This file is licensed under the terms of the GNU General Public License
> + * version 2. This program is licensed "as is" without any warranty of any
> + * kind, whether express or implied.
> + *
> + */
> +
> +#include <linux/errno.h>
> +#include <linux/sched.h>
> +#include <linux/kernel.h>
> +#include <linux/ptrace.h>
> +#include <linux/slab.h>
> +#include <linux/user.h>
> +#include <linux/interrupt.h>
> +#include <linux/reboot.h>
> +#include <linux/init.h>
> +#include <linux/utsrelease.h>
> +#include <linux/module.h>
> +#include <linux/pci.h>
> +#include <linux/console.h>
> +#include <linux/seq_file.h>
> +#include <linux/root_dev.h>
> +#include <linux/initrd.h>
> +#include <linux/module.h>
> +#include <linux/timer.h>
> +
> +#include <asm/pgtable.h>
> +#include <asm/prom.h>
> +#include <asm/dma.h>
> +#include <asm/machdep.h>
> +#include <asm/irq.h>
> +#include <asm/sections.h>
> +#include <asm/time.h>
> +#include <asm/rtas.h>
> +#include <asm/of_device.h>
> +#include <asm/mpc52xx.h>
> +
> +#include "efika.h"

You probably don't need half of those includes :)

> +static void efika_show_cpuinfo(struct seq_file *m)
> +{
> +	struct device_node *root;
> +	const char *revision = NULL;
> +	const char *codegendescription = NULL;
> +	const char *codegenvendor = NULL;
> +
> +	root = of_find_node_by_path("/");
> +	if (root) {
> +		revision = get_property(root, "revision", NULL);
> +		codegendescription =
> +		    get_property(root, "CODEGEN,description", NULL);
> +		codegenvendor = get_property(root, "CODEGEN,vendor", NULL);
> +	}
> +
> +	of_node_put(root);

Move the above to after you are done with the results of get_property().

> +	if (codegendescription)
> +		seq_printf(m, "machine\t\t: %s\n", codegendescription);
> +	else
> +		seq_printf(m, "machine\t\t: Efika\n");
> +
> +	if (revision)
> +		seq_printf(m, "revision\t: %s\n", revision);
> +
> +	if (codegenvendor)
> +		seq_printf(m, "vendor\t\t: %s\n", codegenvendor);
> +}

> +static void __init efika_init_IRQ(void)
> +{
> +	mpc52xx_init_irq();
> +}

Just hook mpc52xx_init_irq() directly

> +static void __init efika_init(void)
> +{
> +	struct device_node *np;
> +	struct device_node *cnp = NULL;
> +	const u32 *base;
> +	char *name;
> +
> +	/* Find every child of the SOC node and add it to of_platform */
> +	np = of_find_node_by_name(NULL, "builtin");
> +	if (np) {
> +		while ((cnp = of_get_next_child(np, cnp))) {
> +			name = kmalloc(BUS_ID_SIZE, GFP_KERNEL);
> +			if (name == NULL)
> +				continue;

Why kmalloc ?

> +			strcpy(name, cnp->name);
> +
> +			base = get_property(cnp, "reg", NULL);
> +			if (base == NULL) {
> +				kfree(name);
> +				continue;
> +			}
> +
> +			sprintf(name+strlen(name), "@%x", *base);
> +			of_platform_device_create(cnp, name, NULL);

Just use a stack based buffer. Either that, or kfree(name) when you are
done. of_platform_device_create() will make a copy of the sting.

Rest looks good.

Ben.

      parent reply	other threads:[~2006-11-04 23:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-01 20:29 [PATCH/RFC] powerpc: Add Efika platform support Nicolas DET
2006-11-01 20:34 ` Nicolas DET
2006-11-01 22:19 ` Benjamin Herrenschmidt
2006-11-01 23:25   ` Benjamin Herrenschmidt
2006-11-02 20:52     ` Nicolas DET
2006-11-03  7:31       ` Nicolas DET
2006-11-04 23:45       ` Benjamin Herrenschmidt [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=1162683925.28571.93.camel@localhost.localdomain \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=linuxppc-embedded@ozlabs.org \
    --cc=nd@bplan-gmbh.de \
    --cc=sl@bplan-gmbh.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.