All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: [PATCH 04/11] [media] allow overriding the driver name
Date: Fri, 12 Feb 2016 07:44:59 -0200	[thread overview]
Message-ID: <e41546d3a262281e9baf45982da6930e493dadf8.1455269986.git.mchehab@osg.samsung.com> (raw)
In-Reply-To: <cover.1455269986.git.mchehab@osg.samsung.com>
In-Reply-To: <cover.1455269986.git.mchehab@osg.samsung.com>

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>
---
 drivers/media/media-device.c | 6 +++++-
 include/media/media-device.h | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

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));
diff --git a/include/media/media-device.h b/include/media/media-device.h
index d3855898c3fc..165451bc3985 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -268,6 +268,10 @@ struct device;
  * struct media_device - Media device
  * @dev:	Parent device
  * @devnode:	Media device node
+ * @driver_name: Optional device driver name. If not set, calls to
+ *		%MEDIA_IOC_DEVICE_INFO will return dev->driver->name.
+ *		This is needed for USB drivers for example, as otherwise
+ *		they'll all appear as if the driver name was "usb".
  * @model:	Device model name
  * @serial:	Device serial number (optional)
  * @bus_info:	Unique and stable device location identifier
@@ -303,6 +307,7 @@ struct media_device {
 	struct media_devnode devnode;
 
 	char model[32];
+	char driver_name[32];
 	char serial[40];
 	char bus_info[32];
 	u32 hw_revision;
-- 
2.5.0



  parent reply	other threads:[~2016-02-12  9:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12  9:44 [PATCH 00/11] Some improvements/fixes Mauro Carvalho Chehab
2016-02-12  9:44 ` [PATCH 01/11] [media] v4l2-mc.h: prevent it for being included twice Mauro Carvalho Chehab
2016-02-12  9:50   ` Hans Verkuil
2016-02-12  9:44 ` [PATCH 02/11] [media] v4l2-mc: add a routine to create USB media_device Mauro Carvalho Chehab
2016-02-12  9:52   ` Hans Verkuil
2016-02-12  9:44 ` [PATCH 03/11] [media] rc-core: don't lock device at rc_register_device() Mauro Carvalho Chehab
2016-02-12  9:44 ` Mauro Carvalho Chehab [this message]
2016-02-12  9:45 ` [PATCH 05/11] [media] use v4l2_mc_usb_media_device_init() on most USB devices Mauro Carvalho Chehab
2016-02-12  9:45 ` [PATCH 06/11] [media] v4l2-mc: use usb_make_path() to provide bus info Mauro Carvalho Chehab
2016-02-12  9:55   ` Hans Verkuil
2016-02-12  9:45 ` [PATCH 07/11] [media] em28xx-dvb: create RF connector on DVB-only mode Mauro Carvalho Chehab
2016-02-12  9:45 ` [PATCH 08/11] [media] cx231xx: use v4l2 core function to create the MC graph Mauro Carvalho Chehab
2016-02-12 10:40   ` kbuild test robot
2016-02-12  9:45 ` [PATCH 09/11] [media] si2157: register as a tuner entity Mauro Carvalho Chehab
2016-02-12  9:45 ` [PATCH 10/11] [media] cx231xx, em28xx: pass media_device to si2157 Mauro Carvalho Chehab
2016-02-12  9:45 ` [PATCH 11/11] [media] cx231xx: create connectors at the media graph Mauro Carvalho Chehab

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=e41546d3a262281e9baf45982da6930e493dadf8.1455269986.git.mchehab@osg.samsung.com \
    --to=mchehab@osg.samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.