Subject: Re: Console polling programming interface change (proposal)
To: =?X-UNKNOWN?Q?Jarom=EDr_Dolecek?= <jdolecek@netbsd.org>
From: Bill Studenmund <wrstuden@zembu.com>
List: tech-kern
Date: 07/19/2001 10:48:37
On Thu, 19 Jul 2001, Jarom=EDr Dolecek wrote:

> Hi,
> to properly address quirks necessary for some weird hw, I'd like
> to be able to pass to/from cnpollc() a cookie value. It's necessary
> to change driver interface in order to support this.
>=20
> I propose these interface changes:
> * individual drivers' entry points would change to
>   int (*cnpollc)(dev_t dev, int on, int cookie)
>   i.e. handler would be function returning int, and taking one extra 'int=
'
>   argument
>   The handler is supposed to return cookie value for 'on' call (the 'cook=
ie'
>   arg would be ingnored in that case), and accept cookie value as the 3rd=
 arg
>   for 'off' call (return value would be always zero in this case)
> * current cnpollc() functionality would be split to two functions -
> =09  int cnpollc(void)
> =09  void cnunpollc(int cookie)=20
>   cnpollc() would switch to polling mode and return cookie returned by
>   driver, cnunpollc() would switch back to interrupt driven mode; the arg=
ument
>   is supposed to be the cookie previously returned by cnpollc().
>=20
> Opinions? I'd like to keep single driver console switch entry points
> for both 'on' and 'off'.

I gather right now it's 'void (*cnpollc)(dev_t dev, int on)' ? Another
option is:

void (*cnpollc)(dev_t dev, int on, int *cookie)

Then the caller doesn't have to do anything special about passing the
cookie in or out.

Take care,

Bill