All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Vitaly Bordug <vitb@kernel.crashing.org>
Cc: "linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][RFC] i2c: adds support for i2c bus on 8xx
Date: Thu, 26 Apr 2007 17:54:38 +0200	[thread overview]
Message-ID: <20070426175438.391157a1@hyperion.delvare> (raw)
In-Reply-To: <462F8A82.40604@kernel.crashing.org>

Hi Vitaly,

On Wed, 25 Apr 2007 21:06:10 +0400, Vitaly Bordug wrote:
> Jean Delvare wrote:
> >>>> +/* Structure for a device driver */
> >>>> +static struct device_driver i2c_rpx_driver = {
> >>>> +	.name = "fsl-i2c-cpm",
> >>>> +	.bus = &platform_bus_type,
> >>>> +	.probe = i2c_rpx_probe,
> >>>> +	.remove = i2c_rpx_remove,
> >>>> +};
> >>>>         
> >>> Why don't you declare it as a struct platform_driver, register it with
> >>> platform_driver_register() and unregister it with
> >>> platform_driver_unregister()?
> >>>       
> >> Well. This stuff belongs to CPM1, of the mpc8xx family, but the
> >> target boards are different, and they may/should provide board
> >> specific inits and filling of platform data. With
> >> platform_driver_register we may end up with ifdef stuff here
> >> (which is evil).
> >>     
> >
> > I don't follow you here, sorry. Platform devices are declared by
> > board-specific code which can include all the needed initialization.
> > And device-specific data can be carried to the platform driver for
> > further use. The platform device/driver infrastructure is meant to
> > handle that kind of situation, so there really is no excuse that I can
> > see not to use it. i2c-omap and i2c-mpc use it. As a matter of fact you
> > _are_ declaring a platform driver (.bus = &platform_bus_type), just not
> > using the standard way.
> >
> >   
> Standard way here - platform devices got registered from elsewhere - 
> from arch/ppc/ppc_sys.c if arch/ppc or from 
> arch/powerpc/sysdev/fsl_soc.c if powerpc.
> Every way (powerpc is more flexible since is pulling the information 
> from the firmware-passed device tree) fills in the resources and 
> platform data, and
> is capable with device/drive bound you are talking about.

This doesn't explain why you can't use platform_driver_register(),
which is the right way to register a platform driver.

-- 
Jean Delvare

WARNING: multiple messages have this Message-ID (diff)
From: Jean Delvare <khali@linux-fr.org>
To: Vitaly Bordug <vitb@kernel.crashing.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	"linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>
Subject: Re: [PATCH][RFC] i2c: adds support for i2c bus on 8xx
Date: Thu, 26 Apr 2007 17:54:38 +0200	[thread overview]
Message-ID: <20070426175438.391157a1@hyperion.delvare> (raw)
In-Reply-To: <462F8A82.40604@kernel.crashing.org>

Hi Vitaly,

On Wed, 25 Apr 2007 21:06:10 +0400, Vitaly Bordug wrote:
> Jean Delvare wrote:
> >>>> +/* Structure for a device driver */
> >>>> +static struct device_driver i2c_rpx_driver = {
> >>>> +	.name = "fsl-i2c-cpm",
> >>>> +	.bus = &platform_bus_type,
> >>>> +	.probe = i2c_rpx_probe,
> >>>> +	.remove = i2c_rpx_remove,
> >>>> +};
> >>>>         
> >>> Why don't you declare it as a struct platform_driver, register it with
> >>> platform_driver_register() and unregister it with
> >>> platform_driver_unregister()?
> >>>       
> >> Well. This stuff belongs to CPM1, of the mpc8xx family, but the
> >> target boards are different, and they may/should provide board
> >> specific inits and filling of platform data. With
> >> platform_driver_register we may end up with ifdef stuff here
> >> (which is evil).
> >>     
> >
> > I don't follow you here, sorry. Platform devices are declared by
> > board-specific code which can include all the needed initialization.
> > And device-specific data can be carried to the platform driver for
> > further use. The platform device/driver infrastructure is meant to
> > handle that kind of situation, so there really is no excuse that I can
> > see not to use it. i2c-omap and i2c-mpc use it. As a matter of fact you
> > _are_ declaring a platform driver (.bus = &platform_bus_type), just not
> > using the standard way.
> >
> >   
> Standard way here - platform devices got registered from elsewhere - 
> from arch/ppc/ppc_sys.c if arch/ppc or from 
> arch/powerpc/sysdev/fsl_soc.c if powerpc.
> Every way (powerpc is more flexible since is pulling the information 
> from the firmware-passed device tree) fills in the resources and 
> platform data, and
> is capable with device/drive bound you are talking about.

This doesn't explain why you can't use platform_driver_register(),
which is the right way to register a platform driver.

-- 
Jean Delvare

  reply	other threads:[~2007-04-26 15:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20  4:27 [PATCH][RFC][POWERPC] i2c: adds support for i2c bus on 8xx Vitaly Bordug
2007-04-20  4:27 ` Vitaly Bordug
2007-04-20  8:57 ` Segher Boessenkool
2007-04-20 15:15 ` Milton Miller
2007-04-21  7:57 ` [PATCH][RFC] " Jean Delvare
2007-04-21  7:57   ` Jean Delvare
2007-04-22 11:29   ` Vitaly Bordug
2007-04-22 11:29     ` Vitaly Bordug
2007-04-23  9:19     ` Jean Delvare
2007-04-23  9:19       ` Jean Delvare
2007-04-25 17:06       ` Vitaly Bordug
2007-04-26 15:54         ` Jean Delvare [this message]
2007-04-26 15:54           ` Jean Delvare
2007-04-26 16:07           ` Vitaly Bordug
2007-04-23  2:57 ` [PATCH][RFC][POWERPC] " Olof Johansson
2007-04-25 17:01   ` Vitaly Bordug
2007-04-25 18:53     ` Scott Wood
2007-04-25 18:53       ` Scott Wood

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=20070426175438.391157a1@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=vitb@kernel.crashing.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 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.