linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* i2c-mux-gpio platform device ID issue
@ 2012-07-25 12:44 Jean Delvare
       [not found] ` <20120725144409.1e47bd95-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Jean Delvare @ 2012-07-25 12:44 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Linux I2C

Hi Peter,

I am anticipating an issue with driver i2c-mux-gpio. Right now there
are no user in the kernel tree (surprisingly...), but I'm about to add
the first one (for SMBus multiplexing on an x86 motherboard) and I
expect more will follow.

Right now I am allocating the multiplexer device with:

	platform_device_alloc("i2c-mux-gpio", -1);

This is OK as long as I am the only user. But if the same system needs
another instance of "i2c-mux-gpio", the second attempt will fail,
because both devices will have the same name and this isn't allowed by
the driver core. I could pass an instance ID at allocation time,
however it would have to be different for my driver and the other
driver, and there's no way to guarantee this for two random drivers.

Do you have any idea how we can solve this problem?

My only idea so far is to change the semantics of pdev->id == -1 from
"there's only one device" to "I don't care about the device ID".
Platform devices created with pdev->id == -1 would get an arbitrary ID
value, using an IDA-style mechanism. The IDA would be stored at the
platform driver level. It has the drawback of adding some burden to all
platform drivers, but I'm not sure how much yet, it might be just
acceptable.

If a per-driver IDA isn't acceptable, then we can go for a global IDA,
but then we can't re-use pdev->id == -1 for it. We'd have to introduce
pdev->id == -2 for drivers which want a dynamically allocated unique
ID. Actually this might be a better approach, as it's less intrusive.

Opinions?

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-26 11:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-25 12:44 i2c-mux-gpio platform device ID issue Jean Delvare
     [not found] ` <20120725144409.1e47bd95-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-07-25 14:39   ` Jean Delvare
     [not found]     ` <20120725163913.60fffd1a-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-07-25 19:32       ` Mark Brown
     [not found]         ` <20120725193243.GA9792-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2012-07-25 21:37           ` Jean Delvare
     [not found]             ` <20120725233727.55693faf-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-07-25 21:47               ` Mark Brown
2012-07-26  7:28   ` Jean Delvare
     [not found]     ` <20120726092814.2689a30f-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-07-26 11:49       ` Jean Delvare

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).