summary refs log tree commit diff
path: root/drivers/media/media-device.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-02-11 14:24:23 -0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-02-16 08:41:10 -0200
commitbb07bd6b6851120ac9b25bb315d62d9782d2c345 (patch)
treeb40e2ae528e4c5427d62c0ce45697dce3e2a5365 /drivers/media/media-device.c
parentc73bbaa4ec3eb225ffe468f80d45724d0496bf03 (diff)
downloadlinux-bb07bd6b6851120ac9b25bb315d62d9782d2c345.tar.gz
[media] allow overriding the driver name
On USB drivers, the dev struct is usually filled with the USB
device. That would mean that the name of the driver specified
by media_device.dev.driver.name would be "usb", instead of the
name of the actual driver that created the media entity.

Add an optional field at the internal struct to allow drivers
to override the driver name.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/media-device.c')
-rw-r--r--drivers/media/media-device.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 4d1c13de494b..5ebb3cd31345 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -55,7 +55,11 @@ static int media_device_get_info(struct media_device *dev,
 
 	memset(&info, 0, sizeof(info));
 
-	strlcpy(info.driver, dev->dev->driver->name, sizeof(info.driver));
+	if (dev->driver_name[0])
+		strlcpy(info.driver, dev->driver_name, sizeof(info.driver));
+	else
+		strlcpy(info.driver, dev->dev->driver->name, sizeof(info.driver));
+
 	strlcpy(info.model, dev->model, sizeof(info.model));
 	strlcpy(info.serial, dev->serial, sizeof(info.serial));
 	strlcpy(info.bus_info, dev->bus_info, sizeof(info.bus_info));