linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: greg@kroah.com, mark.a.allyn@intel.com, linux-kernel@vger.kernel.org
Subject: [PATCH 02/12] sep: handle the rar definition stuff in the header
Date: Wed, 24 Nov 2010 19:33:43 +0000	[thread overview]
Message-ID: <20101124193338.16425.36821.stgit@bob.linux.org.uk> (raw)
In-Reply-To: <20101124192136.16425.49994.stgit@bob.linux.org.uk>

From: Alan Cox <alan@linux.intel.com>

SEP isn't the only driver that may need to handle both cases easily

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/staging/sep/sep_driver.c        |    1 +
 drivers/staging/sep/sep_driver_config.h |   61 -------------------------------
 include/linux/rar_register.h            |   16 ++++++++
 3 files changed, 17 insertions(+), 61 deletions(-)


diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index ef36239..8a1ff86 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -53,6 +53,7 @@
 #include <asm/cacheflush.h>
 #include <linux/sched.h>
 #include <linux/delay.h>
+#include <linux/rar_register.h>
 
 #include <linux/netlink.h>
 #include <linux/connector.h>
diff --git a/drivers/staging/sep/sep_driver_config.h b/drivers/staging/sep/sep_driver_config.h
index 68688cb..cfda86f 100644
--- a/drivers/staging/sep/sep_driver_config.h
+++ b/drivers/staging/sep/sep_driver_config.h
@@ -236,15 +236,6 @@ held by the proccess (struct file) */
 /* This stub header is for non Moorestown driver only */
 
 /*
- * Constants that specify different kinds of RAR regions that could be
- * set up.
- */
-static __u32 const RAR_TYPE_VIDEO;  /* 0 */
-static __u32 const RAR_TYPE_AUDIO = 1;
-static __u32 const RAR_TYPE_IMAGE = 2;
-static __u32 const RAR_TYPE_DATA  = 3;
-
-/*
  * @struct RAR_stat
  *
  * @brief This structure is used for @c RAR_HANDLER_STAT ioctl and for
@@ -373,56 +364,4 @@ struct RAR_buffer {
 
 #endif  /* MEMRAR */
 
-/* rar_register */
-#ifndef CONFIG_RAR_REGISTER
-/* This stub header is for non Moorestown driver only */
-
-/* The register_rar function is to used by other device drivers
- * to ensure that this driver is ready. As we cannot be sure of
- * the compile/execute order of dirvers in ther kernel, it is
- * best to give this driver a callback function to call when
- * it is ready to give out addresses. The callback function
- * would have those steps that continue the initialization of
- * a driver that do require a valid RAR address. One of those
- * steps would be to call get_rar_address()
- * This function return 0 on success an -1 on failure.
- */
-#define register_rar(a, b, c) (-ENODEV)
-
-/* The get_rar_address function is used by other device drivers
- * to obtain RAR address information on a RAR. It takes two
- * parameter:
- *
- * int rar_index
- * The rar_index is an index to the rar for which you wish to retrieve
- * the address information.
- * Values can be 0,1, or 2.
- *
- * struct RAR_address_struct is a pointer to a place to which the function
- * can return the address structure for the RAR.
- *
- * The function returns a 0 upon success or a -1 if there is no RAR
- * facility on this system.
- */
-#define rar_get_address(a, b, c) (-ENODEV)
-
-/* The lock_rar function is ued by other device drivers to lock an RAR.
- * once an RAR is locked, it stays locked until the next system reboot.
- * The function takes one parameter:
- *
- * int rar_index
- * The rar_index is an index to the rar that you want to lock.
- * Values can be 0,1, or 2.
- *
- * The function returns a 0 upon success or a -1 if there is no RAR
- * facility on this system.
- */
-#define rar_lock(a) (-1)
-
-#else /* using real RAR_REGISTER */
-
-#include <linux/rar_register.h>
-
-#endif  /* CONFIG_RAR_REGISTER */
-
 #endif /* SEP DRIVER CONFIG */
diff --git a/include/linux/rar_register.h b/include/linux/rar_register.h
index ffa8057..5c61181 100644
--- a/include/linux/rar_register.h
+++ b/include/linux/rar_register.h
@@ -34,11 +34,27 @@
 
 struct rar_device;
 
+#if defined(CONFIG_RAR_REGISTER)
 int register_rar(int num,
 		int (*callback)(unsigned long data), unsigned long data);
 void unregister_rar(int num);
 int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end);
 int rar_lock(int rar_index);
+#else
+extern void unregister_rar(int num)  { }
+extern int rar_lock(int rar_index) { return -EIO; }
+
+extern inline int register_rar(int num,
+		int (*callback)(unsigned long data), unsigned long data)
+{
+	return -ENODEV;
+}
+
+extern int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end)
+{
+	return -ENODEV;
+}
+#endif	/* RAR_REGISTER */
 
 #endif  /* __KERNEL__ */
 #endif  /* _RAR_REGISTER_H */


  parent reply	other threads:[~2010-11-24 19:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-24 19:23 [PATCH 00/12] SEP cleanups Alan Cox
2010-11-24 19:33 ` [PATCH 01/12] sep: minimal fix for wrong include Alan Cox
2010-11-24 19:33 ` Alan Cox [this message]
2010-11-24 19:33 ` [PATCH 03/12] sep: handle the memrar stuff in the headers Alan Cox
2010-11-24 19:34 ` [PATCH 04/12] sep: netlink - what netlink Alan Cox
2010-11-24 19:34 ` [PATCH 05/12] sep: clean up caller_id function Alan Cox
2010-11-24 19:34 ` [PATCH 06/12] sep: Fix the kernel-doc in SEP Alan Cox
2010-11-24 19:38 ` [PATCH 07/12] sep: clean up some of the obvious sillies Alan Cox
2010-11-24 19:38 ` [PATCH 08/12] sep: Use kzalloc when needed Alan Cox
2010-11-24 19:38 ` [PATCH 09/12] sep: Make SEP consistent Alan Cox
2010-11-24 19:38 ` [PATCH 10/12] sep: cant is an angular inclination Alan Cox
2010-11-24 19:39 ` [PATCH 11/12] sep: clean up a couple of spots missed in pass one Alan Cox
2010-11-24 19:39 ` [PATCH 12/12] sep: Fix crash if a device is not found Alan Cox
2010-11-24 20:18 ` [PATCH 00/12] SEP cleanups Randy Dunlap
2010-11-24 22:19   ` Alan Cox

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=20101124193338.16425.36821.stgit@bob.linux.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.a.allyn@intel.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).