Re: UIO device name
From: Paul Mundt
Date: Wed Sep 24 2008 - 06:15:56 EST
On Wed, Sep 24, 2008 at 11:57:59AM +0200, Joakim Tjernlund wrote:
> On Wed, 2008-09-24 at 18:35 +0900, Paul Mundt wrote:
> > On Wed, Sep 24, 2008 at 11:21:33AM +0200, Joakim Tjernlund wrote:
> > > As far as I can see there isn't a way to name the /dev/uio%d device file
> > > to something more useful, is that so?
> > > I would like to name the device file from within the kernel so I can
> > > find the correct device from userspace.
> > > The very least is to control the minor(%d) number.
> > >
> > You have a couple of options for this:
> >
> > - the 'name' sysfs entry for each of the uio devices, which
> > corresponds to the uio device name.
> > - extracting the relevant data from things like 'lsuio'.
> > - hooking in the pretty mame through udev to create an alias.
>
> Right, but I want to do it from within the kernel when I create the
> device because that the only place I truly know what HW the uio maps to.
>
> I found that this works:
> struct uio_info *info,
> struct uio_device *idev;
>
> idev = info->uio_dev;
> device_rename(idev->dev, "irq4");
>
> but then I have to copy the private uio_device struct from uio.c
> Is there a better way to get at idev->dev?
>
I fail to see what this will buy you that you can't already do with udev
(or a set of scripts that look at sysfs) today. "the only place I truly
know what HW the uio maps to" doesn't make any sense, the name is fully
preserved and exposed. If you can't figure out your device from looking
at /sys/class/uio/uio?/name, I'm not sure how a rename is going to make
any difference.
If you need to poke at uio private data, you are almost certainly doing
something wrong.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/