All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: zhangfei gao <zhangfei.gao@gmail.com>
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: Wed, 18 May 2011 22:38:45 +0200	[thread overview]
Message-ID: <201105182238.45614.arnd@arndb.de> (raw)
In-Reply-To: <BANLkTikVM7QbRJ2Lo2Ef3T9oGAmZ4SJzMQ@mail.gmail.com>

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


  reply	other threads:[~2011-05-19  7:53 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 [this message]
2011-05-19 11:34                       ` zhangfei gao
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=201105182238.45614.arnd@arndb.de \
    --to=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 \
    --cc=zhangfei.gao@gmail.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.