Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364150
b: refs/heads/master
c: 2f69915
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Apr 17, 2013
1 parent e006bf1 commit d77f6cf
Show file tree
Hide file tree
Showing 31 changed files with 51 additions and 155 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f4362867e047a254b745741d09fa68a583f50499
refs/heads/master: 2f69915c728c3be41e12dbbbdd4eeb8d3388d58c
2 changes: 2 additions & 0 deletions trunk/drivers/staging/comedi/comedidev.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset,

int comedi_alloc_subdevices(struct comedi_device *, int);

void comedi_spriv_free(struct comedi_device *, int subdev_num);

int __comedi_request_region(struct comedi_device *,
unsigned long start, unsigned long len);
int comedi_request_region(struct comedi_device *,
Expand Down
12 changes: 12 additions & 0 deletions trunk/drivers/staging/comedi/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices)
}
EXPORT_SYMBOL_GPL(comedi_alloc_subdevices);

void comedi_spriv_free(struct comedi_device *dev, int subdev_num)
{
struct comedi_subdevice *s;

if (dev->subdevices && subdev_num < dev->n_subdevices) {
s = &dev->subdevices[subdev_num];
kfree(s->private);
s->private = NULL;
}
}
EXPORT_SYMBOL_GPL(comedi_spriv_free);

static void cleanup_device(struct comedi_device *dev)
{
int i;
Expand Down
8 changes: 1 addition & 7 deletions trunk/drivers/staging/comedi/drivers/8255.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,6 @@ int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s,
}
EXPORT_SYMBOL_GPL(subdev_8255_init_irq);

void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice *s)
{
kfree(s->private);
}
EXPORT_SYMBOL_GPL(subdev_8255_cleanup);

/*
Start of the 8255 standalone device
Expand Down Expand Up @@ -397,7 +391,7 @@ static void dev_8255_detach(struct comedi_device *dev)
spriv = s->private;
release_region(spriv->iobase, _8255_SIZE);
}
subdev_8255_cleanup(dev, s);
comedi_spriv_free(dev, i);
}
}

Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/staging/comedi/drivers/8255.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s,
int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s,
int (*io) (int, int, int, unsigned long),
unsigned long iobase);
void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice *s);
void subdev_8255_interrupt(struct comedi_device *dev,
struct comedi_subdevice *s);

Expand Down
14 changes: 3 additions & 11 deletions trunk/drivers/staging/comedi/drivers/8255_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,20 +241,12 @@ static int pci_8255_auto_attach(struct comedi_device *dev,

static void pci_8255_detach(struct comedi_device *dev)
{
const struct pci_8255_boardinfo *board = comedi_board(dev);
struct pci_8255_private *devpriv = dev->private;
struct comedi_subdevice *s;
int i;

if (!board || !devpriv)
return;
if (dev->subdevices) {
for (i = 0; i < board->n_8255; i++) {
s = &dev->subdevices[i];
subdev_8255_cleanup(dev, s);
}
}
if (devpriv->mmio_base)
for (i = 0; i < dev->n_subdevices; i++)
comedi_spriv_free(dev, i);
if (devpriv && devpriv->mmio_base)
iounmap(devpriv->mmio_base);
comedi_pci_disable(dev);
}
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/addi_apci_1516.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ static void apci1516_detach(struct comedi_device *dev)
{
if (dev->iobase)
apci1516_reset(dev);
if (dev->subdevices)
addi_watchdog_cleanup(&dev->subdevices[2]);
comedi_spriv_free(dev, 2);
comedi_pci_disable(dev);
}

Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/addi_apci_2032.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,7 @@ static void apci2032_detach(struct comedi_device *dev)
free_irq(dev->irq, dev);
if (dev->read_subdev)
kfree(dev->read_subdev->private);
if (dev->subdevices)
addi_watchdog_cleanup(&dev->subdevices[1]);
comedi_spriv_free(dev, 1);
comedi_pci_disable(dev);
}

Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/addi_apci_2200.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ static void apci2200_detach(struct comedi_device *dev)
{
if (dev->iobase)
apci2200_reset(dev);
if (dev->subdevices)
addi_watchdog_cleanup(&dev->subdevices[2]);
comedi_spriv_free(dev, 2);
comedi_pci_disable(dev);
}

Expand Down
6 changes: 0 additions & 6 deletions trunk/drivers/staging/comedi/drivers/addi_watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,6 @@ int addi_watchdog_init(struct comedi_subdevice *s, unsigned long iobase)
}
EXPORT_SYMBOL_GPL(addi_watchdog_init);

void addi_watchdog_cleanup(struct comedi_subdevice *s)
{
kfree(s->private);
}
EXPORT_SYMBOL_GPL(addi_watchdog_cleanup);

static int __init addi_watchdog_module_init(void)
{
return 0;
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/staging/comedi/drivers/addi_watchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@

void addi_watchdog_reset(unsigned long iobase);
int addi_watchdog_init(struct comedi_subdevice *, unsigned long iobase);
void addi_watchdog_cleanup(struct comedi_subdevice *s);

#endif
12 changes: 5 additions & 7 deletions trunk/drivers/staging/comedi/drivers/adv_pci_dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,13 +1180,11 @@ static void pci_dio_detach(struct comedi_device *dev)
if (devpriv->valid)
pci_dio_reset(dev);
}
if (dev->subdevices) {
for (i = 0; i < dev->n_subdevices; i++) {
s = &dev->subdevices[i];
if (s->type == COMEDI_SUBD_DIO)
subdev_8255_cleanup(dev, s);
s->private = NULL;
}
for (i = 0; i < dev->n_subdevices; i++) {
s = &dev->subdevices[i];
if (s->type == COMEDI_SUBD_DIO)
comedi_spriv_free(dev, i);
s->private = NULL; /* some private data is static */
}
comedi_pci_disable(dev);
}
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/aio_aio12_8.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev,

static void aio_aio12_8_detach(struct comedi_device *dev)
{
if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[2]);
comedi_spriv_free(dev, 2);
if (dev->iobase)
release_region(dev->iobase, 24);
}
Expand Down
51 changes: 1 addition & 50 deletions trunk/drivers/staging/comedi/drivers/amplc_dio200_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,17 +594,6 @@ dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s,
return 0;
}

/*
* This function cleans up an 'INTERRUPT' subdevice.
*/
static void
dio200_subdev_intr_cleanup(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct dio200_subdev_intr *subpriv = s->private;
kfree(subpriv);
}

/*
* Interrupt service routine.
*/
Expand Down Expand Up @@ -937,17 +926,6 @@ dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
return 0;
}

/*
* This function cleans up an '8254' counter subdevice.
*/
static void
dio200_subdev_8254_cleanup(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct dio200_subdev_intr *subpriv = s->private;
kfree(subpriv);
}

/*
* This function sets I/O directions for an '8255' DIO subdevice.
*/
Expand Down Expand Up @@ -1064,17 +1042,6 @@ static int dio200_subdev_8255_init(struct comedi_device *dev,
return 0;
}

/*
* This function cleans up an '8255' DIO subdevice.
*/
static void dio200_subdev_8255_cleanup(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct dio200_subdev_8255 *subpriv = s->private;

kfree(subpriv);
}

/*
* Handle 'insn_read' for a timer subdevice.
*/
Expand Down Expand Up @@ -1178,15 +1145,6 @@ static int dio200_subdev_timer_init(struct comedi_device *dev,
return 0;
}

/*
* This function cleans up a timer subdevice.
*/
static void dio200_subdev_timer_cleanup(struct comedi_device *dev,
struct comedi_subdevice *s)
{
/* Nothing to do. */
}

void amplc_dio200_set_enhance(struct comedi_device *dev, unsigned char val)
{
dio200_write8(dev, DIO200_ENHANCE, val);
Expand Down Expand Up @@ -1282,20 +1240,13 @@ void amplc_dio200_common_detach(struct comedi_device *dev)
if (dev->subdevices) {
layout = dio200_board_layout(thisboard);
for (n = 0; n < dev->n_subdevices; n++) {
struct comedi_subdevice *s = &dev->subdevices[n];
switch (layout->sdtype[n]) {
case sd_8254:
dio200_subdev_8254_cleanup(dev, s);
break;
case sd_8255:
dio200_subdev_8255_cleanup(dev, s);
break;
case sd_intr:
dio200_subdev_intr_cleanup(dev, s);
comedi_spriv_free(dev, n);
break;
case sd_timer:
dio200_subdev_timer_cleanup(dev, s);
break;
default:
break;
}
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/amplc_pc236.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,7 @@ static void pc236_detach(struct comedi_device *dev)
pc236_intr_disable(dev);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[0]);
comedi_spriv_free(dev, 0);
if (is_isa_board(thisboard)) {
if (dev->iobase)
release_region(dev->iobase, PC236_IO_SIZE);
Expand Down
4 changes: 1 addition & 3 deletions trunk/drivers/staging/comedi/drivers/amplc_pci230.c
Original file line number Diff line number Diff line change
Expand Up @@ -2832,11 +2832,9 @@ static int pci230_auto_attach(struct comedi_device *dev,

static void pci230_detach(struct comedi_device *dev)
{
const struct pci230_board *thisboard = comedi_board(dev);
struct pci_dev *pcidev = comedi_to_pci_dev(dev);

if (dev->subdevices && thisboard->have_dio)
subdev_8255_cleanup(dev, &dev->subdevices[2]);
comedi_spriv_free(dev, 2);
if (dev->irq)
free_irq(dev->irq, dev);
comedi_pci_disable(dev);
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/cb_pcidas.c
Original file line number Diff line number Diff line change
Expand Up @@ -1608,8 +1608,7 @@ static void cb_pcidas_detach(struct comedi_device *dev)
}
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[2]);
comedi_spriv_free(dev, 2);
comedi_pci_disable(dev);
}

Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/cb_pcidas64.c
Original file line number Diff line number Diff line change
Expand Up @@ -4163,8 +4163,7 @@ static void detach(struct comedi_device *dev)
devpriv->ao_dma_desc_bus_addr);
}
}
if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[4]);
comedi_spriv_free(dev, 4);
comedi_pci_disable(dev);
}

Expand Down
6 changes: 2 additions & 4 deletions trunk/drivers/staging/comedi/drivers/cb_pcidda.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,8 @@ static int cb_pcidda_auto_attach(struct comedi_device *dev,

static void cb_pcidda_detach(struct comedi_device *dev)
{
if (dev->subdevices) {
subdev_8255_cleanup(dev, &dev->subdevices[1]);
subdev_8255_cleanup(dev, &dev->subdevices[2]);
}
comedi_spriv_free(dev, 1);
comedi_spriv_free(dev, 2);
comedi_pci_disable(dev);
}

Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/cb_pcimdda.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ static int cb_pcimdda_auto_attach(struct comedi_device *dev,

static void cb_pcimdda_detach(struct comedi_device *dev)
{
if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[1]);
comedi_spriv_free(dev, 1);
comedi_pci_disable(dev);
}

Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/daqboard2000.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,7 @@ static void daqboard2000_detach(struct comedi_device *dev)
{
struct daqboard2000_private *devpriv = dev->private;

if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[2]);
comedi_spriv_free(dev, 2);
if (dev->irq)
free_irq(dev->irq, dev);
if (devpriv) {
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/das08.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,7 @@ EXPORT_SYMBOL_GPL(das08_common_attach);

void das08_common_detach(struct comedi_device *dev)
{
if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[4]);
comedi_spriv_free(dev, 4);
}
EXPORT_SYMBOL_GPL(das08_common_detach);

Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/das16.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,8 +1339,7 @@ static void das16_detach(struct comedi_device *dev)
struct das16_private_struct *devpriv = dev->private;

das16_reset(dev);
if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[4]);
comedi_spriv_free(dev, 4);
if (devpriv) {
int i;
for (i = 0; i < 2; i++) {
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/staging/comedi/drivers/das16m1.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,7 @@ static int das16m1_attach(struct comedi_device *dev,

static void das16m1_detach(struct comedi_device *dev)
{
if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[3]);
comedi_spriv_free(dev, 3);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase) {
Expand Down
11 changes: 3 additions & 8 deletions trunk/drivers/staging/comedi/drivers/ni_65xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ static int ni_65xx_auto_attach(struct comedi_device *dev,
static void ni_65xx_detach(struct comedi_device *dev)
{
struct ni_65xx_private *devpriv = dev->private;
int i;

if (devpriv && devpriv->mite && devpriv->mite->daq_io_addr) {
writeb(0x00,
Expand All @@ -738,15 +739,9 @@ static void ni_65xx_detach(struct comedi_device *dev)
}
if (dev->irq)
free_irq(dev->irq, dev);
for (i = 0; i < dev->n_subdevices; ++i)
comedi_spriv_free(dev, i);
if (devpriv) {
struct comedi_subdevice *s;
unsigned i;

for (i = 0; i < dev->n_subdevices; ++i) {
s = &dev->subdevices[i];
kfree(s->private);
s->private = NULL;
}
if (devpriv->mite) {
mite_unsetup(devpriv->mite);
mite_free(devpriv->mite);
Expand Down
Loading

0 comments on commit d77f6cf

Please sign in to comment.