linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linuxppc-dev@ozlabs.org
Cc: Christian Krafft <krafft@de.ibm.com>,
	openipmi-developer@lists.sourceforge.net,
	Christian Krafft <krafft@linux.vnet.ibm.com>,
	Paul Mackerras <paulus@samba.org>
Subject: Re: [patch 0/1] ipmi: update: add autosensing of ipmi devices on powerpc using of device tree
Date: Mon, 18 Dec 2006 23:23:10 +0100	[thread overview]
Message-ID: <200612182323.11262.arnd@arndb.de> (raw)
In-Reply-To: <A45F8443-A031-41AC-887C-669FABBE0F09@kernel.crashing.org>

On Monday 18 December 2006 22:52, Segher Boessenkool wrote:

> > +static int ipmi_of_probe(struct of_device *dev,
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 const =
struct of_device_id *match)
>=20
> Shouldn't this (and everything else) be some kind of __init?

It should be __devinit.

> > +=A0=A0=A0=A0=A0regsize =3D get_property(np, "reg-size", NULL);
> > +=A0=A0=A0=A0=A0regspacing =3D get_property(np, "reg-spacing", NULL);
> > +=A0=A0=A0=A0=A0regshift =3D get_property(np, "reg-shift", NULL);
>=20
> You should check whether you get exactly 4 bytes back or not.
>
> > +=A0=A0=A0=A0=A0if (!regsize)
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0info->io.regsize =3D DEFAULT_RE=
GSPACING;
> > +=A0=A0=A0=A0=A0else
> > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0info->io.regsize =3D *regsize;
>=20
> info->io_regsize =3D regsize ? *regsize : DEFAULT_REGSIZE;
>=20
> [Please note that fixes a copy/paste bug, too].

These two changes are contradictory. It's either

    regsize =3D get_property(np, "reg-size", NULL);
    info->io_regsize =3D regsize ? *regsize : DEFAULT_REGSIZE;

or

    regsize =3D get_property(np, "reg-size", &proplen);
    info->io_regsize =3D (proplen =3D=3D 4) ? *regsize : DEFAULT_REGSIZE;

> > +static int ipmi_of_remove(struct of_device *dev)
> > +{
> > +=A0=A0=A0=A0=A0/* should call
> > +=A0=A0=A0=A0=A0 * cleanup_one_si(dev->dev.driver_data); */
>=20
> So fix that :-)

That should be a separate patch that fixes the same thing for
pci ipmi devices as well. It needs to move code around for this
(or introduce forward declarations), and the effect is no
different, so it's really just a cleanup.

> > +static struct of_device_id ipmi_match[] =3D
> > +{
> > +=A0=A0=A0=A0=A0{ .type =3D "ipmi", .compatible =3D "ipmi-kcs", =A0.dat=
a =3D (void*)=20
> > SI_KCS },
> > +=A0=A0=A0=A0=A0{ .type =3D "ipmi", .compatible =3D "ipmi-smic", .data =
=3D (void*)=20
> > SI_SMIC },
> > +=A0=A0=A0=A0=A0{ .type =3D "ipmi", .compatible =3D "ipmi-bt", =A0 .dat=
a =3D (void*)SI_BT },
>=20
> That cast-to-pointer is what gives you that warning when
> casting back. =A0Is there no better solution?

The one alternative might be something more complicated like:

static const enum si_type __devinitdata of_ipmi_dev_info[] =3D {
	[SI_KCS] SI_KCS,
	[SI_SMIC] SI_SMIC,
	[SI_BT] SI_BT,
};

static const struct of_device_id of_ipmi_match[] =3D {
	{ .type =3D "ipmi", .compatible =3D "ipmi-kcs",  .data =3D &of_ipmi_dev_in=
fo[SI_KCS] },
	{ .type =3D "ipmi", .compatible =3D "ipmi-kcs",  .data =3D &of_ipmi_dev_in=
fo[SI_SMIC] },
	{ .type =3D "ipmi", .compatible =3D "ipmi-kcs",  .data =3D &of_ipmi_dev_in=
fo[SI_BT] },
};

Not sure if that's worth it.

	Arnd <><

  reply	other threads:[~2006-12-18 22:23 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20061218163846.337fed65@localhost>
2006-12-18 15:42 ` [patch 0/1] ipmi: update: add autosensing of ipmi devices on powerpc using of device tree Christian Krafft
2006-12-18 21:52   ` Segher Boessenkool
2006-12-18 22:23     ` Arnd Bergmann [this message]
2006-12-19 17:48       ` Segher Boessenkool
2006-12-19 18:06         ` [Openipmi-developer] " Corey Minyard
2006-12-19 13:12     ` Christian Krafft
2006-12-19 17:52       ` Segher Boessenkool
2006-12-19 18:01         ` Corey Minyard
2006-12-20 14:45           ` [patch 0/1] updated version Christian Krafft
2006-12-21  0:11             ` Arnd Bergmann
2007-01-24 23:45               ` [patch 1/1] updated version, fixed the compiler warning Christian Krafft
2007-01-24 23:56                 ` Benjamin Herrenschmidt
2007-01-25  0:29                   ` Segher Boessenkool
2007-01-25  0:45                     ` Christian Krafft
2007-01-25  0:45                     ` Benjamin Herrenschmidt
2007-01-25  1:05                       ` Segher Boessenkool
2007-01-25  3:14                       ` Arnd Bergmann
2007-01-25  0:24                 ` Segher Boessenkool
2007-01-25  3:30                   ` [patch 0/1] next updated version, fixed cleanup and some minors Christian Krafft
2007-01-25  3:34                     ` [patch 1/1] " Christian Krafft
2007-01-25  5:19                       ` Arnd Bergmann
2007-01-29  3:49                       ` [Openipmi-developer] " Corey Minyard
2007-01-26  2:54                 ` [patch 1/1] updated version, fixed the compiler warning Christoph Hellwig
2007-01-26  4:23                   ` Arnd Bergmann
2007-01-28 23:07                     ` Christian Krafft

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=200612182323.11262.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=krafft@de.ibm.com \
    --cc=krafft@linux.vnet.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=paulus@samba.org \
    /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;
as well as URLs for NNTP newsgroup(s).