diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-11 16:24:23 (GMT) |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-16 10:41:10 (GMT) |
commit | bb07bd6b6851120ac9b25bb315d62d9782d2c345 (patch) | |
tree | b40e2ae528e4c5427d62c0ce45697dce3e2a5365 /drivers/media/media-device.c | |
parent | c73bbaa4ec3eb225ffe468f80d45724d0496bf03 (diff) | |
download | linux-bb07bd6b6851120ac9b25bb315d62d9782d2c345.tar.xz |
[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.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 4d1c13d..5ebb3cd 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)); |