RE: [PATCH] staging: comedi: introduce 'comedi_get_board' helperfunction

From: H Hartley Sweeten
Date: Fri Apr 27 2012 - 16:13:11 EST


On Friday, April 27, 2012 12:29 PM, Greg KH wrote:
> On Fri, Apr 27, 2012 at 11:49:48AM -0700, H Hartley Sweeten wrote:
>> This helper function is used to fetch the comedi_device board_ptr
>> which is used during the attach to pass board specific information
>> to the comedi drivers.
>>
>> Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
>> Cc: Ian Abbott <abbotti@xxxxxxxxx>
>> Cc: Mori Hess <fmhess@xxxxxxxxxxxxxxxxxxxxx>
>> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
>>
>> ---
>>
>> With this helper removing all the 'this_board' defines in the drivers
>> will be easier (and cleaner).
>>
>> diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
>> index 300fd84..53a05dd 100644
>> --- a/drivers/staging/comedi/comedidev.h
>> +++ b/drivers/staging/comedi/comedidev.h
>> @@ -235,6 +235,11 @@ struct comedi_device {
>> void (*close) (struct comedi_device *dev);
>> };
>>
>> +static inline const void *comedi_get_board(struct comedi_device *dev)
>> +{
>> + return dev->board_ptr;
>> +}
>
> "traditionally" the *get* functions increment a reference count of the
> pointer it returns, which isn't happening here.

I was trying to model it after dev_get_drvdata. But I see what you mean.

> How about renaming this to just be comedi_board() instead?

Or comedi_board_ptr... Either one works for me but I do like the shorter
name you suggested.

I'll post an updated patch shortly using the comedi_board name.

Regards,
Hartley

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/