We seem to have a mix of usage here. Is there a reason we shouldn't just use one? Which one is preferred?
From src/include/device/device.h:
typedef struct device * device_t;
Thanks, Myles
On 11.05.2009 15:43, Myles Watson wrote:
We seem to have a mix of usage here. Is there a reason we shouldn't just use one? Which one is preferred?
From src/include/device/device.h:
typedef struct device * device_t;
It's a bit complicated. In early (CAR/ROMCC) code, device_t is u32 for stack size reasons. Later, device_t is struct device *.
Using device_t allows to share some header files and/or code. However, it gets confusing very fast. If you can untangle the mess, please go ahead. I will ack that. Maybe renaming the u32 variants of PCI access functions to *_early or so is one way to proceed.
Regards, Carl-Daniel
On Mon, May 11, 2009 at 7:53 AM, Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net wrote:
On 11.05.2009 15:43, Myles Watson wrote:
We seem to have a mix of usage here. Is there a reason we shouldn't just use one? Which one is preferred?
From src/include/device/device.h:
typedef struct device * device_t;
It's a bit complicated. In early (CAR/ROMCC) code, device_t is u32 for stack size reasons. Later, device_t is struct device *.
Right. I think I knew that but was repressing it. :)
Using device_t allows to share some header files and/or code. However, it gets confusing very fast. If you can untangle the mess, please go ahead. I will ack that.
:)
Maybe renaming the u32 variants of PCI access functions to *_early or so is one way to proceed.
So to avoid as much confusion as possible, should we use struct device * in functions that should never be called early, or should we just always use device_t because it is shorter and prettier?
Thanks, Myles
On 11.05.2009 16:04, Myles Watson wrote:
On Mon, May 11, 2009 at 7:53 AM, Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net wrote:
Maybe renaming the u32 variants of PCI access functions to *_early or so is one way to proceed.
So to avoid as much confusion as possible, should we use struct device
- in functions that should never be called early,
Yes please. It helps a lot when reading the code.
or should we just always use device_t because it is shorter and prettier?
Please don't. The v3 decision to avoid typedefs helped me a lot when I was trying to understand the device code.
Regards, Carl-Daniel
struct device * whereever possible is a good idea.
ron