Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: refactoring



Andrew de Quincey wrote:

[snip]


the ioctl wrapper is only implemented
once for all drivers (the demod code could communicate with the frontend
infrastructure via a thin function-pointer-in-struct interface).

Interesting idea this one - this is the sort of thing I'm trying to sort out with the refactoring.


I see it as:

struct dvb_fe_functions {

int (*set_symbol_rate)(....)
....
};

Then each frontend driver exposes its implementation of that function (if it has one):

extern int stv0299_set_symbol_rate(...);

why not:

extern struct dvb_fe_functions stv0299_functions;

and in stv0299.c:

struct dvb_fe_functions stv0299_functions {
   int (*init)(....);
   int (*set_parameters)(....);
   int (*get_parameters)(....);
   int (*set_voltage)(....);
   int (*sleep)(....)
/* ... */
};

This way only a single pointer needs to get passed around.

When attaching the frontend, the card driver just picks the functions it wants from the demod implementation - it can supply its own implementation if it needs to. Much neater than a clunky ioctl_override() function.

yes...

Holger





Home | Main Index | Thread Index