[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <d970ff420908260625q2d34bc10p62241218f022b5c2@mail.gmail.com>
Date: Wed, 26 Aug 2009 10:25:47 -0300
From: Alemao <xcarandiru@...il.com>
To: linux-kernel@...r.kernel.org
Cc: linuxppc-embedded@...abs.org, linuxppc-dev@...abs.org
Subject: PPC driver - generic bus width
Hi all,
Im trying to develop a driver for my device, and its data bus can be 8, 16
or 32 bits. This information is passed through the device tree source.
My code is like this:
struct device_info_t {
void (*read)();
void (*write)();
};
static int __devinit device_probe()
{
prop = of_get_property(ofdev->node, "bus-width", &size);
device->bus_width = *prop;
switch (device->bus_width) {
case 8:
device->read = in_8;
device->write = out_8;
break;
case 16:
device->read = in_be16;
device->write = out_be16;
break;
case 32:
device->read = in_be32;
device->write = out_be32;
break;
default:
break;
}
}
Can someone point me some driver that is doing something similar to the
ideia shown above?
Or what Im doing wrong in my code? Cause Im getting erros (warnings) like:
cc1: warnings being treated as errors
drivers/dev_test.c:37: warning: function declaration isn't a prototype
drivers/dev_test.c:38: warning: function declaration isn't a prototype
drivers/dev_test.c: In function 'device_probe':
drivers/dev_test.c:113: warning: assignment from incompatible pointer
type
PS: Im using a MPC8349, linux kernel 2.6.26
Cheers,
--
Alemao
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists