Re: [PATCH v2 6/7] ata: Add support for the Tegra124 SATA controller
From: Thierry Reding
Date: Tue Jul 15 2014 - 05:32:02 EST
On Tue, Jul 15, 2014 at 10:55:29AM +0200, Hans de Goede wrote:
> On 07/15/2014 09:12 AM, Mikko Perttunen wrote:
[...]
> > Other subsystems I've been in don't have this kind of helper
> > library, so diverging here seems weird.
>
> Well the usb uhci-platform and ehci-platform drivers are doing the same,
> what we're trying to do here is avoid needless code duplication and
> if possible (for ehci and uhci it currently is) make it so that adding
> support for a new soc only requires adding dt stuff + a phy driver,
> without touching the ?hci code at all. Again I can see that this
> is not possible for the Tegra124.
I don't think helper libraries are good at managing resources. They are
very good for extracting common /functionality/ so that it doesn't have
to be duplicated. That's where the commonalities really are. Resource
allocation and setup are usually where the differences are. Trying to
extract that into common helpers often results in clumsy code.
Also, since resources and setup sequences are often very different, the
chances are that adding support for a new SoC will always require
extending the helpers to cope with that new type of resource that the
new SoC now requires, or bumping the maximum number of resources of an
existing type.
Thierry
Attachment:
pgpaYLg9Gz0D9.pgp
Description: PGP signature