lkml.org 
[lkml]   [2004]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    SubjectSuspend2 merge: 2/51: Find class by name
    From
    Date
    A second patch that shouldn't be needed but is at the moment. It is used
    to find any framebuffer drivers and add put them in the kept-alive
    device tree. Once Pavel's improvements to the PM_ states are merged, I
    hope this will be able to go away.

    Not sure if would be helpful elsewhere?

    diff -ruN 207-find-class-by-name-old/drivers/base/class.c 207-find-class-by-name-new/drivers/base/class.c
    --- 207-find-class-by-name-old/drivers/base/class.c 2004-11-24 09:52:56.000000000 +1100
    +++ 207-find-class-by-name-new/drivers/base/class.c 2004-11-24 17:20:21.385685896 +1100
    @@ -497,6 +497,25 @@
    kobject_put(&class_dev->kobj);
    }

    +struct class * class_find(char * name)
    +{
    + struct class * this_class;
    +
    + if (!name)
    + return NULL;
    +
    + down_read(&class_subsys.rwsem);
    + list_for_each_entry(this_class, &class_subsys.kset.list, subsys.kset.kobj.entry) {
    + if (!(strcmp(this_class->name, name))) {
    + class_get(this_class);
    + up_read(&class_subsys.rwsem);
    + return this_class;
    + }
    + }
    + up_read(&class_subsys.rwsem);
    +
    + return NULL;
    +}

    int class_interface_register(struct class_interface *class_intf)
    {
    @@ -579,3 +598,5 @@

    EXPORT_SYMBOL_GPL(class_interface_register);
    EXPORT_SYMBOL_GPL(class_interface_unregister);
    +
    +EXPORT_SYMBOL_GPL(class_find);
    diff -ruN 207-find-class-by-name-old/include/linux/device.h 207-find-class-by-name-new/include/linux/device.h
    --- 207-find-class-by-name-old/include/linux/device.h 2004-11-24 17:20:41.583615344 +1100
    +++ 207-find-class-by-name-new/include/linux/device.h 2004-11-24 17:19:56.510467504 +1100
    @@ -164,6 +164,7 @@

    extern struct class * class_get(struct class *);
    extern void class_put(struct class *);
    +extern struct class * class_find(char * name);


    struct class_attribute {

    -
    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/

    \
     
     \ /
      Last update: 2005-03-22 14:08    [W:4.041 / U:0.128 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site