Subject: Re: Resource usages in Linux drivers

From: Florian Fainelli <[email-masked]>
Date: Thu, 23 Apr 2015 17:40:12 -0700

On 23/04/15 16:19, Francois Romieu wrote:
> Sergei Shtylyov <[email-masked]> :
>> On 4/23/2015 1:08 PM, Jia-Ju Bai wrote:
> [...]
>>> I also find many drivers do not use these managed APIs, especially in ethernet
>>> card drivers (like e100, r8169). Is it possible to change them?
>>
>>    Patches welcome. :-)
> 
> I respectfully disagree.

Me too, most of the device managed conversions we have seen were bogus
because they were done in a semi-automated way without understanding the
peculiarities of the network devices, that is the separation between
init/open/close that most other device drivers do not have.

A typical example is this:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6892b41d9701283085b655c6086fb57a5d63fa47

> 
> If someone believes basic resouce management to be too hard or error-prone
> to handle, he should imvho seriously rise the bar and reconsider the way
> he wants to contribute to the kernel.

Well, for one, we could have a device managed register_netdev() which
cleans up resources in case of failures and calls free_netdev()
automatically, but is that adding much value?

> 
> I may hope he who reads e100.c to think about DMA api, bql or rx ring
> holes avoidance to quote a few ones. Managed API ? Mildly...
> 

-- 
Florian