The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH/RFC] platform: Add support for automatic device IDs
Date: Fri, 27 Jul 2012 21:37:23 +0200	[thread overview]
Message-ID: <20120727213723.46b8b34f@endymion.delvare> (raw)
In-Reply-To: <20120727182155.GD23564@kroah.com>

Hi Greg,

On Fri, 27 Jul 2012 11:21:55 -0700, Greg Kroah-Hartman wrote:
> On Fri, Jul 27, 2012 at 01:46:25PM +0200, Jean Delvare wrote:
> > Right now we have support for explicit platform device IDs, as well as
> > ID-less platform devices when a given device type can only have one
> > instance. However there are cases where multiple instances of a device
> > type can exist, and their IDs aren't (and can't be) known in advance
> > and do not matter. In that case we need automatic device IDs to avoid
> > device name collisions.
> > 
> > I am using magic ID value -4 for this (I left -2 and -3 free in case
> > we ever need a couple of other magic values.) The automatically
> > allocated device IDs are global (to avoid an additional per-driver
> > cost) and are stored internally as negative numbers, starting with -4.
> > This is required so that the IDs can be freed later. Externally the
> > positive value is used.
> > 
> > Signed-off-by: Jean Delvare <khali@linux-fr.org>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > If anyone has a problem with the -4 or using negative device IDs
> > internally, it would be possible to avoid that by adding a boolean
> > attribute to every platform device to record whether the ID needs to
> > be freed. This would cost some memory.
> 
> A boolean is "free" don't worry about that.  Don't overload the device
> id with "magic" values like this, I don't like that at all.

I suspected so...

> I'd prefer
> to see another field added if this is really going to be needed.

OK, I'll send a different implementation in a moment. Note though that
PLATFORM_DEVID_AUTO will have to stay, as we still need a way to tell
the platform subsystem that we want an automatic ID.

Thanks,
-- 
Jean Delvare

      reply	other threads:[~2012-07-27 19:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-27 11:46 [PATCH/RFC] platform: Add support for automatic device IDs Jean Delvare
2012-07-27 18:21 ` Greg Kroah-Hartman
2012-07-27 19:37   ` Jean Delvare [this message]

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=20120727213723.46b8b34f@endymion.delvare \
    --to=khali@linux-fr.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.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