lkml.org 
[lkml]   [2010]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Topcliff PHUB: Generate PacketHub driver
Date
On Tuesday 08 June 2010, Masayuki Ohtake wrote:
> We are studying your indication.
> > My feeling is that this ioctl interface is too
> > low-level in general. You only export access to specific
> > registers, not to functionality exposed by them.
> > The best kernel interfaces are defined in a way that
> > is independent of the underlying hardware and
> > convert generic commands into device specific commands.
>
> I have a question.
> We don't know 'generic commands' concretely.
> Let me know 'generic commands' in detail.

I have not seen the application using the driver, but
a better abstraction IMHO would be to take an abstraction
you have in your application and move it into the kernel.

I can be more specific if you tell me where to find the
source of the application. Generally speaking, you'd
transform a function like

/* the function that knows how to do 'this' */
int phub_do_this(int phub_fd, unsigned long arg)
{
struct pch_phub_req req = {
.addr_offset = SOME_ADDR_OFF,
};
ioctl(fd, IOCTL_PHUB_READ_REG, &req);

if (req.data & SOME_BITS)
return ERROR;

req.addr_offset = ANOTHER_ADDR_OFF;
req.data = arg | REALLY_DO_IT_BITMASK;

ioctl(fd, IOCTL_PHUB_WRITE_REG, &req);

return 0;
}

into another function that does the same thing but
without knowing anything about the registers:

/* the same function on the abstract interface */
int phub_do_this_new(int phub_fd, unsigned long arg)
{
return ioctl(phub_fd, IOCTL_PHUB_DO_THIS, &arg);
}

Arnd


\
 
 \ /
  Last update: 2010-06-08 11:33    [W:0.040 / U:0.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site