summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/Kconfig3
-rw-r--r--arch/powerpc/include/asm/fsl_85xx_cache_sram.h4
-rw-r--r--arch/powerpc/lib/Makefile2
-rw-r--r--arch/powerpc/platforms/44x/Kconfig2
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/Kconfig2
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype2
-rw-r--r--arch/powerpc/sysdev/cpm1.c2
-rw-r--r--arch/powerpc/sysdev/cpm2.c2
-rw-r--r--arch/powerpc/sysdev/cpm_common.c6
-rw-r--r--arch/powerpc/sysdev/ppc4xx_ocm.c4
-rw-r--r--drivers/dma/bestcomm/Kconfig2
-rw-r--r--drivers/soc/qe/Kconfig2
-rw-r--r--drivers/soc/qe/qe.c2
-rw-r--r--drivers/soc/qe/qe_common.c6
-rw-r--r--drivers/video/Kconfig2
-rw-r--r--include/linux/fsl/bestcomm/sram.h4
-rw-r--r--include/linux/fsl/rheap.h (renamed from arch/powerpc/include/asm/rheap.h)50
-rw-r--r--lib/Kconfig3
-rw-r--r--lib/Makefile2
-rw-r--r--lib/rheap.c (renamed from arch/powerpc/lib/rheap.c)128
21 files changed, 118 insertions, 114 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index d20dc2b..18b658e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -1046,7 +1046,4 @@ config PPC_CLOCK
default n
select HAVE_CLK
-config PPC_LIB_RHEAP
- bool
-
source "arch/powerpc/kvm/Kconfig"
diff --git a/arch/powerpc/include/asm/fsl_85xx_cache_sram.h b/arch/powerpc/include/asm/fsl_85xx_cache_sram.h
index 2af2bdc..5071a2c 100644
--- a/arch/powerpc/include/asm/fsl_85xx_cache_sram.h
+++ b/arch/powerpc/include/asm/fsl_85xx_cache_sram.h
@@ -26,7 +26,7 @@
#ifndef __ASM_POWERPC_FSL_85XX_CACHE_SRAM_H__
#define __ASM_POWERPC_FSL_85XX_CACHE_SRAM_H__
-#include <asm/rheap.h>
+#include <linux/fsl/rheap.h>
#include <linux/spinlock.h>
/*
@@ -37,7 +37,7 @@ struct mpc85xx_cache_sram {
phys_addr_t base_phys;
void *base_virt;
unsigned int size;
- rh_info_t *rh;
+ struct _rh_info *rh;
spinlock_t lock;
};
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 4504332..c7b4e2f 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -26,8 +26,6 @@ obj-$(CONFIG_SMP) += locks.o
obj-$(CONFIG_ALTIVEC) += vmx-helper.o
endif
-obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
-
obj-y += code-patching.o
obj-y += feature-fixups.o
obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index d6c7506..0ea1aee 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -254,7 +254,7 @@ config PPC4xx_GPIO
config PPC4xx_OCM
bool "PPC4xx On Chip Memory (OCM) support"
depends on 4xx
- select PPC_LIB_RHEAP
+ select LIB_RHEAP
help
Enable OCM support for PowerPC 4xx platforms with on chip memory,
OCM provides the fast place for memory access to improve performance.
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index ae9fdb51..ab4777a 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -19,7 +19,7 @@ if PPC32
config FSL_85XX_CACHE_SRAM
bool "Freescale l2cache sram support"
- select PPC_LIB_RHEAP
+ select LIB_RHEAP
help
When selected, this option enables cache-sram support
for memory allocation on P1/P2 QorIQ platforms.
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index d09ae32f..9c38a8d 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -282,7 +282,7 @@ config CPM2
bool "Enable support for the CPM2 (Communications Processor Module)"
depends on (FSL_SOC_BOOKE && PPC32) || 8260
select CPM
- select PPC_LIB_RHEAP
+ select LIB_RHEAP
select PPC_PCI_CHOICE
select ARCH_REQUIRE_GPIOLIB
help
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 1211e3b..1d7281d 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -33,7 +33,7 @@ config PPC_8xx
bool "Freescale 8xx"
select FSL_SOC
select 8xx
- select PPC_LIB_RHEAP
+ select LIB_RHEAP
config 40x
bool "AMCC 40x"
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index 5e6ff38..c6f5762 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -38,7 +38,7 @@
#include <asm/cpm1.h>
#include <asm/io.h>
#include <asm/tlbflush.h>
-#include <asm/rheap.h>
+#include <linux/fsl/rheap.h>
#include <asm/prom.h>
#include <asm/cpm.h>
diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
index 8dc1e24..5a63d35 100644
--- a/arch/powerpc/sysdev/cpm2.c
+++ b/arch/powerpc/sysdev/cpm2.c
@@ -41,7 +41,7 @@
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/cpm2.h>
-#include <asm/rheap.h>
+#include <linux/fsl/rheap.h>
#include <asm/fs_pd.h>
#include <sysdev/fsl_soc.h>
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index 4dd5341..0a98dca 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -26,7 +26,7 @@
#include <asm/udbg.h>
#include <asm/io.h>
-#include <asm/rheap.h>
+#include <linux/fsl/rheap.h>
#include <asm/cpm.h>
#include <mm/mmu_decl.h>
@@ -65,8 +65,8 @@ void __init udbg_init_cpm(void)
#endif
static spinlock_t cpm_muram_lock;
-static rh_block_t cpm_boot_muram_rh_block[16];
-static rh_info_t cpm_muram_info;
+static struct _rh_block cpm_boot_muram_rh_block[16];
+static struct _rh_info cpm_muram_info;
static u8 __iomem *muram_vbase;
static phys_addr_t muram_pbase;
diff --git a/arch/powerpc/sysdev/ppc4xx_ocm.c b/arch/powerpc/sysdev/ppc4xx_ocm.c
index 1b15f93..6ae237a 100644
--- a/arch/powerpc/sysdev/ppc4xx_ocm.c
+++ b/arch/powerpc/sysdev/ppc4xx_ocm.c
@@ -26,7 +26,7 @@
#include <linux/kernel.h>
#include <linux/dma-mapping.h>
#include <linux/of.h>
-#include <asm/rheap.h>
+#include <linux/fsl/rheap.h>
#include <asm/ppc4xx_ocm.h>
#include <linux/slab.h>
#include <linux/debugfs.h>
@@ -49,7 +49,7 @@ struct ocm_region {
int memtotal;
int memfree;
- rh_info_t *rh;
+ struct _rh_info *rh;
struct list_head list;
};
diff --git a/drivers/dma/bestcomm/Kconfig b/drivers/dma/bestcomm/Kconfig
index 29e4270..9bb1bf8 100644
--- a/drivers/dma/bestcomm/Kconfig
+++ b/drivers/dma/bestcomm/Kconfig
@@ -6,7 +6,7 @@ config PPC_BESTCOMM
tristate "Bestcomm DMA engine support"
depends on PPC_MPC52xx
default n
- select PPC_LIB_RHEAP
+ select LIB_RHEAP
help
BestComm is the name of the communication coprocessor found
on the Freescale MPC5200 family of processor. Its usage is
diff --git a/drivers/soc/qe/Kconfig b/drivers/soc/qe/Kconfig
index 5c2b9d8..49118e1 100644
--- a/drivers/soc/qe/Kconfig
+++ b/drivers/soc/qe/Kconfig
@@ -5,7 +5,7 @@
config QUICC_ENGINE
bool "Freescale QUICC Engine (QE) Support"
depends on FSL_SOC && (PPC32 || PPC64)
- select PPC_LIB_RHEAP
+ select LIB_RHEAP
select CRC32
---help---
The QUICC Engine (QE) is a new generation of communications
diff --git a/drivers/soc/qe/qe.c b/drivers/soc/qe/qe.c
index 25f0e0d..e0926f5 100644
--- a/drivers/soc/qe/qe.c
+++ b/drivers/soc/qe/qe.c
@@ -36,7 +36,7 @@
#include <linux/fsl/immap_qe.h>
#include <linux/fsl/qe.h>
#include <asm/prom.h>
-#include <asm/rheap.h>
+#include <linux/fsl/rheap.h>
static void qe_snums_init(void);
static int qe_sdma_init(void);
diff --git a/drivers/soc/qe/qe_common.c b/drivers/soc/qe/qe_common.c
index c82ddcc..8e93b88 100644
--- a/drivers/soc/qe/qe_common.c
+++ b/drivers/soc/qe/qe_common.c
@@ -26,12 +26,12 @@
#include <linux/slab.h>
#include <linux/io.h>
-#include <asm/rheap.h>
+#include <linux/fsl/rheap.h>
#include <linux/fsl/qe.h>
static spinlock_t qe_muram_lock;
-static rh_block_t qe_boot_muram_rh_block[16];
-static rh_info_t qe_muram_info;
+static struct _rh_block qe_boot_muram_rh_block[16];
+static struct _rh_info qe_muram_info;
static u8 __iomem *muram_vbase;
static phys_addr_t muram_pbase;
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 2a46153..4ce7204 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1972,7 +1972,7 @@ config FB_FSL_DIU
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
- select PPC_LIB_RHEAP
+ select LIB_RHEAP
---help---
Framebuffer driver for the Freescale SoC DIU
diff --git a/include/linux/fsl/bestcomm/sram.h b/include/linux/fsl/bestcomm/sram.h
index b6d6689..8555dab 100644
--- a/include/linux/fsl/bestcomm/sram.h
+++ b/include/linux/fsl/bestcomm/sram.h
@@ -12,7 +12,7 @@
#ifndef __BESTCOMM_SRAM_H__
#define __BESTCOMM_SRAM_H__
-#include <asm/rheap.h>
+#include <linux/fsl/rheap.h>
#include <asm/mmu.h>
#include <linux/spinlock.h>
@@ -25,7 +25,7 @@ struct bcom_sram {
phys_addr_t base_phys;
void *base_virt;
unsigned int size;
- rh_info_t *rh;
+ struct _rh_info *rh;
spinlock_t lock;
};
diff --git a/arch/powerpc/include/asm/rheap.h b/include/linux/fsl/rheap.h
index 1723817..88149da 100644
--- a/arch/powerpc/include/asm/rheap.h
+++ b/include/linux/fsl/rheap.h
@@ -16,74 +16,78 @@
#include <linux/list.h>
-typedef struct _rh_block {
+struct _rh_block {
struct list_head list;
unsigned long start;
int size;
const char *owner;
-} rh_block_t;
+};
-typedef struct _rh_info {
+struct _rh_info {
unsigned int alignment;
int max_blocks;
int empty_slots;
- rh_block_t *block;
+ struct _rh_block *block;
struct list_head empty_list;
struct list_head free_list;
struct list_head taken_list;
unsigned int flags;
-} rh_info_t;
+};
#define RHIF_STATIC_INFO 0x1
#define RHIF_STATIC_BLOCK 0x2
-typedef struct _rh_stats {
+struct _rh_stats {
unsigned long start;
int size;
const char *owner;
-} rh_stats_t;
+};
#define RHGS_FREE 0
#define RHGS_TAKEN 1
/* Create a remote heap dynamically */
-extern rh_info_t *rh_create(unsigned int alignment);
+extern struct _rh_info *rh_create(unsigned int alignment);
/* Destroy a remote heap, created by rh_create() */
-extern void rh_destroy(rh_info_t * info);
+extern void rh_destroy(struct _rh_info *info);
/* Initialize in place a remote info block */
-extern void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
- rh_block_t * block);
+extern void rh_init(struct _rh_info *info, unsigned int alignment,
+ int max_blocks, struct _rh_block *block);
/* Attach a free region to manage */
-extern int rh_attach_region(rh_info_t * info, unsigned long start, int size);
+extern int rh_attach_region(struct _rh_info *info, unsigned long start,
+ int size);
/* Detach a free region */
-extern unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size);
+extern unsigned long rh_detach_region(struct _rh_info *info,
+ unsigned long start, int size);
/* Allocate the given size from the remote heap (with alignment) */
-extern unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment,
- const char *owner);
+extern unsigned long rh_alloc_align(struct _rh_info *info, int size,
+ int alignment, const char *owner);
/* Allocate the given size from the remote heap */
-extern unsigned long rh_alloc(rh_info_t * info, int size, const char *owner);
+extern unsigned long rh_alloc(struct _rh_info *info, int size,
+ const char *owner);
/* Allocate the given size from the given address */
-extern unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size,
- const char *owner);
+extern unsigned long rh_alloc_fixed(struct _rh_info *info, unsigned long start,
+ int size, const char *owner);
/* Free the allocated area */
-extern int rh_free(rh_info_t * info, unsigned long start);
+extern int rh_free(struct _rh_info *info, unsigned long start);
/* Get stats for debugging purposes */
-extern int rh_get_stats(rh_info_t * info, int what, int max_stats,
- rh_stats_t * stats);
+extern int rh_get_stats(struct _rh_info *info, int what, int max_stats,
+ struct _rh_stats *stats);
/* Simple dump of remote heap info */
-extern void rh_dump(rh_info_t * info);
+extern void rh_dump(struct _rh_info *info);
/* Set owner of taken block */
-extern int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner);
+extern int rh_set_owner(struct _rh_info *info, unsigned long start,
+ const char *owner);
#endif /* __ASM_PPC_RHEAP_H__ */
diff --git a/lib/Kconfig b/lib/Kconfig
index 4490089..4ffcc86 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -365,6 +365,9 @@ config CPU_RMAP
bool
depends on SMP
+config LIB_RHEAP
+ bool
+
config DQL
bool
diff --git a/lib/Makefile b/lib/Makefile
index 6e23a0f..8523e9d 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -194,3 +194,5 @@ quiet_cmd_build_OID_registry = GEN $@
clean-files += oid_registry_data.c
obj-$(CONFIG_UCS2_STRING) += ucs2_string.o
+
+obj-$(CONFIG_LIB_RHEAP) += rheap.o
diff --git a/arch/powerpc/lib/rheap.c b/lib/rheap.c
index a1060a8..241cc0a 100644
--- a/arch/powerpc/lib/rheap.c
+++ b/lib/rheap.c
@@ -20,7 +20,7 @@
#include <linux/err.h>
#include <linux/slab.h>
-#include <asm/rheap.h>
+#include <linux/fsl/rheap.h>
/*
* Fixup a list_head, needed when copying lists. If the pointers fall
@@ -42,9 +42,9 @@ static inline void fixup(unsigned long s, unsigned long e, int d,
}
/* Grow the allocated blocks */
-static int grow(rh_info_t * info, int max_blocks)
+static int grow(struct _rh_info *info, int max_blocks)
{
- rh_block_t *block, *blk;
+ struct _rh_block *block, *blk;
int i, new_blocks;
int delta;
unsigned long blks, blke;
@@ -54,7 +54,7 @@ static int grow(rh_info_t * info, int max_blocks)
new_blocks = max_blocks - info->max_blocks;
- block = kmalloc(sizeof(rh_block_t) * max_blocks, GFP_ATOMIC);
+ block = kmalloc(sizeof(struct _rh_block) * max_blocks, GFP_ATOMIC);
if (block == NULL)
return -ENOMEM;
@@ -62,7 +62,7 @@ static int grow(rh_info_t * info, int max_blocks)
/* copy old block area */
memcpy(block, info->block,
- sizeof(rh_block_t) * info->max_blocks);
+ sizeof(struct _rh_block) * info->max_blocks);
delta = (char *)block - (char *)info->block;
@@ -100,7 +100,7 @@ static int grow(rh_info_t * info, int max_blocks)
* causes a grow in the block area then all pointers kept to the block
* area are invalid!
*/
-static int assure_empty(rh_info_t * info, int slots)
+static int assure_empty(struct _rh_info *info, int slots)
{
int max_blocks;
@@ -118,19 +118,19 @@ static int assure_empty(rh_info_t * info, int slots)
return grow(info, max_blocks);
}
-static rh_block_t *get_slot(rh_info_t * info)
+static struct _rh_block *get_slot(struct _rh_info *info)
{
- rh_block_t *blk;
+ struct _rh_block *blk;
/* If no more free slots, and failure to extend. */
/* XXX: You should have called assure_empty before */
if (info->empty_slots == 0) {
- printk(KERN_ERR "rh: out of slots; crash is imminent.\n");
+ pr_err("rh: out of slots; crash is imminent.\n");
return NULL;
}
/* Get empty slot to use */
- blk = list_entry(info->empty_list.next, rh_block_t, list);
+ blk = list_entry(info->empty_list.next, struct _rh_block, list);
list_del_init(&blk->list);
info->empty_slots--;
@@ -142,18 +142,18 @@ static rh_block_t *get_slot(rh_info_t * info)
return blk;
}
-static inline void release_slot(rh_info_t * info, rh_block_t * blk)
+static inline void release_slot(struct _rh_info *info, struct _rh_block *blk)
{
list_add(&blk->list, &info->empty_list);
info->empty_slots++;
}
-static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
+static void attach_free_block(struct _rh_info *info, struct _rh_block *blkn)
{
- rh_block_t *blk;
- rh_block_t *before;
- rh_block_t *after;
- rh_block_t *next;
+ struct _rh_block *blk;
+ struct _rh_block *before;
+ struct _rh_block *after;
+ struct _rh_block *next;
int size;
unsigned long s, e, bs, be;
struct list_head *l;
@@ -170,7 +170,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
next = NULL;
list_for_each(l, &info->free_list) {
- blk = list_entry(l, rh_block_t, list);
+ blk = list_entry(l, struct _rh_block, list);
bs = blk->start;
be = bs + blk->size;
@@ -229,14 +229,14 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn)
release_slot(info, after);
}
-static void attach_taken_block(rh_info_t * info, rh_block_t * blkn)
+static void attach_taken_block(struct _rh_info *info, struct _rh_block *blkn)
{
- rh_block_t *blk;
+ struct _rh_block *blk;
struct list_head *l;
/* Find the block immediately before the given one (if any) */
list_for_each(l, &info->taken_list) {
- blk = list_entry(l, rh_block_t, list);
+ blk = list_entry(l, struct _rh_block, list);
if (blk->start > blkn->start) {
list_add_tail(&blkn->list, &blk->list);
return;
@@ -250,9 +250,9 @@ static void attach_taken_block(rh_info_t * info, rh_block_t * blkn)
* Create a remote heap dynamically. Note that no memory for the blocks
* are allocated. It will upon the first allocation
*/
-rh_info_t *rh_create(unsigned int alignment)
+struct _rh_info *rh_create(unsigned int alignment)
{
- rh_info_t *info;
+ struct _rh_info *info;
/* Alignment must be a power of two */
if ((alignment & (alignment - 1)) != 0)
@@ -282,7 +282,7 @@ EXPORT_SYMBOL_GPL(rh_create);
* Destroy a dynamically created remote heap. Deallocate only if the areas
* are not static
*/
-void rh_destroy(rh_info_t * info)
+void rh_destroy(struct _rh_info *info)
{
if ((info->flags & RHIF_STATIC_BLOCK) == 0 && info->block != NULL)
kfree(info->block);
@@ -297,11 +297,11 @@ EXPORT_SYMBOL_GPL(rh_destroy);
* operation very early in the startup of the kernel, when it is not yet safe
* to call kmalloc.
*/
-void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
- rh_block_t * block)
+void rh_init(struct _rh_info *info, unsigned int alignment, int max_blocks,
+ struct _rh_block *block)
{
int i;
- rh_block_t *blk;
+ struct _rh_block *blk;
/* Alignment must be a power of two */
if ((alignment & (alignment - 1)) != 0)
@@ -326,9 +326,9 @@ void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
EXPORT_SYMBOL_GPL(rh_init);
/* Attach a free memory region, coalesces regions if adjuscent */
-int rh_attach_region(rh_info_t * info, unsigned long start, int size)
+int rh_attach_region(struct _rh_info *info, unsigned long start, int size)
{
- rh_block_t *blk;
+ struct _rh_block *blk;
unsigned long s, e, m;
int r;
@@ -367,10 +367,11 @@ int rh_attach_region(rh_info_t * info, unsigned long start, int size)
EXPORT_SYMBOL_GPL(rh_attach_region);
/* Detatch given address range, splits free block if needed. */
-unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size)
+unsigned long rh_detach_region(struct _rh_info *info, unsigned long start,
+ int size)
{
struct list_head *l;
- rh_block_t *blk, *newblk;
+ struct _rh_block *blk, *newblk;
unsigned long s, e, m, bs, be;
/* Validate size */
@@ -393,7 +394,7 @@ unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size)
blk = NULL;
list_for_each(l, &info->free_list) {
- blk = list_entry(l, rh_block_t, list);
+ blk = list_entry(l, struct _rh_block, list);
/* The range must lie entirely inside one free block */
bs = blk->start;
be = blk->start + blk->size;
@@ -439,11 +440,12 @@ EXPORT_SYMBOL_GPL(rh_detach_region);
* is an offset into the buffer initialized by rh_init(), or a negative number
* if there is an error.
*/
-unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owner)
+unsigned long rh_alloc_align(struct _rh_info *info, int size,
+ int alignment, const char *owner)
{
struct list_head *l;
- rh_block_t *blk;
- rh_block_t *newblk;
+ struct _rh_block *blk;
+ struct _rh_block *newblk;
unsigned long start, sp_size;
/* Validate size, and alignment must be power of two */
@@ -458,7 +460,7 @@ unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const ch
blk = NULL;
list_for_each(l, &info->free_list) {
- blk = list_entry(l, rh_block_t, list);
+ blk = list_entry(l, struct _rh_block, list);
if (size <= blk->size) {
start = (blk->start + alignment - 1) & ~(alignment - 1);
if (start + size <= blk->start + blk->size)
@@ -480,7 +482,7 @@ unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const ch
/* Create block for fragment in the beginning */
sp_size = start - blk->start;
if (sp_size) {
- rh_block_t *spblk;
+ struct _rh_block *spblk;
spblk = get_slot(info);
spblk->start = blk->start;
@@ -514,7 +516,7 @@ EXPORT_SYMBOL_GPL(rh_alloc_align);
* an offset into the buffer initialized by rh_init(), or a negative number if
* there is an error.
*/
-unsigned long rh_alloc(rh_info_t * info, int size, const char *owner)
+unsigned long rh_alloc(struct _rh_info *info, int size, const char *owner)
{
return rh_alloc_align(info, size, info->alignment, owner);
}
@@ -524,10 +526,11 @@ EXPORT_SYMBOL_GPL(rh_alloc);
* alignment. The value returned is an offset into the buffer initialized by
* rh_init(), or a negative number if there is an error.
*/
-unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size, const char *owner)
+unsigned long rh_alloc_fixed(struct _rh_info *info, unsigned long start,
+ int size, const char *owner)
{
struct list_head *l;
- rh_block_t *blk, *newblk1, *newblk2;
+ struct _rh_block *blk, *newblk1, *newblk2;
unsigned long s, e, m, bs = 0, be = 0;
/* Validate size */
@@ -550,7 +553,7 @@ unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size, co
blk = NULL;
list_for_each(l, &info->free_list) {
- blk = list_entry(l, rh_block_t, list);
+ blk = list_entry(l, struct _rh_block, list);
/* The range must lie entirely inside one free block */
bs = blk->start;
be = blk->start + blk->size;
@@ -609,16 +612,16 @@ EXPORT_SYMBOL_GPL(rh_alloc_fixed);
* The return value is the size of the deallocated block, or a negative number
* if there is an error.
*/
-int rh_free(rh_info_t * info, unsigned long start)
+int rh_free(struct _rh_info *info, unsigned long start)
{
- rh_block_t *blk, *blk2;
+ struct _rh_block *blk, *blk2;
struct list_head *l;
int size;
/* Linear search for block */
blk = NULL;
list_for_each(l, &info->taken_list) {
- blk2 = list_entry(l, rh_block_t, list);
+ blk2 = list_entry(l, struct _rh_block, list);
if (start < blk2->start)
break;
blk = blk2;
@@ -638,9 +641,10 @@ int rh_free(rh_info_t * info, unsigned long start)
}
EXPORT_SYMBOL_GPL(rh_free);
-int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats)
+int rh_get_stats(struct _rh_info *info, int what, int max_stats,
+ struct _rh_stats *stats)
{
- rh_block_t *blk;
+ struct _rh_block *blk;
struct list_head *l;
struct list_head *h;
int nr;
@@ -662,7 +666,7 @@ int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats)
/* Linear search for block */
nr = 0;
list_for_each(l, h) {
- blk = list_entry(l, rh_block_t, list);
+ blk = list_entry(l, struct _rh_block, list);
if (stats != NULL && nr < max_stats) {
stats->start = blk->start;
stats->size = blk->size;
@@ -676,16 +680,16 @@ int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats)
}
EXPORT_SYMBOL_GPL(rh_get_stats);
-int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner)
+int rh_set_owner(struct _rh_info *info, unsigned long start, const char *owner)
{
- rh_block_t *blk, *blk2;
+ struct _rh_block *blk, *blk2;
struct list_head *l;
int size;
/* Linear search for block */
blk = NULL;
list_for_each(l, &info->taken_list) {
- blk2 = list_entry(l, rh_block_t, list);
+ blk2 = list_entry(l, struct _rh_block, list);
if (start < blk2->start)
break;
blk = blk2;
@@ -701,46 +705,42 @@ int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner)
}
EXPORT_SYMBOL_GPL(rh_set_owner);
-void rh_dump(rh_info_t * info)
+void rh_dump(struct _rh_info *info)
{
- static rh_stats_t st[32]; /* XXX maximum 32 blocks */
+ static struct _rh_stats st[32]; /* XXX maximum 32 blocks */
int maxnr;
int i, nr;
maxnr = ARRAY_SIZE(st);
- printk(KERN_INFO
- "info @0x%p (%d slots empty / %d max)\n",
+ pr_info("info @0x%p (%d slots empty / %d max)\n",
info, info->empty_slots, info->max_blocks);
- printk(KERN_INFO " Free:\n");
+ pr_info(" Free:\n");
nr = rh_get_stats(info, RHGS_FREE, maxnr, st);
if (nr > maxnr)
nr = maxnr;
for (i = 0; i < nr; i++)
- printk(KERN_INFO
- " 0x%lx-0x%lx (%u)\n",
+ pr_info(" 0x%lx-0x%lx (%u)\n",
st[i].start, st[i].start + st[i].size,
st[i].size);
- printk(KERN_INFO "\n");
+ pr_info("\n");
- printk(KERN_INFO " Taken:\n");
+ pr_info(" Taken:\n");
nr = rh_get_stats(info, RHGS_TAKEN, maxnr, st);
if (nr > maxnr)
nr = maxnr;
for (i = 0; i < nr; i++)
- printk(KERN_INFO
- " 0x%lx-0x%lx (%u) %s\n",
+ pr_info(" 0x%lx-0x%lx (%u) %s\n",
st[i].start, st[i].start + st[i].size,
st[i].size, st[i].owner != NULL ? st[i].owner : "");
- printk(KERN_INFO "\n");
+ pr_info("\n");
}
EXPORT_SYMBOL_GPL(rh_dump);
-void rh_dump_blk(rh_info_t * info, rh_block_t * blk)
+void rh_dump_blk(struct _rh_info *info, struct _rh_block *blk)
{
- printk(KERN_INFO
- "blk @0x%p: 0x%lx-0x%lx (%u)\n",
+ pr_info("blk @0x%p: 0x%lx-0x%lx (%u)\n",
blk, blk->start, blk->start + blk->size, blk->size);
}
EXPORT_SYMBOL_GPL(rh_dump_blk);