public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-fpga@vger.kernel.org, Alan Tull <atull@kernel.org>,
	Moritz Fischer <moritz.fischer@ettus.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	matthew.gerlach@linux.intel.com, yi1.li@linux.intel.com
Subject: Re: [PATCH v5] fpga manager: Add Altera CvP driver
Date: Thu, 8 Jun 2017 01:09:28 +0200	[thread overview]
Message-ID: <20170608010928.3effdf38@crub> (raw)
In-Reply-To: <CAHp75VfxGOw-G1+Cqk75eVK6EoLeRDemRc2zif1aJc2o+1fzMQ@mail.gmail.com>

On Fri, 2 Jun 2017 20:43:21 +0300
Andy Shevchenko andy.shevchenko@gmail.com wrote:
...
>
>> +       void                    (*write_data)(struct altera_cvp_conf *conf,
>> +                                             u32 val);
>
>Is it too far beyond 80 characters? I would leave it in one line (~83
>characters are okay).

I changed to single line, (*write_data)(struct altera_cvp_conf *, u32);

...
>> +static void altera_cvp_dummy_write(struct altera_cvp_conf *conf)
>> +{
>> +       unsigned int i;
>> +       u32 val32;  
>
>Drop the useless suffix.

ok, done.

>> +       if (!timeout_us)
>> +               return -ETIMEDOUT;  
>
>Hmm...
>What as a user I would expect here is at least one attempt (0 -- no
>timeout, but try once).

yes, this first attempt is above, please see original patch for full
context.

...
>> +       /* clock to data ratio for uncompressed and unencrypted images */
>> +       conf->numclks = 1;  
>
>To else branch of below?
>
>> +       if (info) {  
>
>> +       }

then, the default numclks value would have to be set in the if branch
as well. It is easier to set it before.

...
>> +               ret = altera_cvp_teardown(mgr, info);
>> +               if (ret < 0)
>> +                       return ret;  
>
>What is the meaning of ret > 0?
>
>Can't it be just if (ret) here?

return value > 0 is never used, here it can be if (ret).

...
>> +       ret = altera_cvp_wait_status(conf, VSEC_CVP_STATUS_CFG_RDY,
>> +                                    VSEC_CVP_STATUS_CFG_RDY, 10);
>> +       if (ret < 0) {
>> +               dev_warn(&mgr->dev, "CFG_RDY == 1 timeout\n");
>> +               return ret;
>> +       }  
>
>Ditto.
>
>Also check another code like this above and below.

ok, done.

>> +static int altera_cvp_write_complete(struct fpga_manager *mgr,
>> +                                    struct fpga_image_info *info)
>> +{  
>
>> +       u32 status_msk;  
>
>status_mask
>
>> +       u32 val32;  
>
>Drop the suffix.

done.

...
>> +       return snprintf(buf, 3, "%d\n", altera_cvp_chkcfg ? 1 : 0);  
>
>Just altera_cvp_chkcfg.

ok, done.

...
>> +static struct pci_device_id altera_cvp_id_tbl[] = {
>> +       { PCI_VDEVICE(ALTERA, PCI_ANY_ID) },  
>
>Does it have dedicated PCI class?
>
>PCI_ANY_ID usually is too broad.

no, it doesn't have dedicated class.

...
>> +       u16 cmd, val16;  
>
>Drop the suffix.

>> +        * space access works without enabling the pci device, memory  
>
>pci -> PCI

ok, done.

...
>> +        * have additional big iomem resources (e.g. 4GiB BARs) on 32-bit  
>
>iomem -> IOMEM

done.

...
>> +        * at all. Thus, enable the device via pci config space command.  
>
>pci -> PCI

ok.

...
>> +       ret = pci_request_region(pdev, CVP_BAR, "CVP");
>> +       if (ret < 0) {  
>
>if (ret)

ok, done.

...
>> +       snprintf(conf->mgr_name, sizeof(conf->mgr_name), "%s @%02x:%02x.%d",
>> +                ALTERA_CVP_MGR_NAME,  
>
>pdev->bus->number,
>> +                PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));  
>
>pci_name() ?

ok.

>> +err_unmap:
>> +       pci_iounmap(pdev, conf->map);
>> +       pci_release_region(pdev, CVP_BAR);  
>
>> +err:  
>
>err_disable:

done.

Thanks,
Anatolij

  parent reply	other threads:[~2017-06-07 23:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-14 15:51 [PATCH v5] fpga manager: Add Altera CvP driver Anatolij Gustschin
2017-05-14 19:01 ` kbuild test robot
2017-06-07 23:51   ` Andy Shevchenko
2017-06-02 17:01 ` Anatolij Gustschin
2017-06-02 17:43 ` Andy Shevchenko
2017-06-02 17:44   ` Andy Shevchenko
2017-06-07 23:09   ` Anatolij Gustschin [this message]
2017-06-07 23:38     ` Andy Shevchenko
2017-06-08 14:15       ` Anatolij Gustschin
2017-06-08 14:44         ` Andy Shevchenko
2017-06-08 15:00           ` Anatolij Gustschin

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=20170608010928.3effdf38@crub \
    --to=agust@denx.de \
    --cc=andy.shevchenko@gmail.com \
    --cc=atull@kernel.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.gerlach@linux.intel.com \
    --cc=moritz.fischer@ettus.com \
    --cc=yi1.li@linux.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