Re: [PATCH] Topcliff PHUB: Generate PacketHub driver

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Arnd Bergmann
Date: Tuesday, June 8, 2010 - 2:29 am

On Tuesday 08 June 2010, Masayuki Ohtake wrote:

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
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Topcliff PHUB: Generate PacketHub driver, Masayuki Ohtake, (Fri Jun 4, 3:16 am)
Re: [PATCH] Topcliff PHUB: Generate PacketHub driver, Masayuki Ohtake, (Mon Jun 7, 12:53 am)
Re: [PATCH] Topcliff PHUB: Generate PacketHub driver, Arnd Bergmann, (Mon Jun 7, 6:37 am)
Re: [PATCH] Topcliff PHUB: Generate PacketHub driver, Masayuki Ohtake, (Mon Jun 7, 5:15 pm)
Re: [PATCH] Topcliff PHUB: Generate PacketHub driver, Masayuki Ohtake, (Tue Jun 8, 1:48 am)
Re: [PATCH] Topcliff PHUB: Generate PacketHub driver, Arnd Bergmann, (Tue Jun 8, 2:29 am)