Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: comedi: pcmuio: tidy up pcmuio_start_intr()

Refactor this function a bit to remove the need for an extra indent
level and cleanup some of the odd line breaks.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

H Hartley Sweeten and committed by
Greg Kroah-Hartman
bf4063e6 fc5ba1bd

+25 -21
+25 -21
drivers/staging/comedi/drivers/pcmuio.c
··· 410 410 struct pcmuio_private *devpriv = dev->private; 411 411 int asic = pcmuio_subdevice_to_asic(s); 412 412 struct pcmuio_asic *chip = &devpriv->asics[asic]; 413 + struct comedi_cmd *cmd = &s->async->cmd; 414 + unsigned int bits = 0; 415 + unsigned int pol_bits = 0; 416 + int i; 413 417 414 418 if (!chip->continuous && chip->stop_count == 0) { 415 419 /* An empty acquisition! */ 416 420 s->async->events |= COMEDI_CB_EOA; 417 421 chip->active = 0; 418 422 return 1; 419 - } else { 420 - struct comedi_cmd *cmd = &s->async->cmd; 421 - unsigned bits = 0, pol_bits = 0, n; 422 - 423 - chip->enabled_mask = 0; 424 - chip->active = 1; 425 - if (cmd->chanlist) { 426 - for (n = 0; n < cmd->chanlist_len; n++) { 427 - bits |= (1U << CR_CHAN(cmd->chanlist[n])); 428 - pol_bits |= (CR_AREF(cmd->chanlist[n]) 429 - || CR_RANGE(cmd-> 430 - chanlist[n]) ? 1U : 0U) 431 - << CR_CHAN(cmd->chanlist[n]); 432 - } 433 - } 434 - bits &= ((0x1 << s->n_chan) - 1); 435 - chip->enabled_mask = bits; 436 - 437 - /* set pol and enab intrs for this subdev.. */ 438 - pcmuio_write(dev, pol_bits, asic, PCMUIO_PAGE_POL, 0); 439 - pcmuio_write(dev, bits, asic, PCMUIO_PAGE_ENAB, 0); 440 423 } 424 + 425 + chip->enabled_mask = 0; 426 + chip->active = 1; 427 + if (cmd->chanlist) { 428 + for (i = 0; i < cmd->chanlist_len; i++) { 429 + unsigned int chanspec = cmd->chanlist[i]; 430 + unsigned int chan = CR_CHAN(chanspec); 431 + unsigned int range = CR_RANGE(chanspec); 432 + unsigned int aref = CR_AREF(chanspec); 433 + 434 + bits |= (1 << chan); 435 + pol_bits |= ((aref || range) ? 1 : 0) << chan; 436 + } 437 + } 438 + bits &= ((1 << s->n_chan) - 1); 439 + chip->enabled_mask = bits; 440 + 441 + /* set pol and enab intrs for this subdev.. */ 442 + pcmuio_write(dev, pol_bits, asic, PCMUIO_PAGE_POL, 0); 443 + pcmuio_write(dev, bits, asic, PCMUIO_PAGE_ENAB, 0); 444 + 441 445 return 0; 442 446 } 443 447