All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhangfei gao <zhangfei.gao@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Philip Rakity <prakity@marvell.com>,
	Wolfram Sang <w.sang@pengutronix.de>, Chris Ball <cjb@laptop.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Jun Nie <njun@marvell.com>, Raymond Wu <xywu@marvell.com>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Mark Brown <mark.brown314@gmail.com>
Subject: Re: [PATCH 2/2] sdhci-pxa: add call back interface to share sdhci-pxa
Date: Thu, 19 May 2011 07:34:29 -0400	[thread overview]
Message-ID: <BANLkTinGQLPD4LmjiSjtswqJ19xtvimjUw@mail.gmail.com> (raw)
In-Reply-To: <201105182238.45614.arnd@arndb.de>

On Wed, May 18, 2011 at 4:38 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 17 May 2011, zhangfei gao wrote:
>> >> The code handle several register difference are located at
>> >> arch/arm/mach-mmp/mmp2.c is for mmp2
>> >> arch/arm/mach-mmp/pxa910.c is for pxa910 serious,
>> >> arch/arm/mach-mmp/mmp3.c is for mmp3 serious, considering there may
>> >> still registers changing.
>> >>
>> >> The board difference are directly put in board.c
>> >> For example ttc_dkb do not use wp pin, so get_ro is provided.
>> >
>> > embedding the code in these chip files stops code sharing.  For example,
>> > mmp3 has same controller as mmp2.
>>
>> If register are totally same, they can share.
>> If there is minor difference with chip upgrading, they can put in
>> different file.
>
> When we talked about similar problems in drivers during the Linaro Developer
> Summit, the broad consensus was to move code from arch/arm into individual
> device drivers, and I think this should be done for this driver too.
>
> My recommendation here would be to have no callbacks in the platform
> data at all, but instead have the code for all variants in the
> sdhci-pxa driver itself. You can still have a structure to describe
> the differences using function pointers, but it's better if that is
> part of the driver itself. In the platform data, provide a way
> to identify the variant of the controller (e.g. using an enum)
> and point to the base addresses as required.
>
>        Arnd
>
Hi, Arnd

Thanks for your suggestion.

To make sdhci-pxa easy to maintain, we still prefer put platform
specific difference under platform code.

"Identify controller from platform data" looks to me is same as using #ifdef.
The method is used in our another driver before.
More and more workaround comes when more and more platform need to
support, making the driver bigger and bigger and not easy to maintain.
Nobody remember what's the workaround purpose several years later.
So the result is we have to re-write the driver again to make it simple :(

Currently, the ip is shared among mmp2, pxa910, pxa168 etc, pxa910
maintainer does not care what workaround is used on pxa168.
When mmp3 wants to reuse the ip, it's easier to not care what's the
history at all.

So we still prefer keep driver as simple as possible, while specific
platform self-maintain specific workaround , which is not aware to
other platform.

Thanks
>

  reply	other threads:[~2011-05-19 11:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29  3:57 [PATCH 2/2] sdhci-pxa: add call back interface to share sdhci-pxa zhangfei gao
2011-05-12 22:25 ` Chris Ball
2011-05-12 22:58   ` Philip Rakity
2011-05-13 13:47     ` Chris Ball
2011-05-14  5:11       ` zhangfei gao
2011-05-14 17:01         ` Philip Rakity
2011-05-15 21:32           ` Philip Rakity
2011-05-16  6:26           ` zhangfei gao
2011-05-16 13:51             ` Philip Rakity
2011-05-17  2:02               ` zhangfei gao
2011-05-17  4:27                 ` Philip Rakity
2011-05-17  5:39                   ` zhangfei gao
2011-05-18 20:38                     ` Arnd Bergmann
2011-05-19 11:34                       ` zhangfei gao [this message]
2011-05-19 13:04                         ` Arnd Bergmann
2011-05-23 13:13                           ` zhangfei gao
2011-05-23 14:56                             ` Arnd Bergmann
2011-05-19 18:24                         ` Nicolas Pitre
2011-05-21  1:50                           ` zhangfei gao
  -- strict thread matches above, loose matches on Subject: below --
2010-12-03  6:31 [PATCH 2/2] sdhci-pxa " zhangfei gao
2010-12-07  5:56 ` Raymond Wu
2010-12-07 15:26   ` Philip Rakity
2010-12-07 15:38     ` zhangfei gao
2010-12-07 15:48       ` Philip Rakity
2010-12-07 15:58         ` zhangfei gao
2010-12-27  7:09 ` zhangfei gao

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=BANLkTinGQLPD4LmjiSjtswqJ19xtvimjUw@mail.gmail.com \
    --to=zhangfei.gao@gmail.com \
    --cc=arnd@arndb.de \
    --cc=cjb@laptop.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mark.brown314@gmail.com \
    --cc=njun@marvell.com \
    --cc=prakity@marvell.com \
    --cc=w.sang@pengutronix.de \
    --cc=xywu@marvell.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.