diff -urN linux-2.5.21/net/irda/irias_object.c linux/net/irda/irias_object.c --- linux-2.5.21/net/irda/irias_object.c 2002-06-09 07:27:15.000000000 +0200 +++ linux/net/irda/irias_object.c 2002-06-09 20:50:51.000000000 +0200 @@ -1,5 +1,5 @@ /********************************************************************* - * + * * Filename: irias_object.c * Version: 0.3 * Description: IAS object database and functions @@ -8,18 +8,18 @@ * Created at: Thu Oct 1 22:50:04 1998 * Modified at: Wed Dec 15 11:23:16 1999 * Modified by: Dag Brattli - * + * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. - * + * * Neither Dag Brattli nor University of Tromsų admit liability nor - * provide warranty for any of this software. This material is + * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. - * + * ********************************************************************/ #include @@ -47,7 +47,7 @@ { char *new_str; int len; - + /* Check string */ if (str == NULL) return NULL; @@ -59,14 +59,14 @@ /* Allocate new string */ new_str = kmalloc(len + 1, GFP_ATOMIC); if (new_str == NULL) { - WARNING(__FUNCTION__"(), Unable to kmalloc!\n"); + WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); return NULL; } /* Copy and truncate */ memcpy(new_str, str, len); new_str[len] = '\0'; - + return new_str; } @@ -79,10 +79,10 @@ struct ias_object *irias_new_object( char *name, int id) { struct ias_object *obj; - + IRDA_DEBUG( 4, __FUNCTION__ "()\n"); - obj = (struct ias_object *) kmalloc(sizeof(struct ias_object), + obj = (struct ias_object *) kmalloc(sizeof(struct ias_object), GFP_ATOMIC); if (obj == NULL) { IRDA_DEBUG(0, __FUNCTION__ "(), Unable to allocate object!\n"); @@ -95,7 +95,7 @@ obj->id = id; obj->attribs = hashbin_new(HB_LOCAL); - + return obj; } @@ -115,7 +115,7 @@ irias_delete_value(attrib->value); attrib->magic = ~IAS_ATTRIB_MAGIC; - + kfree(attrib); } @@ -126,11 +126,11 @@ if (obj->name) kfree(obj->name); - + hashbin_delete(obj->attribs, (FREE_FUNC) __irias_delete_attrib); - + obj->magic = ~IAS_OBJECT_MAGIC; - + kfree(obj); } @@ -141,7 +141,7 @@ * with this object and the object itself * */ -int irias_delete_object(struct ias_object *obj) +int irias_delete_object(struct ias_object *obj) { struct ias_object *node; @@ -164,7 +164,7 @@ * the object, remove the object as well. * */ -int irias_delete_attrib(struct ias_object *obj, struct ias_attrib *attrib) +int irias_delete_attrib(struct ias_object *obj, struct ias_attrib *attrib) { struct ias_attrib *node; @@ -198,7 +198,7 @@ { ASSERT(obj != NULL, return;); ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); - + hashbin_insert(objects, (irda_queue_t *) obj, 0, obj->name); } @@ -247,7 +247,7 @@ { ASSERT(obj != NULL, return;); ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); - + ASSERT(attrib != NULL, return;); ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, return;); @@ -263,8 +263,8 @@ * Change the value of an objects attribute. * */ -int irias_object_change_attribute(char *obj_name, char *attrib_name, - struct ias_value *new_value) +int irias_object_change_attribute(char *obj_name, char *attrib_name, + struct ias_value *new_value) { struct ias_object *obj; struct ias_attrib *attrib; @@ -272,7 +272,7 @@ /* Find object */ obj = hashbin_find(objects, 0, obj_name); if (obj == NULL) { - WARNING(__FUNCTION__ "(), Unable to find object: %s\n", + WARNING("%s: Unable to find object: %s\n", __FUNCTION__, obj_name); return -1; } @@ -280,20 +280,20 @@ /* Find attribute */ attrib = hashbin_find(obj->attribs, 0, attrib_name); if (attrib == NULL) { - WARNING(__FUNCTION__ "(), Unable to find attribute: %s\n", + WARNING("%s: Unable to find attribute: %s\n", __FUNCTION__, attrib_name); return -1; } - + if ( attrib->value->type != new_value->type) { - IRDA_DEBUG( 0, __FUNCTION__ + IRDA_DEBUG( 0, __FUNCTION__ "(), changing value type not allowed!\n"); return -1; } /* Delete old value */ irias_delete_value(attrib->value); - + /* Insert new value */ attrib->value = new_value; @@ -315,11 +315,11 @@ ASSERT(obj != NULL, return;); ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); ASSERT(name != NULL, return;); - - attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib), + + attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib), GFP_ATOMIC); if (attrib == NULL) { - WARNING(__FUNCTION__ "(), Unable to allocate attribute!\n"); + WARNING("%s: Unable to allocate attribute!\n", __FUNCTION__); return; } memset(attrib, 0, sizeof( struct ias_attrib)); @@ -329,7 +329,7 @@ /* Insert value */ attrib->value = irias_new_integer_value(value); - + irias_add_attrib(obj, attrib, owner); } @@ -344,27 +344,26 @@ int len, int owner) { struct ias_attrib *attrib; - + ASSERT(obj != NULL, return;); ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;); - + ASSERT(name != NULL, return;); ASSERT(octets != NULL, return;); - - attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib), + + attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib), GFP_ATOMIC); if (attrib == NULL) { - WARNING(__FUNCTION__ - "(), Unable to allocate attribute!\n"); + WARNING("%s: Unable to allocate attribute!\n", __FUNCTION__); return; } memset(attrib, 0, sizeof( struct ias_attrib)); - + attrib->magic = IAS_ATTRIB_MAGIC; attrib->name = strndup(name, IAS_MAX_ATTRIBNAME); - + attrib->value = irias_new_octseq_value( octets, len); - + irias_add_attrib(obj, attrib, owner); } @@ -384,11 +383,11 @@ ASSERT(name != NULL, return;); ASSERT(value != NULL, return;); - - attrib = (struct ias_attrib *) kmalloc(sizeof( struct ias_attrib), + + attrib = (struct ias_attrib *) kmalloc(sizeof( struct ias_attrib), GFP_ATOMIC); if (attrib == NULL) { - WARNING(__FUNCTION__ "(), Unable to allocate attribute!\n"); + WARNING("%s: Unable to allocate attribute!\n", __FUNCTION__); return; } memset(attrib, 0, sizeof( struct ias_attrib)); @@ -413,7 +412,7 @@ value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); if (value == NULL) { - WARNING(__FUNCTION__ "(), Unable to kmalloc!\n"); + WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); return NULL; } memset(value, 0, sizeof(struct ias_value)); @@ -438,7 +437,7 @@ value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); if (value == NULL) { - WARNING(__FUNCTION__ "(), Unable to kmalloc!\n"); + WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); return NULL; } memset( value, 0, sizeof( struct ias_value)); @@ -465,7 +464,7 @@ value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); if (value == NULL) { - WARNING(__FUNCTION__ "(), Unable to kmalloc!\n"); + WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); return NULL; } memset(value, 0, sizeof(struct ias_value)); @@ -478,7 +477,7 @@ value->t.oct_seq = kmalloc(len, GFP_ATOMIC); if (value->t.oct_seq == NULL){ - WARNING(__FUNCTION__"(), Unable to kmalloc!\n"); + WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); kfree(value); return NULL; } @@ -492,7 +491,7 @@ value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC); if (value == NULL) { - WARNING(__FUNCTION__ "(), Unable to kmalloc!\n"); + WARNING("%s: Unable to kmalloc!\n", __FUNCTION__); return NULL; } memset(value, 0, sizeof(struct ias_value)); @@ -536,6 +535,3 @@ } kfree(value); } - - -