From: Arnd Bergmann <arnd@arndb.de>
To: Sinan Kaya <okaya@codeaurora.org>
Cc: dmaengine@vger.kernel.org, timur@codeaurora.org,
cov@codeaurora.org, jcm@redhat.com,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Vinod Koul <vinod.koul@intel.com>,
Dan Williams <dan.j.williams@intel.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] dma: add Qualcomm Technologies HIDMA management driver
Date: Mon, 02 Nov 2015 22:30:58 +0100 [thread overview]
Message-ID: <9016417.z9Hz6MbmvQ@wuerfel> (raw)
In-Reply-To: <56346502.5070600@codeaurora.org>
On Saturday 31 October 2015 02:51:46 Sinan Kaya wrote:
> On 10/30/2015 5:34 AM, Arnd Bergmann wrote:
> > On Thursday 29 October 2015 23:08:12 Sinan Kaya wrote:
> >> diff --git a/Documentation/devicetree/bindings/dma/qcom_hidma_mgmt.txt b/Documentation/devicetree/bindings/dma/qcom_hidma_mgmt.txt
> >> +
> >> +static int qcom_hidma_mgmt_err_open(struct inode *inode, struct file *file)
> >> +{
> >> + return single_open(file, qcom_hidma_mgmt_err, inode->i_private);
> >> +}
> >> +
> >> +static const struct file_operations qcom_hidma_mgmt_err_fops = {
> >> + .open = qcom_hidma_mgmt_err_open,
> >> + .read = seq_read,
> >> + .llseek = seq_lseek,
> >> + .release = single_release,
> >> +};
> >> +
> >> +static ssize_t qcom_hidma_mgmt_mhiderr_clr(struct file *file,
> >> + const char __user *user_buf, size_t count, loff_t *ppos)
> >> +{
> >> + struct qcom_hidma_mgmt_dev *mgmtdev = file->f_inode->i_private;
> >> +
> >> + HIDMA_RUNTIME_GET(mgmtdev);
> >> + writel(1, mgmtdev->dev_virtaddr + MHID_BUS_ERR_CLR_OFFSET);
> >> + HIDMA_RUNTIME_SET(mgmtdev);
> >> + return count;
> >> +}
> >> +
> >> +static const struct file_operations qcom_hidma_mgmt_mhiderr_clrfops = {
> >> + .write = qcom_hidma_mgmt_mhiderr_clr,
> >> +};
> >
> > Is this really just a debugging interface? If anyone would do this
> > for normal operation, it needs to be a proper API.
> >
> This will be used by the system admin to monitor/reset the execution
> state of the DMA channels. This will be the management interface.
> Debugfs is probably not the right choice. I originally had sysfs but
> than had some doubts. I'm open to suggestions.
User interface design is unfortunately always hard, and I don't have
an obvious answer for you.
Using debugfs by definition means that you don't expect users to
rely on ABI stability, so they should not write any automated scripts
against the contents of the files.
With sysfs, the opposite is true: you need to maintain compatibility
for as long as anyone might rely on the current interface, and it
needs to be reviewed properly and documented in Documentation/ABI/.
Other options are to use ioctl(), netlink or your own virtual file
system, but each of them has the same ABI requirements as sysfs.
Regardless of what you pick, you also need to consider how other drivers
would use the same interface: If someone else has hardware that does
the same thing, we want to be able to use the same tools to access
it, so you should avoid having any hardware specific data in it and
keep it as generic and extensible as possible. In this particular
case, that probably means you should implement the user interfaces in
the dmaengine core driver, and let the specific DMA driver provide
callback function pointers along with the normal ones to fill that
data.
> >> + dev_info(&pdev->dev,
> >> + "HI-DMA engine management driver registration complete\n");
> >> + platform_set_drvdata(pdev, mgmtdev);
> >> + HIDMA_RUNTIME_SET(mgmtdev);
> >> + return 0;
> >> +out:
> >> + pm_runtime_disable(&pdev->dev);
> >> + pm_runtime_put_sync_suspend(&pdev->dev);
> >> + return rc;
> >> +}
> >
> > The rest of the probe function does not register any user interface aside from
> > the debugging stuff. Can you explain in the changelog how you expect the
> > driver to be used in a real system? Is there another driver coming?
>
> I expect this driver to grow in functionality over time. Right now, it
> does the global init for the DMA. After that all channels execute on
> their own without depending on each other. Global init has to be done
> first before attempting to do any channel initialization.
>
> There is also implied startup ordering requirements. I was doing this by
> using channel driver with the late binding to guarantee that.
>
> As soon as I use module_platform_driver, the ordering gets reversed for
> some reason.
For the ordering requirements, it's probably best to export a symbol
with the entry point and let the normal driver call into that. Using
separate initcall levels is not something you should do in a normal
device driver like this.
What is the relation between the device nodes for the two kinds of
devices? Does it make sense to model the other one as a child device
of this one? That way you would trivially do the ordering by not marking
this one as 'compatible="simple-bus"' and triggering the registration
of the child from the parent probe function.
Arnd
next prev parent reply other threads:[~2015-11-02 21:30 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-30 3:08 [PATCH 1/2] dma: add Qualcomm Technologies HIDMA management driver Sinan Kaya
2015-10-30 3:08 ` [PATCH 2/2] dma: add Qualcomm Technologies HIDMA channel driver Sinan Kaya
2015-10-30 8:01 ` kbuild test robot
2015-10-30 10:24 ` Arnd Bergmann
2015-10-30 21:42 ` Sinan Kaya
[not found] ` <5633E442.3010003-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-10-30 21:55 ` Timur Tabi
[not found] ` <5633E744.6040202-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-10-30 22:47 ` Arnd Bergmann
2015-10-30 22:28 ` Arnd Bergmann
2015-10-30 22:36 ` Timur Tabi
2015-10-30 22:50 ` Arnd Bergmann
2015-10-31 1:53 ` Sinan Kaya
2015-11-01 18:50 ` Sinan Kaya
[not found] ` <56365F0D.6010508-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-11-01 20:21 ` Timur Tabi
[not found] ` <56367433.60806-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-11-01 20:27 ` Sinan Kaya
2015-11-02 16:33 ` Arnd Bergmann
2015-11-02 19:21 ` Sinan Kaya
[not found] ` <5637B7C1.2070200-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-11-02 20:55 ` Arnd Bergmann
2015-11-03 5:29 ` Sinan Kaya
2015-11-03 10:43 ` Arnd Bergmann
2015-11-03 21:07 ` Sinan Kaya
2015-11-03 21:10 ` Arnd Bergmann
[not found] ` <1446174501-8870-2-git-send-email-okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-10-30 8:07 ` kbuild test robot
2015-10-30 14:50 ` Mark Rutland
2015-10-31 4:27 ` Sinan Kaya
2015-10-30 4:34 ` [PATCH 1/2] dma: add Qualcomm Technologies HIDMA management driver kbuild test robot
[not found] ` <1446174501-8870-1-git-send-email-okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-10-30 4:34 ` [PATCH] dma: fix platform_no_drv_owner.cocci warnings kbuild test robot
2015-10-30 15:00 ` [PATCH 1/2] dma: add Qualcomm Technologies HIDMA management driver Mark Rutland
2015-10-30 17:59 ` Andy Shevchenko
[not found] ` <CAHp75VdHxGC841cFY3M+ujZKSX04nT4+7gc3iKsgwzLRC4AYWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-30 18:08 ` Sinan Kaya
2015-10-30 18:18 ` Mark Rutland
[not found] ` <5633B207.5030505-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-10-30 18:18 ` Andy Shevchenko
2015-10-30 18:25 ` Mark Rutland
2015-10-30 18:40 ` Andy Shevchenko
[not found] ` <CAHp75Vd-z22XJboxQ=CMxDQ9UaTatbCmpAPLO0jPM0FwJadBOg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-30 18:48 ` Sinan Kaya
[not found] ` <5633BB66.3070505-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-10-30 19:01 ` Mark Rutland
2015-10-30 20:08 ` Al Stone
[not found] ` <5633CE23.7060303-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-10-30 20:15 ` Andy Shevchenko
2015-10-30 20:18 ` Mark Rutland
[not found] ` <CAHp75VcQ6r2FGqsP2mtnv95etCGJmeQ=T7aKSB5H3cvwhdSbDw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-31 3:33 ` Jon Masters
2015-10-31 17:34 ` Sinan Kaya
2015-10-30 19:36 ` Sinan Kaya
2015-10-31 17:11 ` Sinan Kaya
2015-10-30 9:34 ` Arnd Bergmann
2015-10-31 6:51 ` Sinan Kaya
2015-10-31 12:53 ` Timur Tabi
2015-10-31 12:53 ` Timur Tabi
2015-11-02 21:30 ` Arnd Bergmann [this message]
2015-11-03 4:45 ` Sinan Kaya
2015-11-03 12:42 ` Arnd Bergmann
2015-11-03 14:26 ` Timur Tabi
2015-11-04 1:04 ` Sinan Kaya
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=9016417.z9Hz6MbmvQ@wuerfel \
--to=arnd@arndb.de \
--cc=cov@codeaurora.org \
--cc=dan.j.williams@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jcm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=okaya@codeaurora.org \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=timur@codeaurora.org \
--cc=vinod.koul@intel.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