Re: [PATCH] check_region deprecated (maybe a nicer solution?)

On 10/03/05 02:14, Frank Mori Hess wrote:
>>>From: Ian Abbott <abbotti_at_mev.co.uk>
>>>Date: 2005/03/08 Tue AM 08:15:52 CST
>>>To: comedi_at_comedi.org
>>>Subject: [PATCH] check_region deprecated (maybe a nicer solution?)
>>>
>>>Hi,
>>>
>>>Those warnings about check_region being deprecated when compiling the
>>>comedi drivers for 2.6.x are starting to get to me :-)
>>>
>>>The attached patch defines a REQUEST_REGION() macro to act as a
>>>replacement for the check_region()/request_region() pairs.  I stuck it
>>>in the linux/ioport.h compatibility header (cf. the REMAP_PAGE_RANGE()
>>>macro in the linux/mm.h compatibility header).
>>>
>>>As this is a matter of style, maybe someone has opinions on a nicer
>>>way to do this, perhaps by defining a comedi_request_region() inline
>>>function somewhere, or perhaps by avoiding the gcc extention I used.
>>>
>>>I haven't changed any drivers yet (except one driver on my local
>>>system for test purposes).  No point doing that until the name of the
>>>new macro or function is settled.
> 
> 
> It's fine, but I'd make REQUEST_REGION() a static inline function instead 
> of using _start and _n to add pass-by-value and type checking to a macro.

I just defined _start and _n to avoid expanding the macro parameters 
more than once in case of side effects (an old GCC trick), but yes, a 
static inline function would be neater.  Using upper case for a function 
breaks naming conventions though.  Any suggestions?  I suggested 
'comedi_request_region()' earlier, but a function with that name should 
probably go in comedidev.h.  Are LINUX_VERSION_CODE checks allowed in 
comedidev.h?

-- 
-=( Ian Abbott _at_ MEV Ltd.    E-mail: <abbotti_at_mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

Received on 2005-03-15Z17:01:46