staging: comedi: introduce 'comedi_get_board' helper function
PATCH 1/1 staging: comedi: introduce 'comedi_get_board' helper function
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.
---
With this helper removing all the 'this_board' defines in the drivers will be easier (and cleaner).
drivers/staging/comedi/comedidev.h +5 -0
@@ -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; +} +struct comedi_device_file_info {struct comedi_device *device;struct comedi_subdevice *read_subdevice;
Greg KH
maintainerQuoted 19 lines · H Hartley Sweeten
This helper function is used to fetch the
comedi_deviceboard_ptrwhich is used during the attach to pass board specific information to the comedi drivers.Signed-off-by H Hartley Sweeten <[email protected]>Cc Ian Abbott <[email protected]>Cc Mori Hess <[email protected]>Cc Greg Kroah-Hartman <[email protected]>---
With this helper removing all the '
this_board' defines in the drivers will be easier (and cleaner).drivers/staging/comedi/comedidev.h +0
-0
drivers/staging/comedi/comedidev.h struct comedi_device { · line 241
Quoted 7 lines
drivers/staging/comedi/comedidev.h +4
-0@@ -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.
How about renaming this to just be comedi_board() instead?
thanks,
greg k-h
Quoted 23 lines · Greg KH
Quoted 22 lines · H Hartley Sweeten
This helper function is used to fetch the
comedi_deviceboard_ptrwhich is used during the attach to pass board specific information to the comedi drivers.Signed-off-by H Hartley Sweeten <[email protected]>Cc Ian Abbott <[email protected]>Cc Mori Hess <[email protected]>Cc Greg Kroah-Hartman <[email protected]>---
With this helper removing all the '
this_board' defines in the drivers will be easier (and cleaner).drivers/staging/comedi/comedidev.h +0
-0@@ -235,6 +235,11 @@ struct comedi_device {void (*close) (struct comedi_device *dev); };
Quoted 7 lines
drivers/staging/comedi/comedidev.h struct comedi_device { · line 241
Quoted 4 lines
drivers/staging/comedi/comedidev.h +4
-0+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.
Quoted 1 line
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