Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261610AbUFQSfi (ORCPT ); Thu, 17 Jun 2004 14:35:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261638AbUFQSfh (ORCPT ); Thu, 17 Jun 2004 14:35:37 -0400 Received: from mail.homelink.ru ([81.9.33.123]:28381 "EHLO eltel.net") by vger.kernel.org with ESMTP id S261610AbUFQSfR (ORCPT ); Thu, 17 Jun 2004 14:35:17 -0400 Date: Thu, 17 Jun 2004 22:35:14 +0400 From: Andrew Zabolotny To: Greg KH Cc: linux-kernel@vger.kernel.org Subject: Backlight and LCD module patches [1] Message-Id: <20040617223514.2e129ce9.zap@homelink.ru> Organization: home X-Mailer: Sylpheed version 0.9.6 (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: #%`a@cSvZ:n@M%n/to$C^!{JE%'%7_0xb("Hr%7Z0LDKO7?w=m~CU#d@-.2yO9 epB|2@pe{%4[Q3pw""FeqiT6rOc>+8|ED/6=Eh/4l3Ru>qRC]ef%ojRz;GQb=uqI --- linux-2.6.7-rc3/drivers/base/class.c 2004-06-11 02:39:19.000000000 +0400 +++ linux/drivers/base/class.c 2004-06-17 21:51:11.000000000 +0400 @@ -359,7 +359,7 @@ class_device_put(class_dev); } -int class_device_rename(struct class_device *class_dev, char *new_name) +int class_device_rename(struct class_device *class_dev, const char *new_name) { int error = 0; @@ -379,6 +379,33 @@ return error; } +/** + * class_device_find - find a struct class_device in a specific class + * @class: the class to search + * @class_id: the class_id to search for + * + * Iterates through the list of all class devices registered to a class. If + * the class_id is found, its reference count is incremented and returned to + * the caller. If the class_id does not match any existing struct class_device + * registered to this struct class, then NULL is returned. + */ +struct class_device * class_device_find(struct class *class, const char *class_id) +{ + struct class_device *class_dev; + struct class_device *found = NULL; + + down_read(&class->subsys.rwsem); + list_for_each_entry(class_dev, &class->children, node) { + if (strcmp(class_dev->class_id, class_id) == 0) { + found = class_device_get(class_dev); + break; + } + } + up_read(&class->subsys.rwsem); + + return found; +} + struct class_device * class_device_get(struct class_device *class_dev) { if (class_dev) @@ -391,7 +418,6 @@ kobject_put(&class_dev->kobj); } - int class_interface_register(struct class_interface *class_intf) { struct class * parent; @@ -470,6 +496,8 @@ EXPORT_SYMBOL(class_device_put); EXPORT_SYMBOL(class_device_create_file); EXPORT_SYMBOL(class_device_remove_file); +EXPORT_SYMBOL(class_device_rename); +EXPORT_SYMBOL(class_device_find); EXPORT_SYMBOL(class_interface_register); EXPORT_SYMBOL(class_interface_unregister); --- linux-2.6.7-rc3/include/linux/device.h 2004-06-11 02:39:37.000000000 +0400 +++ linux/include/linux/device.h 2004-06-17 21:52:32.000000000 +0400 @@ -212,8 +212,9 @@ extern int class_device_add(struct class_device *); extern void class_device_del(struct class_device *); -extern int class_device_rename(struct class_device *, char *); +extern int class_device_rename(struct class_device *, const char *); +extern struct class_device * class_device_find(struct class *class, const char *class_id); extern struct class_device * class_device_get(struct class_device *); extern void class_device_put(struct class_device *); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/