From c9ef6d3852a8a289f2c39f90a8e02846ba2a3317 Mon Sep 17 00:00:00 2001 From: Phani Kumar Uppalapati Date: Wed, 4 May 2016 10:33:42 -0700 Subject: [PATCH] slimbus: Add API to get matching ID table Add API in slimbus driver for clients to get the matching ID table which helps in accessing driver data and name fields. CRs-fixed: 975738 Change-Id: I09c9f1de74e348b032d215cbb0fb9ba6c7aecf18 Signed-off-by: Phani Kumar Uppalapati --- drivers/slimbus/slimbus.c | 8 ++++++++ include/linux/slimbus/slimbus.h | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/slimbus/slimbus.c b/drivers/slimbus/slimbus.c index a01a226be8b5..0819395a5e65 100644 --- a/drivers/slimbus/slimbus.c +++ b/drivers/slimbus/slimbus.c @@ -62,6 +62,14 @@ static const struct slim_device_id *slim_match(const struct slim_device_id *id, return NULL; } +const struct slim_device_id *slim_get_device_id(const struct slim_device *sdev) +{ + const struct slim_driver *sdrv = to_slim_driver(sdev->dev.driver); + + return slim_match(sdrv->id_table, sdev); +} +EXPORT_SYMBOL(slim_get_device_id); + static int slim_device_match(struct device *dev, struct device_driver *driver) { struct slim_device *slim_dev; diff --git a/include/linux/slimbus/slimbus.h b/include/linux/slimbus/slimbus.h index a2092f062833..05fb62e45b52 100644 --- a/include/linux/slimbus/slimbus.h +++ b/include/linux/slimbus/slimbus.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1173,6 +1173,9 @@ extern struct slim_controller *slim_busnum_to_ctrl(u32 busnum); */ extern void slim_ctrl_add_boarddevs(struct slim_controller *ctrl); +extern const +struct slim_device_id *slim_get_device_id(const struct slim_device *sdev); + /* * slim_register_board_info: Board-initialization routine. * @info: List of all devices on all controllers present on the board.