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

Commit 5d293d90 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

staging: comedi: usbdux: remove 'interface' from private data



This back pointer is only used for a couple dev_printk() messages and
during the detach.

For the dev_printk() we can use the dev->class_dev. In the detach we
can get the usb_interface from the comedi_device.

Do that and remove the back pointer from the private data.

Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cc8cb3da
Loading
Loading
Loading
Loading
+6 −11
Original line number Original line Diff line number Diff line
@@ -227,8 +227,6 @@ struct usbdux_private {
	int16_t *out_buffer;
	int16_t *out_buffer;
	/* interface number */
	/* interface number */
	int ifnum;
	int ifnum;
	/* interface structure in 2.6 */
	struct usb_interface *interface;
	/* is it USB_SPEED_HIGH or not? */
	/* is it USB_SPEED_HIGH or not? */
	short int high_speed;
	short int high_speed;
	/* asynchronous command is running */
	/* asynchronous command is running */
@@ -634,7 +632,7 @@ static int usbdux_firmware_upload(struct comedi_device *dev,
		return 0;
		return 0;


	if (size > FIRMWARE_MAX_LEN) {
	if (size > FIRMWARE_MAX_LEN) {
		dev_err(&usbduxsub->interface->dev,
		dev_err(dev->class_dev,
			"usbdux firmware binary it too large for FX2.\n");
			"usbdux firmware binary it too large for FX2.\n");
		return -ENOMEM;
		return -ENOMEM;
	}
	}
@@ -660,8 +658,7 @@ static int usbdux_firmware_upload(struct comedi_device *dev,
			      tmp, 1,
			      tmp, 1,
			      BULK_TIMEOUT);
			      BULK_TIMEOUT);
	if (ret < 0) {
	if (ret < 0) {
		dev_err(&usbduxsub->interface->dev,
		dev_err(dev->class_dev, "can not stop firmware\n");
			"comedi_: can not stop firmware\n");
		goto done;
		goto done;
	}
	}


@@ -673,8 +670,7 @@ static int usbdux_firmware_upload(struct comedi_device *dev,
			      buf, size,
			      buf, size,
			      BULK_TIMEOUT);
			      BULK_TIMEOUT);
	if (ret < 0) {
	if (ret < 0) {
		dev_err(&usbduxsub->interface->dev,
		dev_err(dev->class_dev, "firmware upload failed\n");
			"comedi_: firmware upload failed\n");
		goto done;
		goto done;
	}
	}


@@ -687,8 +683,7 @@ static int usbdux_firmware_upload(struct comedi_device *dev,
			      tmp, 1,
			      tmp, 1,
			      BULK_TIMEOUT);
			      BULK_TIMEOUT);
	if (ret < 0)
	if (ret < 0)
		dev_err(&usbduxsub->interface->dev,
		dev_err(dev->class_dev, "can not start firmware\n");
			"comedi_: can not start firmware\n");


done:
done:
	kfree(tmp);
	kfree(tmp);
@@ -1902,7 +1897,6 @@ static int usbdux_auto_attach(struct comedi_device *dev,
	sema_init(&devpriv->sem, 1);
	sema_init(&devpriv->sem, 1);


	devpriv->usbdev = usb;
	devpriv->usbdev = usb;
	devpriv->interface = intf;
	devpriv->ifnum = intf->altsetting->desc.bInterfaceNumber;
	devpriv->ifnum = intf->altsetting->desc.bInterfaceNumber;
	usb_set_intfdata(intf, devpriv);
	usb_set_intfdata(intf, devpriv);


@@ -2005,12 +1999,13 @@ static int usbdux_auto_attach(struct comedi_device *dev,


static void usbdux_detach(struct comedi_device *dev)
static void usbdux_detach(struct comedi_device *dev)
{
{
	struct usb_interface *intf = comedi_to_usb_interface(dev);
	struct usbdux_private *devpriv = dev->private;
	struct usbdux_private *devpriv = dev->private;


	if (devpriv) {
	if (devpriv) {
		down(&devpriv->sem);
		down(&devpriv->sem);


		usb_set_intfdata(devpriv->interface, NULL);
		usb_set_intfdata(intf, NULL);


		if (devpriv->pwm_cmd_running)
		if (devpriv->pwm_cmd_running)
			usbduxsub_unlink_pwm_urbs(devpriv);
			usbduxsub_unlink_pwm_urbs(devpriv);