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


Groups > linux.kernel > #1274948

Re: [PATCH V6 2/3] dma: add Qualcomm Technologies HIDMA management driver

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH V6 2/3] dma: add Qualcomm Technologies HIDMA management driver
Date 2015-11-22 21:50 +0100
Message-ID <qxJK9-qg-5@gated-at.bofh.it> (permalink)
References <qxFQe-6mz-13@gated-at.bofh.it> <qxFQe-6mz-11@gated-at.bofh.it> <qxGsV-6Rq-1@gated-at.bofh.it> <qxIXN-8iK-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Nov 22, 2015 at 9:52 PM,  <okaya@codeaurora.org> wrote:
>> On Sun, Nov 22, 2015 at 6:37 PM, Sinan Kaya <okaya@codeaurora.org> wrote:

[]

>>> +       if (!is_power_of_2(mgmtdev->max_write_request) ||
>>> +               (mgmtdev->max_write_request < 128) ||
>>
>> Someone likes parens.
>
> yes, I do. I don't trust compilers and also don't like to open holes for
> people making quick changes to code while ignoring the operator precedence for
> maintenance reasons.

Btw in the other patch you did something like

var xyz;

… == (xyz)

which has nothing to do with operator precedence.

And if a compiler or static analyzer is in doubt it issues a warning / error.

>> I might agree with these cases, but below in assignments and combined
>> operations the parens are indeed redundant.
>>
>
> OK. I think we are already in personal style of code zone now.

Yes and no.

> I have already
> broken another review because you don't like for loops but rather have a while
> loop.

In that case (IIRC) the for-loop use to be too verbose instead of
simple (--i >= 0). For sake of readability and maintenance.

> I'll leave ifs and change the assignments only. I'll need your reviewed-by
> once you are happy.

OK.

>>> +       pm_runtime_set_autosuspend_delay(&pdev->dev, AUTOSUSPEND_TIMEOUT);
>>> +       pm_runtime_use_autosuspend(&pdev->dev);
>>> +       pm_runtime_set_active(&pdev->dev);
>>> +       pm_runtime_enable(&pdev->dev);
>>> +       pm_runtime_get_sync(&pdev->dev);
>>
>> +empty line
>
> added a new line for you. I don't know why.

Readability and logical break of the blocks: a) runtime PM, b)
platform resource management.
Do you agree?

>>> +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> +       virtaddr = devm_ioremap_resource(&pdev->dev, res);
>>> +       if (IS_ERR(virtaddr)) {
>>> +               rc = -ENOMEM;
>>> +               goto out;
>>> +       }

[]

>>> +       unsigned int i;
>>> +       int rc;
>>> +
>>> +       for (i = 0; i < ARRAY_SIZE(files); i++) {
>>> +               rc = create_sysfs_entry(dev, files[i].name, files[i].mode);
>>> +               if (rc)
>>> +                       return rc;
>>> +       }
>>> +
>>
>> Can it be like
>>
>> /sys/…/DEVICExx/
>>  channelYY/
>>  attr1
>>  attr2
>>  …
>>
>> ?
>
> I'll work on it. I didn't know that you are allowed to create subdirectories
> in sysfs. I was just creating attributes to keep it simple. But, your
> suggestion is cleaner.
>
>>
>> I think it will be easier to handle in code and from user. (Similar
>> way DMAEngine API does for slave DMA devices)
>
> Now, the good stuff. Can you clarify your comment? I didn't understand it.

I meant that DMAEngine uses
/sys/class/dma
 dmaYchannelX/
  attr1
  attr2
  …

layout.

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH V6 2/3] dma: add Qualcomm Technologies HIDMA management driver Sinan Kaya <okaya@codeaurora.org> - 2015-11-22 17:40 +0100
  Re: [PATCH V6 2/3] dma: add Qualcomm Technologies HIDMA management driver Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-22 18:20 +0100
    Re: [PATCH V6 2/3] dma: add Qualcomm Technologies HIDMA management  driver okaya@codeaurora.org - 2015-11-22 21:00 +0100
      Re: [PATCH V6 2/3] dma: add Qualcomm Technologies HIDMA management driver Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-22 21:50 +0100
        Re: [PATCH V6 2/3] dma: add Qualcomm Technologies HIDMA management  driver Sinan Kaya <okaya@codeaurora.org> - 2015-11-23 03:40 +0100

csiph-web