From: Michael Ellerman <michael@ellerman.id.au>
To: Alemao <xcarandiru@gmail.com>
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: PPC driver - generic bus width
Date: Thu, 27 Aug 2009 00:22:45 +1000 [thread overview]
Message-ID: <1251296565.7492.7.camel@concordia> (raw)
In-Reply-To: <d970ff420908260625q2d34bc10p62241218f022b5c2@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1519 bytes --]
On Wed, 2009-08-26 at 10:25 -0300, Alemao wrote:
> 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
I'm not sure about the first two, you don't seem to have pasted all the
source, and you haven't given the line numbers.
The 3rd is probably because the prototype for in_8 etc. doesn't match
your structure.
cheers
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2009-08-26 14:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-26 13:25 PPC driver - generic bus width Alemao
2009-08-26 14:22 ` Michael Ellerman [this message]
2009-08-27 0:04 ` Stephen Rothwell
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=1251296565.7492.7.camel@concordia \
--to=michael@ellerman.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=xcarandiru@gmail.com \
/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).