public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
Cc: Mike Rapoport <mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org,
	konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 4/6] ARM: tegra: harmony: register sdhci devices
Date: Wed, 23 Feb 2011 13:53:27 -0700	[thread overview]
Message-ID: <20110223205327.GV14597@angua.secretlab.ca> (raw)
In-Reply-To: <AANLkTi=mjR6dnxcTxYzTvJK4DgEW7mO+p4TUeu6kq6fn-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Tue, Feb 22, 2011 at 07:44:58AM -0800, Olof Johansson wrote:
> On Mon, Feb 21, 2011 at 10:59 PM, Mike Rapoport <mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org> wrote:
> > Hi Olof,
> > Sorry for jumping late, haven't thought about the proposal below yesterday.
> > I'm not objecting to applying the patch as is, we can refactor the code
> > afterwards as well.
> 
> Thanks for the input. And yeah, I'd say we can refactor later when we
> see how things will fit well with flat devicetrees. More below.
> 
> 
> >>  static void __init tegra_harmony_init(void)
> >>  {
> >>       tegra_common_init();
> >> @@ -85,6 +111,10 @@ static void __init tegra_harmony_init(void)
> >>
> >>       harmony_pinmux_init();
> >>
> >> +     tegra_sdhci_device1.dev.platform_data = &sdhci_pdata1;
> >> +     tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2;
> >> +     tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
> >> +
> >
> > I think that instead of copying explicit initialization of the platform_data
> > member from board to board we can do something similar to what PXA does. The
> > board file would have to call something like
> > tegra_set_device_X_info(struct tegra_device_X_platform_data *data);
> > and then static registration of platform devices in the board files can be dropped.
> >
> > For instance, the devices.c would have
> >
> > void __init tegra_register_device(struct platform_device *dev, void *data)
> > {
> >        int ret;
> >
> >        dev->dev.platform_data = data;
> >
> >        ret = platform_device_register(dev);
> >        if (ret)
> >                dev_err(&dev->dev, "unable to register device: %d\n", ret);
> > }
> >
> > void __init tegra_set_sdhci1_info(struct tegra_sdhci_platform_data *info)
> > {
> >        tegra_register_device(&tegra_sdhci_device1, info);
> > }
> >
> > and the board files would just call tegra_set_sdhci1_info to pass the platform
> > data for the tegra_sdhci_device1 and register the device.
> >
> > This way we could reduce amount of copy/paste between the board files. Besides,
> > if/when tegra will be using device trees, handling of the device registration in
> > common place would make the transition easier.
> 
> I don't see how that reduces the amount of copy and paste
> (significantly), since you still need the platform_data defined per
> board so you'll need to add the calls there. Maybe a generic
> "set_platform_data" hook instead of doing the pointer assignment
> open-coded would be an improvement though.

Option 3 is to use a bus notifier to attach additional platform data
when the device gets registered.  That is turning out to be the
cleanest solution when it comes to getting additional pdata to a
device that is pulled out of the dt, and this sounds like a similar
situation.

> 
> I'm personally not a fan of the style where data is described as code,
> i.e. where there would be a tegra_set_<dev>_info function for every
> possible device out there. If anything that adds to the amount of
> copy-and-paste (per device), when it could just be handled with one
> common function being passed the appropriate data (i.e. like
> tegra_register_device).

+1

> 
> Anyway, I'm not looking to argue over it. :) I think we'll see when
> the FDT pieces start to take shape what kind of model will work well,
> and there's no reason to do premature refactoring.
> 
> 
> -Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-02-23 20:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22  5:55 [PATCH v3 0/6] Tegra board patches Olof Johansson
     [not found] ` <1298354117-19097-1-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22  5:55   ` [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config Olof Johansson
     [not found]     ` <1298354117-19097-2-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22 13:13       ` Sergei Shtylyov
     [not found]         ` <4D63B661.6000407-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2011-02-22 15:31           ` Olof Johansson
2011-02-22 19:18       ` Erik Gilling
     [not found]         ` <AANLkTik9_t0mq07mysO2CcK4ppKAmuPAujownfeWEGL5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-22 19:35           ` Olof Johansson
     [not found]             ` <AANLkTimBh2qDx71+P3QCeWJ0sKS1AzYOUohAdSW=AoeS-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-22 23:14               ` Erik Gilling
2011-02-22 20:46       ` Russell King - ARM Linux
     [not found]         ` <20110222204654.GD29559-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-02-22 21:00           ` Olof Johansson
2011-02-22  5:55   ` [PATCH 2/6] ARM: tegra: common device resources Olof Johansson
2011-02-22  5:55   ` [PATCH 3/6] ARM: tegra: remove stale nvidia atag handler Olof Johansson
     [not found]     ` <1298354117-19097-4-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22 19:39       ` Colin Cross
2011-02-22  5:55   ` [PATCH 4/6] ARM: tegra: harmony: register sdhci devices Olof Johansson
     [not found]     ` <1298354117-19097-5-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22  6:59       ` Mike Rapoport
     [not found]         ` <4D635EC4.2030102-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2011-02-22 15:44           ` Olof Johansson
     [not found]             ` <AANLkTi=mjR6dnxcTxYzTvJK4DgEW7mO+p4TUeu6kq6fn-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-23 20:53               ` Grant Likely [this message]
2011-02-22 19:40       ` Colin Cross
2011-02-22  5:55   ` [PATCH 5/6] ARM: tegra: harmony: fix pinmux for MMC slot Olof Johansson
2011-02-22  5:55   ` [PATCH 6/6] ARM: tegra: add seaboard, wario and kaen boards Olof Johansson
     [not found]     ` <1298354117-19097-7-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22  7:05       ` Colin Cross
2011-02-22 20:48       ` Russell King - ARM Linux
     [not found]         ` <20110222204821.GE29559-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-02-22 21:05           ` Olof Johansson
  -- strict thread matches above, loose matches on Subject: below --
2011-02-21 19:06 [PATCH 0/6] Tegra board patches Olof Johansson
     [not found] ` <1298315206-8887-1-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-21 19:06   ` [PATCH 4/6] ARM: tegra: harmony: register sdhci devices Olof Johansson
     [not found]     ` <1298315206-8887-5-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-22  2:52       ` Colin Cross
     [not found]         ` <AANLkTinimyZe0Z49=X1Jpuejjmr9=Ns8AJG2SscH0=kP-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-22  4:32           ` Olof Johansson

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=20110223205327.GV14597@angua.secretlab.ca \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mike-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox