diff mbox

[2/3] V4L2: add a v4l2-clk helper macro to produce an I2C device ID

Message ID 1377696508-3190-3-git-send-email-g.liakhovetski@gmx.de (mailing list archive)
State New, archived
Headers show

Commit Message

Guennadi Liakhovetski Aug. 28, 2013, 1:28 p.m. UTC
To obtain a clock reference consumers supply their device object to the
V4L2 clock framework. The latter then uses the consumer device name to
find a matching clock. For that to work V4L2 clock providers have to
provide the same device name, when registering clocks. This patch adds
a helper macro to generate a suitable device name for I2C devices.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
V4L2 clocks use device ID matching, which in case of I2C devices involves
comparing a specially constructed from an I2C adapter number and a device
address
---
 include/media/v4l2-clk.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Laurent Pinchart Aug. 28, 2013, 1:35 p.m. UTC | #1
Hi Guennadi,

Thank you for the patch.

On Wednesday 28 August 2013 15:28:27 Guennadi Liakhovetski wrote:
> To obtain a clock reference consumers supply their device object to the
> V4L2 clock framework. The latter then uses the consumer device name to
> find a matching clock. For that to work V4L2 clock providers have to
> provide the same device name, when registering clocks. This patch adds
> a helper macro to generate a suitable device name for I2C devices.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> V4L2 clocks use device ID matching, which in case of I2C devices involves
> comparing a specially constructed from an I2C adapter number and a device
> address

Is this text placed below the SoB on purpose ?

> ---
>  include/media/v4l2-clk.h |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/include/media/v4l2-clk.h b/include/media/v4l2-clk.h
> index a354a9d..0b36cc1 100644
> --- a/include/media/v4l2-clk.h
> +++ b/include/media/v4l2-clk.h
> @@ -65,4 +65,7 @@ static inline struct v4l2_clk
> *v4l2_clk_register_fixed(const char *dev_id, return
> __v4l2_clk_register_fixed(dev_id, id, rate, THIS_MODULE); }
> 
> +#define v4l2_clk_name_i2c(name, size, adap, client) snprintf(name, size, \
> +			  "%d-%04x", adap, client)
> +

I would have made this a static inline but I have to confess I don't know why 
:-)

>  #endif
Guennadi Liakhovetski Aug. 28, 2013, 1:42 p.m. UTC | #2
On Wed, 28 Aug 2013, Laurent Pinchart wrote:

> Hi Guennadi,
> 
> Thank you for the patch.
> 
> On Wednesday 28 August 2013 15:28:27 Guennadi Liakhovetski wrote:
> > To obtain a clock reference consumers supply their device object to the
> > V4L2 clock framework. The latter then uses the consumer device name to
> > find a matching clock. For that to work V4L2 clock providers have to
> > provide the same device name, when registering clocks. This patch adds
> > a helper macro to generate a suitable device name for I2C devices.
> > 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > V4L2 clocks use device ID matching, which in case of I2C devices involves
> > comparing a specially constructed from an I2C adapter number and a device
> > address
> 
> Is this text placed below the SoB on purpose ?

Errm, it should have been deleted :) sorry.

Thanks
Guennadi

> 
> > ---
> >  include/media/v4l2-clk.h |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> > 
> > diff --git a/include/media/v4l2-clk.h b/include/media/v4l2-clk.h
> > index a354a9d..0b36cc1 100644
> > --- a/include/media/v4l2-clk.h
> > +++ b/include/media/v4l2-clk.h
> > @@ -65,4 +65,7 @@ static inline struct v4l2_clk
> > *v4l2_clk_register_fixed(const char *dev_id, return
> > __v4l2_clk_register_fixed(dev_id, id, rate, THIS_MODULE); }
> > 
> > +#define v4l2_clk_name_i2c(name, size, adap, client) snprintf(name, size, \
> > +			  "%d-%04x", adap, client)
> > +
> 
> I would have made this a static inline but I have to confess I don't know why 
> :-)
> 
> >  #endif
> -- 
> Regards,
> 
> Laurent Pinchart
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/media/v4l2-clk.h b/include/media/v4l2-clk.h
index a354a9d..0b36cc1 100644
--- a/include/media/v4l2-clk.h
+++ b/include/media/v4l2-clk.h
@@ -65,4 +65,7 @@  static inline struct v4l2_clk *v4l2_clk_register_fixed(const char *dev_id,
 	return __v4l2_clk_register_fixed(dev_id, id, rate, THIS_MODULE);
 }
 
+#define v4l2_clk_name_i2c(name, size, adap, client) snprintf(name, size, \
+			  "%d-%04x", adap, client)
+
 #endif