From 6faa4ed74df2d83cbb959ba799032da4249893b6 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 29 Jul 2017 11:34:53 -0600 Subject: dm: blk: Add a function to find an interface-type name Add a function to find the name of an interface type (e.g. "sata", "scsi") from the interface type enum. This is useful for generic code (not specific to SATA or SCSI, for example) that wants to display the type of interface it is dealing with. Signed-off-by: Simon Glass --- drivers/block/blk_legacy.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/block/blk_legacy.c') diff --git a/drivers/block/blk_legacy.c b/drivers/block/blk_legacy.c index 7b90a8a6e1..981872ecb3 100644 --- a/drivers/block/blk_legacy.c +++ b/drivers/block/blk_legacy.c @@ -38,6 +38,13 @@ static struct blk_driver *blk_driver_lookup_typename(const char *if_typename) return NULL; } +const char *blk_get_if_type_name(enum if_type if_type) +{ + struct blk_driver *drv = blk_driver_lookup_type(if_type); + + return drv ? drv->if_typename : NULL; +} + /** * get_desc() - Get the block device descriptor for the given device number * -- cgit v1.2.3