[PATCH] staging: comedi: remove duplicate pointer assignments in attach functions

Hartley Sweeten HartleyS at visionengravers.com
Mon Apr 28 22:36:13 UTC 2014


On Saturday, April 26, 2014 7:04 AM, Christian Engelmayer wrote:
> Some board pointer are assigned twice via comedi_board() in the comedi low
> level driver attach functions. Remove the duplicate assignment from the
> variable definition where the pointer is not used anyway until assigned later
> in the function when dev->board_ptr, that comedi_board() relies on, is setup
> correctly.
>
> Signed-off-by: Christian Engelmayer <cengelma at gmx.at>
> ---
> Compile tested and applies against v3.15-rc2 as well as branch staging-next
> of tree git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
> ---
>  drivers/staging/comedi/drivers/das1800.c     | 2 +-
>  drivers/staging/comedi/drivers/das800.c      | 2 +-
>  drivers/staging/comedi/drivers/dt2801.c      | 2 +-
>  drivers/staging/comedi/drivers/ni_at_a2150.c | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)

Technically, these drivers are fine as-is.

They are all legacy comedi drivers and use the manual attach mechanism. The
dev->board pointer is setup by the comedi core before calling the drivers
(*attach) so the foo = comedi_board(dev) is getting the board pointer that
was found by the core.

Unlike most comedi legacy drivers, these drivers then do an additional "probe"
to try and identify the board. This could result in the dev->board_ptr getting
changed which requires updating the local variable for the board pointer.

These probe functions need to be looked at to see if they are actually needed.

For now I would prefer that the existing code stay as-is.

Regards,
Hartley



More information about the devel mailing list