diff mbox series

[v2,2/3] media: rkisp1: Make local immutable array variables static const

Message ID 20221117084217.3892680-3-paul.elder@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series media: rkisp1: Miscellaneous improvements | expand

Commit Message

Paul Elder Nov. 17, 2022, 8:42 a.m. UTC
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

The max_widths and max_heights variables in rkisp1_try_fmt() are
immutable and don't need to be allocated on the stack every time the
function is called. Make them static.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
---
 .../media/platform/rockchip/rkisp1/rkisp1-capture.c  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Laurent Pinchart Nov. 19, 2022, 10:28 p.m. UTC | #1
Hi Dafna,

Are you fine with this patch, can I include it in my next pull request
along with the other ones from the series ?

On Thu, Nov 17, 2022 at 05:42:16PM +0900, Paul Elder wrote:
> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> The max_widths and max_heights variables in rkisp1_try_fmt() are
> immutable and don't need to be allocated on the stack every time the
> function is called. Make them static.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
>  .../media/platform/rockchip/rkisp1/rkisp1-capture.c  | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> index 7695ef134908..91e685fdbbe9 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> @@ -1150,13 +1150,17 @@ static void rkisp1_try_fmt(const struct rkisp1_capture *cap,
>  			   const struct rkisp1_capture_fmt_cfg **fmt_cfg,
>  			   const struct v4l2_format_info **fmt_info)
>  {
> +	static const unsigned int max_widths[] = {
> +		RKISP1_RSZ_MP_SRC_MAX_WIDTH,
> +		RKISP1_RSZ_SP_SRC_MAX_WIDTH,
> +	};
> +	static const unsigned int max_heights[] = {
> +		RKISP1_RSZ_MP_SRC_MAX_HEIGHT,
> +		RKISP1_RSZ_SP_SRC_MAX_HEIGHT,
> +	};
>  	const struct rkisp1_capture_config *config = cap->config;
>  	const struct rkisp1_capture_fmt_cfg *fmt;
>  	const struct v4l2_format_info *info;
> -	const unsigned int max_widths[] = { RKISP1_RSZ_MP_SRC_MAX_WIDTH,
> -					    RKISP1_RSZ_SP_SRC_MAX_WIDTH };
> -	const unsigned int max_heights[] = { RKISP1_RSZ_MP_SRC_MAX_HEIGHT,
> -					     RKISP1_RSZ_SP_SRC_MAX_HEIGHT};
>  
>  	fmt = rkisp1_find_fmt_cfg(cap, pixm->pixelformat);
>  	if (!fmt) {
> -- 
> 2.35.1
>
Laurent Pinchart Jan. 26, 2023, 11:28 p.m. UTC | #2
Hi Dafna,

On Sun, Nov 20, 2022 at 12:28:01AM +0200, Laurent Pinchart wrote:
> Hi Dafna,
> 
> Are you fine with this patch, can I include it in my next pull request
> along with the other ones from the series ?

Ping.

> On Thu, Nov 17, 2022 at 05:42:16PM +0900, Paul Elder wrote:
> > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> > The max_widths and max_heights variables in rkisp1_try_fmt() are
> > immutable and don't need to be allocated on the stack every time the
> > function is called. Make them static.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> > ---
> >  .../media/platform/rockchip/rkisp1/rkisp1-capture.c  | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > index 7695ef134908..91e685fdbbe9 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > @@ -1150,13 +1150,17 @@ static void rkisp1_try_fmt(const struct rkisp1_capture *cap,
> >  			   const struct rkisp1_capture_fmt_cfg **fmt_cfg,
> >  			   const struct v4l2_format_info **fmt_info)
> >  {
> > +	static const unsigned int max_widths[] = {
> > +		RKISP1_RSZ_MP_SRC_MAX_WIDTH,
> > +		RKISP1_RSZ_SP_SRC_MAX_WIDTH,
> > +	};
> > +	static const unsigned int max_heights[] = {
> > +		RKISP1_RSZ_MP_SRC_MAX_HEIGHT,
> > +		RKISP1_RSZ_SP_SRC_MAX_HEIGHT,
> > +	};
> >  	const struct rkisp1_capture_config *config = cap->config;
> >  	const struct rkisp1_capture_fmt_cfg *fmt;
> >  	const struct v4l2_format_info *info;
> > -	const unsigned int max_widths[] = { RKISP1_RSZ_MP_SRC_MAX_WIDTH,
> > -					    RKISP1_RSZ_SP_SRC_MAX_WIDTH };
> > -	const unsigned int max_heights[] = { RKISP1_RSZ_MP_SRC_MAX_HEIGHT,
> > -					     RKISP1_RSZ_SP_SRC_MAX_HEIGHT};
> >  
> >  	fmt = rkisp1_find_fmt_cfg(cap, pixm->pixelformat);
> >  	if (!fmt) {
Jacopo Mondi March 24, 2023, 10:37 a.m. UTC | #3
Hello
   the change seems trivial, do we need an explicit ack from Dafna ?

Dafna are you comfortable being listed as maintainer of this driver or
do you think you won't be able to dedicate time to it and need help ?

Thanks
   j

On Fri, Jan 27, 2023 at 01:28:05AM +0200, Laurent Pinchart wrote:
> Hi Dafna,
>
> On Sun, Nov 20, 2022 at 12:28:01AM +0200, Laurent Pinchart wrote:
> > Hi Dafna,
> >
> > Are you fine with this patch, can I include it in my next pull request
> > along with the other ones from the series ?
>
> Ping.
>
> > On Thu, Nov 17, 2022 at 05:42:16PM +0900, Paul Elder wrote:
> > > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > >
> > > The max_widths and max_heights variables in rkisp1_try_fmt() are
> > > immutable and don't need to be allocated on the stack every time the
> > > function is called. Make them static.
> > >
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> > > ---
> > >  .../media/platform/rockchip/rkisp1/rkisp1-capture.c  | 12 ++++++++----
> > >  1 file changed, 8 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > > index 7695ef134908..91e685fdbbe9 100644
> > > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > > @@ -1150,13 +1150,17 @@ static void rkisp1_try_fmt(const struct rkisp1_capture *cap,
> > >  			   const struct rkisp1_capture_fmt_cfg **fmt_cfg,
> > >  			   const struct v4l2_format_info **fmt_info)
> > >  {
> > > +	static const unsigned int max_widths[] = {
> > > +		RKISP1_RSZ_MP_SRC_MAX_WIDTH,
> > > +		RKISP1_RSZ_SP_SRC_MAX_WIDTH,
> > > +	};
> > > +	static const unsigned int max_heights[] = {
> > > +		RKISP1_RSZ_MP_SRC_MAX_HEIGHT,
> > > +		RKISP1_RSZ_SP_SRC_MAX_HEIGHT,
> > > +	};
> > >  	const struct rkisp1_capture_config *config = cap->config;
> > >  	const struct rkisp1_capture_fmt_cfg *fmt;
> > >  	const struct v4l2_format_info *info;
> > > -	const unsigned int max_widths[] = { RKISP1_RSZ_MP_SRC_MAX_WIDTH,
> > > -					    RKISP1_RSZ_SP_SRC_MAX_WIDTH };
> > > -	const unsigned int max_heights[] = { RKISP1_RSZ_MP_SRC_MAX_HEIGHT,
> > > -					     RKISP1_RSZ_SP_SRC_MAX_HEIGHT};
> > >
> > >  	fmt = rkisp1_find_fmt_cfg(cap, pixm->pixelformat);
> > >  	if (!fmt) {
>
> --
> Regards,
>
> Laurent Pinchart
Laurent Pinchart March 25, 2023, 7:24 p.m. UTC | #4
Hi Jacopo,

On Fri, Mar 24, 2023 at 11:37:44AM +0100, Jacopo Mondi wrote:
> Hello
>    the change seems trivial, do we need an explicit ack from Dafna ?

An alternative patch has been merged in commit 4ee8191c7c9f ("media:
rkisp1: make a few const arrays static").

> Dafna are you comfortable being listed as maintainer of this driver or
> do you think you won't be able to dedicate time to it and need help ?
> 
> Thanks
>    j
> 
> On Fri, Jan 27, 2023 at 01:28:05AM +0200, Laurent Pinchart wrote:
> > On Sun, Nov 20, 2022 at 12:28:01AM +0200, Laurent Pinchart wrote:
> > > Hi Dafna,
> > >
> > > Are you fine with this patch, can I include it in my next pull request
> > > along with the other ones from the series ?
> >
> > Ping.
> >
> > > On Thu, Nov 17, 2022 at 05:42:16PM +0900, Paul Elder wrote:
> > > > From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > >
> > > > The max_widths and max_heights variables in rkisp1_try_fmt() are
> > > > immutable and don't need to be allocated on the stack every time the
> > > > function is called. Make them static.
> > > >
> > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
> > > > ---
> > > >  .../media/platform/rockchip/rkisp1/rkisp1-capture.c  | 12 ++++++++----
> > > >  1 file changed, 8 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > > > index 7695ef134908..91e685fdbbe9 100644
> > > > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > > > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > > > @@ -1150,13 +1150,17 @@ static void rkisp1_try_fmt(const struct rkisp1_capture *cap,
> > > >  			   const struct rkisp1_capture_fmt_cfg **fmt_cfg,
> > > >  			   const struct v4l2_format_info **fmt_info)
> > > >  {
> > > > +	static const unsigned int max_widths[] = {
> > > > +		RKISP1_RSZ_MP_SRC_MAX_WIDTH,
> > > > +		RKISP1_RSZ_SP_SRC_MAX_WIDTH,
> > > > +	};
> > > > +	static const unsigned int max_heights[] = {
> > > > +		RKISP1_RSZ_MP_SRC_MAX_HEIGHT,
> > > > +		RKISP1_RSZ_SP_SRC_MAX_HEIGHT,
> > > > +	};
> > > >  	const struct rkisp1_capture_config *config = cap->config;
> > > >  	const struct rkisp1_capture_fmt_cfg *fmt;
> > > >  	const struct v4l2_format_info *info;
> > > > -	const unsigned int max_widths[] = { RKISP1_RSZ_MP_SRC_MAX_WIDTH,
> > > > -					    RKISP1_RSZ_SP_SRC_MAX_WIDTH };
> > > > -	const unsigned int max_heights[] = { RKISP1_RSZ_MP_SRC_MAX_HEIGHT,
> > > > -					     RKISP1_RSZ_SP_SRC_MAX_HEIGHT};
> > > >
> > > >  	fmt = rkisp1_find_fmt_cfg(cap, pixm->pixelformat);
> > > >  	if (!fmt) {
diff mbox series

Patch

diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
index 7695ef134908..91e685fdbbe9 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
@@ -1150,13 +1150,17 @@  static void rkisp1_try_fmt(const struct rkisp1_capture *cap,
 			   const struct rkisp1_capture_fmt_cfg **fmt_cfg,
 			   const struct v4l2_format_info **fmt_info)
 {
+	static const unsigned int max_widths[] = {
+		RKISP1_RSZ_MP_SRC_MAX_WIDTH,
+		RKISP1_RSZ_SP_SRC_MAX_WIDTH,
+	};
+	static const unsigned int max_heights[] = {
+		RKISP1_RSZ_MP_SRC_MAX_HEIGHT,
+		RKISP1_RSZ_SP_SRC_MAX_HEIGHT,
+	};
 	const struct rkisp1_capture_config *config = cap->config;
 	const struct rkisp1_capture_fmt_cfg *fmt;
 	const struct v4l2_format_info *info;
-	const unsigned int max_widths[] = { RKISP1_RSZ_MP_SRC_MAX_WIDTH,
-					    RKISP1_RSZ_SP_SRC_MAX_WIDTH };
-	const unsigned int max_heights[] = { RKISP1_RSZ_MP_SRC_MAX_HEIGHT,
-					     RKISP1_RSZ_SP_SRC_MAX_HEIGHT};
 
 	fmt = rkisp1_find_fmt_cfg(cap, pixm->pixelformat);
 	if (!fmt) {