lkml.org 
[lkml]   [2005]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch 1/16] s390: klist bus_find_device & driver_find_device callback.
From
Date
Greg KH <greg@kroah.com> wrote on 22.06.2005 08:26:27:

> What's wrong with just using bus_for_each_dev() instead? You have to
> supply a "match" type function anyway, so the caller doesn't have an
> easier time using this function instead.

Maybe it's just too early in the morning, but I don't see how I could
achive what I want to do with bus_for_each_dev(). The idea behind
bus_find_device() is to scan the bus for a device matching some
criterium and to return a pointer to it with which the caller can
continue to work. bus_for_each_dev() calls the match function for
every device until we abort, but I don't see how I can grab a reference
to a specific device for later use.

> You also don't increment the reference properly when you return the
> pointer, so you better document that... :(

You're right, this should be done in the base code and not by the
caller...

> In short, I don't think this is needed at all, as it's an almost
> identical copy of bus_for_each_dev().

It looks similar, yes, but they are for different purposes:
- bus_for_each_dev(): do something for each device (as specified
in the callback function)
- bus_find_device(): get a reference to a specific device for later
use (as matched in the callback function)

> Same comment as above, I don't think this function is necessary.

Same comment from me, I think I need this interface for drivers
as well.

> thanks,
>
> greg k-h

Regards,
Cornelia

-
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-06-22 10:09    [W:0.056 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site