2007-08-09 00:38:26

by Steven Rostedt

[permalink] [raw]
Subject: [PATCH 4/7] Moved the io struct up to the generic lg.h

Move the io struct into the lg.h file since the io.c is generic to other
architectures.

Also added a proper ifdef for the generic lg.h.

Signed-off-by: Steven Rostedt <[email protected]>
---
drivers/lguest/i386/lg.h | 11 ++---------
drivers/lguest/lg.h | 16 ++++++++++++++++
2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/lguest/i386/lg.h b/drivers/lguest/i386/lg.h
index 64f0abe..c5ea14c 100644
--- a/drivers/lguest/i386/lg.h
+++ b/drivers/lguest/i386/lg.h
@@ -20,6 +20,8 @@
#include <linux/err.h>
#include <asm/semaphore.h>
#include "irq_vectors.h"
+/* some files include this, some include the parent */
+#include "../lg.h"

#define GUEST_PL 1

@@ -245,15 +247,6 @@ void pin_page(struct lguest *lg, unsigned long vaddr);
int lguest_device_init(void);
void lguest_device_remove(void);

-/* io.c: */
-void lguest_io_init(void);
-int bind_dma(struct lguest *lg,
- unsigned long key, unsigned long udma, u16 numdmas, u8 interrupt);
-void send_dma(struct lguest *info, unsigned long key, unsigned long udma);
-void release_all_dma(struct lguest *lg);
-unsigned long get_dma_buffer(struct lguest *lg, unsigned long key,
- unsigned long *interrupt);
-
/* hypercalls.c: */
void do_hypercalls(struct lguest *lg);
void write_timestamp(struct lguest *lg);
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index 4c4356e..3147bf6 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -1,3 +1,19 @@
+#ifndef _LGUEST_LG_GENERIC
+#define _LGUEST_LG_GENERIC
+
+struct lguest;
+
+/* io.c: */
+void lguest_io_init(void);
+int bind_dma(struct lguest *lg,
+ unsigned long key, unsigned long udma, u16 numdmas, u8 interrupt);
+void send_dma(struct lguest *info, unsigned long key, unsigned long udma);
+void release_all_dma(struct lguest *lg);
+unsigned long get_dma_buffer(struct lguest *lg, unsigned long key,
+ unsigned long *interrupt);
+
#ifdef CONFIG_X86_32
#include "i386/lg.h"
#endif
+
+#endif /* _LGUEST_LG_GENERIC */
--
1.4.4.4

--


2007-08-09 01:52:17

by Stephen Rothwell

[permalink] [raw]
Subject: Re: [PATCH 4/7] Moved the io struct up to the generic lg.h

On Wed, 08 Aug 2007 20:32:15 -0400 Steven Rostedt <[email protected]>
wrote:
>
> diff --git a/drivers/lguest/i386/lg.h b/drivers/lguest/i386/lg.h
> index 64f0abe..c5ea14c 100644
> --- a/drivers/lguest/i386/lg.h
> +++ b/drivers/lguest/i386/lg.h
> @@ -20,6 +20,8 @@
> #include <linux/err.h>
> #include <asm/semaphore.h>
> #include "irq_vectors.h"
> +/* some files include this, some include the parent */
> +#include "../lg.h"

Surely everything should just include the parent which allows for easier
consolidation over time. (as you are doing here)

> --- a/drivers/lguest/lg.h
> +++ b/drivers/lguest/lg.h
> @@ -1,3 +1,19 @@
> +#ifndef _LGUEST_LG_GENERIC
> +#define _LGUEST_LG_GENERIC

Maybe _LGUEST_LG_H? and the arch ones could use _LGUEST_I386_LG_H etc.

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (866.00 B)
(No filename) (189.00 B)
Download all attachments

2007-08-09 02:20:17

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 4/7] Moved the io struct up to the generic lg.h


--
On Thu, 9 Aug 2007, Stephen Rothwell wrote:

> On Wed, 08 Aug 2007 20:32:15 -0400 Steven Rostedt <[email protected]>
> wrote:
> >
> > diff --git a/drivers/lguest/i386/lg.h b/drivers/lguest/i386/lg.h
> > index 64f0abe..c5ea14c 100644
> > --- a/drivers/lguest/i386/lg.h
> > +++ b/drivers/lguest/i386/lg.h
> > @@ -20,6 +20,8 @@
> > #include <linux/err.h>
> > #include <asm/semaphore.h>
> > #include "irq_vectors.h"
> > +/* some files include this, some include the parent */
> > +#include "../lg.h"
>
> Surely everything should just include the parent which allows for easier
> consolidation over time. (as you are doing here)

Yeah, that sounds better. This was my attempt at not modifing the
i386/ stuff too much. But I can have those files change to do a "../lg.h"
include. Again, doing the move plus change to keep things building. Hmm,
I guess git can handle that.

>
> > --- a/drivers/lguest/lg.h
> > +++ b/drivers/lguest/lg.h
> > @@ -1,3 +1,19 @@
> > +#ifndef _LGUEST_LG_GENERIC
> > +#define _LGUEST_LG_GENERIC
>
> Maybe _LGUEST_LG_H? and the arch ones could use _LGUEST_I386_LG_H etc.

Noted. Will do in the next release.

Thanks,

-- Steve

2007-08-09 12:27:53

by Jes Sorensen

[permalink] [raw]
Subject: Re: [PATCH 4/7] Moved the io struct up to the generic lg.h

Stephen Rothwell wrote:
> On Wed, 08 Aug 2007 20:32:15 -0400 Steven Rostedt <[email protected]>
> wrote:
>> diff --git a/drivers/lguest/i386/lg.h b/drivers/lguest/i386/lg.h
>> index 64f0abe..c5ea14c 100644
>> --- a/drivers/lguest/i386/lg.h
>> +++ b/drivers/lguest/i386/lg.h
>> @@ -20,6 +20,8 @@
>> #include <linux/err.h>
>> #include <asm/semaphore.h>
>> #include "irq_vectors.h"
>> +/* some files include this, some include the parent */
>> +#include "../lg.h"
>
> Surely everything should just include the parent which allows for easier
> consolidation over time. (as you are doing here)

Whats wrong with introducing an include/asm-<arch>/lg.h and have the
parent do #include <asm/lg.h> ? Seems much cleaner to me.

Cheers,
Jes

2007-08-09 12:47:58

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH 4/7] Moved the io struct up to the generic lg.h


--
On Thu, 9 Aug 2007, Jes Sorensen wrote:

> Stephen Rothwell wrote:
> > On Wed, 08 Aug 2007 20:32:15 -0400 Steven Rostedt <[email protected]>
> > wrote:
> >> diff --git a/drivers/lguest/i386/lg.h b/drivers/lguest/i386/lg.h
> >> index 64f0abe..c5ea14c 100644
> >> --- a/drivers/lguest/i386/lg.h
> >> +++ b/drivers/lguest/i386/lg.h
> >> @@ -20,6 +20,8 @@
> >> #include <linux/err.h>
> >> #include <asm/semaphore.h>
> >> #include "irq_vectors.h"
> >> +/* some files include this, some include the parent */
> >> +#include "../lg.h"
> >
> > Surely everything should just include the parent which allows for easier
> > consolidation over time. (as you are doing here)
>
> Whats wrong with introducing an include/asm-<arch>/lg.h and have the
> parent do #include <asm/lg.h> ? Seems much cleaner to me.

Seems cleaner to me to! I think I'll do that.

Oh, wait! I did. ;-)

-- Steve

P.S. Sorry, couldn't resist.