Re: powerpc/111522: Add support for the ofw bus interface to nexus

[ Available lists | Index of freebsd-ppc | Month of Apr 2007 | Week of 13 Apr 2007 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Andrew Turner <andrew@fubar.geek.nz>
Date
13 Apr 2007 09:30:08
Subject
Re: powerpc/111522: Add support for the ofw bus interface to nexus
Message-ID
200704130930.l3D9U7RO065100@freefall.freebsd.org


[ Hide this part ]
The following reply was made to PR powerpc/111522; it has been noted by GNATS.

From: Andrew Turner <andrew@fubar.geek.nz>
To: Rink Springer <rink@FreeBSD.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: powerpc/111522: Add support for the ofw bus interface to nexus
Date: Fri, 13 Apr 2007 21:22:56 +1200

--MP_PScor1Tq6r5if1qCZ6+Yn6T
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Fri, 13 Apr 2007 08:39:56 +0200
Rink Springer <rink@FreeBSD.org> wrote:

> Hi Andrew,
>
> On Fri, Apr 13, 2007 at 11:00:33AM +1200, Andrew Turner wrote:
> > + if ((dinfo = device_get_ivars(dev)) == 0)
>
> style(9) says you should use NULL instead of 0. Other than this, I
> can't see anything wrong with the patch.
>
> Cheers,
>
That line is a copy+paste from a similar line further up in the file.

I've attached a patch with the new code changed to NULL's.

Andrew
--MP_PScor1Tq6r5if1qCZ6+Yn6T
Content-Type: text/x-patch; name=freebsd-ppc-nexus-ofw.diff
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=freebsd-ppc-nexus-ofw.diff

Index: sys/powerpc/powerpc/nexus.c
===================================================================
RCS file: /cvsroot/src/sys/powerpc/powerpc/nexus.c,v
retrieving revision 1.13
diff -u -u -r1.13 nexus.c
--- sys/powerpc/powerpc/nexus.c 7 Mar 2007 11:42:14 -0000 1.13
+++ sys/powerpc/powerpc/nexus.c 13 Apr 2007 09:20:56 -0000
@@ -74,6 +74,7 @@

#include <sys/rman.h>

+#include "ofw_bus_if.h"
#include "pic_if.h"

/*
@@ -124,6 +125,11 @@
static int nexus_release_resource(device_t, device_t, int, int,
struct resource *);

+static phandle_t nexus_ofw_get_node(device_t, device_t);
+static const char *nexus_ofw_get_name(device_t, device_t);
+static const char *nexus_ofw_get_type(device_t, device_t);
+static const char *nexus_ofw_get_compat(device_t, device_t);
+
/*
* Local routines
*/
@@ -151,6 +157,12 @@
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
DEVMETHOD(bus_release_resource, nexus_release_resource),

+ /* OFW bus interface */
+ DEVMETHOD(ofw_bus_get_node, nexus_ofw_get_node),
+ DEVMETHOD(ofw_bus_get_name, nexus_ofw_get_name),
+ DEVMETHOD(ofw_bus_get_type, nexus_ofw_get_type),
+ DEVMETHOD(ofw_bus_get_compat, nexus_ofw_get_compat),
+
{ 0, 0 }
};

@@ -416,3 +428,47 @@

return (0);
}
+
+static const char *
+nexus_ofw_get_name(device_t bus, device_t dev)
+{
+ struct nexus_devinfo *dinfo;
+
+ if ((dinfo = device_get_ivars(dev)) == NULL)
+ return NULL;
+
+ return dinfo->ndi_name;
+}
+
+static phandle_t
+nexus_ofw_get_node(device_t bus, device_t dev)
+{
+ struct nexus_devinfo *dinfo;
+
+ if ((dinfo = device_get_ivars(dev)) == NULL)
+ return 0;
+
+ return dinfo->ndi_node;
+}
+
+static const char *
+nexus_ofw_get_type(device_t bus, device_t dev)
+{
+ struct nexus_devinfo *dinfo;
+
+ if ((dinfo = device_get_ivars(dev)) == NULL)
+ return NULL;
+
+ return dinfo->ndi_device_type;
+}
+
+static const char *
+nexus_ofw_get_compat(device_t bus, device_t dev)
+{
+ struct nexus_devinfo *dinfo;
+
+ if ((dinfo = device_get_ivars(dev)) == NULL)
+ return NULL;
+
+ return dinfo->ndi_compatible;
+}

--MP_PScor1Tq6r5if1qCZ6+Yn6T--


Elapsed time: 0.173 seconds