Message ID | 1301417093-14843-1-git-send-email-rob@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Mar 30, 2011 at 2:44 AM, Rob Clark <rob@ti.com> wrote: > From: Rob Clark <robdclark@gmail.com> > > Include the minor device id in the bus-id to give userspace a way to open > the correct "cardN" when there are multiple device instances. > --- > It may seem a bit strange to have multiple platform device instances, but > we have a use-case for this. And this relatively simple patch does the > trick. I'm finding it hard to like this since I feel it might limit certain thing in the future, by baking this into the ABI. We have plans for multiple device nodes per device, but they don't involve abusing the bus id like this. Surely you'd just have another platform device with another unique name for this, I'd be more willing to accept some sort of unique id stored in the platformdev or drm that isn't the device node. Dave.
On Mon, Apr 4, 2011 at 7:30 PM, Dave Airlie <airlied@gmail.com> wrote: > On Wed, Mar 30, 2011 at 2:44 AM, Rob Clark <rob@ti.com> wrote: >> From: Rob Clark <robdclark@gmail.com> >> >> Include the minor device id in the bus-id to give userspace a way to open >> the correct "cardN" when there are multiple device instances. >> --- >> It may seem a bit strange to have multiple platform device instances, but >> we have a use-case for this. And this relatively simple patch does the >> trick. > > I'm finding it hard to like this since I feel it might limit certain > thing in the future, by baking > this into the ABI. > > We have plans for multiple device nodes per device, but they don't > involve abusing the bus id like this. > > Surely you'd just have another platform device with another unique > name for this, I'd be more willing > to accept some sort of unique id stored in the platformdev or drm that > isn't the device node. What about: len = snprintf(master->unique, master->unique_len, "platform:%s:%02d", dev->platformdev->name, dev->platformdev->id); (ie. using the id field from struct platform_device).. Perhaps this is more analogous to using pci bus # / slot / func? BR, -R
On Tue, Apr 5, 2011 at 1:08 PM, Rob Clark <robdclark@gmail.com> wrote: > On Mon, Apr 4, 2011 at 7:30 PM, Dave Airlie <airlied@gmail.com> wrote: >> On Wed, Mar 30, 2011 at 2:44 AM, Rob Clark <rob@ti.com> wrote: >>> From: Rob Clark <robdclark@gmail.com> >>> >>> Include the minor device id in the bus-id to give userspace a way to open >>> the correct "cardN" when there are multiple device instances. >>> --- >>> It may seem a bit strange to have multiple platform device instances, but >>> we have a use-case for this. And this relatively simple patch does the >>> trick. >> >> I'm finding it hard to like this since I feel it might limit certain >> thing in the future, by baking >> this into the ABI. >> >> We have plans for multiple device nodes per device, but they don't >> involve abusing the bus id like this. >> >> Surely you'd just have another platform device with another unique >> name for this, I'd be more willing >> to accept some sort of unique id stored in the platformdev or drm that >> isn't the device node. > > What about: > > len = snprintf(master->unique, master->unique_len, > "platform:%s:%02d", dev->platformdev->name, dev->platformdev->id); > > (ie. using the id field from struct platform_device).. > > Perhaps this is more analogous to using pci bus # / slot / func? Yup that seems a lot saner and more acceptable. Dave.
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 47db4df..075024b 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -165,14 +165,15 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv) drm_unset_busid(dev, master); if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) { - master->unique_len = 10 + strlen(dev->platformdev->name); + master->unique_len = 13 + strlen(dev->platformdev->name); + master->unique_size = master->unique_len; master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL); if (master->unique == NULL) return -ENOMEM; len = snprintf(master->unique, master->unique_len, - "platform:%s", dev->platformdev->name); + "platform:%s:%02d", dev->platformdev->name, dev->primary->index); if (len > master->unique_len) { DRM_ERROR("Unique buffer overflowed\n");