public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Cc: Lee Jones <lee.jones@linaro.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: most: dim2: force fcnt=3 on Renesas GEN3
Date: Mon, 27 Sep 2021 17:29:07 +0200	[thread overview]
Message-ID: <YVHjQ95lbDjvVR73@kroah.com> (raw)
In-Reply-To: <20210921165130.24178-1-nikita.yoush@cogentembedded.com>

On Tue, Sep 21, 2021 at 07:51:30PM +0300, Nikita Yushchenko wrote:
> Per Renesas datasheet, MLBC0 register's fcnt field in the embedded
> dim2 module must be never set to value different from 3.
> 
> Enforce that, via an optional field in struct dim2_platform_data.
> 
> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> ---
>  drivers/staging/most/dim2/dim2.c | 25 +++++++++++++++++++------
>  1 file changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
> index 093ef9a2b291..d90284d79621 100644
> --- a/drivers/staging/most/dim2/dim2.c
> +++ b/drivers/staging/most/dim2/dim2.c
> @@ -108,6 +108,7 @@ struct dim2_hdm {
>  struct dim2_platform_data {
>  	int (*enable)(struct platform_device *pdev);
>  	void (*disable)(struct platform_device *pdev);
> +	u8 fcnt;
>  };
>  
>  #define iface_to_hdm(iface) container_of(iface, struct dim2_hdm, most_iface)
> @@ -731,7 +732,7 @@ static int dim2_probe(struct platform_device *pdev)
>  	struct dim2_hdm *dev;
>  	struct resource *res;
>  	int ret, i;
> -	u8 hal_ret;
> +	u8 dev_fcnt, hal_ret;
>  	int irq;
>  
>  	enum { MLB_INT_IDX, AHB0_INT_IDX };
> @@ -770,8 +771,10 @@ static int dim2_probe(struct platform_device *pdev)
>  
>  	dev->disable_platform = pdata ? pdata->disable : NULL;
>  
> -	dev_info(&pdev->dev, "sync: num of frames per sub-buffer: %u\n", fcnt);
> -	hal_ret = dim_startup(dev->io_base, dev->clk_speed, fcnt);
> +	dev_fcnt = pdata && pdata->fcnt ? pdata->fcnt : fcnt;

Please use a real if () statement here and do not bury real logic in a
crazy line like this one, as that is all but impossible to maintain over
time.

thanks,

greg k-h

  reply	other threads:[~2021-09-27 15:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 16:51 [PATCH] staging: most: dim2: force fcnt=3 on Renesas GEN3 Nikita Yushchenko
2021-09-27 15:29 ` Greg Kroah-Hartman [this message]
2021-09-27 15:40   ` Nikita Yushchenko
2021-09-27 15:50     ` Greg Kroah-Hartman
2021-09-27 15:58       ` [PATCH v2] " Nikita Yushchenko
2021-09-28  7:11         ` Greg Kroah-Hartman
2021-09-27 16:06       ` [PATCH] staging: most: dim2: use if statements instead of ?: expressions Nikita Yushchenko

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=YVHjQ95lbDjvVR73@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=nikita.yoush@cogentembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox