public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Chee, Tien Fong <tien.fong.chee@intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 3/6] block: Add a function to find block device descriptor
Date: Wed, 11 Jul 2018 14:23:06 +0000	[thread overview]
Message-ID: <1531318986.9560.8.camel@intel.com> (raw)
In-Reply-To: <CAPnjgZ1xpJTcdiWK8E3w8rZRk+ZYTrNKJetkCO-Ny7=9ygk9_w@mail.gmail.com>

On Wed, 2018-07-11 at 08:02 -0600, Simon Glass wrote:
> Hi Tien,
> 
> On 6 July 2018 at 02:26,  <tien.fong.chee@intel.com> wrote:
> > 
> > From: Tien Fong Chee <tien.fong.chee@intel.com>
> > 
> > Add a function to find the block device descriptor of the parent
> > device.
> > 
> > Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
> > ---
> >  drivers/block/blk-uclass.c | 23 +++++++++++++++++++++++
> >  include/blk.h              |  9 +++++++++
> >  2 files changed, 32 insertions(+)
> > 
> > diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-
> > uclass.c
> > index 9e0c823..facf527 100644
> > --- a/drivers/block/blk-uclass.c
> > +++ b/drivers/block/blk-uclass.c
> > @@ -132,6 +132,29 @@ struct blk_desc
> > *blk_get_devnum_by_typename(const char *if_typename, int devnum)
> >  }
> > 
> >  /**
> > + * blk_get_by_device() - Get the block device descriptor for the
> > given device
> > + * @dev:       Instance of a storage device
> > + *
> > + * Return: With block device descriptor on success , NULL if there
> > is no such
> > + *        block device.
> > + */
> > +struct blk_desc *blk_get_by_device(struct udevice *dev)
> > +{
> > +       struct udevice *child_dev, *next;
> > +
> > +       device_foreach_child_safe(child_dev, next, dev) {
> > +               if (device_get_uclass_id(child_dev) != UCLASS_BLK)
> > +                       continue;
> > +
> > +               return dev_get_uclass_platdata(child_dev);
> > +       }
> > +
> > +       debug("%s: No block device found\n", __func__);
> > +
> > +       return NULL;
> > +}
> Is this different from blk_get_from_parent() ?
This new function would return block description. 
blk_get_from_parents() would return child device.
> 
> [..]
> 
> Regards,
> Simon

  reply	other threads:[~2018-07-11 14:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-06  8:26 [U-Boot] [PATCH v4 3/6] block: Add a function to find block device descriptor tien.fong.chee at intel.com
2018-07-11 14:02 ` Simon Glass
2018-07-11 14:23   ` Chee, Tien Fong [this message]
2018-07-11 20:13     ` Simon Glass
2018-07-12  5:30       ` Chee, Tien Fong
2018-09-29 15:43 ` [U-Boot] [U-Boot, v4, " Tom Rini

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=1531318986.9560.8.camel@intel.com \
    --to=tien.fong.chee@intel.com \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox