linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: v4l2-tpg: Remove unused tpg_fillbuffer
@ 2025-06-03 22:51 linux
  2025-06-04  7:09 ` Hans Verkuil
  0 siblings, 1 reply; 3+ messages in thread
From: linux @ 2025-06-03 22:51 UTC (permalink / raw)
  To: mchehab, linux-media; +Cc: linux-kernel, Dr. David Alan Gilbert

From: "Dr. David Alan Gilbert" <linux@treblig.org>

The last use of tpg_fillbuffer() was removed in 2015 by
commit ddcaee9dd4c0 ("[media] vivid: add support for single buffer planar
formats")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 17 -----------------
 include/media/tpg/v4l2-tpg.h                  |  2 --
 2 files changed, 19 deletions(-)

diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index 931e5dc453b9..d51d8ba99dcb 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -2710,23 +2710,6 @@ void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std,
 }
 EXPORT_SYMBOL_GPL(tpg_fill_plane_buffer);
 
-void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std, unsigned p, u8 *vbuf)
-{
-	unsigned offset = 0;
-	unsigned i;
-
-	if (tpg->buffers > 1) {
-		tpg_fill_plane_buffer(tpg, std, p, vbuf);
-		return;
-	}
-
-	for (i = 0; i < tpg_g_planes(tpg); i++) {
-		tpg_fill_plane_buffer(tpg, std, i, vbuf + offset);
-		offset += tpg_calc_plane_size(tpg, i);
-	}
-}
-EXPORT_SYMBOL_GPL(tpg_fillbuffer);
-
 MODULE_DESCRIPTION("V4L2 Test Pattern Generator");
 MODULE_AUTHOR("Hans Verkuil");
 MODULE_LICENSE("GPL");
diff --git a/include/media/tpg/v4l2-tpg.h b/include/media/tpg/v4l2-tpg.h
index a55088921d1d..3e3bd0889b6d 100644
--- a/include/media/tpg/v4l2-tpg.h
+++ b/include/media/tpg/v4l2-tpg.h
@@ -248,8 +248,6 @@ void tpg_calc_text_basep(struct tpg_data *tpg,
 unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line);
 void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std,
 			   unsigned p, u8 *vbuf);
-void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std,
-		    unsigned p, u8 *vbuf);
 bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc);
 void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop,
 		const struct v4l2_rect *compose);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: v4l2-tpg: Remove unused tpg_fillbuffer
  2025-06-03 22:51 [PATCH] media: v4l2-tpg: Remove unused tpg_fillbuffer linux
@ 2025-06-04  7:09 ` Hans Verkuil
  2025-06-05  1:10   ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2025-06-04  7:09 UTC (permalink / raw)
  To: linux, mchehab, linux-media; +Cc: linux-kernel

On 04/06/2025 00:51, linux@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
> 
> The last use of tpg_fillbuffer() was removed in 2015 by
> commit ddcaee9dd4c0 ("[media] vivid: add support for single buffer planar
> formats")
> 
> Remove it.

Ah, this can't be removed.

This tpg code is actually also used in git://linuxtv.org/v4l-utils.git which
copies the code from the kernel source. And there this function is in use.

This function is really a helper function. I think the best approach is to move
this out of v4l2-tpg-core.c and into v4l2-tpg.h as a static inline.

That way it doesn't add to the kernel code size, but is still available when needed.

Perhaps add a comment in front of this function noting that it is used in v4l-utils.

Regards,

	Hans

> 
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> ---
>  drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 17 -----------------
>  include/media/tpg/v4l2-tpg.h                  |  2 --
>  2 files changed, 19 deletions(-)
> 
> diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> index 931e5dc453b9..d51d8ba99dcb 100644
> --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> @@ -2710,23 +2710,6 @@ void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std,
>  }
>  EXPORT_SYMBOL_GPL(tpg_fill_plane_buffer);
>  
> -void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std, unsigned p, u8 *vbuf)
> -{
> -	unsigned offset = 0;
> -	unsigned i;
> -
> -	if (tpg->buffers > 1) {
> -		tpg_fill_plane_buffer(tpg, std, p, vbuf);
> -		return;
> -	}
> -
> -	for (i = 0; i < tpg_g_planes(tpg); i++) {
> -		tpg_fill_plane_buffer(tpg, std, i, vbuf + offset);
> -		offset += tpg_calc_plane_size(tpg, i);
> -	}
> -}
> -EXPORT_SYMBOL_GPL(tpg_fillbuffer);
> -
>  MODULE_DESCRIPTION("V4L2 Test Pattern Generator");
>  MODULE_AUTHOR("Hans Verkuil");
>  MODULE_LICENSE("GPL");
> diff --git a/include/media/tpg/v4l2-tpg.h b/include/media/tpg/v4l2-tpg.h
> index a55088921d1d..3e3bd0889b6d 100644
> --- a/include/media/tpg/v4l2-tpg.h
> +++ b/include/media/tpg/v4l2-tpg.h
> @@ -248,8 +248,6 @@ void tpg_calc_text_basep(struct tpg_data *tpg,
>  unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line);
>  void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std,
>  			   unsigned p, u8 *vbuf);
> -void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std,
> -		    unsigned p, u8 *vbuf);
>  bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc);
>  void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop,
>  		const struct v4l2_rect *compose);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: v4l2-tpg: Remove unused tpg_fillbuffer
  2025-06-04  7:09 ` Hans Verkuil
@ 2025-06-05  1:10   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2025-06-05  1:10 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: mchehab, linux-media, linux-kernel

* Hans Verkuil (hans@jjverkuil.nl) wrote:
> On 04/06/2025 00:51, linux@treblig.org wrote:
> > From: "Dr. David Alan Gilbert" <linux@treblig.org>
> > 
> > The last use of tpg_fillbuffer() was removed in 2015 by
> > commit ddcaee9dd4c0 ("[media] vivid: add support for single buffer planar
> > formats")
> > 
> > Remove it.
> 
> Ah, this can't be removed.
> 
> This tpg code is actually also used in git://linuxtv.org/v4l-utils.git which
> copies the code from the kernel source. And there this function is in use.

Ah OK, fair enough.

> This function is really a helper function. I think the best approach is to move
> this out of v4l2-tpg-core.c and into v4l2-tpg.h as a static inline.
> 
> That way it doesn't add to the kernel code size, but is still available when needed.

It feels a bit bug for a static inline to me; personally I wouldn't worry that much about
kernel size in that case - the tpg is in a separate module isn't it, which I guess
is rarely used in normal use?

> Perhaps add a comment in front of this function noting that it is used in v4l-utils.

Yeh, reasonable,

Thanks for the review,

Dave

> Regards,
> 
> 	Hans
> 
> > 
> > Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> > ---
> >  drivers/media/common/v4l2-tpg/v4l2-tpg-core.c | 17 -----------------
> >  include/media/tpg/v4l2-tpg.h                  |  2 --
> >  2 files changed, 19 deletions(-)
> > 
> > diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> > index 931e5dc453b9..d51d8ba99dcb 100644
> > --- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> > +++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
> > @@ -2710,23 +2710,6 @@ void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std,
> >  }
> >  EXPORT_SYMBOL_GPL(tpg_fill_plane_buffer);
> >  
> > -void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std, unsigned p, u8 *vbuf)
> > -{
> > -	unsigned offset = 0;
> > -	unsigned i;
> > -
> > -	if (tpg->buffers > 1) {
> > -		tpg_fill_plane_buffer(tpg, std, p, vbuf);
> > -		return;
> > -	}
> > -
> > -	for (i = 0; i < tpg_g_planes(tpg); i++) {
> > -		tpg_fill_plane_buffer(tpg, std, i, vbuf + offset);
> > -		offset += tpg_calc_plane_size(tpg, i);
> > -	}
> > -}
> > -EXPORT_SYMBOL_GPL(tpg_fillbuffer);
> > -
> >  MODULE_DESCRIPTION("V4L2 Test Pattern Generator");
> >  MODULE_AUTHOR("Hans Verkuil");
> >  MODULE_LICENSE("GPL");
> > diff --git a/include/media/tpg/v4l2-tpg.h b/include/media/tpg/v4l2-tpg.h
> > index a55088921d1d..3e3bd0889b6d 100644
> > --- a/include/media/tpg/v4l2-tpg.h
> > +++ b/include/media/tpg/v4l2-tpg.h
> > @@ -248,8 +248,6 @@ void tpg_calc_text_basep(struct tpg_data *tpg,
> >  unsigned tpg_g_interleaved_plane(const struct tpg_data *tpg, unsigned buf_line);
> >  void tpg_fill_plane_buffer(struct tpg_data *tpg, v4l2_std_id std,
> >  			   unsigned p, u8 *vbuf);
> > -void tpg_fillbuffer(struct tpg_data *tpg, v4l2_std_id std,
> > -		    unsigned p, u8 *vbuf);
> >  bool tpg_s_fourcc(struct tpg_data *tpg, u32 fourcc);
> >  void tpg_s_crop_compose(struct tpg_data *tpg, const struct v4l2_rect *crop,
> >  		const struct v4l2_rect *compose);
> 
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-05  1:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-03 22:51 [PATCH] media: v4l2-tpg: Remove unused tpg_fillbuffer linux
2025-06-04  7:09 ` Hans Verkuil
2025-06-05  1:10   ` Dr. David Alan Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).