From: Vinod Koul <vkoul@kernel.org>
To: Gustavo Pimentel <Gustavo.Pimentel@synopsys.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Russell King <rmk+kernel@armlinux.org.uk>,
Joao Pinto <Joao.Pinto@synopsys.com>
Subject: Re: [RFC v6 3/6] dmaengine: Add Synopsys eDMA IP version 0 debugfs support
Date: Tue, 7 May 2019 10:41:36 +0530 [thread overview]
Message-ID: <20190507051136.GB16052@vkoul-mobl> (raw)
In-Reply-To: <305100E33629484CBB767107E4246BBB0A2386A1@de02wembxa.internal.synopsys.com>
On 06-05-19, 17:09, Gustavo Pimentel wrote:
> Hi Vinod,
>
> On Mon, May 6, 2019 at 13:7:10, Vinod Koul <vkoul@kernel.org> wrote:
>
> > On 23-04-19, 20:30, Gustavo Pimentel wrote:
> >
> > > int dw_edma_v0_core_debugfs_on(struct dw_edma_chip *chip)
> > > {
> > > - return 0;
> > > + return dw_edma_v0_debugfs_on(chip);
> >
> > who calls this?
>
> The main driver. This was done like this for 2 reasons:
> 1) To not break the patch #1 compilation
> 2) Since the code it's to extensive, I decided to break it in another
> patch.
Hmm I guess I missed that one. I was actually looking at usage and not
questioning split :)
> > > +static int dw_edma_debugfs_u32_get(void *data, u64 *val)
> > > +{
> > > + if (dw->mode == EDMA_MODE_LEGACY &&
> > > + data >= (void *)®s->type.legacy.ch) {
> > > + void *ptr = (void *)®s->type.legacy.ch;
> > > + u32 viewport_sel = 0;
> > > + unsigned long flags;
> > > + u16 ch;
> > > +
> > > + for (ch = 0; ch < dw->wr_ch_cnt; ch++)
> > > + if (lim[0][ch].start >= data && data < lim[0][ch].end) {
> > > + ptr += (data - lim[0][ch].start);
> > > + goto legacy_sel_wr;
> > > + }
> > > +
> > > + for (ch = 0; ch < dw->rd_ch_cnt; ch++)
> > > + if (lim[1][ch].start >= data && data < lim[1][ch].end) {
> > > + ptr += (data - lim[1][ch].start);
> > > + goto legacy_sel_rd;
> > > + }
> > > +
> > > + return 0;
> > > +legacy_sel_rd:
> > > + viewport_sel = BIT(31);
> > > +legacy_sel_wr:
> > > + viewport_sel |= FIELD_PREP(EDMA_V0_VIEWPORT_MASK, ch);
> > > +
> > > + raw_spin_lock_irqsave(&dw->lock, flags);
> > > +
> > > + writel(viewport_sel, ®s->type.legacy.viewport_sel);
> > > + *val = readl((u32 *)ptr);
> >
> > why do you need the cast?
>
> I can't tell from my head, but I think checkpatch or some code analysis
> tool was complaining about not having that.
ptr is void, so there is no need for casts to or away from void.
> > > +static int dw_edma_debugfs_regs(void)
> > > +{
> > > + const struct debugfs_entries debugfs_regs[] = {
> > > + REGISTER(ctrl_data_arb_prior),
> > > + REGISTER(ctrl),
> > > + };
> > > + struct dentry *regs_dir;
> > > + int nr_entries, err;
> > > +
> > > + regs_dir = debugfs_create_dir(REGISTERS_STR, base_dir);
> > > + if (!regs_dir)
> > > + return -EPERM;
> > > +
> > > + nr_entries = ARRAY_SIZE(debugfs_regs);
> > > + err = dw_edma_debugfs_create_x32(debugfs_regs, nr_entries, regs_dir);
> > > + if (err)
> > > + return err;
> > > +
> > > + err = dw_edma_debugfs_regs_wr(regs_dir);
> > > + if (err)
> > > + return err;
> > > +
> > > + err = dw_edma_debugfs_regs_rd(regs_dir);
> > > + if (err)
> > > + return err;
> > > +
> > > + return 0;
> >
> > single return err would suffice right?
>
> By looking now to this code, I decided to remove the err variable and
> perform the if immediately on the function, if the result is different
> from 0 it goes directly to a return -EPERM.
And one more things, we do not need to check errors on debugfs calls,
and if it fails it fails...
--
~Vinod
next prev parent reply other threads:[~2019-05-07 5:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 18:30 [RFC v6 0/6] dmaengine: Add Synopsys eDMA IP driver (version 0) Gustavo Pimentel
2019-04-23 18:30 ` [RFC,v6,1/6] dmaengine: Add Synopsys eDMA IP core driver Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 1/6] " Gustavo Pimentel
2019-05-06 11:20 ` Vinod Koul
2019-05-06 16:42 ` Gustavo Pimentel
2019-05-07 5:03 ` Vinod Koul
2019-05-07 9:08 ` Gustavo Pimentel
2019-05-07 9:56 ` Vinod Koul
2019-04-23 18:30 ` [RFC,v6,2/6] dmaengine: Add Synopsys eDMA IP version 0 support Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 2/6] " Gustavo Pimentel
2019-05-06 11:56 ` Vinod Koul
2019-04-23 18:30 ` [RFC,v6,3/6] dmaengine: Add Synopsys eDMA IP version 0 debugfs support Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 3/6] " Gustavo Pimentel
2019-05-06 12:07 ` Vinod Koul
2019-05-06 17:09 ` Gustavo Pimentel
2019-05-07 5:11 ` Vinod Koul [this message]
2019-05-07 9:48 ` Gustavo Pimentel
2019-04-23 18:30 ` [RFC,v6,4/6] PCI: Add Synopsys endpoint EDDA Device ID Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 4/6] " Gustavo Pimentel
2019-04-23 18:30 ` [RFC,v6,5/6] dmaengine: Add Synopsys eDMA IP PCIe glue-logic Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 5/6] " Gustavo Pimentel
2019-04-23 18:30 ` [RFC,v6,6/6] MAINTAINERS: Add Synopsys eDMA IP driver maintainer Gustavo Pimentel
2019-04-23 18:30 ` [RFC v6 6/6] " Gustavo Pimentel
2019-05-06 8:12 ` [RFC v6 0/6] dmaengine: Add Synopsys eDMA IP driver (version 0) Gustavo Pimentel
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=20190507051136.GB16052@vkoul-mobl \
--to=vkoul@kernel.org \
--cc=Gustavo.Pimentel@synopsys.com \
--cc=Joao.Pinto@synopsys.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
/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).