All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Shuah Khan <shuahkh@osg.samsung.com>,
	mchehab@osg.samsung.com, hans.verkuil@cisco.com,
	laurent.pinchart@ideasonboard.com, tiwai@suse.de, perex@perex.cz,
	agoode@google.com, pierre-louis.bossart@linux.intel.com,
	gtmkramer@xs4all.nl, clemens@ladisch.de, vladcatoi@gmail.com,
	damien@zamaudio.com, chris.j.arges@canonical.com,
	takamichiho@gmail.com, misterpib@gmail.com, daniel@zonque.org,
	pmatilai@laiskiainen.org, jussi@sonarnerd.net,
	normalperson@yhbt.net, fisch602@gmail.com, joe@oampo.co.uk
Cc: linux-media@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/2] media: new media controller API for device resource support
Date: Fri, 29 May 2015 12:34:03 +0200	[thread overview]
Message-ID: <5568409B.1040108@xs4all.nl> (raw)
In-Reply-To: <c7f3e48e130dd397046f59383921960a43f6eed8.1431110739.git.shuahkh@osg.samsung.com>

On 05/08/2015 09:31 PM, Shuah Khan wrote:
> Add new media controller API to allocate media device as a
> device resource. When a media device is created on the main
> struct device which is the parent device for the interface
> device, it will be available to all drivers associated with
> that interface. For example, if a usb media device driver
> creates the media device on the main struct device which is
> common for all the drivers that control the media device,
> including the non-media ALSA driver, media controller API
> can be used to share access to the resources on the media
> device. This new interface provides the above described
> feature. A second interface that finds and returns the media
> device is added to allow drivers to find the media device
> created by any of the drivers associated with the device.
> 
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  drivers/media/media-device.c | 33 +++++++++++++++++++++++++++++++++
>  include/media/media-device.h |  2 ++
>  2 files changed, 35 insertions(+)
> 
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index 7b39440..1c32752 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -462,3 +462,36 @@ void media_device_unregister_entity(struct media_entity *entity)
>  	entity->parent = NULL;
>  }
>  EXPORT_SYMBOL_GPL(media_device_unregister_entity);
> +
> +static void media_device_release_dr(struct device *dev, void *res)
> +{
> +}
> +
> +/*
> + * media_device_get_dr() - get media device as device resource
> + *			creates if one doesn't exist
> +*/
> +struct media_device *media_device_get_dr(struct device *dev)

I'd use get_devres rather than get_dr. I keep thinking that get_dr means
get_driver. It's too ambiguous, I think.

Regards,

	Hans

> +{
> +	struct media_device *mdev;
> +
> +	mdev = devres_find(dev, media_device_release_dr, NULL, NULL);
> +	if (mdev)
> +		return mdev;
> +
> +	mdev = devres_alloc(media_device_release_dr,
> +				sizeof(struct media_device), GFP_KERNEL);
> +	if (!mdev)
> +		return NULL;
> +	return devres_get(dev, mdev, NULL, NULL);
> +}
> +EXPORT_SYMBOL_GPL(media_device_get_dr);
> +
> +/*
> + * media_device_find_dr() - find media device as device resource
> +*/
> +struct media_device *media_device_find_dr(struct device *dev)
> +{
> +	return devres_find(dev, media_device_release_dr, NULL, NULL);
> +}
> +EXPORT_SYMBOL_GPL(media_device_find_dr);
> diff --git a/include/media/media-device.h b/include/media/media-device.h
> index 6e6db78..53d0fc3 100644
> --- a/include/media/media-device.h
> +++ b/include/media/media-device.h
> @@ -95,6 +95,8 @@ void media_device_unregister(struct media_device *mdev);
>  int __must_check media_device_register_entity(struct media_device *mdev,
>  					      struct media_entity *entity);
>  void media_device_unregister_entity(struct media_entity *entity);
> +struct media_device *media_device_get_dr(struct device *dev);
> +struct media_device *media_device_find_dr(struct device *dev);
>  
>  /* Iterate over all entities. */
>  #define media_device_for_each_entity(entity, mdev)			\
> 

  reply	other threads:[~2015-05-29 10:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 19:31 [PATCH 0/2] Update ALSA driver to use media controller API Shuah Khan
2015-05-08 19:31 ` [PATCH 1/2] media: new media controller API for device resource support Shuah Khan
2015-05-08 19:31   ` Shuah Khan
2015-05-29 10:34   ` Hans Verkuil [this message]
2015-05-08 19:31 ` [PATCH 2/2] sound/usb: Update ALSA driver to use media controller API Shuah Khan
2015-05-09  4:51   ` Eric Wong
2015-05-11 16:09     ` Shuah Khan
2015-05-27 15:24   ` Takashi Iwai
2015-06-01 15:51     ` Shuah Khan
2015-05-29 10:43   ` Hans Verkuil
2015-05-22 20:34 ` [PATCH 0/2] " Shuah Khan

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=5568409B.1040108@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=agoode@google.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=chris.j.arges@canonical.com \
    --cc=clemens@ladisch.de \
    --cc=damien@zamaudio.com \
    --cc=daniel@zonque.org \
    --cc=fisch602@gmail.com \
    --cc=gtmkramer@xs4all.nl \
    --cc=hans.verkuil@cisco.com \
    --cc=joe@oampo.co.uk \
    --cc=jussi@sonarnerd.net \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=misterpib@gmail.com \
    --cc=normalperson@yhbt.net \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=pmatilai@laiskiainen.org \
    --cc=shuahkh@osg.samsung.com \
    --cc=takamichiho@gmail.com \
    --cc=tiwai@suse.de \
    --cc=vladcatoi@gmail.com \
    /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.