Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1660336

Re: [PATCH v5] fpga manager: Add Altera CvP driver

From Anatolij Gustschin <agust@denx.de>
Newsgroups linux.kernel
Subject Re: [PATCH v5] fpga manager: Add Altera CvP driver
Date 2017-06-08 01:10 +0200
Message-ID <tPSfq-4Fa-65@gated-at.bofh.it> (permalink)
References <tH466-3pN-5@gated-at.bofh.it> <tNYRY-4gc-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v5] fpga manager: Add Altera CvP driver Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-02 19:50 +0200
  Re: [PATCH v5] fpga manager: Add Altera CvP driver Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-02 19:50 +0200
  Re: [PATCH v5] fpga manager: Add Altera CvP driver Anatolij Gustschin <agust@denx.de> - 2017-06-08 01:10 +0200
    Re: [PATCH v5] fpga manager: Add Altera CvP driver Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-08 01:40 +0200
      Re: [PATCH v5] fpga manager: Add Altera CvP driver Anatolij Gustschin <agust@denx.de> - 2017-06-08 16:20 +0200
        Re: [PATCH v5] fpga manager: Add Altera CvP driver Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-08 16:50 +0200
          Re: [PATCH v5] fpga manager: Add Altera CvP driver Anatolij Gustschin <agust@denx.de> - 2017-06-08 17:10 +0200

csiph-web