Messages in this thread |  | | Subject | Re: [patch 1/16] s390: klist bus_find_device & driver_find_device callback. | From | Cornelia Huck <> | Date | Wed, 22 Jun 2005 09:48:02 +0200 |
| |
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/
|  |