[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [RFC PATCH v3 06/18] xen/arm: ITS: Add helper functions to manage its_devices
Hi Vijay, On 22/06/2015 13:01, vijay.kilari@xxxxxxxxx wrote: From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx> Helper functions to mange its devices using RB-tree s/mange/manage/ are introduced in physical ITS driver. This is global list of all the devices. Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx> --- xen/arch/arm/gic-v3-its.c | 49 +++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/gic-its.h | 3 +++ 2 files changed, 52 insertions(+) diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c index b1a97c1..349d0bb 100644 --- a/xen/arch/arm/gic-v3-its.c +++ b/xen/arch/arm/gic-v3-its.c @@ -92,6 +92,7 @@ struct its_node { static LIST_HEAD(its_nodes); static DEFINE_SPINLOCK(its_lock); static struct rdist_prop *gic_rdists; +static struct rb_root rb_its_dev; #define gic_data_rdist() (per_cpu(rdist, smp_processor_id())) #define gic_data_rdist_rd_base() (per_cpu(rdist, smp_processor_id()).rbase) @@ -145,6 +146,53 @@ void dump_cmd(its_cmd_block *cmd) } #endif +/* RB-tree helpers for its_device */ +struct its_device * find_its_device(struct rb_root *root, u32 devid) coding style: struct its_device *findI would rename to its_find_device to keep consistent with the function name within this file. Also, for any exported function you have to declare the prototype in the header within the same patch. +{ + struct rb_node *node = root->rb_node; + + while ( node ) + { + struct its_device *dev; + + dev = container_of(node, struct its_device, node); + if ( devid < dev->device_id ) + node = node->rb_left; + else if ( devid > dev->device_id ) + node = node->rb_right; + else + return dev; + } + + return NULL; +} + +int insert_its_device(struct rb_root *root, struct its_device *dev) Why do you need the root in parameter? You already it within the file. Also, I would rename to its_add_device. Regards, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |