public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Hans J. Koch" <hjk@linutronix.de>
To: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Cc: Paul Mundt <lethal@linux-sh.org>,
	hjk@linutronix.de, gregkh@suse.de,
	Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: UIO device name
Date: Wed, 24 Sep 2008 12:22:31 +0200	[thread overview]
Message-ID: <20080924102230.GB2973@local> (raw)
In-Reply-To: <1222250279.12624.195.camel@gentoo-jocke.transmode.se>

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.

Set info->name to something that's useful for the userspace part of the
driver. You can create an individual string for each HW so userspace can
easily identify the devices. The string in info->name can be anything
you like, it's only used as info given in the "name" sysfs file.

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

That's a clear sign that the UIO authors didn't want people to do that
;-)

> Is there a better way to get at idev->dev?

No hackery, please. The "name" attribute is there for this purpose, use
it. Or use one of the other possibilities Paul mentioned.

Thanks,
Hans


  parent reply	other threads:[~2008-09-24 10:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-24  9:21 UIO device name Joakim Tjernlund
2008-09-24  9:35 ` Paul Mundt
2008-09-24  9:57   ` Joakim Tjernlund
2008-09-24 10:14     ` Paul Mundt
2008-09-24 10:22     ` Hans J. Koch [this message]
2008-09-24 11:33       ` Joakim Tjernlund
2008-09-24 11:47         ` Paul Mundt
2008-09-24 12:38           ` Joakim Tjernlund
2008-09-24 22:57             ` Ben Nizette
2008-09-25 10:05               ` Joakim Tjernlund
2008-09-25 10:48                 ` Ben Nizette
2008-09-25 11:41                   ` Joakim Tjernlund
2008-09-25 11:53                     ` Paul Mundt
2008-09-25 12:36                       ` Joakim Tjernlund

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=20080924102230.GB2973@local \
    --to=hjk@linutronix.de \
    --cc=gregkh@suse.de \
    --cc=joakim.tjernlund@transmode.se \
    --cc=lethal@linux-sh.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