linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Andersson <andersson@kernel.org>
To: andy.shevchenko@gmail.com
Cc: Mukesh Ojha <quic_mojha@quicinc.com>,
	agross@kernel.org, konrad.dybcio@linaro.org,
	linus.walleij@linaro.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [PATCH v6 5/5] firmware: qcom_scm: Add multiple download mode support
Date: Fri, 26 May 2023 16:36:04 -0700	[thread overview]
Message-ID: <20230526233604.3eiqbfrkecir3ga5@ripper> (raw)
In-Reply-To: <ZHEvWpCqg_oyWyZW@surfacebook>

On Sat, May 27, 2023 at 01:14:50AM +0300, andy.shevchenko@gmail.com wrote:
> Wed, Mar 29, 2023 at 01:16:52PM +0530, Mukesh Ojha kirjoitti:
> > Currently, scm driver only supports full dump when download
> > mode is selected. Add support to enable minidump as well as
> > enable it along with fulldump.
> 
> ...
> 
> >  #define QCOM_DOWNLOAD_MODE_MASK 0x30
> >  #define QCOM_DOWNLOAD_FULLDUMP	0x1
> > +#define QCOM_DOWNLOAD_MINIDUMP  0x2
> > +#define QCOM_DOWNLOAD_BOTHDUMP	(QCOM_DOWNLOAD_FULLDUMP | QCOM_DOWNLOAD_MINIDUMP)
> 
> Now order is broken.
> 
> >  #define QCOM_DOWNLOAD_NODUMP	0x0
> 
> ...
> 
> > @@ -1420,13 +1422,16 @@ static irqreturn_t qcom_scm_irq_handler(int irq, void *data)
> >  	return IRQ_HANDLED;
> >  }
> >  
> > -
> 
> Stray change and ping-pong style at the same time.
> 
> ...
> 
> >  	if (download_mode == QCOM_DOWNLOAD_FULLDUMP)
> >  		len = sysfs_emit(buffer, "full\n");
> > +	else if (download_mode == QCOM_DOWNLOAD_MINIDUMP)
> > +		len = sysfs_emit(buffer, "mini\n");
> > +	else if (download_mode == QCOM_DOWNLOAD_BOTHDUMP)
> 
> > +		len = sysfs_emit(buffer, "full,mini\n");
> 
> Why not "both" ?
> 

"both" isn't very future proof (and I think we've had additional
variations in the past already), so I asked for this form.

Many thanks for your thorough review, Andy!

Regards,
Bjorn

> >  	else if (download_mode == QCOM_DOWNLOAD_NODUMP)
> >  		len = sysfs_emit(buffer, "off\n");
> 
> 
> With an array (for streq_match_string() call suggested earlier) this become as
> simple as
> 
> 	if (mode >= ARRAY_SIZE(...))
> 		return sysfs_emit("Oh heh!\n");
> 
> 	return sysfs_emit("%s\n", array[mode]);
> 
> ...
> 
> > -	if (sysfs_streq(val, "full")) {
> 
> Why changing this line?
> 
> > +	if (sysfs_streq(val, "full,mini") || sysfs_streq(val, "mini,full")) {
> > +		download_mode = QCOM_DOWNLOAD_BOTHDUMP;
> 
> It's way too hard, esp. taking into account that once user enters wrong order,
> user can't simply validate this by reading value back.
> 
> Use "both" and that's it.
> 
> > +	} else if (sysfs_streq(val, "full")) {
> >  		download_mode = QCOM_DOWNLOAD_FULLDUMP;
> > +	} else if (sysfs_streq(val, "mini")) {
> > +		download_mode = QCOM_DOWNLOAD_MINIDUMP;
> 
> ...
> 
> >  module_param_cb(download_mode, &download_mode_param_ops, NULL, 0644);
> >  MODULE_PARM_DESC(download_mode,
> > -		 "Download mode: off/full or 0/1 for existing users");
> > +		"download mode: off/full/mini/full,mini or mini,full and 0/1 for existing users");
> 
> You really must be consistent with at least a couple of things:
> 1) capitalization;
> 2) indentation.
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

  reply	other threads:[~2023-05-26 23:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29  7:46 [PATCH v6 0/5] Refactor to support multiple download mode Mukesh Ojha
2023-03-29  7:46 ` [PATCH v6 1/5] firmware: qcom_scm: provide a read-modify-write function Mukesh Ojha
2023-05-26 22:00   ` andy.shevchenko
2023-03-29  7:46 ` [PATCH v6 2/5] pinctrl: qcom: Use qcom_scm_io_update_field() Mukesh Ojha
2023-05-26 22:02   ` andy.shevchenko
2023-03-29  7:46 ` [PATCH v6 3/5] firmware: scm: Modify only the download bits in TCSR register Mukesh Ojha
2023-05-26 20:17   ` Bjorn Andersson
2023-03-29  7:46 ` [PATCH v6 4/5] firmware: qcom_scm: Refactor code to support multiple download mode Mukesh Ojha
2023-05-26 22:08   ` andy.shevchenko
2023-06-26 16:27     ` Mukesh Ojha
2023-06-26 17:12       ` Andy Shevchenko
2023-03-29  7:46 ` [PATCH v6 5/5] firmware: qcom_scm: Add multiple download mode support Mukesh Ojha
2023-05-26 22:14   ` andy.shevchenko
2023-05-26 23:36     ` Bjorn Andersson [this message]
2023-05-27  7:22       ` Andy Shevchenko
2023-04-10 14:34 ` [PATCH v6 0/5] Refactor to support multiple download mode Mukesh Ojha
2023-05-26 22:15   ` andy.shevchenko

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=20230526233604.3eiqbfrkecir3ga5@ripper \
    --to=andersson@kernel.org \
    --cc=agross@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=konrad.dybcio@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_mojha@quicinc.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;
as well as URLs for NNTP newsgroup(s).