LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Jochen Friedrich <jochen@scram.de>
Cc: Jean Delvare <khali@linux-fr.org>,
	linux-kernel@vger.kernel.org,
	linuxppc-dev list <linuxppc-dev@ozlabs.org>,
	i2c@lm-sensors.org, Scott Wood <scottwood@freescale.com>
Subject: Re: [PATCHv4 2.6.25] i2c: adds support for i2c bus on Freescale CPM1/CPM2 controllers
Date: Wed, 26 Mar 2008 11:41:34 +1100	[thread overview]
Message-ID: <20080326114134.495f5fe5.sfr@canb.auug.org.au> (raw)
In-Reply-To: <47E94891.6020000@scram.de>

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

Hi Jochen,

Firstly, you should probably cc Dave Miller <davem@davemloft.net> on
anything in drivers/of as Sparc is the other user of this stuff (just in
case they are interested).

On Tue, 25 Mar 2008 19:46:41 +0100 Jochen Friedrich <jochen@scram.de> wrote:
>
> +++ b/drivers/of/i2c.c
> @@ -0,0 +1,113 @@
> +/*
> + * OF helpers for the I2C API
> + *
> + * Copyright (c) 2008 Jochen Friedrich <jochen@scram.de>
> + *
> + * Based on a previous patch from Jon Smirl <jonsmirl@gmail.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/i2c.h>
> +#include <asm/prom.h>

You should really include <linux/of.h> instead.

> +struct i2c_driver_device {
> +	char    *of_device;
> +	char    *i2c_type;
> +};
> +
> +static struct i2c_driver_device i2c_devices[] = {
> +	{"dallas,ds1374", "rtc-ds1374",},
                                      ^
You don't need the comma before the brace (unless you are anticipating
that struct i2c_driver_device will change.  Even then, its not a big
thing.

> +void of_register_i2c_devices(struct i2c_adapter *adap,
> +			     struct device_node *adap_node)
> +{
> +	void *result;
> +	struct device_node *node = NULL;
> +
> +	while ((node = of_get_next_child(adap_node, node))) {

	for_each_child_of_node(adap_node, node) {
And then you don't need to initialise "node" above.

> +		info.irq = irq_of_parse_and_map(node, 0);
> +		if (info.irq == NO_IRQ)
> +			info.irq = -1;
> +
> +		if (of_find_i2c_driver(node, &info) < 0)
> +			continue;

Do you need to clean up after the irq_of_parse_and_map() above?

-- 
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-26  0:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-31 12:54 Jochen Friedrich
2008-02-21 12:05 ` Jean Delvare
2008-02-22 11:16   ` Jochen Friedrich
2008-02-23 12:43     ` Jean Delvare
2008-03-25 18:46       ` Jochen Friedrich
2008-03-26  0:41         ` Stephen Rothwell [this message]
2008-02-23 21:28     ` Olof Johansson
2008-02-24 15:16       ` Jochen Friedrich
2008-02-24 18:15         ` Olof Johansson
2008-02-25 16:48           ` Jochen Friedrich
2008-02-24 16:19     ` Jon Smirl

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=20080326114134.495f5fe5.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=i2c@lm-sensors.org \
    --cc=jochen@scram.de \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=scottwood@freescale.com \
    --subject='Re: [PATCHv4 2.6.25] i2c: adds support for i2c bus on Freescale CPM1/CPM2 controllers' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).