public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Greg KH <greg@kroah.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] Couple of sysfs patches
Date: Wed, 16 Jun 2004 17:51:03 -0500	[thread overview]
Message-ID: <200406161751.03574.dtor_core@ameritech.net> (raw)
In-Reply-To: <20040610212552.C6833@flint.arm.linux.org.uk>

On Thursday 10 June 2004 03:25 pm, Russell King wrote:
> On Thu, Jun 10, 2004 at 07:17:40PM +0100, Russell King wrote:
> > On Thu, Jun 10, 2004 at 09:14:42AM -0700, Greg KH wrote:
> > > On Thu, Jun 10, 2004 at 05:06:07PM +0100, Russell King wrote:
> > > > 
> > > > Now that I can see the platform device interfaces multipling like rabbits,
> > > > (to GregKH) I think that the patch I submitted for platform_add_device
> > > > suffers from this problem as well, and I should've thrown that code
> > > > into platform_register_device itself.
> > > > 
> > > > Greg - comments?  Would you like a new patch which does that, or do you
> > > > think that's too risky?
> > > 
> > > Hm, I don't think it's too risky.  Make up a patch and let's see how it
> > > looks.
> > > 
> > > I'm just worried that this "simple" interface really isn't so simple, as
> > > it's almost just as much work to manage it as a normal platform device.
> > 
> > Ok, here's a patch so you can see what I'm suggesting above.  This is
> > on top of the previous patch I sent.  Merely discards one over-eager
> > rabbit [1] and moves the code into platform_device_register().
> > 
> > [1]: No animals were harmed in the creation of this patch.
> 
> And for added good behaviour, particularly when things go wrong.
> 
>  
> +	for (i = 0; i < pdev->num_resources; i++) {
> +		struct resource *p, *r = &pdev->resource[i];
> +
> +		r->name = pdev->dev.bus_id;
> +
> +		p = NULL;
> +		if (r->flags & IORESOURCE_MEM)
> +			p = &iomem_resource;
> +		else if (r->flags & IORESOURCE_IO)
> +			p = &ioport_resource;
> +
> +		if (p && request_resource(p, r)) {
> +			printk(KERN_ERR
> +			       "%s: failed to claim resource %d\n",
> +			       pdev->dev.bus_id, i);
> +			ret = -EBUSY;
> +			goto failed;
> +		}
> +	}
> +

What about freeing the resources? Can it be put in platform_device_unregister
or is it release handler task? I'd put it in unregister because when I call
unregister I expect device be half-dead and release as much resources as it
can.

-- 
Dmitry

  reply	other threads:[~2004-06-16 22:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-10 14:46 [PATCH 0/3] Couple of sysfs patches Dmitry Torokhov
2004-06-10 16:06 ` Russell King
2004-06-10 16:14   ` Greg KH
2004-06-10 18:17     ` Russell King
2004-06-10 20:25       ` Russell King
2004-06-16 22:51         ` Dmitry Torokhov [this message]
2004-06-18 19:29           ` Russell King
2004-06-18 20:39             ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2004-06-18 19:59 Dmitry Torokhov
2004-06-09  7:21 Dmitry Torokhov
2004-06-09 22:13 ` Greg KH
     [not found]   ` <200406091732.28684.dtor_core@ameritech.net>
2004-06-09 22:45     ` Greg KH
     [not found]       ` <200406091754.23303.dtor_core@ameritech.net>
2004-06-09 23:19         ` Greg KH
2004-06-10  6:40           ` Dmitry Torokhov

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=200406161751.03574.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    /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