All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Cornelia Huck <COHUCK@de.ibm.com>
Cc: Greg KH <greg@kroah.com>,
	akpm@osdl.org, linux-kernel@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	mochel@digitalimplant.org
Subject: Re: [patch 1/16] s390: klist bus_find_device & driver_find_device callback.
Date: Wed, 22 Jun 2005 01:14:12 -0700	[thread overview]
Message-ID: <20050622081411.GA30791@suse.de> (raw)
In-Reply-To: <OF6148E781.C94AF99A-ON42257028.002925D7-42257028.002AF389@de.ibm.com>

On Wed, Jun 22, 2005 at 09:48:02AM +0200, Cornelia Huck wrote:
> 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.

Ah, now I get it.  "later use" is the key point here.  I was thinking
you could do whatever you want within the callback.  But if you want to
do something later on with this pointer, that would be very tough.

Hm, I could use this kind of function, as I had to jump through a few
hoops when iterating over all devices on a bus, when I just wanted to
find a specific device (it involved creating a temp structure on the
stack and doing my logic in the callback function itself, for details
see
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/driver/driver-bind.patch
for a patch that adds manual binding of drivers to devices from
userspace through sysfs.  With this function it should get even smaller.)

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

Care to fix this up and resend it?

Sorry for the misunderstanding.

thanks,

greg k-h

  reply	other threads:[~2005-06-22  8:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-21 16:22 [patch 1/16] s390: klist bus_find_device & driver_find_device callback Martin Schwidefsky
2005-06-22  6:26 ` Greg KH
2005-06-22  7:48   ` Cornelia Huck
2005-06-22  8:14     ` Greg KH [this message]
2005-06-22 14:59       ` Cornelia Huck
2005-06-22 14:59       ` [patch 1/2] " Cornelia Huck
2005-06-22 14:59       ` [patch 2/2] s390: use klist in cio Cornelia Huck
2005-06-22  8:11 ` [patch 1/16] s390: klist bus_find_device & driver_find_device callback Christoph Hellwig
2005-06-22  8:19   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050622081411.GA30791@suse.de \
    --to=gregkh@suse.de \
    --cc=COHUCK@de.ibm.com \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@digitalimplant.org \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.