Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f41ad667 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman
Browse files

staging: comedi: change device used in dev_...() calls



A previous set of patches by Ravishankar Karkala Mallikarjunayya
replaced a load of printk() calls with dev_info(), dev_err(), etc.
Unfortunately, these used the 'struct device *hw_dev' member of 'struct
comedi_device') as the first parameter of these dev_...() calls, but
that pointer is usually NULL, so the kernel log messages come out a bit
wrong (they contain the phrase "(NULL device *)").

Use the 'struct device *class_dev' member of 'struct comedi_device'
instead for these dev_...() calls.  It will be non-NULL and somewhat
meaningful to users.  It's also consistent with those comedi drivers
that already use the class_dev member in their dev_...() calls.

Some of the messages included the format "comedi%d" with the minor
device number used for the "%d".  This is now redundant as it will be
the same as the dev_name() part of the kernel log message produced by
the dev_...() calls.

Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4ea418b8
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -1347,7 +1347,7 @@ static int pci1710_attach(struct comedi_device *dev,
	int i;
	int board_index;

	dev_info(dev->hw_dev, "comedi%d: adv_pci1710:\n", dev->minor);
	dev_info(dev->class_dev, DRV_NAME ": attach\n");

	opt_bus = it->options[0];
	opt_slot = it->options[1];
@@ -1399,10 +1399,10 @@ static int pci1710_attach(struct comedi_device *dev,

	if (!pcidev) {
		if (opt_bus || opt_slot) {
			dev_err(dev->hw_dev, "- Card at b:s %d:%d %s\n",
			dev_err(dev->class_dev, "- Card at b:s %d:%d %s\n",
				opt_bus, opt_slot, errstr);
		} else {
			dev_err(dev->hw_dev, "- Card %s\n", errstr);
			dev_err(dev->class_dev, "- Card %s\n", errstr);
		}
		return -EIO;
	}
@@ -1413,8 +1413,8 @@ static int pci1710_attach(struct comedi_device *dev,
	irq = pcidev->irq;
	iobase = pci_resource_start(pcidev, 2);

	dev_dbg(dev->hw_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n", pci_bus, pci_slot,
		pci_func, iobase);
	dev_dbg(dev->class_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n",
		pci_bus, pci_slot, pci_func, iobase);

	dev->iobase = iobase;

@@ -1444,14 +1444,15 @@ static int pci1710_attach(struct comedi_device *dev,
			if (request_irq(irq, interrupt_service_pci1710,
					IRQF_SHARED, "Advantech PCI-1710",
					dev)) {
				dev_dbg(dev->hw_dev, "unable to allocate IRQ %d, DISABLING IT",
				dev_dbg(dev->class_dev,
					"unable to allocate IRQ %d, DISABLING IT",
					irq);
				irq = 0;	/* Can't use IRQ */
			} else {
				dev_dbg(dev->hw_dev, "irq=%u", irq);
				dev_dbg(dev->class_dev, "irq=%u", irq);
			}
		} else {
			dev_dbg(dev->hw_dev, "IRQ disabled");
			dev_dbg(dev->class_dev, "IRQ disabled");
		}
	} else {
		irq = 0;
+5 −3
Original line number Diff line number Diff line
@@ -1121,16 +1121,18 @@ static int pci_dio_attach(struct comedi_device *dev,
	}

	if (!dev->board_ptr) {
		dev_err(dev->hw_dev, "Error: Requested type of the card was not found!\n");
		dev_err(dev->class_dev,
			"Error: Requested type of the card was not found!\n");
		return -EIO;
	}

	if (comedi_pci_enable(pcidev, dev->driver->driver_name)) {
		dev_err(dev->hw_dev, "Error: Can't enable PCI device and request regions!\n");
		dev_err(dev->class_dev,
			"Error: Can't enable PCI device and request regions!\n");
		return -EIO;
	}
	iobase = pci_resource_start(pcidev, this_board->main_pci_region);
	dev_dbg(dev->hw_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n",
	dev_dbg(dev->class_dev, "b:s:f=%d:%d:%d, io=0x%4lx\n",
		pcidev->bus->number, PCI_SLOT(pcidev->devfn),
		PCI_FUNC(pcidev->devfn), iobase);

+7 −7
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ static const struct das16cs_board *das16cs_probe(struct comedi_device *dev,
			return das16cs_boards + i;
	}

	dev_dbg(dev->hw_dev, "unknown board!\n");
	dev_dbg(dev->class_dev, "unknown board!\n");

	return NULL;
}
@@ -163,18 +163,18 @@ static int das16cs_attach(struct comedi_device *dev,
	int ret;
	int i;

	dev_dbg(dev->hw_dev, "comedi%d: cb_das16_cs: attached\n", dev->minor);
	dev_dbg(dev->class_dev, "cb_das16_cs: attach\n");

	link = cur_dev;		/* XXX hack */
	if (!link)
		return -EIO;

	dev->iobase = link->resource[0]->start;
	dev_dbg(dev->hw_dev, "I/O base=0x%04lx\n", dev->iobase);
	dev_dbg(dev->class_dev, "I/O base=0x%04lx\n", dev->iobase);

	dev_dbg(dev->hw_dev, "fingerprint:\n");
	dev_dbg(dev->class_dev, "fingerprint:\n");
	for (i = 0; i < 48; i += 2)
		dev_dbg(dev->hw_dev, "%04x\n", inw(dev->iobase + i));
		dev_dbg(dev->class_dev, "%04x\n", inw(dev->iobase + i));


	ret = request_irq(link->irq, das16cs_interrupt,
@@ -184,7 +184,7 @@ static int das16cs_attach(struct comedi_device *dev,

	dev->irq = link->irq;

	dev_dbg(dev->hw_dev, "irq=%u\n", dev->irq);
	dev_dbg(dev->class_dev, "irq=%u\n", dev->irq);

	dev->board_ptr = das16cs_probe(dev, link);
	if (!dev->board_ptr)
@@ -306,7 +306,7 @@ static int das16cs_ai_rinsn(struct comedi_device *dev,
				break;
		}
		if (to == TIMEOUT) {
			dev_dbg(dev->hw_dev, "cb_das16_cs: ai timeout\n");
			dev_dbg(dev->class_dev, "cb_das16_cs: ai timeout\n");
			return -ETIME;
		}
		data[i] = (unsigned short)inw(dev->iobase + 0);
+14 −12
Original line number Diff line number Diff line
@@ -567,12 +567,13 @@ static int cb_pcidas_attach(struct comedi_device *dev,
		}
	}

	dev_err(dev->hw_dev, "No supported ComputerBoards/MeasurementComputing card found on requested position\n");
	dev_err(dev->class_dev,
		"No supported ComputerBoards/MeasurementComputing card found on requested position\n");
	return -EIO;

found:

	dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n",
	dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n",
		cb_pcidas_boards[index].name, pcidev->bus->number,
		PCI_SLOT(pcidev->devfn));

@@ -580,7 +581,8 @@ static int cb_pcidas_attach(struct comedi_device *dev,
	 * Enable PCI device and reserve I/O ports.
	 */
	if (comedi_pci_enable(pcidev, "cb_pcidas")) {
		dev_err(dev->hw_dev, "Failed to enable PCI device and request regions\n");
		dev_err(dev->class_dev,
			"Failed to enable PCI device and request regions\n");
		return -EIO;
	}
	/*
@@ -606,7 +608,7 @@ static int cb_pcidas_attach(struct comedi_device *dev,
	/*  get irq */
	if (request_irq(devpriv->pci_dev->irq, cb_pcidas_interrupt,
			IRQF_SHARED, "cb_pcidas", dev)) {
		dev_dbg(dev->hw_dev, "unable to allocate irq %d\n",
		dev_dbg(dev->class_dev, "unable to allocate irq %d\n",
			devpriv->pci_dev->irq);
		return -EINVAL;
	}
@@ -807,7 +809,7 @@ static int ai_config_calibration_source(struct comedi_device *dev,
	unsigned int source = data[1];

	if (source >= num_calibration_sources) {
		dev_err(dev->hw_dev, "invalid calibration source: %i\n",
		dev_err(dev->class_dev, "invalid calibration source: %i\n",
			source);
		return -EINVAL;
	}
@@ -1229,7 +1231,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev,
	outw(bits, devpriv->control_status + ADCMUX_CONT);

#ifdef CB_PCIDAS_DEBUG
	dev_dbg(dev->hw_dev, "comedi: sent 0x%x to adcmux control\n", bits);
	dev_dbg(dev->class_dev, "sent 0x%x to adcmux control\n", bits);
#endif

	/*  load counters */
@@ -1256,7 +1258,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev,
		devpriv->adc_fifo_bits |= INT_FHF;	/* interrupt fifo half full */
	}
#ifdef CB_PCIDAS_DEBUG
	dev_dbg(dev->hw_dev, "comedi: adc_fifo_bits are 0x%x\n",
	dev_dbg(dev->class_dev, "adc_fifo_bits are 0x%x\n",
		devpriv->adc_fifo_bits);
#endif
	/*  enable (and clear) interrupts */
@@ -1283,7 +1285,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev,
		bits |= BURSTE;
	outw(bits, devpriv->control_status + TRIG_CONTSTAT);
#ifdef CB_PCIDAS_DEBUG
	dev_dbg(dev->hw_dev, "comedi: sent 0x%x to trig control\n", bits);
	dev_dbg(dev->class_dev, "sent 0x%x to trig control\n", bits);
#endif

	return 0;
@@ -1500,7 +1502,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev,
	spin_lock_irqsave(&dev->spinlock, flags);
	devpriv->adc_fifo_bits |= DAEMIE | DAHFIE;
#ifdef CB_PCIDAS_DEBUG
	dev_dbg(dev->hw_dev, "comedi: adc_fifo_bits are 0x%x\n",
	dev_dbg(dev->class_dev, "adc_fifo_bits are 0x%x\n",
		devpriv->adc_fifo_bits);
#endif
	/*  enable and clear interrupts */
@@ -1511,7 +1513,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev,
	devpriv->ao_control_bits |= DAC_START | DACEN | DAC_EMPTY;
	outw(devpriv->ao_control_bits, devpriv->control_status + DAC_CSR);
#ifdef CB_PCIDAS_DEBUG
	dev_dbg(dev->hw_dev, "comedi: sent 0x%x to dac control\n",
	dev_dbg(dev->class_dev, "sent 0x%x to dac control\n",
		devpriv->ao_control_bits);
#endif
	spin_unlock_irqrestore(&dev->spinlock, flags);
@@ -1540,8 +1542,8 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d)

	s5933_status = inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR);
#ifdef CB_PCIDAS_DEBUG
	dev_dbg(dev->hw_dev, "intcsr 0x%x\n", s5933_status);
	dev_dbg(dev->hw_dev, "mbef 0x%x\n",
	dev_dbg(dev->class_dev, "intcsr 0x%x\n", s5933_status);
	dev_dbg(dev->class_dev, "mbef 0x%x\n",
		inl(devpriv->s5933_config + AMCC_OP_REG_MBEF));
#endif

+11 −9
Original line number Diff line number Diff line
@@ -1701,11 +1701,12 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
		return -EIO;
	}

	dev_dbg(dev->hw_dev, "Found %s on bus %i, slot %i\n", board(dev)->name,
		pcidev->bus->number, PCI_SLOT(pcidev->devfn));
	dev_dbg(dev->class_dev, "Found %s on bus %i, slot %i\n",
		board(dev)->name, pcidev->bus->number, PCI_SLOT(pcidev->devfn));

	if (comedi_pci_enable(pcidev, dev->driver->driver_name)) {
		dev_warn(dev->hw_dev, "failed to enable PCI device and request regions\n");
		dev_warn(dev->class_dev,
			 "failed to enable PCI device and request regions\n");
		return -EIO;
	}
	pci_set_master(pcidev);
@@ -1733,7 +1734,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)

	if (!priv(dev)->plx9080_iobase || !priv(dev)->main_iobase
	    || !priv(dev)->dio_counter_iobase) {
		dev_warn(dev->hw_dev, "failed to remap io memory\n");
		dev_warn(dev->class_dev, "failed to remap io memory\n");
		return -ENOMEM;
	}

@@ -1769,19 +1770,19 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)

	priv(dev)->hw_revision =
	    hw_revision(dev, readw(priv(dev)->main_iobase + HW_STATUS_REG));
	dev_dbg(dev->hw_dev, "stc hardware revision %i\n",
	dev_dbg(dev->class_dev, "stc hardware revision %i\n",
		priv(dev)->hw_revision);
	init_plx9080(dev);
	init_stc_registers(dev);
	/*  get irq */
	if (request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
			"cb_pcidas64", dev)) {
		dev_dbg(dev->hw_dev, "unable to allocate irq %u\n",
		dev_dbg(dev->class_dev, "unable to allocate irq %u\n",
			pcidev->irq);
		return -EINVAL;
	}
	dev->irq = pcidev->irq;
	dev_dbg(dev->hw_dev, "irq %u\n", dev->irq);
	dev_dbg(dev->class_dev, "irq %u\n", dev->irq);

	retval = setup_subdevices(dev);
	if (retval < 0)
@@ -2002,7 +2003,7 @@ static int ai_config_calibration_source(struct comedi_device *dev,
	else
		num_calibration_sources = 8;
	if (source >= num_calibration_sources) {
		dev_dbg(dev->hw_dev, "invalid calibration source: %i\n",
		dev_dbg(dev->class_dev, "invalid calibration source: %i\n",
			source);
		return -EINVAL;
	}
@@ -2834,7 +2835,8 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev)
		}

		if (num_samples < 0) {
			dev_err(dev->hw_dev, "cb_pcidas64: bug! num_samples < 0\n");
			dev_err(dev->class_dev,
				"cb_pcidas64: bug! num_samples < 0\n");
			break;
		}

Loading