linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: cyril-l0cyMroinI0@public.gmane.org
Cc: "spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org"
	<spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	"davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org"
	<davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org>,
	"broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org"
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	"dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org"
	<dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	"lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org"
	<lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org>
Subject: Re: [PATCH 01/12] misc: add driver for sequencer serial port
Date: Mon, 18 Oct 2010 08:59:20 -0600	[thread overview]
Message-ID: <AANLkTimZm6T_WywkekkoFepHJk72EC9wRVXxJFHkspHO@mail.gmail.com> (raw)
In-Reply-To: <4CBC520B.9070502-l0cyMroinI0@public.gmane.org>

On Mon, Oct 18, 2010 at 7:56 AM, Cyril Chemparathy <cyril-l0cyMroinI0@public.gmane.org> wrote:
> Hi Grant,
>
> Thanks for the feedback, I will send out an updated v2 with the proposed
> changes.
>
> [...]
>>> +EXPORT_SYMBOL(ti_ssp_open);
>>
>> I'm not thrilled with the ti_ssp_open()/ti_ssp_close() usage model.
>> It appears that the usage model is the board code registers an pile
>> of platform_devices, one for the ssp, and one for each of the
>> behaviours on top of it.  Then the various driver instances have to
>> figure out how to find each other and whether or not they are related.
>> Am I correct?
>>
>> Rather than doing an end-run around the Linux driver model, I strongly
>> recommend using the model to solve your problem.  Register only the
>> ssp platform_device in the board support code and pass it data about
>> the intended behaviour (via platform data).  When it gets probed, it
>> can then register additional platform devices which will get probed by
>> the requested driver.  That way the specific ssp device instance data
>> can be passed reliably to the spi/i2c/whatever driver without any
>> ambiguity, without any uncertainty about whether a port is 'busy', and
>> without the need of these open/close routines.
>>
>> (Hint: The trick is to set the platform_device's pdev->dev.parent
>> pointer to make use of the Linux device model's hierarchy).
>
> I am not very thrilled with this approach either :-)  I had looked at a
> few other instances where something similar was being done (spi, i2c,
> mdio, etc.), but felt that defining a new bus type would be an overkill
> for this.

Nope!  you don't need to define a new bus type.  Just continue to use
platform bus.  If you set the dev->parent pointer before registering
the device then the device model with have the appropriate hierarchy.

> For reference, could you please point me to some other place where
> something similar is being done?

Most of the multifunction devices operating in this way (though those
implementations are probably more convoluted than they need to be.
Take a look.  If you still have trouble with it let me know and I'll
draft an example for you.

g.

  parent reply	other threads:[~2010-10-18 14:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-14 18:38 [PATCH 00/12] tnetv107x ssp driver stack Cyril Chemparathy
     [not found] ` <1287081535-2864-1-git-send-email-cyril-l0cyMroinI0@public.gmane.org>
2010-10-14 18:38   ` [PATCH 01/12] misc: add driver for sequencer serial port Cyril Chemparathy
     [not found]     ` <1287081535-2864-2-git-send-email-cyril-l0cyMroinI0@public.gmane.org>
2010-10-16  5:00       ` Grant Likely
     [not found]         ` <20101016050055.GH21170-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2010-10-18 13:56           ` Cyril Chemparathy
     [not found]             ` <4CBC520B.9070502-l0cyMroinI0@public.gmane.org>
2010-10-18 14:59               ` Grant Likely [this message]
2010-10-14 18:38   ` [PATCH 02/12] davinci: add tnetv107x ssp platform device Cyril Chemparathy
2010-10-14 18:38   ` [PATCH 03/12] davinci: add ssp config for tnetv107x evm board Cyril Chemparathy
2010-10-14 18:38   ` [PATCH 04/12] spi: add ti-ssp spi master driver Cyril Chemparathy
     [not found]     ` <1287081535-2864-5-git-send-email-cyril-l0cyMroinI0@public.gmane.org>
2010-10-16  5:05       ` Grant Likely
2010-10-14 18:38   ` [PATCH 05/12] davinci: add spi devices on tnetv107x evm Cyril Chemparathy
2010-10-14 18:38   ` [PATCH 06/12] regulator: add driver for tps6524x regulator Cyril Chemparathy
     [not found]     ` <1287081535-2864-7-git-send-email-cyril-l0cyMroinI0@public.gmane.org>
2010-10-14 21:03       ` Mark Brown
     [not found]         ` <20101014210323.GB14479-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2010-10-18 12:50           ` Cyril Chemparathy
2010-10-16 10:00       ` Mark Brown
2010-10-14 18:38   ` [PATCH 07/12] davinci: add tnetv107x evm regulators Cyril Chemparathy
     [not found]     ` <1287081535-2864-8-git-send-email-cyril-l0cyMroinI0@public.gmane.org>
2010-10-14 21:05       ` Mark Brown
2010-10-14 18:38   ` [PATCH 08/12] gpio: add ti-ssp virtual gpio driver Cyril Chemparathy
2010-10-14 18:38   ` [PATCH 09/12] davinci: add tnetv107x evm ti-ssp gpio device Cyril Chemparathy
2010-10-14 18:38   ` [PATCH 10/12] backlight: add support for tps6116x controller Cyril Chemparathy
2010-10-14 18:38   ` [PATCH 11/12] davinci: add tnetv107x evm backlight device Cyril Chemparathy
2010-10-14 18:38   ` [PATCH 12/12] davinci: add tnetv107x evm i2c eeprom device Cyril Chemparathy

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=AANLkTimZm6T_WywkekkoFepHJk72EC9wRVXxJFHkspHO@mail.gmail.com \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=cyril-l0cyMroinI0@public.gmane.org \
    --cc=davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org \
    --cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@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;
as well as URLs for NNTP newsgroup(s).