public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
Cc: Andy Gross <agross@kernel.org>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Rob Herring <robh+dt@kernel.org>, Alex Elder <elder@ieee.org>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, Sibi Sankar <quic_sibis@quicinc.com>,
	Rajendra Nayak <quic_rjendra@quicinc.com>
Subject: Re: [PATCH V23 2/3] misc: dcc: Add driver support for Data Capture and Compare unit(DCC)
Date: Thu, 15 Jun 2023 14:50:31 +0200	[thread overview]
Message-ID: <2023061515-unbuckled-consonant-e207@gregkh> (raw)
In-Reply-To: <cc9750f3-c85c-be7f-e63c-0fcf4eb160f0@quicinc.com>

On Thu, Jun 15, 2023 at 06:13:53PM +0530, Souradeep Chowdhury wrote:
> 
> 
> On 6/15/2023 4:03 PM, Greg Kroah-Hartman wrote:
> > On Thu, May 04, 2023 at 11:36:22PM -0700, Souradeep Chowdhury wrote:
> > > +/**
> > > + * struct dcc_config_entry - configuration information related to each dcc instruction
> > > + * @base:                    Base address of the register to be configured in dcc
> > 
> > Why is this a u32 and not a bigger size?
> 
> Currently only 32 bit register addresses are supported for DCC
> configuration.
> 
> > 
> > > + * @offset:                  Offset to the base address to be configured in dcc
> > > + * @len:                     Length of the address in words to be configured in dcc
> > 
> > What is a "word" here, 16 bits?
> 
> Each word is 4 bytes(32 bits)

See, I guess wrong, you should say what this is :)

> > > + * @loop_cnt:                The number of times to loop on the register address in case
> > > +				of loop instructions
> > > + * @write_val:               The value to be written on the register address in case of
> > > +				write instructions
> > > + * @mask:                    Mask corresponding to the value to be written in case of
> > > +				write instructions
> > > + * @apb_bus:                 Type of bus to be used for the instruction, can be either
> > > +				'apb' or 'ahb'
> > 
> > How can a bool be either "apb" or "ahb"?
> 
> 1 stands for apb and 0 for ahb. Will update the same here.

Why not have an enum?  Will there ever be another "bus"?

> > > +static ssize_t ready_read(struct file *filp, char __user *userbuf,
> > > +			  size_t count, loff_t *ppos)
> > > +{
> > > +	int ret = 0;
> > > +	char *buf;
> > > +	struct dcc_drvdata *drvdata = filp->private_data;
> > > +
> > > +	mutex_lock(&drvdata->mutex);
> > > +
> > > +	if (!is_dcc_enabled(drvdata)) {
> > > +		ret = -EINVAL;
> > > +		goto out_unlock;
> > > +	}
> > > +
> > > +	if (!FIELD_GET(BIT(1), readl(drvdata->base + dcc_status(drvdata->mem_map_ver))))
> > > +		buf = "Y\n";
> > > +	else
> > > +		buf = "N\n";
> > > +out_unlock:
> > > +	mutex_unlock(&drvdata->mutex);
> > > +
> > > +	if (ret < 0)
> > > +		return -EINVAL;
> > > +	else
> > 
> > You do the "lock, get a value, unlock, do something with the value"
> > thing a bunch, but what prevents the value from changing after the lock
> > happens?  So why is the lock needed at all?
> 
> The lock is used to prevent concurrent accesses of the drv_data when
> scripts are being run from userspace.

How would that matter?  The state can change instantly after the lock is
given up, and then the returned value is now incorrect.  So no need for
a lock at all as you really aren't "protecting" anything, or am I
missing something else?

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-06-15 12:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05  6:36 [PATCH V23 0/3] misc: Add driver support for Data Capture and Compare unit(DCC) Souradeep Chowdhury
2023-05-05  6:36 ` [PATCH V23 1/3] dt-bindings: misc: qcom,dcc: Add the dtschema Souradeep Chowdhury
2023-05-05  6:36 ` [PATCH V23 2/3] misc: dcc: Add driver support for Data Capture and Compare unit(DCC) Souradeep Chowdhury
2023-05-24  5:10   ` Trilok Soni
2023-05-31 16:17     ` Trilok Soni
2023-06-15 10:33   ` Greg Kroah-Hartman
2023-06-15 12:43     ` Souradeep Chowdhury
2023-06-15 12:50       ` Greg Kroah-Hartman [this message]
2023-06-15 13:47         ` Souradeep Chowdhury
2023-06-15 14:06           ` Greg Kroah-Hartman
2023-06-21  9:18             ` Souradeep Chowdhury
2023-05-05  6:36 ` [PATCH V23 3/3] MAINTAINERS: Add the entry for DCC(Data Capture and Compare) driver support Souradeep Chowdhury
2023-05-24  4:55 ` [PATCH V23 0/3] misc: Add driver support for Data Capture and Compare unit(DCC) Souradeep Chowdhury
2023-06-07  5:26 ` Souradeep Chowdhury
2023-06-15 10:26 ` Greg Kroah-Hartman

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=2023061515-unbuckled-consonant-e207@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=elder@ieee.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_rjendra@quicinc.com \
    --cc=quic_schowdhu@quicinc.com \
    --cc=quic_sibis@quicinc.com \
    --cc=robh+dt@kernel.org \
    /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