Commit 125ca745 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull staging driver updates from Greg KH:
 "Here's the pretty small staging driver tree update for 6.14-rc1. Not
  much happened this development cycle:

   - deleted some unused ioctl code from the rtl8723bs driver

   - gpib driver cleanups and fixes

   - other tiny minor coding style fixes.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (38 commits)
  staging: gpib: Agilent usb code cleanup
  staging: gpib: Fix NULL pointer dereference in detach
  staging: gpib: Fix inadvertent negative shift
  staging: gpib: fix prefixing 0x with decimal output
  staging: gpib: Use C99 syntax and make static
  staging: gpib: Avoid plain integers as NULL pointers
  staging: gpib: Use __user for user space pointers
  staging: gpib: Use __iomem attribute for io addresses
  staging: gpib: Add missing mutex unlock in ni usb driver
  staging: gpib: Add missing mutex unlock in agilent usb driver
  staging: gpib: Modernize gpib_interface_t initialization and make static
  staging: gpib: Remove commented-out debug code
  staging: rtl8723bs: Remove ioctl interface
  staging: gpib: tnt4882: Handle gpib_register_driver() errors
  staging: gpib: pc2: Handle gpib_register_driver() errors
  staging: gpib: ni_usb: Handle gpib_register_driver() errors
  staging: gpib: lpvo_usb: Return error value from gpib_register_driver()
  staging: gpib: ines: Handle gpib_register_driver() errors
  staging: gpib: hp_82341: Handle gpib_register_driver() errors
  staging: gpib: hp_82335: Return error value from gpib_register_driver()
  ...
parents cc8b10fa 579b6f18
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <linux/init.h>
#include <linux/spi/spi.h>
#include <linux/delay.h>
#include <linux/string_choices.h>

#include "fbtft.h"

@@ -162,7 +163,7 @@ static int set_gamma(struct fbtft_par *par, u32 *curves)
static int blank(struct fbtft_par *par, bool on)
{
	fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n",
		      __func__, on ? "true" : "false");
		      __func__, str_true_false(on));
	if (on)
		write_reg(par, 0xAE);
	else
+76 −62
Original line number Diff line number Diff line
@@ -30,11 +30,8 @@ int agilent_82350b_accel_read(gpib_board_t *board, uint8_t *buffer, size_t lengt
	unsigned short event_status;
	int i, num_fifo_bytes;
	//hardware doesn't support checking for end-of-string character when using fifo
	if (tms_priv->eos_flags & REOS) {
		//pr_info("ag-rd: using tms9914 read for REOS %x EOS %x\n",tms_priv->eos_flags,
		// tms_priv->eos);
	if (tms_priv->eos_flags & REOS)
		return tms9914_read(board, tms_priv, buffer, length, end, bytes_read);
	}

	clear_bit(DEV_CLEAR_BN, &tms_priv->state);

@@ -811,15 +808,15 @@ void agilent_82350b_detach(gpib_board_t *board)
		if (a_priv->gpib_base) {
			tms9914_board_reset(tms_priv);
			if (a_priv->misc_base)
				iounmap((void *)a_priv->misc_base);
				iounmap(a_priv->misc_base);
			if (a_priv->borg_base)
				iounmap((void *)a_priv->borg_base);
				iounmap(a_priv->borg_base);
			if (a_priv->sram_base)
				iounmap((void *)a_priv->sram_base);
				iounmap(a_priv->sram_base);
			if (a_priv->gpib_base)
				iounmap((void *)a_priv->gpib_base);
				iounmap(a_priv->gpib_base);
			if (a_priv->plx_base)
				iounmap((void *)a_priv->plx_base);
				iounmap(a_priv->plx_base);
			pci_release_regions(a_priv->pci_device);
		}
		if (a_priv->pci_device)
@@ -828,58 +825,58 @@ void agilent_82350b_detach(gpib_board_t *board)
	agilent_82350b_free_private(board);
}

gpib_interface_t agilent_82350b_unaccel_interface = {
name: "agilent_82350b_unaccel",
attach : agilent_82350b_unaccel_attach,
detach : agilent_82350b_detach,
read : agilent_82350b_read,
write : agilent_82350b_write,
command : agilent_82350b_command,
request_system_control : agilent_82350b_request_system_control,
take_control : agilent_82350b_take_control,
go_to_standby : agilent_82350b_go_to_standby,
interface_clear : agilent_82350b_interface_clear,
remote_enable : agilent_82350b_remote_enable,
enable_eos : agilent_82350b_enable_eos,
disable_eos : agilent_82350b_disable_eos,
parallel_poll : agilent_82350b_parallel_poll,
parallel_poll_configure : agilent_82350b_parallel_poll_configure,
parallel_poll_response : agilent_82350b_parallel_poll_response,
local_parallel_poll_mode : NULL, // XXX
line_status : agilent_82350b_line_status,
update_status : agilent_82350b_update_status,
primary_address : agilent_82350b_primary_address,
secondary_address : agilent_82350b_secondary_address,
serial_poll_response : agilent_82350b_serial_poll_response,
t1_delay : agilent_82350b_t1_delay,
return_to_local : agilent_82350b_return_to_local,
static gpib_interface_t agilent_82350b_unaccel_interface = {
	.name = "agilent_82350b_unaccel",
	.attach = agilent_82350b_unaccel_attach,
	.detach = agilent_82350b_detach,
	.read = agilent_82350b_read,
	.write = agilent_82350b_write,
	.command = agilent_82350b_command,
	.request_system_control = agilent_82350b_request_system_control,
	.take_control = agilent_82350b_take_control,
	.go_to_standby = agilent_82350b_go_to_standby,
	.interface_clear = agilent_82350b_interface_clear,
	.remote_enable = agilent_82350b_remote_enable,
	.enable_eos = agilent_82350b_enable_eos,
	.disable_eos = agilent_82350b_disable_eos,
	.parallel_poll = agilent_82350b_parallel_poll,
	.parallel_poll_configure = agilent_82350b_parallel_poll_configure,
	.parallel_poll_response = agilent_82350b_parallel_poll_response,
	.local_parallel_poll_mode = NULL, // XXX
	.line_status = agilent_82350b_line_status,
	.update_status = agilent_82350b_update_status,
	.primary_address = agilent_82350b_primary_address,
	.secondary_address = agilent_82350b_secondary_address,
	.serial_poll_response = agilent_82350b_serial_poll_response,
	.t1_delay = agilent_82350b_t1_delay,
	.return_to_local = agilent_82350b_return_to_local,
};

gpib_interface_t agilent_82350b_interface = {
name: "agilent_82350b",
attach : agilent_82350b_accel_attach,
detach : agilent_82350b_detach,
read : agilent_82350b_accel_read,
write : agilent_82350b_accel_write,
command : agilent_82350b_command,
request_system_control : agilent_82350b_request_system_control,
take_control : agilent_82350b_take_control,
go_to_standby : agilent_82350b_go_to_standby,
interface_clear : agilent_82350b_interface_clear,
remote_enable : agilent_82350b_remote_enable,
enable_eos : agilent_82350b_enable_eos,
disable_eos : agilent_82350b_disable_eos,
parallel_poll : agilent_82350b_parallel_poll,
parallel_poll_configure : agilent_82350b_parallel_poll_configure,
parallel_poll_response : agilent_82350b_parallel_poll_response,
local_parallel_poll_mode : NULL, // XXX
line_status : agilent_82350b_line_status,
update_status : agilent_82350b_update_status,
primary_address : agilent_82350b_primary_address,
secondary_address : agilent_82350b_secondary_address,
serial_poll_response : agilent_82350b_serial_poll_response,
t1_delay : agilent_82350b_t1_delay,
return_to_local : agilent_82350b_return_to_local,
static gpib_interface_t agilent_82350b_interface = {
	.name = "agilent_82350b",
	.attach = agilent_82350b_accel_attach,
	.detach = agilent_82350b_detach,
	.read = agilent_82350b_accel_read,
	.write = agilent_82350b_accel_write,
	.command = agilent_82350b_command,
	.request_system_control = agilent_82350b_request_system_control,
	.take_control = agilent_82350b_take_control,
	.go_to_standby = agilent_82350b_go_to_standby,
	.interface_clear = agilent_82350b_interface_clear,
	.remote_enable = agilent_82350b_remote_enable,
	.enable_eos = agilent_82350b_enable_eos,
	.disable_eos = agilent_82350b_disable_eos,
	.parallel_poll = agilent_82350b_parallel_poll,
	.parallel_poll_configure = agilent_82350b_parallel_poll_configure,
	.parallel_poll_response = agilent_82350b_parallel_poll_response,
	.local_parallel_poll_mode = NULL, // XXX
	.line_status = agilent_82350b_line_status,
	.update_status = agilent_82350b_update_status,
	.primary_address = agilent_82350b_primary_address,
	.secondary_address = agilent_82350b_secondary_address,
	.serial_poll_response = agilent_82350b_serial_poll_response,
	.t1_delay = agilent_82350b_t1_delay,
	.return_to_local = agilent_82350b_return_to_local,
};

static int agilent_82350b_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
@@ -910,13 +907,30 @@ static int __init agilent_82350b_init_module(void)

	result = pci_register_driver(&agilent_82350b_pci_driver);
	if (result) {
		pr_err("agilent_82350b: pci_driver_register failed!\n");
		pr_err("agilent_82350b: pci_register_driver failed: error = %d\n", result);
		return result;
	}

	gpib_register_driver(&agilent_82350b_unaccel_interface, THIS_MODULE);
	gpib_register_driver(&agilent_82350b_interface, THIS_MODULE);
	result = gpib_register_driver(&agilent_82350b_unaccel_interface, THIS_MODULE);
	if (result) {
		pr_err("agilent_82350b: gpib_register_driver failed: error = %d\n", result);
		goto err_unaccel;
	}

	result = gpib_register_driver(&agilent_82350b_interface, THIS_MODULE);
	if (result) {
		pr_err("agilent_82350b: gpib_register_driver failed: error = %d\n", result);
		goto err_interface;
	}

	return 0;

err_interface:
	gpib_unregister_driver(&agilent_82350b_unaccel_interface);
err_unaccel:
	pci_unregister_driver(&agilent_82350b_pci_driver);

	return result;
}

static void __exit agilent_82350b_exit_module(void)
+5 −7
Original line number Diff line number Diff line
@@ -45,11 +45,11 @@ enum board_model {
struct agilent_82350b_priv {
	struct tms9914_priv tms9914_priv;
	struct pci_dev *pci_device;
	void *plx_base;	//82350a only
	void *gpib_base;
	void *sram_base;
	void *misc_base;
	void *borg_base;
	void __iomem *plx_base;	//82350a only
	void __iomem *gpib_base;
	void __iomem *sram_base;
	void __iomem *misc_base;
	void __iomem *borg_base;
	int irq;
	unsigned short card_mode_bits;
	unsigned short event_status_bits;
@@ -60,8 +60,6 @@ struct agilent_82350b_priv {
// driver name
extern const char *driver_name;

// interfaces
extern gpib_interface_t agilent_82350b_interface;
// init functions

int agilent_82350b_unaccel_attach(gpib_board_t *board, const gpib_board_config_t *config);
+80 −81
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ MODULE_DESCRIPTION("GPIB driver for Agilent 82357A/B usb adapters");

#define MAX_NUM_82357A_INTERFACES 128
static struct usb_interface *agilent_82357a_driver_interfaces[MAX_NUM_82357A_INTERFACES];
DEFINE_MUTEX(agilent_82357a_hotplug_lock); // protect board insertion and removal
static DEFINE_MUTEX(agilent_82357a_hotplug_lock); // protect board insertion and removal

static unsigned int agilent_82357a_update_status(gpib_board_t *board, unsigned int clear_mask);

@@ -1146,25 +1146,6 @@ static int agilent_82357a_setup_urbs(gpib_board_t *board)
	return retval;
}

#ifdef RESET_USB_CONFIG
static int agilent_82357a_reset_usb_configuration(gpib_board_t *board)
{
	struct agilent_82357a_priv *a_priv = board->private_data;
	struct usb_device *usb_dev = interface_to_usbdev(a_priv->bus_interface);
	struct usb_device *usb_dev;
	int retval;

	if (!a_priv->bus_interface)
		return -ENODEV;
	usb_dev = interface_to_usbdev(a_priv->bus_interface);
	retval = usb_reset_configuration(usb_dev);
	if (retval)
		dev_err(&usb_dev->dev, "%s: usb_reset_configuration() returned %i\n",
			__func__, retval);
	return retval;
}
#endif

static void agilent_82357a_cleanup_urbs(struct agilent_82357a_priv *a_priv)
{
	if (a_priv && a_priv->bus_interface) {
@@ -1175,15 +1156,23 @@ static void agilent_82357a_cleanup_urbs(struct agilent_82357a_priv *a_priv)
	}
};

static void agilent_82357a_release_urbs(struct agilent_82357a_priv *a_priv)
{
	if (a_priv) {
		usb_free_urb(a_priv->interrupt_urb);
		a_priv->interrupt_urb = NULL;
		kfree(a_priv->interrupt_buffer);
	}
}

static int agilent_82357a_allocate_private(gpib_board_t *board)
{
	struct agilent_82357a_priv *a_priv;

	board->private_data = kmalloc(sizeof(struct agilent_82357a_priv), GFP_KERNEL);
	board->private_data = kzalloc(sizeof(struct agilent_82357a_priv), GFP_KERNEL);
	if (!board->private_data)
		return -ENOMEM;
	a_priv = board->private_data;
	memset(a_priv, 0, sizeof(struct agilent_82357a_priv));
	mutex_init(&a_priv->bulk_transfer_lock);
	mutex_init(&a_priv->bulk_alloc_lock);
	mutex_init(&a_priv->control_alloc_lock);
@@ -1191,11 +1180,11 @@ static int agilent_82357a_allocate_private(gpib_board_t *board)
	return 0;
}

static void agilent_82357a_free_private(struct agilent_82357a_priv *a_priv)
static void agilent_82357a_free_private(gpib_board_t *board)
{
	usb_free_urb(a_priv->interrupt_urb);
	kfree(a_priv->interrupt_buffer);
	kfree(a_priv);
	kfree(board->private_data);
	board->private_data = NULL;

}

static int agilent_82357a_init(gpib_board_t *board)
@@ -1342,16 +1331,14 @@ static int agilent_82357a_attach(gpib_board_t *board, const gpib_board_config_t
			a_priv->bus_interface = agilent_82357a_driver_interfaces[i];
			usb_set_intfdata(agilent_82357a_driver_interfaces[i], board);
			usb_dev = interface_to_usbdev(a_priv->bus_interface);
			dev_info(&usb_dev->dev,
				 "bus %d dev num %d attached to gpib minor %d, agilent usb interface %i\n",
				 usb_dev->bus->busnum, usb_dev->devnum, board->minor, i);
			break;
		}
	}
	if (i == MAX_NUM_82357A_INTERFACES) {
		mutex_unlock(&agilent_82357a_hotplug_lock);
		pr_err("No Agilent 82357 gpib adapters found, have you loaded its firmware?\n");
		return -ENODEV;
		dev_err(board->gpib_dev,
			"No Agilent 82357 gpib adapters found, have you loaded its firmware?\n");
		retval = -ENODEV;
		goto attach_fail;
	}
	product_id = le16_to_cpu(interface_to_usbdev(a_priv->bus_interface)->descriptor.idProduct);
	switch (product_id) {
@@ -1365,20 +1352,13 @@ static int agilent_82357a_attach(gpib_board_t *board, const gpib_board_config_t
		break;
	default:
		dev_err(&usb_dev->dev, "bug, unhandled product_id in switch?\n");
		return -EIO;
	}
#ifdef RESET_USB_CONFIG
	retval = agilent_82357a_reset_usb_configuration(board);
	if (retval < 0)	{
		mutex_unlock(&agilent_82357a_hotplug_lock);
		return retval;
		retval = -EIO;
		goto attach_fail;
	}
#endif

	retval = agilent_82357a_setup_urbs(board);
	if (retval < 0)	{
		mutex_unlock(&agilent_82357a_hotplug_lock);
		return retval;
	}
	if (retval < 0)
		goto attach_fail;

	timer_setup(&a_priv->bulk_timer, agilent_82357a_timeout_handler, 0);

@@ -1387,11 +1367,19 @@ static int agilent_82357a_attach(gpib_board_t *board, const gpib_board_config_t
	retval = agilent_82357a_init(board);

	if (retval < 0)	{
		agilent_82357a_cleanup_urbs(a_priv);
		agilent_82357a_release_urbs(a_priv);
		goto attach_fail;
	}

	dev_info(&usb_dev->dev,
		 "bus %d dev num %d attached to gpib minor %d, agilent usb interface %i\n",
		 usb_dev->bus->busnum, usb_dev->devnum, board->minor, i);
	mutex_unlock(&agilent_82357a_hotplug_lock);
	return retval;
	}

	dev_info(&usb_dev->dev, "%s: attached\n", __func__);
attach_fail:
	agilent_82357a_free_private(board);
	mutex_unlock(&agilent_82357a_hotplug_lock);
	return retval;
}
@@ -1441,12 +1429,10 @@ static int agilent_82357a_go_idle(gpib_board_t *board)
static void agilent_82357a_detach(gpib_board_t *board)
{
	struct agilent_82357a_priv *a_priv;
	struct usb_device *usb_dev;

	mutex_lock(&agilent_82357a_hotplug_lock);

	a_priv = board->private_data;
	usb_dev = interface_to_usbdev(a_priv->bus_interface);
	if (a_priv) {
		if (a_priv->bus_interface) {
			agilent_82357a_go_idle(board);
@@ -1456,40 +1442,41 @@ static void agilent_82357a_detach(gpib_board_t *board)
		mutex_lock(&a_priv->bulk_alloc_lock);
		mutex_lock(&a_priv->interrupt_alloc_lock);
		agilent_82357a_cleanup_urbs(a_priv);
		agilent_82357a_free_private(a_priv);
		agilent_82357a_release_urbs(a_priv);
		agilent_82357a_free_private(board);
	}
	dev_info(&usb_dev->dev, "%s: detached\n", __func__);
	dev_info(board->gpib_dev, "%s: detached\n", __func__);
	mutex_unlock(&agilent_82357a_hotplug_lock);
}

gpib_interface_t agilent_82357a_gpib_interface = {
name: "agilent_82357a",
attach : agilent_82357a_attach,
detach : agilent_82357a_detach,
read : agilent_82357a_read,
write : agilent_82357a_write,
command : agilent_82357a_command,
take_control : agilent_82357a_take_control,
go_to_standby : agilent_82357a_go_to_standby,
request_system_control : agilent_82357a_request_system_control,
interface_clear : agilent_82357a_interface_clear,
remote_enable : agilent_82357a_remote_enable,
enable_eos : agilent_82357a_enable_eos,
disable_eos : agilent_82357a_disable_eos,
parallel_poll : agilent_82357a_parallel_poll,
parallel_poll_configure : agilent_82357a_parallel_poll_configure,
parallel_poll_response : agilent_82357a_parallel_poll_response,
local_parallel_poll_mode : NULL, // XXX
line_status : agilent_82357a_line_status,
update_status : agilent_82357a_update_status,
primary_address : agilent_82357a_primary_address,
secondary_address : agilent_82357a_secondary_address,
serial_poll_response : agilent_82357a_serial_poll_response,
serial_poll_status : agilent_82357a_serial_poll_status,
t1_delay : agilent_82357a_t1_delay,
return_to_local : agilent_82357a_return_to_local,
no_7_bit_eos : 1,
skip_check_for_command_acceptors : 1
static gpib_interface_t agilent_82357a_gpib_interface = {
	.name = "agilent_82357a",
	.attach = agilent_82357a_attach,
	.detach = agilent_82357a_detach,
	.read = agilent_82357a_read,
	.write = agilent_82357a_write,
	.command = agilent_82357a_command,
	.take_control = agilent_82357a_take_control,
	.go_to_standby = agilent_82357a_go_to_standby,
	.request_system_control = agilent_82357a_request_system_control,
	.interface_clear = agilent_82357a_interface_clear,
	.remote_enable = agilent_82357a_remote_enable,
	.enable_eos = agilent_82357a_enable_eos,
	.disable_eos = agilent_82357a_disable_eos,
	.parallel_poll = agilent_82357a_parallel_poll,
	.parallel_poll_configure = agilent_82357a_parallel_poll_configure,
	.parallel_poll_response = agilent_82357a_parallel_poll_response,
	.local_parallel_poll_mode = NULL, // XXX
	.line_status = agilent_82357a_line_status,
	.update_status = agilent_82357a_update_status,
	.primary_address = agilent_82357a_primary_address,
	.secondary_address = agilent_82357a_secondary_address,
	.serial_poll_response = agilent_82357a_serial_poll_response,
	.serial_poll_status = agilent_82357a_serial_poll_status,
	.t1_delay = agilent_82357a_t1_delay,
	.return_to_local = agilent_82357a_return_to_local,
	.no_7_bit_eos = 1,
	.skip_check_for_command_acceptors = 1
};

// Table with the USB-devices: just now only testing IDs
@@ -1691,12 +1678,24 @@ static struct usb_driver agilent_82357a_bus_driver = {
static int __init agilent_82357a_init_module(void)
{
	int i;
	int ret;

	pr_info("agilent_82357a_gpib driver loading");
	for (i = 0; i < MAX_NUM_82357A_INTERFACES; ++i)
		agilent_82357a_driver_interfaces[i] = NULL;
	usb_register(&agilent_82357a_bus_driver);
	gpib_register_driver(&agilent_82357a_gpib_interface, THIS_MODULE);

	ret = usb_register(&agilent_82357a_bus_driver);
	if (ret) {
		pr_err("agilent_82357a: usb_register failed: error = %d\n", ret);
		return ret;
	}

	ret = gpib_register_driver(&agilent_82357a_gpib_interface, THIS_MODULE);
	if (ret) {
		pr_err("agilent_82357a: gpib_register_driver failed: error = %d\n", ret);
		usb_deregister(&agilent_82357a_bus_driver);
		return ret;
	}

	return 0;
}
+326 −262

File changed.

Preview size limit exceeded, changes collapsed.

Loading