public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Felipe Balbi
	<felipebalbi-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Cc: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>,
	dsaxena-k7pgMgclrJvR7s880joybQ@public.gmane.org,
	i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: Re: [PATCH 2/2] I2C: ISP1301_OMAP: New-style i2c driver updates, part 2
Date: Sat, 15 Mar 2008 12:59:40 +0100	[thread overview]
Message-ID: <20080315125940.2fe84f24@hyperion.delvare> (raw)
In-Reply-To: <31e679430803071300w2f2e80ddqd4516a976df4474-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi Felipe,

On Fri, 7 Mar 2008 23:00:40 +0200, Felipe Balbi wrote:
> Hi,
> 
> On Fri, Mar 7, 2008 at 10:20 PM, David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org> wrote:
> > On Tuesday 26 February 2008, Felipe Balbi wrote:
> >  > >
> >  > >  Passing irq_flags???  That sounds like nonsense.  Please explain ...
> >  >
> >  > request_irq was using different irq flags depending on the board, so
> >  > instead of keeping if (machine_is_*) in the driver just because of irq
> >  > flags we could bring it from a platform_data.
> >
> >  Just use the resource type flags ... IORESOURCE_IRQ can
> >  be combined with
> 
> but then isp1301 should become a platform_driver, shouldn't it?
> I'd need a struct platform_device on the board file and get the device
> on probe just to get an irq flag?
> 
> Maybe I'm missing something but I'm understanding something like:
> 
> --- a/arch/arm/mach-omap1/board-h2.c
> +++ b/arch/arm/mach-omap1/board-h2.c
> @@ -140,6 +140,17 @@ static struct platform_device h2_nor_device = {
>         .resource       = &h2_nor_resource,
>  };
> 
> +static struct resource h2_isp1301_resource = {
> +       .flags          = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> +};
> +
> +static struct platform_device h2_nor_device = {
> +       .name           = "isp1301_omap",
> +       .id             = 0,
> +       .num_resources  = 1,
> +       .resource       = &h2_isp1301_resource,
> +};
> +
>  static struct mtd_partition h2_nand_partitions[] = {
>  #if 0
>         /* REVISIT:  enable these partitions if you make NAND BOOT
> diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c
> index 4bb931c..d0a5825 100644
> --- a/drivers/i2c/chips/isp1301_omap.c
> +++ b/drivers/i2c/chips/isp1301_omap.c
> @@ -1453,6 +1453,27 @@ isp1301_start_hnp(struct otg_transceiver *dev)
> 
>  /*-------------------------------------------------------------------------*/
> 
> +struct platform_driver isp1301_plat_driver = {
> +       .driver = {
> +               .name   = DRIVER_NAME,
> +               .bus    = &platform_bus_type,
> +               .owner  = THIS_MODULE,
> +       },
> +};
> +
> +static int __init isp1301_plat_probe(struct platform_device *pdev)
> +{
> +       struct resource *resource;
> +
> +       resource = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> +       if (!resource)
> +               return -ENODEV;
> +
> +       the_transceiver->irq_type = resource->flags;
> +}
> +
> +/*-------------------------------------------------------------------------*/
> +
>  /* no error returns, they'd just make bus scanning stop */
>  static int __init isp1301_probe(struct i2c_client *client)
>  {
> 
> (of course the code above doesn't work, it's just to clear my mind :-p)
> 
> Anyways, wouldn't be easier to put a platform_data that can ship
> withing struct i2c_board_info?

The above looks all wrong to me. The ISP1301 is an I²C device, it gets
an i2c driver, not a platform driver.

If you need to pass any extra parameter from the platform code to the
isp1301 driver, you must define a custom structure and pass it as
i2c_board_info->platform_data. In your case, it would look like:

struct isp1301_platform_data {
	int irq_type;
}

David, please correct me if I'm wrong.

That being said, if many drivers need an irq_type field in addition to
the irq number, we might consider adding an irq_type field to struct
i2c_board_info and struct i2c_client directly. It probably doesn't make
much sense to have irq and irq_type take different routes if they are
most often needed together.

-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

  parent reply	other threads:[~2008-03-15 11:59 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1199379597-6273-1-git-send-email-me@felipebalbi.com>
     [not found] ` <1199379597-6273-2-git-send-email-me@felipebalbi.com>
2008-01-21 17:15   ` [PATCH 1/2] I2C: ISP1301_OMAP: New-style i2c driver updates, part 1 Jean Delvare
2008-01-21 18:37     ` Felipe Balbi
     [not found]   ` <1199379597-6273-3-git-send-email-me@felipebalbi.com>
2008-01-22 12:01     ` [PATCH 2/2] I2C: ISP1301_OMAP: New-style i2c driver updates, part 2 Jean Delvare
     [not found]       ` <20080122130158.4d4d44dc-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-22 12:13         ` Felipe Balbi
2008-01-22 17:56           ` Jean Delvare
     [not found]             ` <20080122185615.4a8ebbea-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-02-23 16:52               ` Jean Delvare
     [not found]                 ` <20080223175233.7d2f358e-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-02-23 17:01                   ` Felipe Balbi
     [not found]                     ` <31e679430802230901j66e17535w6ac8ec57e60e5c6b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-23 17:11                       ` Jean Delvare
     [not found]                         ` <20080223181120.30e9f63a-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-02-23 17:13                           ` Felipe Balbi
     [not found]                             ` <31e679430802230913m33d8457x1760399183c56ced-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-23 17:53                               ` David Brownell
     [not found]                                 ` <20080223175356.95681BA69D-ZcXrCSuhvln6VZ3dlLfH/g4gEjPzgfUyLrfjE7I9kuVHxeISYlDBzl6hYfS7NtTn@public.gmane.org>
2008-02-23 18:00                                   ` Felipe Balbi
     [not found]                                     ` <31e679430802231000i4a360269v5d0bc61fc21fd7c3-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-23 18:10                                       ` David Brownell
     [not found]                                         ` <200802231010.40108.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-02-23 19:00                                           ` Felipe Balbi
     [not found]                                             ` <31e679430802231100r19df9157x9bbd910a592f4392-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-23 19:08                                               ` Felipe Balbi
     [not found]                                                 ` <31e679430802231108k613bdd9ds2782aed429b65b50-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-23 19:48                                                   ` Jean Delvare
2008-02-23 19:28                                           ` Jean Delvare
     [not found]                                             ` <20080223202832.4a953910-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-02-23 19:53                                               ` David Brownell
     [not found]                                                 ` <200802231153.04011.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-02-24  9:30                                                   ` Jean Delvare
     [not found]                                                     ` <20080224103052.66da6803-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-02-24 11:05                                                       ` felipebalbi-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f
     [not found]                                                         ` <31e679430802240305o62ec88a9jfcc54f0a3be658ff-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-25  8:46                                                           ` Felipe Balbi
     [not found]                                                             ` <31e679430802250046h4df04aa0y6a32005e6d791e65-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-02-25 12:54                                                               ` Felipe Balbi
     [not found]                                                                 ` <31e679430802250454k234e071alc9bbcb2e3b7e7605-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-03-06  6:28                                                                   ` David Brownell
     [not found]                                                                     ` <200803052228.47162.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-03-06  9:15                                                                       ` Felipe Balbi
2008-02-26  5:38                                                               ` David Brownell
     [not found]                                                                 ` <200802252138.30301.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-02-26  9:22                                                                   ` Felipe Balbi
     [not found]                                                                     ` <31e679430802260122xc30356ayd98fc3c079e613b7-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-03-07 20:20                                                                       ` David Brownell
     [not found]                                                                         ` <200803071220.10744.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-03-07 21:00                                                                           ` Felipe Balbi
     [not found]                                                                             ` <31e679430803071300w2f2e80ddqd4516a976df4474-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-03-15 11:59                                                                               ` Jean Delvare [this message]
     [not found]                                                                                 ` <20080315125940.2fe84f24-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-03-15 12:04                                                                                   ` Felipe Balbi
2008-03-16  3:57                                                                                   ` David Brownell
     [not found]                                                                                     ` <200803152057.19375.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-03-16 10:22                                                                                       ` Felipe Balbi
     [not found]                                                                                         ` <31e679430803160322v7b8d6ecepf03bd8b87d975553-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-03-16 10:40                                                                                           ` Jean Delvare
     [not found]                                                                                             ` <20080316114043.57e38dd7-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-03-16 11:07                                                                                               ` Felipe Balbi
2008-02-28 21:50                                                               ` Jean Delvare
     [not found]                                                                 ` <20080228225032.61f07a18-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-02-28 21:53                                                                   ` Felipe Balbi

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=20080315125940.2fe84f24@hyperion.delvare \
    --to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
    --cc=david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org \
    --cc=dsaxena-k7pgMgclrJvR7s880joybQ@public.gmane.org \
    --cc=felipebalbi-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=i2c-GZX6beZjE8VD60Wz+7aTrA@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