diff options
author | Alan Cox <alan@linux.intel.com> | 2010-12-08 10:57:30 +0000 |
---|---|---|
committer | Alan Cox <alan@linux.intel.com> | 2010-12-08 10:57:30 +0000 |
commit | a5f6c2a554ee06b63e4cbe1e604aa6eaf65ee1eb (patch) | |
tree | 55b4893a064738b83b988cff382ba7f2c7b1321a | |
parent | 35123c4561b9e35a266da70add75927782df0f6b (diff) | |
download | mrst-s0i3-test-a5f6c2a554ee06b63e4cbe1e604aa6eaf65ee1eb.tar.gz mrst-s0i3-test-a5f6c2a554ee06b63e4cbe1e604aa6eaf65ee1eb.tar.xz mrst-s0i3-test-a5f6c2a554ee06b63e4cbe1e604aa6eaf65ee1eb.zip |
rar_register: provide alternates when compiled out
Rework this from the staging patch and rar_register_stubs in the existing
code but use inlines so we still typecheck.
Signed-off-by: Alan Cox <alan@linux.intel.com>
-rw-r--r-- | drivers/staging/sep/rar_register_stub.h | 84 | ||||
-rw-r--r-- | drivers/staging/sep/sep_driver.c | 4 | ||||
-rw-r--r-- | include/linux/rar_register.h | 20 |
3 files changed, 20 insertions, 88 deletions
diff --git a/drivers/staging/sep/rar_register_stub.h b/drivers/staging/sep/rar_register_stub.h deleted file mode 100644 index 7e3d6d25ba4..00000000000 --- a/drivers/staging/sep/rar_register_stub.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2008, 2010 Intel Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General - * Public License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be - * useful, but WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the Free - * Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * The full GNU General Public License is included in this - * distribution in the file called COPYING. - * - * - * CONTACTS: - * - * Mark Allyn mark.a.allyn@intel.com - * - * Revisions: - * 9/2010 - Initial publish (Mark Allyn) - */ - - -#ifndef _RAR_REGISTER_STUB_H -#define _RAR_REGISTER_STUB_H - -# include <linux/types.h> - -/* 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) - - -#endif /* _RAR_REGISTER_H */ - - -/* - Local Variables: - c-file-style: "linux" - End: -*/ diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c index bf9f2a7db93..efa7c6b5c17 100644 --- a/drivers/staging/sep/sep_driver.c +++ b/drivers/staging/sep/sep_driver.c @@ -65,11 +65,7 @@ #include "memrar_stub.h" #endif -#if defined(CONFIG_RAR_REGISTER) #include <linux/rar_register.h> -#else -#include "rar_register_stub.h" -#endif #include "sep_driver_hw_defs.h" #include "sep_driver_config.h" diff --git a/include/linux/rar_register.h b/include/linux/rar_register.h index ffa805780f8..80b68fc8eeb 100644 --- a/include/linux/rar_register.h +++ b/include/linux/rar_register.h @@ -32,6 +32,7 @@ #ifdef __KERNEL__ +#if defined(CONFIG_RAR_REGISTER) struct rar_device; int register_rar(int num, @@ -40,5 +41,24 @@ 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 inline int register_rar(int num, + int (*callback)(unsigned long data), unsigned long data) +{ + return -ENODEV; +} + +extern inline void unregister_rar(int num) { return; } + +extern inline int rar_get_address(int rar_index, dma_addr_t *start, + dma_addr_t *end) +{ + return -ENODEV; +} + +extern inline int rar_lock(int rar_index) { return -1; } + +#endif /* RAR_REGISTER */ #endif /* __KERNEL__ */ #endif /* _RAR_REGISTER_H */ |