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

Merge tag 'staging-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

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()
...

+1850 -2908
+2 -1
drivers/staging/fbtft/fb_ssd1351.c
··· 6 6 #include <linux/init.h> 7 7 #include <linux/spi/spi.h> 8 8 #include <linux/delay.h> 9 + #include <linux/string_choices.h> 9 10 10 11 #include "fbtft.h" 11 12 ··· 163 162 static int blank(struct fbtft_par *par, bool on) 164 163 { 165 164 fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n", 166 - __func__, on ? "true" : "false"); 165 + __func__, str_true_false(on)); 167 166 if (on) 168 167 write_reg(par, 0xAE); 169 168 else
+76 -62
drivers/staging/gpib/agilent_82350b/agilent_82350b.c
··· 30 30 unsigned short event_status; 31 31 int i, num_fifo_bytes; 32 32 //hardware doesn't support checking for end-of-string character when using fifo 33 - if (tms_priv->eos_flags & REOS) { 34 - //pr_info("ag-rd: using tms9914 read for REOS %x EOS %x\n",tms_priv->eos_flags, 35 - // tms_priv->eos); 33 + if (tms_priv->eos_flags & REOS) 36 34 return tms9914_read(board, tms_priv, buffer, length, end, bytes_read); 37 - } 38 35 39 36 clear_bit(DEV_CLEAR_BN, &tms_priv->state); 40 37 ··· 808 811 if (a_priv->gpib_base) { 809 812 tms9914_board_reset(tms_priv); 810 813 if (a_priv->misc_base) 811 - iounmap((void *)a_priv->misc_base); 814 + iounmap(a_priv->misc_base); 812 815 if (a_priv->borg_base) 813 - iounmap((void *)a_priv->borg_base); 816 + iounmap(a_priv->borg_base); 814 817 if (a_priv->sram_base) 815 - iounmap((void *)a_priv->sram_base); 818 + iounmap(a_priv->sram_base); 816 819 if (a_priv->gpib_base) 817 - iounmap((void *)a_priv->gpib_base); 820 + iounmap(a_priv->gpib_base); 818 821 if (a_priv->plx_base) 819 - iounmap((void *)a_priv->plx_base); 822 + iounmap(a_priv->plx_base); 820 823 pci_release_regions(a_priv->pci_device); 821 824 } 822 825 if (a_priv->pci_device) ··· 825 828 agilent_82350b_free_private(board); 826 829 } 827 830 828 - gpib_interface_t agilent_82350b_unaccel_interface = { 829 - name: "agilent_82350b_unaccel", 830 - attach : agilent_82350b_unaccel_attach, 831 - detach : agilent_82350b_detach, 832 - read : agilent_82350b_read, 833 - write : agilent_82350b_write, 834 - command : agilent_82350b_command, 835 - request_system_control : agilent_82350b_request_system_control, 836 - take_control : agilent_82350b_take_control, 837 - go_to_standby : agilent_82350b_go_to_standby, 838 - interface_clear : agilent_82350b_interface_clear, 839 - remote_enable : agilent_82350b_remote_enable, 840 - enable_eos : agilent_82350b_enable_eos, 841 - disable_eos : agilent_82350b_disable_eos, 842 - parallel_poll : agilent_82350b_parallel_poll, 843 - parallel_poll_configure : agilent_82350b_parallel_poll_configure, 844 - parallel_poll_response : agilent_82350b_parallel_poll_response, 845 - local_parallel_poll_mode : NULL, // XXX 846 - line_status : agilent_82350b_line_status, 847 - update_status : agilent_82350b_update_status, 848 - primary_address : agilent_82350b_primary_address, 849 - secondary_address : agilent_82350b_secondary_address, 850 - serial_poll_response : agilent_82350b_serial_poll_response, 851 - t1_delay : agilent_82350b_t1_delay, 852 - return_to_local : agilent_82350b_return_to_local, 831 + static gpib_interface_t agilent_82350b_unaccel_interface = { 832 + .name = "agilent_82350b_unaccel", 833 + .attach = agilent_82350b_unaccel_attach, 834 + .detach = agilent_82350b_detach, 835 + .read = agilent_82350b_read, 836 + .write = agilent_82350b_write, 837 + .command = agilent_82350b_command, 838 + .request_system_control = agilent_82350b_request_system_control, 839 + .take_control = agilent_82350b_take_control, 840 + .go_to_standby = agilent_82350b_go_to_standby, 841 + .interface_clear = agilent_82350b_interface_clear, 842 + .remote_enable = agilent_82350b_remote_enable, 843 + .enable_eos = agilent_82350b_enable_eos, 844 + .disable_eos = agilent_82350b_disable_eos, 845 + .parallel_poll = agilent_82350b_parallel_poll, 846 + .parallel_poll_configure = agilent_82350b_parallel_poll_configure, 847 + .parallel_poll_response = agilent_82350b_parallel_poll_response, 848 + .local_parallel_poll_mode = NULL, // XXX 849 + .line_status = agilent_82350b_line_status, 850 + .update_status = agilent_82350b_update_status, 851 + .primary_address = agilent_82350b_primary_address, 852 + .secondary_address = agilent_82350b_secondary_address, 853 + .serial_poll_response = agilent_82350b_serial_poll_response, 854 + .t1_delay = agilent_82350b_t1_delay, 855 + .return_to_local = agilent_82350b_return_to_local, 853 856 }; 854 857 855 - gpib_interface_t agilent_82350b_interface = { 856 - name: "agilent_82350b", 857 - attach : agilent_82350b_accel_attach, 858 - detach : agilent_82350b_detach, 859 - read : agilent_82350b_accel_read, 860 - write : agilent_82350b_accel_write, 861 - command : agilent_82350b_command, 862 - request_system_control : agilent_82350b_request_system_control, 863 - take_control : agilent_82350b_take_control, 864 - go_to_standby : agilent_82350b_go_to_standby, 865 - interface_clear : agilent_82350b_interface_clear, 866 - remote_enable : agilent_82350b_remote_enable, 867 - enable_eos : agilent_82350b_enable_eos, 868 - disable_eos : agilent_82350b_disable_eos, 869 - parallel_poll : agilent_82350b_parallel_poll, 870 - parallel_poll_configure : agilent_82350b_parallel_poll_configure, 871 - parallel_poll_response : agilent_82350b_parallel_poll_response, 872 - local_parallel_poll_mode : NULL, // XXX 873 - line_status : agilent_82350b_line_status, 874 - update_status : agilent_82350b_update_status, 875 - primary_address : agilent_82350b_primary_address, 876 - secondary_address : agilent_82350b_secondary_address, 877 - serial_poll_response : agilent_82350b_serial_poll_response, 878 - t1_delay : agilent_82350b_t1_delay, 879 - return_to_local : agilent_82350b_return_to_local, 858 + static gpib_interface_t agilent_82350b_interface = { 859 + .name = "agilent_82350b", 860 + .attach = agilent_82350b_accel_attach, 861 + .detach = agilent_82350b_detach, 862 + .read = agilent_82350b_accel_read, 863 + .write = agilent_82350b_accel_write, 864 + .command = agilent_82350b_command, 865 + .request_system_control = agilent_82350b_request_system_control, 866 + .take_control = agilent_82350b_take_control, 867 + .go_to_standby = agilent_82350b_go_to_standby, 868 + .interface_clear = agilent_82350b_interface_clear, 869 + .remote_enable = agilent_82350b_remote_enable, 870 + .enable_eos = agilent_82350b_enable_eos, 871 + .disable_eos = agilent_82350b_disable_eos, 872 + .parallel_poll = agilent_82350b_parallel_poll, 873 + .parallel_poll_configure = agilent_82350b_parallel_poll_configure, 874 + .parallel_poll_response = agilent_82350b_parallel_poll_response, 875 + .local_parallel_poll_mode = NULL, // XXX 876 + .line_status = agilent_82350b_line_status, 877 + .update_status = agilent_82350b_update_status, 878 + .primary_address = agilent_82350b_primary_address, 879 + .secondary_address = agilent_82350b_secondary_address, 880 + .serial_poll_response = agilent_82350b_serial_poll_response, 881 + .t1_delay = agilent_82350b_t1_delay, 882 + .return_to_local = agilent_82350b_return_to_local, 880 883 }; 881 884 882 885 static int agilent_82350b_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) ··· 907 910 908 911 result = pci_register_driver(&agilent_82350b_pci_driver); 909 912 if (result) { 910 - pr_err("agilent_82350b: pci_driver_register failed!\n"); 913 + pr_err("agilent_82350b: pci_register_driver failed: error = %d\n", result); 911 914 return result; 912 915 } 913 916 914 - gpib_register_driver(&agilent_82350b_unaccel_interface, THIS_MODULE); 915 - gpib_register_driver(&agilent_82350b_interface, THIS_MODULE); 917 + result = gpib_register_driver(&agilent_82350b_unaccel_interface, THIS_MODULE); 918 + if (result) { 919 + pr_err("agilent_82350b: gpib_register_driver failed: error = %d\n", result); 920 + goto err_unaccel; 921 + } 922 + 923 + result = gpib_register_driver(&agilent_82350b_interface, THIS_MODULE); 924 + if (result) { 925 + pr_err("agilent_82350b: gpib_register_driver failed: error = %d\n", result); 926 + goto err_interface; 927 + } 928 + 916 929 return 0; 930 + 931 + err_interface: 932 + gpib_unregister_driver(&agilent_82350b_unaccel_interface); 933 + err_unaccel: 934 + pci_unregister_driver(&agilent_82350b_pci_driver); 935 + 936 + return result; 917 937 } 918 938 919 939 static void __exit agilent_82350b_exit_module(void)
+5 -7
drivers/staging/gpib/agilent_82350b/agilent_82350b.h
··· 45 45 struct agilent_82350b_priv { 46 46 struct tms9914_priv tms9914_priv; 47 47 struct pci_dev *pci_device; 48 - void *plx_base; //82350a only 49 - void *gpib_base; 50 - void *sram_base; 51 - void *misc_base; 52 - void *borg_base; 48 + void __iomem *plx_base; //82350a only 49 + void __iomem *gpib_base; 50 + void __iomem *sram_base; 51 + void __iomem *misc_base; 52 + void __iomem *borg_base; 53 53 int irq; 54 54 unsigned short card_mode_bits; 55 55 unsigned short event_status_bits; ··· 60 60 // driver name 61 61 extern const char *driver_name; 62 62 63 - // interfaces 64 - extern gpib_interface_t agilent_82350b_interface; 65 63 // init functions 66 64 67 65 int agilent_82350b_unaccel_attach(gpib_board_t *board, const gpib_board_config_t *config);
+80 -81
drivers/staging/gpib/agilent_82357a/agilent_82357a.c
··· 19 19 20 20 #define MAX_NUM_82357A_INTERFACES 128 21 21 static struct usb_interface *agilent_82357a_driver_interfaces[MAX_NUM_82357A_INTERFACES]; 22 - DEFINE_MUTEX(agilent_82357a_hotplug_lock); // protect board insertion and removal 22 + static DEFINE_MUTEX(agilent_82357a_hotplug_lock); // protect board insertion and removal 23 23 24 24 static unsigned int agilent_82357a_update_status(gpib_board_t *board, unsigned int clear_mask); 25 25 ··· 1146 1146 return retval; 1147 1147 } 1148 1148 1149 - #ifdef RESET_USB_CONFIG 1150 - static int agilent_82357a_reset_usb_configuration(gpib_board_t *board) 1151 - { 1152 - struct agilent_82357a_priv *a_priv = board->private_data; 1153 - struct usb_device *usb_dev = interface_to_usbdev(a_priv->bus_interface); 1154 - struct usb_device *usb_dev; 1155 - int retval; 1156 - 1157 - if (!a_priv->bus_interface) 1158 - return -ENODEV; 1159 - usb_dev = interface_to_usbdev(a_priv->bus_interface); 1160 - retval = usb_reset_configuration(usb_dev); 1161 - if (retval) 1162 - dev_err(&usb_dev->dev, "%s: usb_reset_configuration() returned %i\n", 1163 - __func__, retval); 1164 - return retval; 1165 - } 1166 - #endif 1167 - 1168 1149 static void agilent_82357a_cleanup_urbs(struct agilent_82357a_priv *a_priv) 1169 1150 { 1170 1151 if (a_priv && a_priv->bus_interface) { ··· 1156 1175 } 1157 1176 }; 1158 1177 1178 + static void agilent_82357a_release_urbs(struct agilent_82357a_priv *a_priv) 1179 + { 1180 + if (a_priv) { 1181 + usb_free_urb(a_priv->interrupt_urb); 1182 + a_priv->interrupt_urb = NULL; 1183 + kfree(a_priv->interrupt_buffer); 1184 + } 1185 + } 1186 + 1159 1187 static int agilent_82357a_allocate_private(gpib_board_t *board) 1160 1188 { 1161 1189 struct agilent_82357a_priv *a_priv; 1162 1190 1163 - board->private_data = kmalloc(sizeof(struct agilent_82357a_priv), GFP_KERNEL); 1191 + board->private_data = kzalloc(sizeof(struct agilent_82357a_priv), GFP_KERNEL); 1164 1192 if (!board->private_data) 1165 1193 return -ENOMEM; 1166 1194 a_priv = board->private_data; 1167 - memset(a_priv, 0, sizeof(struct agilent_82357a_priv)); 1168 1195 mutex_init(&a_priv->bulk_transfer_lock); 1169 1196 mutex_init(&a_priv->bulk_alloc_lock); 1170 1197 mutex_init(&a_priv->control_alloc_lock); ··· 1180 1191 return 0; 1181 1192 } 1182 1193 1183 - static void agilent_82357a_free_private(struct agilent_82357a_priv *a_priv) 1194 + static void agilent_82357a_free_private(gpib_board_t *board) 1184 1195 { 1185 - usb_free_urb(a_priv->interrupt_urb); 1186 - kfree(a_priv->interrupt_buffer); 1187 - kfree(a_priv); 1196 + kfree(board->private_data); 1197 + board->private_data = NULL; 1198 + 1188 1199 } 1189 1200 1190 1201 static int agilent_82357a_init(gpib_board_t *board) ··· 1331 1342 a_priv->bus_interface = agilent_82357a_driver_interfaces[i]; 1332 1343 usb_set_intfdata(agilent_82357a_driver_interfaces[i], board); 1333 1344 usb_dev = interface_to_usbdev(a_priv->bus_interface); 1334 - dev_info(&usb_dev->dev, 1335 - "bus %d dev num %d attached to gpib minor %d, agilent usb interface %i\n", 1336 - usb_dev->bus->busnum, usb_dev->devnum, board->minor, i); 1337 1345 break; 1338 1346 } 1339 1347 } 1340 1348 if (i == MAX_NUM_82357A_INTERFACES) { 1341 - mutex_unlock(&agilent_82357a_hotplug_lock); 1342 - pr_err("No Agilent 82357 gpib adapters found, have you loaded its firmware?\n"); 1343 - return -ENODEV; 1349 + dev_err(board->gpib_dev, 1350 + "No Agilent 82357 gpib adapters found, have you loaded its firmware?\n"); 1351 + retval = -ENODEV; 1352 + goto attach_fail; 1344 1353 } 1345 1354 product_id = le16_to_cpu(interface_to_usbdev(a_priv->bus_interface)->descriptor.idProduct); 1346 1355 switch (product_id) { ··· 1352 1365 break; 1353 1366 default: 1354 1367 dev_err(&usb_dev->dev, "bug, unhandled product_id in switch?\n"); 1355 - return -EIO; 1368 + retval = -EIO; 1369 + goto attach_fail; 1356 1370 } 1357 - #ifdef RESET_USB_CONFIG 1358 - retval = agilent_82357a_reset_usb_configuration(board); 1359 - if (retval < 0) { 1360 - mutex_unlock(&agilent_82357a_hotplug_lock); 1361 - return retval; 1362 - } 1363 - #endif 1371 + 1364 1372 retval = agilent_82357a_setup_urbs(board); 1365 - if (retval < 0) { 1366 - mutex_unlock(&agilent_82357a_hotplug_lock); 1367 - return retval; 1368 - } 1373 + if (retval < 0) 1374 + goto attach_fail; 1369 1375 1370 1376 timer_setup(&a_priv->bulk_timer, agilent_82357a_timeout_handler, 0); 1371 1377 ··· 1367 1387 retval = agilent_82357a_init(board); 1368 1388 1369 1389 if (retval < 0) { 1370 - mutex_unlock(&agilent_82357a_hotplug_lock); 1371 - return retval; 1390 + agilent_82357a_cleanup_urbs(a_priv); 1391 + agilent_82357a_release_urbs(a_priv); 1392 + goto attach_fail; 1372 1393 } 1373 1394 1374 - dev_info(&usb_dev->dev, "%s: attached\n", __func__); 1395 + dev_info(&usb_dev->dev, 1396 + "bus %d dev num %d attached to gpib minor %d, agilent usb interface %i\n", 1397 + usb_dev->bus->busnum, usb_dev->devnum, board->minor, i); 1398 + mutex_unlock(&agilent_82357a_hotplug_lock); 1399 + return retval; 1400 + 1401 + attach_fail: 1402 + agilent_82357a_free_private(board); 1375 1403 mutex_unlock(&agilent_82357a_hotplug_lock); 1376 1404 return retval; 1377 1405 } ··· 1429 1441 static void agilent_82357a_detach(gpib_board_t *board) 1430 1442 { 1431 1443 struct agilent_82357a_priv *a_priv; 1432 - struct usb_device *usb_dev; 1433 1444 1434 1445 mutex_lock(&agilent_82357a_hotplug_lock); 1435 1446 1436 1447 a_priv = board->private_data; 1437 - usb_dev = interface_to_usbdev(a_priv->bus_interface); 1438 1448 if (a_priv) { 1439 1449 if (a_priv->bus_interface) { 1440 1450 agilent_82357a_go_idle(board); ··· 1442 1456 mutex_lock(&a_priv->bulk_alloc_lock); 1443 1457 mutex_lock(&a_priv->interrupt_alloc_lock); 1444 1458 agilent_82357a_cleanup_urbs(a_priv); 1445 - agilent_82357a_free_private(a_priv); 1459 + agilent_82357a_release_urbs(a_priv); 1460 + agilent_82357a_free_private(board); 1446 1461 } 1447 - dev_info(&usb_dev->dev, "%s: detached\n", __func__); 1462 + dev_info(board->gpib_dev, "%s: detached\n", __func__); 1448 1463 mutex_unlock(&agilent_82357a_hotplug_lock); 1449 1464 } 1450 1465 1451 - gpib_interface_t agilent_82357a_gpib_interface = { 1452 - name: "agilent_82357a", 1453 - attach : agilent_82357a_attach, 1454 - detach : agilent_82357a_detach, 1455 - read : agilent_82357a_read, 1456 - write : agilent_82357a_write, 1457 - command : agilent_82357a_command, 1458 - take_control : agilent_82357a_take_control, 1459 - go_to_standby : agilent_82357a_go_to_standby, 1460 - request_system_control : agilent_82357a_request_system_control, 1461 - interface_clear : agilent_82357a_interface_clear, 1462 - remote_enable : agilent_82357a_remote_enable, 1463 - enable_eos : agilent_82357a_enable_eos, 1464 - disable_eos : agilent_82357a_disable_eos, 1465 - parallel_poll : agilent_82357a_parallel_poll, 1466 - parallel_poll_configure : agilent_82357a_parallel_poll_configure, 1467 - parallel_poll_response : agilent_82357a_parallel_poll_response, 1468 - local_parallel_poll_mode : NULL, // XXX 1469 - line_status : agilent_82357a_line_status, 1470 - update_status : agilent_82357a_update_status, 1471 - primary_address : agilent_82357a_primary_address, 1472 - secondary_address : agilent_82357a_secondary_address, 1473 - serial_poll_response : agilent_82357a_serial_poll_response, 1474 - serial_poll_status : agilent_82357a_serial_poll_status, 1475 - t1_delay : agilent_82357a_t1_delay, 1476 - return_to_local : agilent_82357a_return_to_local, 1477 - no_7_bit_eos : 1, 1478 - skip_check_for_command_acceptors : 1 1466 + static gpib_interface_t agilent_82357a_gpib_interface = { 1467 + .name = "agilent_82357a", 1468 + .attach = agilent_82357a_attach, 1469 + .detach = agilent_82357a_detach, 1470 + .read = agilent_82357a_read, 1471 + .write = agilent_82357a_write, 1472 + .command = agilent_82357a_command, 1473 + .take_control = agilent_82357a_take_control, 1474 + .go_to_standby = agilent_82357a_go_to_standby, 1475 + .request_system_control = agilent_82357a_request_system_control, 1476 + .interface_clear = agilent_82357a_interface_clear, 1477 + .remote_enable = agilent_82357a_remote_enable, 1478 + .enable_eos = agilent_82357a_enable_eos, 1479 + .disable_eos = agilent_82357a_disable_eos, 1480 + .parallel_poll = agilent_82357a_parallel_poll, 1481 + .parallel_poll_configure = agilent_82357a_parallel_poll_configure, 1482 + .parallel_poll_response = agilent_82357a_parallel_poll_response, 1483 + .local_parallel_poll_mode = NULL, // XXX 1484 + .line_status = agilent_82357a_line_status, 1485 + .update_status = agilent_82357a_update_status, 1486 + .primary_address = agilent_82357a_primary_address, 1487 + .secondary_address = agilent_82357a_secondary_address, 1488 + .serial_poll_response = agilent_82357a_serial_poll_response, 1489 + .serial_poll_status = agilent_82357a_serial_poll_status, 1490 + .t1_delay = agilent_82357a_t1_delay, 1491 + .return_to_local = agilent_82357a_return_to_local, 1492 + .no_7_bit_eos = 1, 1493 + .skip_check_for_command_acceptors = 1 1479 1494 }; 1480 1495 1481 1496 // Table with the USB-devices: just now only testing IDs ··· 1678 1691 static int __init agilent_82357a_init_module(void) 1679 1692 { 1680 1693 int i; 1694 + int ret; 1681 1695 1682 1696 pr_info("agilent_82357a_gpib driver loading"); 1683 1697 for (i = 0; i < MAX_NUM_82357A_INTERFACES; ++i) 1684 1698 agilent_82357a_driver_interfaces[i] = NULL; 1685 - usb_register(&agilent_82357a_bus_driver); 1686 - gpib_register_driver(&agilent_82357a_gpib_interface, THIS_MODULE); 1699 + 1700 + ret = usb_register(&agilent_82357a_bus_driver); 1701 + if (ret) { 1702 + pr_err("agilent_82357a: usb_register failed: error = %d\n", ret); 1703 + return ret; 1704 + } 1705 + 1706 + ret = gpib_register_driver(&agilent_82357a_gpib_interface, THIS_MODULE); 1707 + if (ret) { 1708 + pr_err("agilent_82357a: gpib_register_driver failed: error = %d\n", ret); 1709 + usb_deregister(&agilent_82357a_bus_driver); 1710 + return ret; 1711 + } 1687 1712 1688 1713 return 0; 1689 1714 }
+325 -261
drivers/staging/gpib/cb7210/cb7210.c
··· 683 683 write_byte(nec_priv, AUX_RTL, AUXMR); 684 684 } 685 685 686 - gpib_interface_t cb_pci_unaccel_interface = { 687 - name: "cbi_pci_unaccel", 688 - attach : cb_pci_attach, 689 - detach : cb_pci_detach, 690 - read : cb7210_read, 691 - write : cb7210_write, 692 - command : cb7210_command, 693 - take_control : cb7210_take_control, 694 - go_to_standby : cb7210_go_to_standby, 695 - request_system_control : cb7210_request_system_control, 696 - interface_clear : cb7210_interface_clear, 697 - remote_enable : cb7210_remote_enable, 698 - enable_eos : cb7210_enable_eos, 699 - disable_eos : cb7210_disable_eos, 700 - parallel_poll : cb7210_parallel_poll, 701 - parallel_poll_configure : cb7210_parallel_poll_configure, 702 - parallel_poll_response : cb7210_parallel_poll_response, 703 - local_parallel_poll_mode : NULL, // XXX 704 - line_status : cb7210_line_status, 705 - update_status : cb7210_update_status, 706 - primary_address : cb7210_primary_address, 707 - secondary_address : cb7210_secondary_address, 708 - serial_poll_response : cb7210_serial_poll_response, 709 - serial_poll_status : cb7210_serial_poll_status, 710 - t1_delay : cb7210_t1_delay, 711 - return_to_local : cb7210_return_to_local, 686 + static gpib_interface_t cb_pci_unaccel_interface = { 687 + .name = "cbi_pci_unaccel", 688 + .attach = cb_pci_attach, 689 + .detach = cb_pci_detach, 690 + .read = cb7210_read, 691 + .write = cb7210_write, 692 + .command = cb7210_command, 693 + .take_control = cb7210_take_control, 694 + .go_to_standby = cb7210_go_to_standby, 695 + .request_system_control = cb7210_request_system_control, 696 + .interface_clear = cb7210_interface_clear, 697 + .remote_enable = cb7210_remote_enable, 698 + .enable_eos = cb7210_enable_eos, 699 + .disable_eos = cb7210_disable_eos, 700 + .parallel_poll = cb7210_parallel_poll, 701 + .parallel_poll_configure = cb7210_parallel_poll_configure, 702 + .parallel_poll_response = cb7210_parallel_poll_response, 703 + .local_parallel_poll_mode = NULL, // XXX 704 + .line_status = cb7210_line_status, 705 + .update_status = cb7210_update_status, 706 + .primary_address = cb7210_primary_address, 707 + .secondary_address = cb7210_secondary_address, 708 + .serial_poll_response = cb7210_serial_poll_response, 709 + .serial_poll_status = cb7210_serial_poll_status, 710 + .t1_delay = cb7210_t1_delay, 711 + .return_to_local = cb7210_return_to_local, 712 712 }; 713 713 714 - gpib_interface_t cb_pci_accel_interface = { 715 - name: "cbi_pci_accel", 716 - attach : cb_pci_attach, 717 - detach : cb_pci_detach, 718 - read : cb7210_accel_read, 719 - write : cb7210_accel_write, 720 - command : cb7210_command, 721 - take_control : cb7210_take_control, 722 - go_to_standby : cb7210_go_to_standby, 723 - request_system_control : cb7210_request_system_control, 724 - interface_clear : cb7210_interface_clear, 725 - remote_enable : cb7210_remote_enable, 726 - enable_eos : cb7210_enable_eos, 727 - disable_eos : cb7210_disable_eos, 728 - parallel_poll : cb7210_parallel_poll, 729 - parallel_poll_configure : cb7210_parallel_poll_configure, 730 - parallel_poll_response : cb7210_parallel_poll_response, 731 - local_parallel_poll_mode : NULL, // XXX 732 - line_status : cb7210_line_status, 733 - update_status : cb7210_update_status, 734 - primary_address : cb7210_primary_address, 735 - secondary_address : cb7210_secondary_address, 736 - serial_poll_response : cb7210_serial_poll_response, 737 - serial_poll_status : cb7210_serial_poll_status, 738 - t1_delay : cb7210_t1_delay, 739 - return_to_local : cb7210_return_to_local, 714 + static gpib_interface_t cb_pci_accel_interface = { 715 + .name = "cbi_pci_accel", 716 + .attach = cb_pci_attach, 717 + .detach = cb_pci_detach, 718 + .read = cb7210_accel_read, 719 + .write = cb7210_accel_write, 720 + .command = cb7210_command, 721 + .take_control = cb7210_take_control, 722 + .go_to_standby = cb7210_go_to_standby, 723 + .request_system_control = cb7210_request_system_control, 724 + .interface_clear = cb7210_interface_clear, 725 + .remote_enable = cb7210_remote_enable, 726 + .enable_eos = cb7210_enable_eos, 727 + .disable_eos = cb7210_disable_eos, 728 + .parallel_poll = cb7210_parallel_poll, 729 + .parallel_poll_configure = cb7210_parallel_poll_configure, 730 + .parallel_poll_response = cb7210_parallel_poll_response, 731 + .local_parallel_poll_mode = NULL, // XXX 732 + .line_status = cb7210_line_status, 733 + .update_status = cb7210_update_status, 734 + .primary_address = cb7210_primary_address, 735 + .secondary_address = cb7210_secondary_address, 736 + .serial_poll_response = cb7210_serial_poll_response, 737 + .serial_poll_status = cb7210_serial_poll_status, 738 + .t1_delay = cb7210_t1_delay, 739 + .return_to_local = cb7210_return_to_local, 740 740 }; 741 741 742 - gpib_interface_t cb_pci_interface = { 743 - name: "cbi_pci", 744 - attach : cb_pci_attach, 745 - detach : cb_pci_detach, 746 - read : cb7210_accel_read, 747 - write : cb7210_accel_write, 748 - command : cb7210_command, 749 - take_control : cb7210_take_control, 750 - go_to_standby : cb7210_go_to_standby, 751 - request_system_control : cb7210_request_system_control, 752 - interface_clear : cb7210_interface_clear, 753 - remote_enable : cb7210_remote_enable, 754 - enable_eos : cb7210_enable_eos, 755 - disable_eos : cb7210_disable_eos, 756 - parallel_poll : cb7210_parallel_poll, 757 - parallel_poll_configure : cb7210_parallel_poll_configure, 758 - parallel_poll_response : cb7210_parallel_poll_response, 759 - line_status : cb7210_line_status, 760 - update_status : cb7210_update_status, 761 - primary_address : cb7210_primary_address, 762 - secondary_address : cb7210_secondary_address, 763 - serial_poll_response : cb7210_serial_poll_response, 764 - serial_poll_status : cb7210_serial_poll_status, 765 - t1_delay : cb7210_t1_delay, 766 - return_to_local : cb7210_return_to_local, 742 + static gpib_interface_t cb_pci_interface = { 743 + .name = "cbi_pci", 744 + .attach = cb_pci_attach, 745 + .detach = cb_pci_detach, 746 + .read = cb7210_accel_read, 747 + .write = cb7210_accel_write, 748 + .command = cb7210_command, 749 + .take_control = cb7210_take_control, 750 + .go_to_standby = cb7210_go_to_standby, 751 + .request_system_control = cb7210_request_system_control, 752 + .interface_clear = cb7210_interface_clear, 753 + .remote_enable = cb7210_remote_enable, 754 + .enable_eos = cb7210_enable_eos, 755 + .disable_eos = cb7210_disable_eos, 756 + .parallel_poll = cb7210_parallel_poll, 757 + .parallel_poll_configure = cb7210_parallel_poll_configure, 758 + .parallel_poll_response = cb7210_parallel_poll_response, 759 + .line_status = cb7210_line_status, 760 + .update_status = cb7210_update_status, 761 + .primary_address = cb7210_primary_address, 762 + .secondary_address = cb7210_secondary_address, 763 + .serial_poll_response = cb7210_serial_poll_response, 764 + .serial_poll_status = cb7210_serial_poll_status, 765 + .t1_delay = cb7210_t1_delay, 766 + .return_to_local = cb7210_return_to_local, 767 767 }; 768 768 769 - gpib_interface_t cb_isa_unaccel_interface = { 770 - name: "cbi_isa_unaccel", 771 - attach : cb_isa_attach, 772 - detach : cb_isa_detach, 773 - read : cb7210_read, 774 - write : cb7210_write, 775 - command : cb7210_command, 776 - take_control : cb7210_take_control, 777 - go_to_standby : cb7210_go_to_standby, 778 - request_system_control : cb7210_request_system_control, 779 - interface_clear : cb7210_interface_clear, 780 - remote_enable : cb7210_remote_enable, 781 - enable_eos : cb7210_enable_eos, 782 - disable_eos : cb7210_disable_eos, 783 - parallel_poll : cb7210_parallel_poll, 784 - parallel_poll_configure : cb7210_parallel_poll_configure, 785 - parallel_poll_response : cb7210_parallel_poll_response, 786 - local_parallel_poll_mode : NULL, // XXX 787 - line_status : cb7210_line_status, 788 - update_status : cb7210_update_status, 789 - primary_address : cb7210_primary_address, 790 - secondary_address : cb7210_secondary_address, 791 - serial_poll_response : cb7210_serial_poll_response, 792 - serial_poll_status : cb7210_serial_poll_status, 793 - t1_delay : cb7210_t1_delay, 794 - return_to_local : cb7210_return_to_local, 769 + static gpib_interface_t cb_isa_unaccel_interface = { 770 + .name = "cbi_isa_unaccel", 771 + .attach = cb_isa_attach, 772 + .detach = cb_isa_detach, 773 + .read = cb7210_read, 774 + .write = cb7210_write, 775 + .command = cb7210_command, 776 + .take_control = cb7210_take_control, 777 + .go_to_standby = cb7210_go_to_standby, 778 + .request_system_control = cb7210_request_system_control, 779 + .interface_clear = cb7210_interface_clear, 780 + .remote_enable = cb7210_remote_enable, 781 + .enable_eos = cb7210_enable_eos, 782 + .disable_eos = cb7210_disable_eos, 783 + .parallel_poll = cb7210_parallel_poll, 784 + .parallel_poll_configure = cb7210_parallel_poll_configure, 785 + .parallel_poll_response = cb7210_parallel_poll_response, 786 + .local_parallel_poll_mode = NULL, // XXX 787 + .line_status = cb7210_line_status, 788 + .update_status = cb7210_update_status, 789 + .primary_address = cb7210_primary_address, 790 + .secondary_address = cb7210_secondary_address, 791 + .serial_poll_response = cb7210_serial_poll_response, 792 + .serial_poll_status = cb7210_serial_poll_status, 793 + .t1_delay = cb7210_t1_delay, 794 + .return_to_local = cb7210_return_to_local, 795 795 }; 796 796 797 - gpib_interface_t cb_isa_interface = { 798 - name: "cbi_isa", 799 - attach : cb_isa_attach, 800 - detach : cb_isa_detach, 801 - read : cb7210_accel_read, 802 - write : cb7210_accel_write, 803 - command : cb7210_command, 804 - take_control : cb7210_take_control, 805 - go_to_standby : cb7210_go_to_standby, 806 - request_system_control : cb7210_request_system_control, 807 - interface_clear : cb7210_interface_clear, 808 - remote_enable : cb7210_remote_enable, 809 - enable_eos : cb7210_enable_eos, 810 - disable_eos : cb7210_disable_eos, 811 - parallel_poll : cb7210_parallel_poll, 812 - parallel_poll_configure : cb7210_parallel_poll_configure, 813 - parallel_poll_response : cb7210_parallel_poll_response, 814 - line_status : cb7210_line_status, 815 - update_status : cb7210_update_status, 816 - primary_address : cb7210_primary_address, 817 - secondary_address : cb7210_secondary_address, 818 - serial_poll_response : cb7210_serial_poll_response, 819 - serial_poll_status : cb7210_serial_poll_status, 820 - t1_delay : cb7210_t1_delay, 821 - return_to_local : cb7210_return_to_local, 797 + static gpib_interface_t cb_isa_interface = { 798 + .name = "cbi_isa", 799 + .attach = cb_isa_attach, 800 + .detach = cb_isa_detach, 801 + .read = cb7210_accel_read, 802 + .write = cb7210_accel_write, 803 + .command = cb7210_command, 804 + .take_control = cb7210_take_control, 805 + .go_to_standby = cb7210_go_to_standby, 806 + .request_system_control = cb7210_request_system_control, 807 + .interface_clear = cb7210_interface_clear, 808 + .remote_enable = cb7210_remote_enable, 809 + .enable_eos = cb7210_enable_eos, 810 + .disable_eos = cb7210_disable_eos, 811 + .parallel_poll = cb7210_parallel_poll, 812 + .parallel_poll_configure = cb7210_parallel_poll_configure, 813 + .parallel_poll_response = cb7210_parallel_poll_response, 814 + .line_status = cb7210_line_status, 815 + .update_status = cb7210_update_status, 816 + .primary_address = cb7210_primary_address, 817 + .secondary_address = cb7210_secondary_address, 818 + .serial_poll_response = cb7210_serial_poll_response, 819 + .serial_poll_status = cb7210_serial_poll_status, 820 + .t1_delay = cb7210_t1_delay, 821 + .return_to_local = cb7210_return_to_local, 822 822 }; 823 823 824 - gpib_interface_t cb_isa_accel_interface = { 825 - name: "cbi_isa_accel", 826 - attach : cb_isa_attach, 827 - detach : cb_isa_detach, 828 - read : cb7210_accel_read, 829 - write : cb7210_accel_write, 830 - command : cb7210_command, 831 - take_control : cb7210_take_control, 832 - go_to_standby : cb7210_go_to_standby, 833 - request_system_control : cb7210_request_system_control, 834 - interface_clear : cb7210_interface_clear, 835 - remote_enable : cb7210_remote_enable, 836 - enable_eos : cb7210_enable_eos, 837 - disable_eos : cb7210_disable_eos, 838 - parallel_poll : cb7210_parallel_poll, 839 - parallel_poll_configure : cb7210_parallel_poll_configure, 840 - parallel_poll_response : cb7210_parallel_poll_response, 841 - local_parallel_poll_mode : NULL, // XXX 842 - line_status : cb7210_line_status, 843 - update_status : cb7210_update_status, 844 - primary_address : cb7210_primary_address, 845 - secondary_address : cb7210_secondary_address, 846 - serial_poll_response : cb7210_serial_poll_response, 847 - serial_poll_status : cb7210_serial_poll_status, 848 - t1_delay : cb7210_t1_delay, 849 - return_to_local : cb7210_return_to_local, 824 + static gpib_interface_t cb_isa_accel_interface = { 825 + .name = "cbi_isa_accel", 826 + .attach = cb_isa_attach, 827 + .detach = cb_isa_detach, 828 + .read = cb7210_accel_read, 829 + .write = cb7210_accel_write, 830 + .command = cb7210_command, 831 + .take_control = cb7210_take_control, 832 + .go_to_standby = cb7210_go_to_standby, 833 + .request_system_control = cb7210_request_system_control, 834 + .interface_clear = cb7210_interface_clear, 835 + .remote_enable = cb7210_remote_enable, 836 + .enable_eos = cb7210_enable_eos, 837 + .disable_eos = cb7210_disable_eos, 838 + .parallel_poll = cb7210_parallel_poll, 839 + .parallel_poll_configure = cb7210_parallel_poll_configure, 840 + .parallel_poll_response = cb7210_parallel_poll_response, 841 + .local_parallel_poll_mode = NULL, // XXX 842 + .line_status = cb7210_line_status, 843 + .update_status = cb7210_update_status, 844 + .primary_address = cb7210_primary_address, 845 + .secondary_address = cb7210_secondary_address, 846 + .serial_poll_response = cb7210_serial_poll_response, 847 + .serial_poll_status = cb7210_serial_poll_status, 848 + .t1_delay = cb7210_t1_delay, 849 + .return_to_local = cb7210_return_to_local, 850 850 }; 851 851 852 852 static int cb7210_allocate_private(gpib_board_t *board) ··· 1040 1040 return retval; 1041 1041 cb_priv = board->private_data; 1042 1042 nec_priv = &cb_priv->nec7210_priv; 1043 - if (request_region(config->ibbase, cb7210_iosize, "cb7210") == 0) { 1044 - pr_err("gpib: ioports starting at 0x%u are already in use\n", config->ibbase); 1043 + if (!request_region(config->ibbase, cb7210_iosize, "cb7210")) { 1044 + pr_err("gpib: ioports starting at 0x%x are already in use\n", config->ibbase); 1045 1045 return -EIO; 1046 1046 } 1047 1047 nec_priv->iobase = config->ibbase; ··· 1351 1351 .resume = cb_gpib_resume, 1352 1352 }; 1353 1353 1354 - int cb_pcmcia_init_module(void) 1355 - { 1356 - pcmcia_register_driver(&cb_gpib_cs_driver); 1357 - return 0; 1358 - } 1359 - 1360 1354 void cb_pcmcia_cleanup_module(void) 1361 1355 { 1362 1356 DEBUG(0, "cb_gpib_cs: unloading\n"); 1363 1357 pcmcia_unregister_driver(&cb_gpib_cs_driver); 1364 1358 } 1365 1359 1366 - gpib_interface_t cb_pcmcia_unaccel_interface = { 1367 - name: "cbi_pcmcia_unaccel", 1368 - attach : cb_pcmcia_attach, 1369 - detach : cb_pcmcia_detach, 1370 - read : cb7210_read, 1371 - write : cb7210_write, 1372 - command : cb7210_command, 1373 - take_control : cb7210_take_control, 1374 - go_to_standby : cb7210_go_to_standby, 1375 - request_system_control : cb7210_request_system_control, 1376 - interface_clear : cb7210_interface_clear, 1377 - remote_enable : cb7210_remote_enable, 1378 - enable_eos : cb7210_enable_eos, 1379 - disable_eos : cb7210_disable_eos, 1380 - parallel_poll : cb7210_parallel_poll, 1381 - parallel_poll_configure : cb7210_parallel_poll_configure, 1382 - parallel_poll_response : cb7210_parallel_poll_response, 1383 - local_parallel_poll_mode : NULL, // XXX 1384 - line_status : cb7210_line_status, 1385 - update_status : cb7210_update_status, 1386 - primary_address : cb7210_primary_address, 1387 - secondary_address : cb7210_secondary_address, 1388 - serial_poll_response : cb7210_serial_poll_response, 1389 - serial_poll_status : cb7210_serial_poll_status, 1390 - t1_delay : cb7210_t1_delay, 1391 - return_to_local : cb7210_return_to_local, 1360 + static gpib_interface_t cb_pcmcia_unaccel_interface = { 1361 + .name = "cbi_pcmcia_unaccel", 1362 + .attach = cb_pcmcia_attach, 1363 + .detach = cb_pcmcia_detach, 1364 + .read = cb7210_read, 1365 + .write = cb7210_write, 1366 + .command = cb7210_command, 1367 + .take_control = cb7210_take_control, 1368 + .go_to_standby = cb7210_go_to_standby, 1369 + .request_system_control = cb7210_request_system_control, 1370 + .interface_clear = cb7210_interface_clear, 1371 + .remote_enable = cb7210_remote_enable, 1372 + .enable_eos = cb7210_enable_eos, 1373 + .disable_eos = cb7210_disable_eos, 1374 + .parallel_poll = cb7210_parallel_poll, 1375 + .parallel_poll_configure = cb7210_parallel_poll_configure, 1376 + .parallel_poll_response = cb7210_parallel_poll_response, 1377 + .local_parallel_poll_mode = NULL, // XXX 1378 + .line_status = cb7210_line_status, 1379 + .update_status = cb7210_update_status, 1380 + .primary_address = cb7210_primary_address, 1381 + .secondary_address = cb7210_secondary_address, 1382 + .serial_poll_response = cb7210_serial_poll_response, 1383 + .serial_poll_status = cb7210_serial_poll_status, 1384 + .t1_delay = cb7210_t1_delay, 1385 + .return_to_local = cb7210_return_to_local, 1392 1386 }; 1393 1387 1394 - gpib_interface_t cb_pcmcia_interface = { 1395 - name: "cbi_pcmcia", 1396 - attach : cb_pcmcia_attach, 1397 - detach : cb_pcmcia_detach, 1398 - read : cb7210_accel_read, 1399 - write : cb7210_accel_write, 1400 - command : cb7210_command, 1401 - take_control : cb7210_take_control, 1402 - go_to_standby : cb7210_go_to_standby, 1403 - request_system_control : cb7210_request_system_control, 1404 - interface_clear : cb7210_interface_clear, 1405 - remote_enable : cb7210_remote_enable, 1406 - enable_eos : cb7210_enable_eos, 1407 - disable_eos : cb7210_disable_eos, 1408 - parallel_poll : cb7210_parallel_poll, 1409 - parallel_poll_configure : cb7210_parallel_poll_configure, 1410 - parallel_poll_response : cb7210_parallel_poll_response, 1411 - local_parallel_poll_mode : NULL, // XXX 1412 - line_status : cb7210_line_status, 1413 - update_status : cb7210_update_status, 1414 - primary_address : cb7210_primary_address, 1415 - secondary_address : cb7210_secondary_address, 1416 - serial_poll_response : cb7210_serial_poll_response, 1417 - serial_poll_status : cb7210_serial_poll_status, 1418 - t1_delay : cb7210_t1_delay, 1419 - return_to_local : cb7210_return_to_local, 1388 + static gpib_interface_t cb_pcmcia_interface = { 1389 + .name = "cbi_pcmcia", 1390 + .attach = cb_pcmcia_attach, 1391 + .detach = cb_pcmcia_detach, 1392 + .read = cb7210_accel_read, 1393 + .write = cb7210_accel_write, 1394 + .command = cb7210_command, 1395 + .take_control = cb7210_take_control, 1396 + .go_to_standby = cb7210_go_to_standby, 1397 + .request_system_control = cb7210_request_system_control, 1398 + .interface_clear = cb7210_interface_clear, 1399 + .remote_enable = cb7210_remote_enable, 1400 + .enable_eos = cb7210_enable_eos, 1401 + .disable_eos = cb7210_disable_eos, 1402 + .parallel_poll = cb7210_parallel_poll, 1403 + .parallel_poll_configure = cb7210_parallel_poll_configure, 1404 + .parallel_poll_response = cb7210_parallel_poll_response, 1405 + .local_parallel_poll_mode = NULL, // XXX 1406 + .line_status = cb7210_line_status, 1407 + .update_status = cb7210_update_status, 1408 + .primary_address = cb7210_primary_address, 1409 + .secondary_address = cb7210_secondary_address, 1410 + .serial_poll_response = cb7210_serial_poll_response, 1411 + .serial_poll_status = cb7210_serial_poll_status, 1412 + .t1_delay = cb7210_t1_delay, 1413 + .return_to_local = cb7210_return_to_local, 1420 1414 }; 1421 1415 1422 - gpib_interface_t cb_pcmcia_accel_interface = { 1423 - name: "cbi_pcmcia_accel", 1424 - attach : cb_pcmcia_attach, 1425 - detach : cb_pcmcia_detach, 1426 - read : cb7210_accel_read, 1427 - write : cb7210_accel_write, 1428 - command : cb7210_command, 1429 - take_control : cb7210_take_control, 1430 - go_to_standby : cb7210_go_to_standby, 1431 - request_system_control : cb7210_request_system_control, 1432 - interface_clear : cb7210_interface_clear, 1433 - remote_enable : cb7210_remote_enable, 1434 - enable_eos : cb7210_enable_eos, 1435 - disable_eos : cb7210_disable_eos, 1436 - parallel_poll : cb7210_parallel_poll, 1437 - parallel_poll_configure : cb7210_parallel_poll_configure, 1438 - parallel_poll_response : cb7210_parallel_poll_response, 1439 - local_parallel_poll_mode : NULL, // XXX 1440 - line_status : cb7210_line_status, 1441 - update_status : cb7210_update_status, 1442 - primary_address : cb7210_primary_address, 1443 - secondary_address : cb7210_secondary_address, 1444 - serial_poll_response : cb7210_serial_poll_response, 1445 - serial_poll_status : cb7210_serial_poll_status, 1446 - t1_delay : cb7210_t1_delay, 1447 - return_to_local : cb7210_return_to_local, 1416 + static gpib_interface_t cb_pcmcia_accel_interface = { 1417 + .name = "cbi_pcmcia_accel", 1418 + .attach = cb_pcmcia_attach, 1419 + .detach = cb_pcmcia_detach, 1420 + .read = cb7210_accel_read, 1421 + .write = cb7210_accel_write, 1422 + .command = cb7210_command, 1423 + .take_control = cb7210_take_control, 1424 + .go_to_standby = cb7210_go_to_standby, 1425 + .request_system_control = cb7210_request_system_control, 1426 + .interface_clear = cb7210_interface_clear, 1427 + .remote_enable = cb7210_remote_enable, 1428 + .enable_eos = cb7210_enable_eos, 1429 + .disable_eos = cb7210_disable_eos, 1430 + .parallel_poll = cb7210_parallel_poll, 1431 + .parallel_poll_configure = cb7210_parallel_poll_configure, 1432 + .parallel_poll_response = cb7210_parallel_poll_response, 1433 + .local_parallel_poll_mode = NULL, // XXX 1434 + .line_status = cb7210_line_status, 1435 + .update_status = cb7210_update_status, 1436 + .primary_address = cb7210_primary_address, 1437 + .secondary_address = cb7210_secondary_address, 1438 + .serial_poll_response = cb7210_serial_poll_response, 1439 + .serial_poll_status = cb7210_serial_poll_status, 1440 + .t1_delay = cb7210_t1_delay, 1441 + .return_to_local = cb7210_return_to_local, 1448 1442 }; 1449 1443 1450 1444 int cb_pcmcia_attach(gpib_board_t *board, const gpib_board_config_t *config) ··· 1459 1465 cb_priv = board->private_data; 1460 1466 nec_priv = &cb_priv->nec7210_priv; 1461 1467 1462 - if (request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]), 1463 - "cb7210") == 0) { 1468 + if (!request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]), 1469 + "cb7210")) { 1464 1470 pr_err("gpib: ioports starting at 0x%lx are already in use\n", 1465 1471 (unsigned long)curr_dev->resource[0]->start); 1466 1472 return -EIO; ··· 1500 1506 1501 1507 static int __init cb7210_init_module(void) 1502 1508 { 1503 - int err = 0; 1504 - int result; 1509 + int ret; 1505 1510 1506 - result = pci_register_driver(&cb7210_pci_driver); 1507 - if (result) { 1508 - pr_err("cb7210: pci_driver_register failed!\n"); 1509 - return result; 1511 + ret = pci_register_driver(&cb7210_pci_driver); 1512 + if (ret) { 1513 + pr_err("cb7210: pci_register_driver failed: error = %d\n", ret); 1514 + return ret; 1510 1515 } 1511 1516 1512 - gpib_register_driver(&cb_pci_interface, THIS_MODULE); 1513 - gpib_register_driver(&cb_isa_interface, THIS_MODULE); 1514 - gpib_register_driver(&cb_pci_accel_interface, THIS_MODULE); 1515 - gpib_register_driver(&cb_pci_unaccel_interface, THIS_MODULE); 1516 - gpib_register_driver(&cb_isa_accel_interface, THIS_MODULE); 1517 - gpib_register_driver(&cb_isa_unaccel_interface, THIS_MODULE); 1517 + ret = gpib_register_driver(&cb_pci_interface, THIS_MODULE); 1518 + if (ret) { 1519 + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); 1520 + goto err_pci; 1521 + } 1518 1522 1519 - #ifdef GPIB__PCMCIA 1520 - gpib_register_driver(&cb_pcmcia_interface, THIS_MODULE); 1521 - gpib_register_driver(&cb_pcmcia_accel_interface, THIS_MODULE); 1522 - gpib_register_driver(&cb_pcmcia_unaccel_interface, THIS_MODULE); 1523 - err += cb_pcmcia_init_module(); 1523 + ret = gpib_register_driver(&cb_isa_interface, THIS_MODULE); 1524 + if (ret) { 1525 + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); 1526 + goto err_isa; 1527 + } 1528 + 1529 + ret = gpib_register_driver(&cb_pci_accel_interface, THIS_MODULE); 1530 + if (ret) { 1531 + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); 1532 + goto err_pci_accel; 1533 + } 1534 + 1535 + ret = gpib_register_driver(&cb_pci_unaccel_interface, THIS_MODULE); 1536 + if (ret) { 1537 + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); 1538 + goto err_pci_unaccel; 1539 + } 1540 + 1541 + ret = gpib_register_driver(&cb_isa_accel_interface, THIS_MODULE); 1542 + if (ret) { 1543 + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); 1544 + goto err_isa_accel; 1545 + } 1546 + 1547 + ret = gpib_register_driver(&cb_isa_unaccel_interface, THIS_MODULE); 1548 + if (ret) { 1549 + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); 1550 + goto err_isa_unaccel; 1551 + } 1552 + 1553 + #ifdef GPIB_PCMCIA 1554 + ret = gpib_register_driver(&cb_pcmcia_interface, THIS_MODULE); 1555 + if (ret) { 1556 + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); 1557 + goto err_pcmcia; 1558 + } 1559 + 1560 + ret = gpib_register_driver(&cb_pcmcia_accel_interface, THIS_MODULE); 1561 + if (ret) { 1562 + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); 1563 + goto err_pcmcia_accel; 1564 + } 1565 + 1566 + ret = gpib_register_driver(&cb_pcmcia_unaccel_interface, THIS_MODULE); 1567 + if (ret) { 1568 + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); 1569 + goto err_pcmcia_unaccel; 1570 + } 1571 + 1572 + ret = pcmcia_register_driver(&cb_gpib_cs_driver); 1573 + if (ret) { 1574 + pr_err("cb7210: pcmcia_register_driver failed: error = %d\n", ret); 1575 + goto err_pcmcia_driver; 1576 + } 1524 1577 #endif 1525 - if (err) 1526 - return -1; 1527 1578 1528 1579 return 0; 1580 + 1581 + #ifdef GPIB_PCMCIA 1582 + err_pcmcia_driver: 1583 + gpib_unregister_driver(&cb_pcmcia_unaccel_interface); 1584 + err_pcmcia_unaccel: 1585 + gpib_unregister_driver(&cb_pcmcia_accel_interface); 1586 + err_pcmcia_accel: 1587 + gpib_unregister_driver(&cb_pcmcia_interface); 1588 + err_pcmcia: 1589 + #endif 1590 + gpib_unregister_driver(&cb_isa_unaccel_interface); 1591 + err_isa_unaccel: 1592 + gpib_unregister_driver(&cb_isa_accel_interface); 1593 + err_isa_accel: 1594 + gpib_unregister_driver(&cb_pci_unaccel_interface); 1595 + err_pci_unaccel: 1596 + gpib_unregister_driver(&cb_pci_accel_interface); 1597 + err_pci_accel: 1598 + gpib_unregister_driver(&cb_isa_interface); 1599 + err_isa: 1600 + gpib_unregister_driver(&cb_pci_interface); 1601 + err_pci: 1602 + pci_unregister_driver(&cb7210_pci_driver); 1603 + 1604 + return ret; 1529 1605 } 1530 1606 1531 1607 static void __exit cb7210_exit_module(void)
-5
drivers/staging/gpib/cb7210/cb7210.h
··· 36 36 unsigned in_fifo_half_full : 1; 37 37 }; 38 38 39 - // interfaces 40 - extern gpib_interface_t cb_pcmcia_interface; 41 - extern gpib_interface_t cb_pcmcia_accel_interface; 42 - extern gpib_interface_t cb_pcmcia_unaccel_interface; 43 - 44 39 // interrupt service routines 45 40 irqreturn_t cb_pci_interrupt(int irq, void *arg); 46 41 irqreturn_t cb7210_interrupt(int irq, void *arg);
-4
drivers/staging/gpib/cec/cec.h
··· 16 16 unsigned int irq; 17 17 }; 18 18 19 - // interfaces 20 - extern gpib_interface_t cec_pci_interface; 21 - extern gpib_interface_t cec_pcmcia_interface; 22 - 23 19 // interface functions 24 20 int cec_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end, size_t *bytes_read); 25 21 int cec_write(gpib_board_t *board, uint8_t *buffer, size_t length, int send_eoi,
+32 -28
drivers/staging/gpib/cec/cec_gpib.c
··· 182 182 nec7210_return_to_local(board, &priv->nec7210_priv); 183 183 } 184 184 185 - gpib_interface_t cec_pci_interface = { 186 - name: "cec_pci", 187 - attach : cec_pci_attach, 188 - detach : cec_pci_detach, 189 - read : cec_read, 190 - write : cec_write, 191 - command : cec_command, 192 - take_control : cec_take_control, 193 - go_to_standby : cec_go_to_standby, 194 - request_system_control : cec_request_system_control, 195 - interface_clear : cec_interface_clear, 196 - remote_enable : cec_remote_enable, 197 - enable_eos : cec_enable_eos, 198 - disable_eos : cec_disable_eos, 199 - parallel_poll : cec_parallel_poll, 200 - parallel_poll_configure : cec_parallel_poll_configure, 201 - parallel_poll_response : cec_parallel_poll_response, 202 - local_parallel_poll_mode : NULL, // XXX 203 - line_status : NULL, //XXX 204 - update_status : cec_update_status, 205 - primary_address : cec_primary_address, 206 - secondary_address : cec_secondary_address, 207 - serial_poll_response : cec_serial_poll_response, 208 - serial_poll_status : cec_serial_poll_status, 209 - t1_delay : cec_t1_delay, 210 - return_to_local : cec_return_to_local, 185 + static gpib_interface_t cec_pci_interface = { 186 + .name = "cec_pci", 187 + .attach = cec_pci_attach, 188 + .detach = cec_pci_detach, 189 + .read = cec_read, 190 + .write = cec_write, 191 + .command = cec_command, 192 + .take_control = cec_take_control, 193 + .go_to_standby = cec_go_to_standby, 194 + .request_system_control = cec_request_system_control, 195 + .interface_clear = cec_interface_clear, 196 + .remote_enable = cec_remote_enable, 197 + .enable_eos = cec_enable_eos, 198 + .disable_eos = cec_disable_eos, 199 + .parallel_poll = cec_parallel_poll, 200 + .parallel_poll_configure = cec_parallel_poll_configure, 201 + .parallel_poll_response = cec_parallel_poll_response, 202 + .local_parallel_poll_mode = NULL, // XXX 203 + .line_status = NULL, //XXX 204 + .update_status = cec_update_status, 205 + .primary_address = cec_primary_address, 206 + .secondary_address = cec_secondary_address, 207 + .serial_poll_response = cec_serial_poll_response, 208 + .serial_poll_status = cec_serial_poll_status, 209 + .t1_delay = cec_t1_delay, 210 + .return_to_local = cec_return_to_local, 211 211 }; 212 212 213 213 static int cec_allocate_private(gpib_board_t *board) ··· 365 365 366 366 result = pci_register_driver(&cec_pci_driver); 367 367 if (result) { 368 - pr_err("cec_gpib: pci_driver_register failed!\n"); 368 + pr_err("cec_gpib: pci_register_driver failed: error = %d\n", result); 369 369 return result; 370 370 } 371 371 372 - gpib_register_driver(&cec_pci_interface, THIS_MODULE); 372 + result = gpib_register_driver(&cec_pci_interface, THIS_MODULE); 373 + if (result) { 374 + pr_err("cec_gpib: gpib_register_driver failed: error = %d\n", result); 375 + return result; 376 + } 373 377 374 378 return 0; 375 379 }
+64 -62
drivers/staging/gpib/common/gpib_os.c
··· 835 835 return -EBUSY; 836 836 } 837 837 838 - retval = copy_from_user(&cmd, (void *)arg, sizeof(board_type_ioctl_t)); 838 + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(board_type_ioctl_t)); 839 839 if (retval) 840 840 return retval; 841 841 ··· 879 879 unsigned long arg) 880 880 { 881 881 read_write_ioctl_t read_cmd; 882 - u8 *userbuf; 882 + u8 __user *userbuf; 883 883 unsigned long remain; 884 884 int end_flag = 0; 885 885 int retval; ··· 887 887 gpib_descriptor_t *desc; 888 888 size_t nbytes; 889 889 890 - retval = copy_from_user(&read_cmd, (void *)arg, sizeof(read_cmd)); 890 + retval = copy_from_user(&read_cmd, (void __user *)arg, sizeof(read_cmd)); 891 891 if (retval) 892 892 return -EFAULT; 893 893 ··· 901 901 if (WARN_ON_ONCE(sizeof(userbuf) > sizeof(read_cmd.buffer_ptr))) 902 902 return -EFAULT; 903 903 904 - userbuf = (u8 *)(unsigned long)read_cmd.buffer_ptr; 904 + userbuf = (u8 __user *)(unsigned long)read_cmd.buffer_ptr; 905 905 userbuf += read_cmd.completed_transfer_count; 906 906 907 907 remain = read_cmd.requested_transfer_count - read_cmd.completed_transfer_count; ··· 939 939 if (remain == 0 || end_flag) 940 940 read_ret = 0; 941 941 if (retval == 0) 942 - retval = copy_to_user((void *)arg, &read_cmd, sizeof(read_cmd)); 942 + retval = copy_to_user((void __user *)arg, &read_cmd, sizeof(read_cmd)); 943 943 944 944 atomic_set(&desc->io_in_progress, 0); 945 945 ··· 954 954 gpib_board_t *board, unsigned long arg) 955 955 { 956 956 read_write_ioctl_t cmd; 957 - u8 *userbuf; 957 + u8 __user *userbuf; 958 958 unsigned long remain; 959 959 int retval; 960 960 int fault = 0; ··· 962 962 size_t bytes_written; 963 963 int no_clear_io_in_prog; 964 964 965 - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); 965 + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); 966 966 if (retval) 967 967 return -EFAULT; 968 968 ··· 973 973 if (!desc) 974 974 return -EINVAL; 975 975 976 - userbuf = (u8 *)(unsigned long)cmd.buffer_ptr; 976 + userbuf = (u8 __user *)(unsigned long)cmd.buffer_ptr; 977 977 userbuf += cmd.completed_transfer_count; 978 978 979 979 no_clear_io_in_prog = cmd.end; ··· 1016 1016 cmd.completed_transfer_count = cmd.requested_transfer_count - remain; 1017 1017 1018 1018 if (fault == 0) 1019 - fault = copy_to_user((void *)arg, &cmd, sizeof(cmd)); 1019 + fault = copy_to_user((void __user *)arg, &cmd, sizeof(cmd)); 1020 1020 1021 1021 /* 1022 1022 * no_clear_io_in_prog (cmd.end) is true when io_in_progress should ··· 1038 1038 unsigned long arg) 1039 1039 { 1040 1040 read_write_ioctl_t write_cmd; 1041 - u8 *userbuf; 1041 + u8 __user *userbuf; 1042 1042 unsigned long remain; 1043 1043 int retval = 0; 1044 1044 int fault; 1045 1045 gpib_descriptor_t *desc; 1046 1046 1047 - fault = copy_from_user(&write_cmd, (void *)arg, sizeof(write_cmd)); 1047 + fault = copy_from_user(&write_cmd, (void __user *)arg, sizeof(write_cmd)); 1048 1048 if (fault) 1049 1049 return -EFAULT; 1050 1050 ··· 1055 1055 if (!desc) 1056 1056 return -EINVAL; 1057 1057 1058 - userbuf = (u8 *)(unsigned long)write_cmd.buffer_ptr; 1058 + userbuf = (u8 __user *)(unsigned long)write_cmd.buffer_ptr; 1059 1059 userbuf += write_cmd.completed_transfer_count; 1060 1060 1061 1061 remain = write_cmd.requested_transfer_count - write_cmd.completed_transfer_count; ··· 1094 1094 if (remain == 0) 1095 1095 retval = 0; 1096 1096 if (fault == 0) 1097 - fault = copy_to_user((void *)arg, &write_cmd, sizeof(write_cmd)); 1097 + fault = copy_to_user((void __user *)arg, &write_cmd, sizeof(write_cmd)); 1098 1098 1099 1099 atomic_set(&desc->io_in_progress, 0); 1100 1100 ··· 1111 1111 spoll_bytes_ioctl_t cmd; 1112 1112 int retval; 1113 1113 1114 - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); 1114 + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); 1115 1115 if (retval) 1116 1116 return -EFAULT; 1117 1117 ··· 1121 1121 else 1122 1122 cmd.num_bytes = num_status_bytes(device); 1123 1123 1124 - retval = copy_to_user((void *)arg, &cmd, sizeof(cmd)); 1124 + retval = copy_to_user((void __user *)arg, &cmd, sizeof(cmd)); 1125 1125 if (retval) 1126 1126 return -EFAULT; 1127 1127 ··· 1231 1231 gpib_file_private_t *file_priv = filep->private_data; 1232 1232 int i; 1233 1233 1234 - retval = copy_from_user(&open_dev_cmd, (void *)arg, sizeof(open_dev_cmd)); 1234 + retval = copy_from_user(&open_dev_cmd, (void __user *)arg, sizeof(open_dev_cmd)); 1235 1235 if (retval) 1236 1236 return -EFAULT; 1237 1237 ··· 1267 1267 atomic_set(&board->stuck_srq, 0); 1268 1268 1269 1269 open_dev_cmd.handle = i; 1270 - retval = copy_to_user((void *)arg, &open_dev_cmd, sizeof(open_dev_cmd)); 1270 + retval = copy_to_user((void __user *)arg, &open_dev_cmd, sizeof(open_dev_cmd)); 1271 1271 if (retval) 1272 1272 return -EFAULT; 1273 1273 ··· 1280 1280 gpib_file_private_t *file_priv = filep->private_data; 1281 1281 int retval; 1282 1282 1283 - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); 1283 + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); 1284 1284 if (retval) 1285 1285 return -EFAULT; 1286 1286 ··· 1308 1308 1309 1309 dev_dbg(board->gpib_dev, "pid %i, entering %s()\n", current->pid, __func__); 1310 1310 1311 - retval = copy_from_user(&serial_cmd, (void *)arg, sizeof(serial_cmd)); 1311 + retval = copy_from_user(&serial_cmd, (void __user *)arg, sizeof(serial_cmd)); 1312 1312 if (retval) 1313 1313 return -EFAULT; 1314 1314 ··· 1317 1317 if (retval < 0) 1318 1318 return retval; 1319 1319 1320 - retval = copy_to_user((void *)arg, &serial_cmd, sizeof(serial_cmd)); 1320 + retval = copy_to_user((void __user *)arg, &serial_cmd, sizeof(serial_cmd)); 1321 1321 if (retval) 1322 1322 return -EFAULT; 1323 1323 ··· 1331 1331 int retval; 1332 1332 gpib_descriptor_t *desc; 1333 1333 1334 - retval = copy_from_user(&wait_cmd, (void *)arg, sizeof(wait_cmd)); 1334 + retval = copy_from_user(&wait_cmd, (void __user *)arg, sizeof(wait_cmd)); 1335 1335 if (retval) 1336 1336 return -EFAULT; 1337 1337 ··· 1344 1344 if (retval < 0) 1345 1345 return retval; 1346 1346 1347 - retval = copy_to_user((void *)arg, &wait_cmd, sizeof(wait_cmd)); 1347 + retval = copy_to_user((void __user *)arg, &wait_cmd, sizeof(wait_cmd)); 1348 1348 if (retval) 1349 1349 return -EFAULT; 1350 1350 ··· 1360 1360 if (retval < 0) 1361 1361 return retval; 1362 1362 1363 - retval = copy_to_user((void *)arg, &poll_byte, sizeof(poll_byte)); 1363 + retval = copy_to_user((void __user *)arg, &poll_byte, sizeof(poll_byte)); 1364 1364 if (retval) 1365 1365 return -EFAULT; 1366 1366 ··· 1371 1371 { 1372 1372 online_ioctl_t online_cmd; 1373 1373 int retval; 1374 - void *init_data = NULL; 1374 + void __user *init_data = NULL; 1375 1375 1376 1376 board->config.init_data = NULL; 1377 1377 1378 1378 if (!capable(CAP_SYS_ADMIN)) 1379 1379 return -EPERM; 1380 1380 1381 - retval = copy_from_user(&online_cmd, (void *)arg, sizeof(online_cmd)); 1381 + retval = copy_from_user(&online_cmd, (void __user *)arg, sizeof(online_cmd)); 1382 1382 if (retval) 1383 1383 return -EFAULT; 1384 1384 if (online_cmd.init_data_length > 0) { ··· 1387 1387 return -ENOMEM; 1388 1388 if (WARN_ON_ONCE(sizeof(init_data) > sizeof(online_cmd.init_data_ptr))) 1389 1389 return -EFAULT; 1390 - init_data = (void *)(unsigned long)(online_cmd.init_data_ptr); 1390 + init_data = (void __user *)(unsigned long)(online_cmd.init_data_ptr); 1391 1391 retval = copy_from_user(board->config.init_data, init_data, 1392 1392 online_cmd.init_data_length); 1393 1393 if (retval) { ··· 1416 1416 int enable; 1417 1417 int retval; 1418 1418 1419 - retval = copy_from_user(&enable, (void *)arg, sizeof(enable)); 1419 + retval = copy_from_user(&enable, (void __user *)arg, sizeof(enable)); 1420 1420 if (retval) 1421 1421 return -EFAULT; 1422 1422 ··· 1428 1428 int synchronous; 1429 1429 int retval; 1430 1430 1431 - retval = copy_from_user(&synchronous, (void *)arg, sizeof(synchronous)); 1431 + retval = copy_from_user(&synchronous, (void __user *)arg, sizeof(synchronous)); 1432 1432 if (retval) 1433 1433 return -EFAULT; 1434 1434 ··· 1444 1444 if (retval < 0) 1445 1445 return retval; 1446 1446 1447 - retval = copy_to_user((void *)arg, &lines, sizeof(lines)); 1447 + retval = copy_to_user((void __user *)arg, &lines, sizeof(lines)); 1448 1448 if (retval) 1449 1449 return -EFAULT; 1450 1450 ··· 1458 1458 int retval; 1459 1459 gpib_descriptor_t *desc; 1460 1460 1461 - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); 1461 + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); 1462 1462 if (retval) 1463 1463 return -EFAULT; 1464 1464 ··· 1494 1494 int retval; 1495 1495 gpib_descriptor_t *desc; 1496 1496 1497 - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); 1497 + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); 1498 1498 if (retval) 1499 1499 return -EFAULT; 1500 1500 ··· 1527 1527 eos_ioctl_t eos_cmd; 1528 1528 int retval; 1529 1529 1530 - retval = copy_from_user(&eos_cmd, (void *)arg, sizeof(eos_cmd)); 1530 + retval = copy_from_user(&eos_cmd, (void __user *)arg, sizeof(eos_cmd)); 1531 1531 if (retval) 1532 1532 return -EFAULT; 1533 1533 ··· 1539 1539 u8 status_byte; 1540 1540 int retval; 1541 1541 1542 - retval = copy_from_user(&status_byte, (void *)arg, sizeof(status_byte)); 1542 + retval = copy_from_user(&status_byte, (void __user *)arg, sizeof(status_byte)); 1543 1543 if (retval) 1544 1544 return -EFAULT; 1545 1545 ··· 1551 1551 request_service2_t request_service2_cmd; 1552 1552 int retval; 1553 1553 1554 - retval = copy_from_user(&request_service2_cmd, (void *)arg, sizeof(request_service2_t)); 1554 + retval = copy_from_user(&request_service2_cmd, (void __user *)arg, 1555 + sizeof(request_service2_t)); 1555 1556 if (retval) 1556 1557 return -EFAULT; 1557 1558 ··· 1568 1567 if (!capable(CAP_SYS_ADMIN)) 1569 1568 return -EPERM; 1570 1569 1571 - retval = copy_from_user(&base_addr, (void *)arg, sizeof(base_addr)); 1570 + retval = copy_from_user(&base_addr, (void __user *)arg, sizeof(base_addr)); 1572 1571 if (retval) 1573 1572 return -EFAULT; 1574 1573 ··· 1587 1586 if (!capable(CAP_SYS_ADMIN)) 1588 1587 return -EPERM; 1589 1588 1590 - retval = copy_from_user(&irq, (void *)arg, sizeof(irq)); 1589 + retval = copy_from_user(&irq, (void __user *)arg, sizeof(irq)); 1591 1590 if (retval) 1592 1591 return -EFAULT; 1593 1592 ··· 1604 1603 if (!capable(CAP_SYS_ADMIN)) 1605 1604 return -EPERM; 1606 1605 1607 - retval = copy_from_user(&dma_channel, (void *)arg, sizeof(dma_channel)); 1606 + retval = copy_from_user(&dma_channel, (void __user *)arg, sizeof(dma_channel)); 1608 1607 if (retval) 1609 1608 return -EFAULT; 1610 1609 ··· 1620 1619 int retval; 1621 1620 gpib_descriptor_t *desc; 1622 1621 1623 - retval = copy_from_user(&enable, (void *)arg, sizeof(enable)); 1622 + retval = copy_from_user(&enable, (void __user *)arg, sizeof(enable)); 1624 1623 if (retval) 1625 1624 return -EFAULT; 1626 1625 ··· 1655 1654 { 1656 1655 int retval, lock_mutex; 1657 1656 1658 - retval = copy_from_user(&lock_mutex, (void *)arg, sizeof(lock_mutex)); 1657 + retval = copy_from_user(&lock_mutex, (void __user *)arg, sizeof(lock_mutex)); 1659 1658 if (retval) 1660 1659 return -EFAULT; 1661 1660 ··· 1699 1698 unsigned int timeout; 1700 1699 int retval; 1701 1700 1702 - retval = copy_from_user(&timeout, (void *)arg, sizeof(timeout)); 1701 + retval = copy_from_user(&timeout, (void __user *)arg, sizeof(timeout)); 1703 1702 if (retval) 1704 1703 return -EFAULT; 1705 1704 ··· 1714 1713 ppoll_config_ioctl_t cmd; 1715 1714 int retval; 1716 1715 1717 - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); 1716 + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); 1718 1717 if (retval) 1719 1718 return -EFAULT; 1720 1719 ··· 1740 1739 local_ppoll_mode_ioctl_t cmd; 1741 1740 int retval; 1742 1741 1743 - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); 1742 + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); 1744 1743 if (retval) 1745 1744 return -EFAULT; 1746 1745 ··· 1760 1759 int retval; 1761 1760 1762 1761 cmd = board->local_ppoll_mode; 1763 - retval = copy_to_user((void *)arg, &cmd, sizeof(cmd)); 1762 + retval = copy_to_user((void __user *)arg, &cmd, sizeof(cmd)); 1764 1763 if (retval) 1765 1764 return -EFAULT; 1766 1765 ··· 1774 1773 1775 1774 status = board->interface->serial_poll_status(board); 1776 1775 1777 - retval = copy_to_user((void *)arg, &status, sizeof(status)); 1776 + retval = copy_to_user((void __user *)arg, &status, sizeof(status)); 1778 1777 if (retval) 1779 1778 return -EFAULT; 1780 1779 ··· 1797 1796 info.t1_delay = board->t1_nano_sec; 1798 1797 info.ist = board->ist; 1799 1798 info.no_7_bit_eos = board->interface->no_7_bit_eos; 1800 - retval = copy_to_user((void *)arg, &info, sizeof(info)); 1799 + retval = copy_to_user((void __user *)arg, &info, sizeof(info)); 1801 1800 if (retval) 1802 1801 return -EFAULT; 1803 1802 ··· 1809 1808 unsigned int usec_duration; 1810 1809 int retval; 1811 1810 1812 - retval = copy_from_user(&usec_duration, (void *)arg, sizeof(usec_duration)); 1811 + retval = copy_from_user(&usec_duration, (void __user *)arg, sizeof(usec_duration)); 1813 1812 if (retval) 1814 1813 return -EFAULT; 1815 1814 ··· 1824 1823 if (!capable(CAP_SYS_ADMIN)) 1825 1824 return -EPERM; 1826 1825 1827 - retval = copy_from_user(&selection, (void *)arg, sizeof(selection)); 1826 + retval = copy_from_user(&selection, (void __user *)arg, sizeof(selection)); 1828 1827 if (retval) 1829 1828 return -EFAULT; 1830 1829 ··· 1846 1845 if (!selection) 1847 1846 return -ENOMEM; 1848 1847 1849 - retval = copy_from_user(selection, (void *)arg, sizeof(select_device_path_ioctl_t)); 1848 + retval = copy_from_user(selection, (void __user *)arg, sizeof(select_device_path_ioctl_t)); 1850 1849 if (retval) { 1851 1850 vfree(selection); 1852 1851 return -EFAULT; ··· 1980 1979 1981 1980 user_event = event; 1982 1981 1983 - retval = copy_to_user((void *)arg, &user_event, sizeof(user_event)); 1982 + retval = copy_to_user((void __user *)arg, &user_event, sizeof(user_event)); 1984 1983 if (retval) 1985 1984 return -EFAULT; 1986 1985 ··· 1992 1991 rsc_ioctl_t request_control; 1993 1992 int retval; 1994 1993 1995 - retval = copy_from_user(&request_control, (void *)arg, sizeof(request_control)); 1994 + retval = copy_from_user(&request_control, (void __user *)arg, sizeof(request_control)); 1996 1995 if (retval) 1997 1996 return -EFAULT; 1998 1997 ··· 2012 2011 return -EIO; 2013 2012 } 2014 2013 2015 - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); 2014 + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); 2016 2015 if (retval) 2017 2016 return -EFAULT; 2018 2017 ··· 2023 2022 return 0; 2024 2023 } 2025 2024 2026 - const struct file_operations ib_fops = { 2027 - owner: THIS_MODULE, 2028 - llseek : NULL, 2029 - unlocked_ioctl : &ibioctl, 2030 - compat_ioctl : &ibioctl, 2031 - open : &ibopen, 2032 - release : &ibclose, 2025 + static const struct file_operations ib_fops = { 2026 + .owner = THIS_MODULE, 2027 + .llseek = NULL, 2028 + .unlocked_ioctl = &ibioctl, 2029 + .compat_ioctl = &ibioctl, 2030 + .open = &ibopen, 2031 + .release = &ibclose, 2033 2032 }; 2034 2033 2035 2034 gpib_board_t board_array[GPIB_MAX_NUM_BOARDS]; ··· 2045 2044 atomic_set(&desc->io_in_progress, 0); 2046 2045 } 2047 2046 2048 - void gpib_register_driver(gpib_interface_t *interface, struct module *provider_module) 2047 + int gpib_register_driver(gpib_interface_t *interface, struct module *provider_module) 2049 2048 { 2050 2049 struct gpib_interface_list_struct *entry; 2051 2050 2052 2051 entry = kmalloc(sizeof(*entry), GFP_KERNEL); 2053 2052 if (!entry) 2054 - return; 2053 + return -ENOMEM; 2055 2054 2056 2055 entry->interface = interface; 2057 2056 entry->module = provider_module; 2058 2057 list_add(&entry->list, &registered_drivers); 2059 - pr_info("gpib: registered %s interface\n", interface->name); 2058 + 2059 + return 0; 2060 2060 } 2061 2061 EXPORT_SYMBOL(gpib_register_driver); 2062 2062 ··· 2197 2195 return PTR_ERR(gpib_class); 2198 2196 } 2199 2197 for (i = 0; i < GPIB_MAX_NUM_BOARDS; ++i) 2200 - board_array[i].gpib_dev = device_create(gpib_class, 0, 2198 + board_array[i].gpib_dev = device_create(gpib_class, NULL, 2201 2199 MKDEV(GPIB_CODE, i), NULL, "gpib%i", i); 2202 2200 2203 2201 return 0;
+1 -1
drivers/staging/gpib/common/iblib.c
··· 695 695 696 696 /* make sure we only clear status bits that we are reporting */ 697 697 if (*status & clear_mask || set_mask) 698 - general_ibstatus(board, status_queue, *status & clear_mask, set_mask, 0); 698 + general_ibstatus(board, status_queue, *status & clear_mask, set_mask, NULL); 699 699 700 700 return 0; 701 701 }
+102 -80
drivers/staging/gpib/eastwood/fluke_gpib.c
··· 720 720 return retval; 721 721 } 722 722 723 - gpib_interface_t fluke_unaccel_interface = { 724 - name: "fluke_unaccel", 725 - attach : fluke_attach_holdoff_all, 726 - detach : fluke_detach, 727 - read : fluke_read, 728 - write : fluke_write, 729 - command : fluke_command, 730 - take_control : fluke_take_control, 731 - go_to_standby : fluke_go_to_standby, 732 - request_system_control : fluke_request_system_control, 733 - interface_clear : fluke_interface_clear, 734 - remote_enable : fluke_remote_enable, 735 - enable_eos : fluke_enable_eos, 736 - disable_eos : fluke_disable_eos, 737 - parallel_poll : fluke_parallel_poll, 738 - parallel_poll_configure : fluke_parallel_poll_configure, 739 - parallel_poll_response : fluke_parallel_poll_response, 740 - line_status : fluke_line_status, 741 - update_status : fluke_update_status, 742 - primary_address : fluke_primary_address, 743 - secondary_address : fluke_secondary_address, 744 - serial_poll_response : fluke_serial_poll_response, 745 - serial_poll_status : fluke_serial_poll_status, 746 - t1_delay : fluke_t1_delay, 747 - return_to_local : fluke_return_to_local, 723 + static gpib_interface_t fluke_unaccel_interface = { 724 + .name = "fluke_unaccel", 725 + .attach = fluke_attach_holdoff_all, 726 + .detach = fluke_detach, 727 + .read = fluke_read, 728 + .write = fluke_write, 729 + .command = fluke_command, 730 + .take_control = fluke_take_control, 731 + .go_to_standby = fluke_go_to_standby, 732 + .request_system_control = fluke_request_system_control, 733 + .interface_clear = fluke_interface_clear, 734 + .remote_enable = fluke_remote_enable, 735 + .enable_eos = fluke_enable_eos, 736 + .disable_eos = fluke_disable_eos, 737 + .parallel_poll = fluke_parallel_poll, 738 + .parallel_poll_configure = fluke_parallel_poll_configure, 739 + .parallel_poll_response = fluke_parallel_poll_response, 740 + .line_status = fluke_line_status, 741 + .update_status = fluke_update_status, 742 + .primary_address = fluke_primary_address, 743 + .secondary_address = fluke_secondary_address, 744 + .serial_poll_response = fluke_serial_poll_response, 745 + .serial_poll_status = fluke_serial_poll_status, 746 + .t1_delay = fluke_t1_delay, 747 + .return_to_local = fluke_return_to_local, 748 748 }; 749 749 750 750 /* fluke_hybrid uses dma for writes but not for reads. Added ··· 755 755 * register just as the dma controller is also doing a read. 756 756 */ 757 757 758 - gpib_interface_t fluke_hybrid_interface = { 759 - name: "fluke_hybrid", 760 - attach : fluke_attach_holdoff_all, 761 - detach : fluke_detach, 762 - read : fluke_read, 763 - write : fluke_accel_write, 764 - command : fluke_command, 765 - take_control : fluke_take_control, 766 - go_to_standby : fluke_go_to_standby, 767 - request_system_control : fluke_request_system_control, 768 - interface_clear : fluke_interface_clear, 769 - remote_enable : fluke_remote_enable, 770 - enable_eos : fluke_enable_eos, 771 - disable_eos : fluke_disable_eos, 772 - parallel_poll : fluke_parallel_poll, 773 - parallel_poll_configure : fluke_parallel_poll_configure, 774 - parallel_poll_response : fluke_parallel_poll_response, 775 - line_status : fluke_line_status, 776 - update_status : fluke_update_status, 777 - primary_address : fluke_primary_address, 778 - secondary_address : fluke_secondary_address, 779 - serial_poll_response : fluke_serial_poll_response, 780 - serial_poll_status : fluke_serial_poll_status, 781 - t1_delay : fluke_t1_delay, 782 - return_to_local : fluke_return_to_local, 758 + static gpib_interface_t fluke_hybrid_interface = { 759 + .name = "fluke_hybrid", 760 + .attach = fluke_attach_holdoff_all, 761 + .detach = fluke_detach, 762 + .read = fluke_read, 763 + .write = fluke_accel_write, 764 + .command = fluke_command, 765 + .take_control = fluke_take_control, 766 + .go_to_standby = fluke_go_to_standby, 767 + .request_system_control = fluke_request_system_control, 768 + .interface_clear = fluke_interface_clear, 769 + .remote_enable = fluke_remote_enable, 770 + .enable_eos = fluke_enable_eos, 771 + .disable_eos = fluke_disable_eos, 772 + .parallel_poll = fluke_parallel_poll, 773 + .parallel_poll_configure = fluke_parallel_poll_configure, 774 + .parallel_poll_response = fluke_parallel_poll_response, 775 + .line_status = fluke_line_status, 776 + .update_status = fluke_update_status, 777 + .primary_address = fluke_primary_address, 778 + .secondary_address = fluke_secondary_address, 779 + .serial_poll_response = fluke_serial_poll_response, 780 + .serial_poll_status = fluke_serial_poll_status, 781 + .t1_delay = fluke_t1_delay, 782 + .return_to_local = fluke_return_to_local, 783 783 }; 784 784 785 - gpib_interface_t fluke_interface = { 786 - name: "fluke", 787 - attach : fluke_attach_holdoff_end, 788 - detach : fluke_detach, 789 - read : fluke_accel_read, 790 - write : fluke_accel_write, 791 - command : fluke_command, 792 - take_control : fluke_take_control, 793 - go_to_standby : fluke_go_to_standby, 794 - request_system_control : fluke_request_system_control, 795 - interface_clear : fluke_interface_clear, 796 - remote_enable : fluke_remote_enable, 797 - enable_eos : fluke_enable_eos, 798 - disable_eos : fluke_disable_eos, 799 - parallel_poll : fluke_parallel_poll, 800 - parallel_poll_configure : fluke_parallel_poll_configure, 801 - parallel_poll_response : fluke_parallel_poll_response, 802 - line_status : fluke_line_status, 803 - update_status : fluke_update_status, 804 - primary_address : fluke_primary_address, 805 - secondary_address : fluke_secondary_address, 806 - serial_poll_response : fluke_serial_poll_response, 807 - serial_poll_status : fluke_serial_poll_status, 808 - t1_delay : fluke_t1_delay, 809 - return_to_local : fluke_return_to_local, 785 + static gpib_interface_t fluke_interface = { 786 + .name = "fluke", 787 + .attach = fluke_attach_holdoff_end, 788 + .detach = fluke_detach, 789 + .read = fluke_accel_read, 790 + .write = fluke_accel_write, 791 + .command = fluke_command, 792 + .take_control = fluke_take_control, 793 + .go_to_standby = fluke_go_to_standby, 794 + .request_system_control = fluke_request_system_control, 795 + .interface_clear = fluke_interface_clear, 796 + .remote_enable = fluke_remote_enable, 797 + .enable_eos = fluke_enable_eos, 798 + .disable_eos = fluke_disable_eos, 799 + .parallel_poll = fluke_parallel_poll, 800 + .parallel_poll_configure = fluke_parallel_poll_configure, 801 + .parallel_poll_response = fluke_parallel_poll_response, 802 + .line_status = fluke_line_status, 803 + .update_status = fluke_update_status, 804 + .primary_address = fluke_primary_address, 805 + .secondary_address = fluke_secondary_address, 806 + .serial_poll_response = fluke_serial_poll_response, 807 + .serial_poll_status = fluke_serial_poll_status, 808 + .t1_delay = fluke_t1_delay, 809 + .return_to_local = fluke_return_to_local, 810 810 }; 811 811 812 812 irqreturn_t fluke_gpib_internal_interrupt(gpib_board_t *board) ··· 1155 1155 1156 1156 result = platform_driver_register(&fluke_gpib_platform_driver); 1157 1157 if (result) { 1158 - pr_err("fluke_gpib: platform_driver_register failed!\n"); 1158 + pr_err("fluke_gpib: platform_driver_register failed: error = %d\n", result); 1159 1159 return result; 1160 1160 } 1161 1161 1162 - gpib_register_driver(&fluke_unaccel_interface, THIS_MODULE); 1163 - gpib_register_driver(&fluke_hybrid_interface, THIS_MODULE); 1164 - gpib_register_driver(&fluke_interface, THIS_MODULE); 1162 + result = gpib_register_driver(&fluke_unaccel_interface, THIS_MODULE); 1163 + if (result) { 1164 + pr_err("fluke_gpib: gpib_register_driver failed: error = %d\n", result); 1165 + goto err_unaccel; 1166 + } 1165 1167 1166 - pr_info("fluke_gpib\n"); 1168 + result = gpib_register_driver(&fluke_hybrid_interface, THIS_MODULE); 1169 + if (result) { 1170 + pr_err("fluke_gpib: gpib_register_driver failed: error = %d\n", result); 1171 + goto err_hybrid; 1172 + } 1173 + 1174 + result = gpib_register_driver(&fluke_interface, THIS_MODULE); 1175 + if (result) { 1176 + pr_err("fluke_gpib: gpib_register_driver failed: error = %d\n", result); 1177 + goto err_interface; 1178 + } 1179 + 1167 1180 return 0; 1181 + 1182 + err_interface: 1183 + gpib_unregister_driver(&fluke_hybrid_interface); 1184 + err_hybrid: 1185 + gpib_unregister_driver(&fluke_unaccel_interface); 1186 + err_unaccel: 1187 + platform_driver_unregister(&fluke_gpib_platform_driver); 1188 + 1189 + return result; 1168 1190 } 1169 1191 1170 1192 static void __exit fluke_exit_module(void)
+1 -1
drivers/staging/gpib/eastwood/fluke_gpib.h
··· 21 21 struct dma_chan *dma_channel; 22 22 u8 *dma_buffer; 23 23 int dma_buffer_size; 24 - void *write_transfer_counter; 24 + void __iomem *write_transfer_counter; 25 25 }; 26 26 27 27 // cb7210 specific registers and bits
+143 -112
drivers/staging/gpib/fmh_gpib/fmh_gpib.c
··· 1040 1040 return retval; 1041 1041 } 1042 1042 1043 - gpib_interface_t fmh_gpib_unaccel_interface = { 1044 - name: "fmh_gpib_unaccel", 1045 - attach : fmh_gpib_attach_holdoff_all, 1046 - detach : fmh_gpib_detach, 1047 - read : fmh_gpib_read, 1048 - write : fmh_gpib_write, 1049 - command : fmh_gpib_command, 1050 - take_control : fmh_gpib_take_control, 1051 - go_to_standby : fmh_gpib_go_to_standby, 1052 - request_system_control : fmh_gpib_request_system_control, 1053 - interface_clear : fmh_gpib_interface_clear, 1054 - remote_enable : fmh_gpib_remote_enable, 1055 - enable_eos : fmh_gpib_enable_eos, 1056 - disable_eos : fmh_gpib_disable_eos, 1057 - parallel_poll : fmh_gpib_parallel_poll, 1058 - parallel_poll_configure : fmh_gpib_parallel_poll_configure, 1059 - parallel_poll_response : fmh_gpib_parallel_poll_response, 1060 - local_parallel_poll_mode : fmh_gpib_local_parallel_poll_mode, 1061 - line_status : fmh_gpib_line_status, 1062 - update_status : fmh_gpib_update_status, 1063 - primary_address : fmh_gpib_primary_address, 1064 - secondary_address : fmh_gpib_secondary_address, 1065 - serial_poll_response2 : fmh_gpib_serial_poll_response2, 1066 - serial_poll_status : fmh_gpib_serial_poll_status, 1067 - t1_delay : fmh_gpib_t1_delay, 1068 - return_to_local : fmh_gpib_return_to_local, 1043 + static gpib_interface_t fmh_gpib_unaccel_interface = { 1044 + .name = "fmh_gpib_unaccel", 1045 + .attach = fmh_gpib_attach_holdoff_all, 1046 + .detach = fmh_gpib_detach, 1047 + .read = fmh_gpib_read, 1048 + .write = fmh_gpib_write, 1049 + .command = fmh_gpib_command, 1050 + .take_control = fmh_gpib_take_control, 1051 + .go_to_standby = fmh_gpib_go_to_standby, 1052 + .request_system_control = fmh_gpib_request_system_control, 1053 + .interface_clear = fmh_gpib_interface_clear, 1054 + .remote_enable = fmh_gpib_remote_enable, 1055 + .enable_eos = fmh_gpib_enable_eos, 1056 + .disable_eos = fmh_gpib_disable_eos, 1057 + .parallel_poll = fmh_gpib_parallel_poll, 1058 + .parallel_poll_configure = fmh_gpib_parallel_poll_configure, 1059 + .parallel_poll_response = fmh_gpib_parallel_poll_response, 1060 + .local_parallel_poll_mode = fmh_gpib_local_parallel_poll_mode, 1061 + .line_status = fmh_gpib_line_status, 1062 + .update_status = fmh_gpib_update_status, 1063 + .primary_address = fmh_gpib_primary_address, 1064 + .secondary_address = fmh_gpib_secondary_address, 1065 + .serial_poll_response2 = fmh_gpib_serial_poll_response2, 1066 + .serial_poll_status = fmh_gpib_serial_poll_status, 1067 + .t1_delay = fmh_gpib_t1_delay, 1068 + .return_to_local = fmh_gpib_return_to_local, 1069 1069 }; 1070 1070 1071 - gpib_interface_t fmh_gpib_interface = { 1072 - name: "fmh_gpib", 1073 - attach : fmh_gpib_attach_holdoff_end, 1074 - detach : fmh_gpib_detach, 1075 - read : fmh_gpib_accel_read, 1076 - write : fmh_gpib_accel_write, 1077 - command : fmh_gpib_command, 1078 - take_control : fmh_gpib_take_control, 1079 - go_to_standby : fmh_gpib_go_to_standby, 1080 - request_system_control : fmh_gpib_request_system_control, 1081 - interface_clear : fmh_gpib_interface_clear, 1082 - remote_enable : fmh_gpib_remote_enable, 1083 - enable_eos : fmh_gpib_enable_eos, 1084 - disable_eos : fmh_gpib_disable_eos, 1085 - parallel_poll : fmh_gpib_parallel_poll, 1086 - parallel_poll_configure : fmh_gpib_parallel_poll_configure, 1087 - parallel_poll_response : fmh_gpib_parallel_poll_response, 1088 - local_parallel_poll_mode : fmh_gpib_local_parallel_poll_mode, 1089 - line_status : fmh_gpib_line_status, 1090 - update_status : fmh_gpib_update_status, 1091 - primary_address : fmh_gpib_primary_address, 1092 - secondary_address : fmh_gpib_secondary_address, 1093 - serial_poll_response2 : fmh_gpib_serial_poll_response2, 1094 - serial_poll_status : fmh_gpib_serial_poll_status, 1095 - t1_delay : fmh_gpib_t1_delay, 1096 - return_to_local : fmh_gpib_return_to_local, 1071 + static gpib_interface_t fmh_gpib_interface = { 1072 + .name = "fmh_gpib", 1073 + .attach = fmh_gpib_attach_holdoff_end, 1074 + .detach = fmh_gpib_detach, 1075 + .read = fmh_gpib_accel_read, 1076 + .write = fmh_gpib_accel_write, 1077 + .command = fmh_gpib_command, 1078 + .take_control = fmh_gpib_take_control, 1079 + .go_to_standby = fmh_gpib_go_to_standby, 1080 + .request_system_control = fmh_gpib_request_system_control, 1081 + .interface_clear = fmh_gpib_interface_clear, 1082 + .remote_enable = fmh_gpib_remote_enable, 1083 + .enable_eos = fmh_gpib_enable_eos, 1084 + .disable_eos = fmh_gpib_disable_eos, 1085 + .parallel_poll = fmh_gpib_parallel_poll, 1086 + .parallel_poll_configure = fmh_gpib_parallel_poll_configure, 1087 + .parallel_poll_response = fmh_gpib_parallel_poll_response, 1088 + .local_parallel_poll_mode = fmh_gpib_local_parallel_poll_mode, 1089 + .line_status = fmh_gpib_line_status, 1090 + .update_status = fmh_gpib_update_status, 1091 + .primary_address = fmh_gpib_primary_address, 1092 + .secondary_address = fmh_gpib_secondary_address, 1093 + .serial_poll_response2 = fmh_gpib_serial_poll_response2, 1094 + .serial_poll_status = fmh_gpib_serial_poll_status, 1095 + .t1_delay = fmh_gpib_t1_delay, 1096 + .return_to_local = fmh_gpib_return_to_local, 1097 1097 }; 1098 1098 1099 - gpib_interface_t fmh_gpib_pci_interface = { 1100 - name: "fmh_gpib_pci", 1101 - attach : fmh_gpib_pci_attach_holdoff_end, 1102 - detach : fmh_gpib_pci_detach, 1103 - read : fmh_gpib_fifo_read, 1104 - write : fmh_gpib_fifo_write, 1105 - command : fmh_gpib_command, 1106 - take_control : fmh_gpib_take_control, 1107 - go_to_standby : fmh_gpib_go_to_standby, 1108 - request_system_control : fmh_gpib_request_system_control, 1109 - interface_clear : fmh_gpib_interface_clear, 1110 - remote_enable : fmh_gpib_remote_enable, 1111 - enable_eos : fmh_gpib_enable_eos, 1112 - disable_eos : fmh_gpib_disable_eos, 1113 - parallel_poll : fmh_gpib_parallel_poll, 1114 - parallel_poll_configure : fmh_gpib_parallel_poll_configure, 1115 - parallel_poll_response : fmh_gpib_parallel_poll_response, 1116 - local_parallel_poll_mode : fmh_gpib_local_parallel_poll_mode, 1117 - line_status : fmh_gpib_line_status, 1118 - update_status : fmh_gpib_update_status, 1119 - primary_address : fmh_gpib_primary_address, 1120 - secondary_address : fmh_gpib_secondary_address, 1121 - serial_poll_response2 : fmh_gpib_serial_poll_response2, 1122 - serial_poll_status : fmh_gpib_serial_poll_status, 1123 - t1_delay : fmh_gpib_t1_delay, 1124 - return_to_local : fmh_gpib_return_to_local, 1099 + static gpib_interface_t fmh_gpib_pci_interface = { 1100 + .name = "fmh_gpib_pci", 1101 + .attach = fmh_gpib_pci_attach_holdoff_end, 1102 + .detach = fmh_gpib_pci_detach, 1103 + .read = fmh_gpib_fifo_read, 1104 + .write = fmh_gpib_fifo_write, 1105 + .command = fmh_gpib_command, 1106 + .take_control = fmh_gpib_take_control, 1107 + .go_to_standby = fmh_gpib_go_to_standby, 1108 + .request_system_control = fmh_gpib_request_system_control, 1109 + .interface_clear = fmh_gpib_interface_clear, 1110 + .remote_enable = fmh_gpib_remote_enable, 1111 + .enable_eos = fmh_gpib_enable_eos, 1112 + .disable_eos = fmh_gpib_disable_eos, 1113 + .parallel_poll = fmh_gpib_parallel_poll, 1114 + .parallel_poll_configure = fmh_gpib_parallel_poll_configure, 1115 + .parallel_poll_response = fmh_gpib_parallel_poll_response, 1116 + .local_parallel_poll_mode = fmh_gpib_local_parallel_poll_mode, 1117 + .line_status = fmh_gpib_line_status, 1118 + .update_status = fmh_gpib_update_status, 1119 + .primary_address = fmh_gpib_primary_address, 1120 + .secondary_address = fmh_gpib_secondary_address, 1121 + .serial_poll_response2 = fmh_gpib_serial_poll_response2, 1122 + .serial_poll_status = fmh_gpib_serial_poll_status, 1123 + .t1_delay = fmh_gpib_t1_delay, 1124 + .return_to_local = fmh_gpib_return_to_local, 1125 1125 }; 1126 1126 1127 - gpib_interface_t fmh_gpib_pci_unaccel_interface = { 1128 - name: "fmh_gpib_pci_unaccel", 1129 - attach : fmh_gpib_pci_attach_holdoff_all, 1130 - detach : fmh_gpib_pci_detach, 1131 - read : fmh_gpib_read, 1132 - write : fmh_gpib_write, 1133 - command : fmh_gpib_command, 1134 - take_control : fmh_gpib_take_control, 1135 - go_to_standby : fmh_gpib_go_to_standby, 1136 - request_system_control : fmh_gpib_request_system_control, 1137 - interface_clear : fmh_gpib_interface_clear, 1138 - remote_enable : fmh_gpib_remote_enable, 1139 - enable_eos : fmh_gpib_enable_eos, 1140 - disable_eos : fmh_gpib_disable_eos, 1141 - parallel_poll : fmh_gpib_parallel_poll, 1142 - parallel_poll_configure : fmh_gpib_parallel_poll_configure, 1143 - parallel_poll_response : fmh_gpib_parallel_poll_response, 1144 - local_parallel_poll_mode : fmh_gpib_local_parallel_poll_mode, 1145 - line_status : fmh_gpib_line_status, 1146 - update_status : fmh_gpib_update_status, 1147 - primary_address : fmh_gpib_primary_address, 1148 - secondary_address : fmh_gpib_secondary_address, 1149 - serial_poll_response2 : fmh_gpib_serial_poll_response2, 1150 - serial_poll_status : fmh_gpib_serial_poll_status, 1151 - t1_delay : fmh_gpib_t1_delay, 1152 - return_to_local : fmh_gpib_return_to_local, 1127 + static gpib_interface_t fmh_gpib_pci_unaccel_interface = { 1128 + .name = "fmh_gpib_pci_unaccel", 1129 + .attach = fmh_gpib_pci_attach_holdoff_all, 1130 + .detach = fmh_gpib_pci_detach, 1131 + .read = fmh_gpib_read, 1132 + .write = fmh_gpib_write, 1133 + .command = fmh_gpib_command, 1134 + .take_control = fmh_gpib_take_control, 1135 + .go_to_standby = fmh_gpib_go_to_standby, 1136 + .request_system_control = fmh_gpib_request_system_control, 1137 + .interface_clear = fmh_gpib_interface_clear, 1138 + .remote_enable = fmh_gpib_remote_enable, 1139 + .enable_eos = fmh_gpib_enable_eos, 1140 + .disable_eos = fmh_gpib_disable_eos, 1141 + .parallel_poll = fmh_gpib_parallel_poll, 1142 + .parallel_poll_configure = fmh_gpib_parallel_poll_configure, 1143 + .parallel_poll_response = fmh_gpib_parallel_poll_response, 1144 + .local_parallel_poll_mode = fmh_gpib_local_parallel_poll_mode, 1145 + .line_status = fmh_gpib_line_status, 1146 + .update_status = fmh_gpib_update_status, 1147 + .primary_address = fmh_gpib_primary_address, 1148 + .secondary_address = fmh_gpib_secondary_address, 1149 + .serial_poll_response2 = fmh_gpib_serial_poll_response2, 1150 + .serial_poll_status = fmh_gpib_serial_poll_status, 1151 + .t1_delay = fmh_gpib_t1_delay, 1152 + .return_to_local = fmh_gpib_return_to_local, 1153 1153 }; 1154 1154 1155 1155 irqreturn_t fmh_gpib_internal_interrupt(gpib_board_t *board) ··· 1692 1692 1693 1693 result = platform_driver_register(&fmh_gpib_platform_driver); 1694 1694 if (result) { 1695 - pr_err("fmh_gpib: platform_driver_register failed!\n"); 1695 + pr_err("fmh_gpib: platform_driver_register failed: error = %d\n", result); 1696 1696 return result; 1697 1697 } 1698 1698 1699 1699 result = pci_register_driver(&fmh_gpib_pci_driver); 1700 1700 if (result) { 1701 - pr_err("fmh_gpib: pci_driver_register failed!\n"); 1702 - return result; 1701 + pr_err("fmh_gpib: pci_register_driver failed: error = %d\n", result); 1702 + goto err_pci_driver; 1703 1703 } 1704 1704 1705 - gpib_register_driver(&fmh_gpib_unaccel_interface, THIS_MODULE); 1706 - gpib_register_driver(&fmh_gpib_interface, THIS_MODULE); 1707 - gpib_register_driver(&fmh_gpib_pci_unaccel_interface, THIS_MODULE); 1708 - gpib_register_driver(&fmh_gpib_pci_interface, THIS_MODULE); 1705 + result = gpib_register_driver(&fmh_gpib_unaccel_interface, THIS_MODULE); 1706 + if (result) { 1707 + pr_err("fmh_gpib: gpib_register_driver failed: error = %d\n", result); 1708 + goto err_unaccel; 1709 + } 1709 1710 1710 - pr_info("fmh_gpib\n"); 1711 + result = gpib_register_driver(&fmh_gpib_interface, THIS_MODULE); 1712 + if (result) { 1713 + pr_err("fmh_gpib: gpib_register_driver failed: error = %d\n", result); 1714 + goto err_interface; 1715 + } 1716 + 1717 + result = gpib_register_driver(&fmh_gpib_pci_unaccel_interface, THIS_MODULE); 1718 + if (result) { 1719 + pr_err("fmh_gpib: gpib_register_driver failed: error = %d\n", result); 1720 + goto err_pci_unaccel; 1721 + } 1722 + 1723 + result = gpib_register_driver(&fmh_gpib_pci_interface, THIS_MODULE); 1724 + if (result) { 1725 + pr_err("fmh_gpib: gpib_register_driver failed: error = %d\n", result); 1726 + goto err_pci; 1727 + } 1728 + 1711 1729 return 0; 1730 + 1731 + err_pci: 1732 + gpib_unregister_driver(&fmh_gpib_pci_unaccel_interface); 1733 + err_pci_unaccel: 1734 + gpib_unregister_driver(&fmh_gpib_interface); 1735 + err_interface: 1736 + gpib_unregister_driver(&fmh_gpib_unaccel_interface); 1737 + err_unaccel: 1738 + pci_unregister_driver(&fmh_gpib_pci_driver); 1739 + err_pci_driver: 1740 + platform_driver_unregister(&fmh_gpib_platform_driver); 1741 + 1742 + return result; 1712 1743 } 1713 1744 1714 1745 static void __exit fmh_gpib_exit_module(void)
+1 -1
drivers/staging/gpib/fmh_gpib/fmh_gpib.h
··· 33 33 u8 *dma_buffer; 34 34 int dma_buffer_size; 35 35 int dma_burst_length; 36 - void *fifo_base; 36 + void __iomem *fifo_base; 37 37 unsigned supports_fifo_interrupts : 1; 38 38 }; 39 39
+35 -30
drivers/staging/gpib/gpio/gpib_bitbang.c
··· 147 147 led_trigger_event(ledtrig_gpib, LED_OFF); } \ 148 148 while (0) 149 149 150 - struct gpio_desc *all_descriptors[GPIB_PINS + SN7516X_PINS]; 150 + static struct gpio_desc *all_descriptors[GPIB_PINS + SN7516X_PINS]; 151 151 152 152 #define D01 all_descriptors[0] 153 153 #define D02 all_descriptors[1] ··· 175 175 /* YOGA dapter uses a global enable for the buffer chips, re-using the TE pin */ 176 176 #define YOGA_ENABLE TE 177 177 178 - int gpios_vector[] = { 178 + static int gpios_vector[] = { 179 179 D01_pin_nr, 180 180 D02_pin_nr, 181 181 D03_pin_nr, ··· 265 265 static struct gpiod_lookup_table *lookup_tables[] = { 266 266 &gpib_gpio_table_0, 267 267 &gpib_gpio_table_1, 268 - 0 268 + NULL 269 269 }; 270 270 271 271 /* struct which defines private_data for gpio driver */ ··· 1119 1119 for (j = 0 ; j < NUM_PINS ; j++) { 1120 1120 if (all_descriptors[j]) { 1121 1121 gpiod_put(all_descriptors[j]); 1122 - all_descriptors[j] = 0; 1122 + all_descriptors[j] = NULL; 1123 1123 } 1124 1124 } 1125 1125 } ··· 1312 1312 return retval; 1313 1313 } 1314 1314 1315 - gpib_interface_t bb_interface = { 1316 - name: NAME, 1317 - attach : bb_attach, 1318 - detach : bb_detach, 1319 - read : bb_read, 1320 - write : bb_write, 1321 - command : bb_command, 1322 - take_control : bb_take_control, 1323 - go_to_standby : bb_go_to_standby, 1324 - request_system_control : bb_request_system_control, 1325 - interface_clear : bb_interface_clear, 1326 - remote_enable : bb_remote_enable, 1327 - enable_eos : bb_enable_eos, 1328 - disable_eos : bb_disable_eos, 1329 - parallel_poll : bb_parallel_poll, 1330 - parallel_poll_configure : bb_parallel_poll_configure, 1331 - parallel_poll_response : bb_parallel_poll_response, 1332 - line_status : bb_line_status, 1333 - update_status : bb_update_status, 1334 - primary_address : bb_primary_address, 1335 - secondary_address : bb_secondary_address, 1336 - serial_poll_response : bb_serial_poll_response, 1337 - serial_poll_status : bb_serial_poll_status, 1338 - t1_delay : bb_t1_delay, 1339 - return_to_local : bb_return_to_local, 1315 + static gpib_interface_t bb_interface = { 1316 + .name = NAME, 1317 + .attach = bb_attach, 1318 + .detach = bb_detach, 1319 + .read = bb_read, 1320 + .write = bb_write, 1321 + .command = bb_command, 1322 + .take_control = bb_take_control, 1323 + .go_to_standby = bb_go_to_standby, 1324 + .request_system_control = bb_request_system_control, 1325 + .interface_clear = bb_interface_clear, 1326 + .remote_enable = bb_remote_enable, 1327 + .enable_eos = bb_enable_eos, 1328 + .disable_eos = bb_disable_eos, 1329 + .parallel_poll = bb_parallel_poll, 1330 + .parallel_poll_configure = bb_parallel_poll_configure, 1331 + .parallel_poll_response = bb_parallel_poll_response, 1332 + .line_status = bb_line_status, 1333 + .update_status = bb_update_status, 1334 + .primary_address = bb_primary_address, 1335 + .secondary_address = bb_secondary_address, 1336 + .serial_poll_response = bb_serial_poll_response, 1337 + .serial_poll_status = bb_serial_poll_status, 1338 + .t1_delay = bb_t1_delay, 1339 + .return_to_local = bb_return_to_local, 1340 1340 }; 1341 1341 1342 1342 static int __init bb_init_module(void) 1343 1343 { 1344 - gpib_register_driver(&bb_interface, THIS_MODULE); 1344 + int result = gpib_register_driver(&bb_interface, THIS_MODULE); 1345 + 1346 + if (result) { 1347 + pr_err("gpib_bitbang: gpib_register_driver failed: error = %d\n", result); 1348 + return result; 1349 + } 1345 1350 1346 1351 dbg_printk(0, "module loaded with pin map \"%s\"%s\n", 1347 1352 pin_map, (sn7516x_used) ? " and SN7516x driver support" : "");
+33 -27
drivers/staging/gpib/hp_82335/hp82335.c
··· 173 173 tms9914_return_to_local(board, &priv->tms9914_priv); 174 174 } 175 175 176 - gpib_interface_t hp82335_interface = { 177 - name: "hp82335", 178 - attach : hp82335_attach, 179 - detach : hp82335_detach, 180 - read : hp82335_read, 181 - write : hp82335_write, 182 - command : hp82335_command, 183 - request_system_control : hp82335_request_system_control, 184 - take_control : hp82335_take_control, 185 - go_to_standby : hp82335_go_to_standby, 186 - interface_clear : hp82335_interface_clear, 187 - remote_enable : hp82335_remote_enable, 188 - enable_eos : hp82335_enable_eos, 189 - disable_eos : hp82335_disable_eos, 190 - parallel_poll : hp82335_parallel_poll, 191 - parallel_poll_configure : hp82335_parallel_poll_configure, 192 - parallel_poll_response : hp82335_parallel_poll_response, 193 - local_parallel_poll_mode : NULL, // XXX 194 - line_status : hp82335_line_status, 195 - update_status : hp82335_update_status, 196 - primary_address : hp82335_primary_address, 197 - secondary_address : hp82335_secondary_address, 198 - serial_poll_response : hp82335_serial_poll_response, 199 - serial_poll_status : hp82335_serial_poll_status, 200 - t1_delay : hp82335_t1_delay, 201 - return_to_local : hp82335_return_to_local, 176 + static gpib_interface_t hp82335_interface = { 177 + .name = "hp82335", 178 + .attach = hp82335_attach, 179 + .detach = hp82335_detach, 180 + .read = hp82335_read, 181 + .write = hp82335_write, 182 + .command = hp82335_command, 183 + .request_system_control = hp82335_request_system_control, 184 + .take_control = hp82335_take_control, 185 + .go_to_standby = hp82335_go_to_standby, 186 + .interface_clear = hp82335_interface_clear, 187 + .remote_enable = hp82335_remote_enable, 188 + .enable_eos = hp82335_enable_eos, 189 + .disable_eos = hp82335_disable_eos, 190 + .parallel_poll = hp82335_parallel_poll, 191 + .parallel_poll_configure = hp82335_parallel_poll_configure, 192 + .parallel_poll_response = hp82335_parallel_poll_response, 193 + .local_parallel_poll_mode = NULL, // XXX 194 + .line_status = hp82335_line_status, 195 + .update_status = hp82335_update_status, 196 + .primary_address = hp82335_primary_address, 197 + .secondary_address = hp82335_secondary_address, 198 + .serial_poll_response = hp82335_serial_poll_response, 199 + .serial_poll_status = hp82335_serial_poll_status, 200 + .t1_delay = hp82335_t1_delay, 201 + .return_to_local = hp82335_return_to_local, 202 202 }; 203 203 204 204 int hp82335_allocate_private(gpib_board_t *board) ··· 326 326 327 327 static int __init hp82335_init_module(void) 328 328 { 329 - gpib_register_driver(&hp82335_interface, THIS_MODULE); 329 + int result = gpib_register_driver(&hp82335_interface, THIS_MODULE); 330 + 331 + if (result) { 332 + pr_err("hp82335: gpib_register_driver failed: error = %d\n", result); 333 + return result; 334 + } 335 + 330 336 return 0; 331 337 } 332 338
-3
drivers/staging/gpib/hp_82335/hp82335.h
··· 17 17 unsigned long raw_iobase; 18 18 }; 19 19 20 - // interfaces 21 - extern gpib_interface_t hp82335_interface; 22 - 23 20 // interface functions 24 21 int hp82335_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end, size_t *bytes_read); 25 22 int hp82335_write(gpib_board_t *board, uint8_t *buffer, size_t length,
+66 -53
drivers/staging/gpib/hp_82341/hp_82341.c
··· 402 402 tms9914_return_to_local(board, &priv->tms9914_priv); 403 403 } 404 404 405 - gpib_interface_t hp_82341_unaccel_interface = { 406 - name: "hp_82341_unaccel", 407 - attach : hp_82341_attach, 408 - detach : hp_82341_detach, 409 - read : hp_82341_read, 410 - write : hp_82341_write, 411 - command : hp_82341_command, 412 - request_system_control : hp_82341_request_system_control, 413 - take_control : hp_82341_take_control, 414 - go_to_standby : hp_82341_go_to_standby, 415 - interface_clear : hp_82341_interface_clear, 416 - remote_enable : hp_82341_remote_enable, 417 - enable_eos : hp_82341_enable_eos, 418 - disable_eos : hp_82341_disable_eos, 419 - parallel_poll : hp_82341_parallel_poll, 420 - parallel_poll_configure : hp_82341_parallel_poll_configure, 421 - parallel_poll_response : hp_82341_parallel_poll_response, 422 - local_parallel_poll_mode : NULL, // XXX 423 - line_status : hp_82341_line_status, 424 - update_status : hp_82341_update_status, 425 - primary_address : hp_82341_primary_address, 426 - secondary_address : hp_82341_secondary_address, 427 - serial_poll_response : hp_82341_serial_poll_response, 428 - serial_poll_status : hp_82341_serial_poll_status, 429 - t1_delay : hp_82341_t1_delay, 430 - return_to_local : hp_82341_return_to_local, 405 + static gpib_interface_t hp_82341_unaccel_interface = { 406 + .name = "hp_82341_unaccel", 407 + .attach = hp_82341_attach, 408 + .detach = hp_82341_detach, 409 + .read = hp_82341_read, 410 + .write = hp_82341_write, 411 + .command = hp_82341_command, 412 + .request_system_control = hp_82341_request_system_control, 413 + .take_control = hp_82341_take_control, 414 + .go_to_standby = hp_82341_go_to_standby, 415 + .interface_clear = hp_82341_interface_clear, 416 + .remote_enable = hp_82341_remote_enable, 417 + .enable_eos = hp_82341_enable_eos, 418 + .disable_eos = hp_82341_disable_eos, 419 + .parallel_poll = hp_82341_parallel_poll, 420 + .parallel_poll_configure = hp_82341_parallel_poll_configure, 421 + .parallel_poll_response = hp_82341_parallel_poll_response, 422 + .local_parallel_poll_mode = NULL, // XXX 423 + .line_status = hp_82341_line_status, 424 + .update_status = hp_82341_update_status, 425 + .primary_address = hp_82341_primary_address, 426 + .secondary_address = hp_82341_secondary_address, 427 + .serial_poll_response = hp_82341_serial_poll_response, 428 + .serial_poll_status = hp_82341_serial_poll_status, 429 + .t1_delay = hp_82341_t1_delay, 430 + .return_to_local = hp_82341_return_to_local, 431 431 }; 432 432 433 - gpib_interface_t hp_82341_interface = { 434 - name: "hp_82341", 435 - attach : hp_82341_attach, 436 - detach : hp_82341_detach, 437 - read : hp_82341_accel_read, 438 - write : hp_82341_accel_write, 439 - command : hp_82341_command, 440 - request_system_control : hp_82341_request_system_control, 441 - take_control : hp_82341_take_control, 442 - go_to_standby : hp_82341_go_to_standby, 443 - interface_clear : hp_82341_interface_clear, 444 - remote_enable : hp_82341_remote_enable, 445 - enable_eos : hp_82341_enable_eos, 446 - disable_eos : hp_82341_disable_eos, 447 - parallel_poll : hp_82341_parallel_poll, 448 - parallel_poll_configure : hp_82341_parallel_poll_configure, 449 - parallel_poll_response : hp_82341_parallel_poll_response, 450 - local_parallel_poll_mode : NULL, // XXX 451 - line_status : hp_82341_line_status, 452 - update_status : hp_82341_update_status, 453 - primary_address : hp_82341_primary_address, 454 - secondary_address : hp_82341_secondary_address, 455 - serial_poll_response : hp_82341_serial_poll_response, 456 - t1_delay : hp_82341_t1_delay, 457 - return_to_local : hp_82341_return_to_local, 433 + static gpib_interface_t hp_82341_interface = { 434 + .name = "hp_82341", 435 + .attach = hp_82341_attach, 436 + .detach = hp_82341_detach, 437 + .read = hp_82341_accel_read, 438 + .write = hp_82341_accel_write, 439 + .command = hp_82341_command, 440 + .request_system_control = hp_82341_request_system_control, 441 + .take_control = hp_82341_take_control, 442 + .go_to_standby = hp_82341_go_to_standby, 443 + .interface_clear = hp_82341_interface_clear, 444 + .remote_enable = hp_82341_remote_enable, 445 + .enable_eos = hp_82341_enable_eos, 446 + .disable_eos = hp_82341_disable_eos, 447 + .parallel_poll = hp_82341_parallel_poll, 448 + .parallel_poll_configure = hp_82341_parallel_poll_configure, 449 + .parallel_poll_response = hp_82341_parallel_poll_response, 450 + .local_parallel_poll_mode = NULL, // XXX 451 + .line_status = hp_82341_line_status, 452 + .update_status = hp_82341_update_status, 453 + .primary_address = hp_82341_primary_address, 454 + .secondary_address = hp_82341_secondary_address, 455 + .serial_poll_response = hp_82341_serial_poll_response, 456 + .t1_delay = hp_82341_t1_delay, 457 + .return_to_local = hp_82341_return_to_local, 458 458 }; 459 459 460 460 int hp_82341_allocate_private(gpib_board_t *board) ··· 807 807 808 808 static int __init hp_82341_init_module(void) 809 809 { 810 - gpib_register_driver(&hp_82341_unaccel_interface, THIS_MODULE); 811 - gpib_register_driver(&hp_82341_interface, THIS_MODULE); 810 + int ret; 811 + 812 + ret = gpib_register_driver(&hp_82341_unaccel_interface, THIS_MODULE); 813 + if (ret) { 814 + pr_err("hp_82341: gpib_register_driver failed: error = %d\n", ret); 815 + return ret; 816 + } 817 + 818 + ret = gpib_register_driver(&hp_82341_interface, THIS_MODULE); 819 + if (ret) { 820 + pr_err("hp_82341: gpib_register_driver failed: error = %d\n", ret); 821 + gpib_unregister_driver(&hp_82341_unaccel_interface); 822 + return ret; 823 + } 824 + 812 825 return 0; 813 826 } 814 827
-2
drivers/staging/gpib/hp_82341/hp_82341.h
··· 26 26 enum hp_82341_hardware_version hw_version; 27 27 }; 28 28 29 - // interfaces 30 - extern gpib_interface_t hp_82341_interface; 31 29 32 30 // interface functions 33 31 int hp_82341_accel_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end,
+1 -1
drivers/staging/gpib/include/amcc5920.h
··· 22 22 23 23 static inline uint32_t amcc_wait_state_bits(unsigned int region, unsigned int num_wait_states) 24 24 { 25 - return (num_wait_states & 0x7) << (-region * bits_per_region); 25 + return (num_wait_states & 0x7) << (--region * bits_per_region); 26 26 }; 27 27 28 28 enum amcc_prefetch_bits {
+1 -1
drivers/staging/gpib/include/gpibP.h
··· 18 18 #include <linux/interrupt.h> 19 19 #include <linux/io.h> 20 20 21 - void gpib_register_driver(gpib_interface_t *interface, struct module *mod); 21 + int gpib_register_driver(gpib_interface_t *interface, struct module *mod); 22 22 void gpib_unregister_driver(gpib_interface_t *interface); 23 23 struct pci_dev *gpib_pci_get_device(const gpib_board_config_t *config, unsigned int vendor_id, 24 24 unsigned int device_id, struct pci_dev *from);
-7
drivers/staging/gpib/ines/ines.h
··· 35 35 u8 extend_mode_bits; 36 36 }; 37 37 38 - // interfaces 39 - extern gpib_interface_t ines_pci_interface; 40 - extern gpib_interface_t ines_pci_accel_interface; 41 - extern gpib_interface_t ines_pcmcia_interface; 42 - extern gpib_interface_t ines_pcmcia_accel_interface; 43 - extern gpib_interface_t ines_pcmcia_unaccel_interface; 44 - 45 38 // interface functions 46 39 int ines_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end, size_t *bytes_read); 47 40 int ines_write(gpib_board_t *board, uint8_t *buffer, size_t length,
+288 -236
drivers/staging/gpib/ines/ines_gpib.c
··· 357 357 enum ines_pci_chip pci_chip_type; 358 358 }; 359 359 360 - struct ines_pci_id pci_ids[] = { 361 - {vendor_id: PCI_VENDOR_ID_PLX, 362 - device_id : PCI_DEVICE_ID_PLX_9050, 363 - subsystem_vendor_id : PCI_VENDOR_ID_PLX, 364 - subsystem_device_id : PCI_SUBDEVICE_ID_INES_GPIB, 365 - gpib_region : 2, 366 - io_offset : 1, 367 - pci_chip_type : PCI_CHIP_PLX9050, 360 + static struct ines_pci_id pci_ids[] = { 361 + {.vendor_id = PCI_VENDOR_ID_PLX, 362 + .device_id = PCI_DEVICE_ID_PLX_9050, 363 + .subsystem_vendor_id = PCI_VENDOR_ID_PLX, 364 + .subsystem_device_id = PCI_SUBDEVICE_ID_INES_GPIB, 365 + .gpib_region = 2, 366 + .io_offset = 1, 367 + .pci_chip_type = PCI_CHIP_PLX9050, 368 368 }, 369 - {vendor_id: PCI_VENDOR_ID_AMCC, 370 - device_id : PCI_DEVICE_ID_INES_GPIB_AMCC, 371 - subsystem_vendor_id : PCI_VENDOR_ID_AMCC, 372 - subsystem_device_id : PCI_SUBDEVICE_ID_INES_GPIB, 373 - gpib_region : 1, 374 - io_offset : 1, 375 - pci_chip_type : PCI_CHIP_AMCC5920, 369 + {.vendor_id = PCI_VENDOR_ID_AMCC, 370 + .device_id = PCI_DEVICE_ID_INES_GPIB_AMCC, 371 + .subsystem_vendor_id = PCI_VENDOR_ID_AMCC, 372 + .subsystem_device_id = PCI_SUBDEVICE_ID_INES_GPIB, 373 + .gpib_region = 1, 374 + .io_offset = 1, 375 + .pci_chip_type = PCI_CHIP_AMCC5920, 376 376 }, 377 - {vendor_id: PCI_VENDOR_ID_INES_QUICKLOGIC, 378 - device_id : PCI_DEVICE_ID_INES_GPIB_QL5030, 379 - subsystem_vendor_id : PCI_VENDOR_ID_INES_QUICKLOGIC, 380 - subsystem_device_id : PCI_DEVICE_ID_INES_GPIB_QL5030, 381 - gpib_region : 1, 382 - io_offset : 1, 383 - pci_chip_type : PCI_CHIP_QUICKLOGIC5030, 377 + {.vendor_id = PCI_VENDOR_ID_INES_QUICKLOGIC, 378 + .device_id = PCI_DEVICE_ID_INES_GPIB_QL5030, 379 + .subsystem_vendor_id = PCI_VENDOR_ID_INES_QUICKLOGIC, 380 + .subsystem_device_id = PCI_DEVICE_ID_INES_GPIB_QL5030, 381 + .gpib_region = 1, 382 + .io_offset = 1, 383 + .pci_chip_type = PCI_CHIP_QUICKLOGIC5030, 384 384 }, 385 - {vendor_id: PCI_VENDOR_ID_QUANCOM, 386 - device_id : PCI_DEVICE_ID_QUANCOM_GPIB, 387 - subsystem_vendor_id : -1, 388 - subsystem_device_id : -1, 389 - gpib_region : 0, 390 - io_offset : 4, 391 - pci_chip_type : PCI_CHIP_QUANCOM, 385 + {.vendor_id = PCI_VENDOR_ID_QUANCOM, 386 + .device_id = PCI_DEVICE_ID_QUANCOM_GPIB, 387 + .subsystem_vendor_id = -1, 388 + .subsystem_device_id = -1, 389 + .gpib_region = 0, 390 + .io_offset = 4, 391 + .pci_chip_type = PCI_CHIP_QUANCOM, 392 392 }, 393 393 }; 394 394 ··· 540 540 nec7210_return_to_local(board, &priv->nec7210_priv); 541 541 } 542 542 543 - gpib_interface_t ines_pci_unaccel_interface = { 544 - name: "ines_pci_unaccel", 545 - attach : ines_pci_attach, 546 - detach : ines_pci_detach, 547 - read : ines_read, 548 - write : ines_write, 549 - command : ines_command, 550 - take_control : ines_take_control, 551 - go_to_standby : ines_go_to_standby, 552 - request_system_control : ines_request_system_control, 553 - interface_clear : ines_interface_clear, 554 - remote_enable : ines_remote_enable, 555 - enable_eos : ines_enable_eos, 556 - disable_eos : ines_disable_eos, 557 - parallel_poll : ines_parallel_poll, 558 - parallel_poll_configure : ines_parallel_poll_configure, 559 - parallel_poll_response : ines_parallel_poll_response, 560 - local_parallel_poll_mode : NULL, // XXX 561 - line_status : ines_line_status, 562 - update_status : ines_update_status, 563 - primary_address : ines_primary_address, 564 - secondary_address : ines_secondary_address, 565 - serial_poll_response : ines_serial_poll_response, 566 - serial_poll_status : ines_serial_poll_status, 567 - t1_delay : ines_t1_delay, 568 - return_to_local : ines_return_to_local, 543 + static gpib_interface_t ines_pci_unaccel_interface = { 544 + .name = "ines_pci_unaccel", 545 + .attach = ines_pci_attach, 546 + .detach = ines_pci_detach, 547 + .read = ines_read, 548 + .write = ines_write, 549 + .command = ines_command, 550 + .take_control = ines_take_control, 551 + .go_to_standby = ines_go_to_standby, 552 + .request_system_control = ines_request_system_control, 553 + .interface_clear = ines_interface_clear, 554 + .remote_enable = ines_remote_enable, 555 + .enable_eos = ines_enable_eos, 556 + .disable_eos = ines_disable_eos, 557 + .parallel_poll = ines_parallel_poll, 558 + .parallel_poll_configure = ines_parallel_poll_configure, 559 + .parallel_poll_response = ines_parallel_poll_response, 560 + .local_parallel_poll_mode = NULL, // XXX 561 + .line_status = ines_line_status, 562 + .update_status = ines_update_status, 563 + .primary_address = ines_primary_address, 564 + .secondary_address = ines_secondary_address, 565 + .serial_poll_response = ines_serial_poll_response, 566 + .serial_poll_status = ines_serial_poll_status, 567 + .t1_delay = ines_t1_delay, 568 + .return_to_local = ines_return_to_local, 569 569 }; 570 570 571 - gpib_interface_t ines_pci_interface = { 572 - name: "ines_pci", 573 - attach : ines_pci_accel_attach, 574 - detach : ines_pci_detach, 575 - read : ines_accel_read, 576 - write : ines_accel_write, 577 - command : ines_command, 578 - take_control : ines_take_control, 579 - go_to_standby : ines_go_to_standby, 580 - request_system_control : ines_request_system_control, 581 - interface_clear : ines_interface_clear, 582 - remote_enable : ines_remote_enable, 583 - enable_eos : ines_enable_eos, 584 - disable_eos : ines_disable_eos, 585 - parallel_poll : ines_parallel_poll, 586 - parallel_poll_configure : ines_parallel_poll_configure, 587 - parallel_poll_response : ines_parallel_poll_response, 588 - local_parallel_poll_mode : NULL, // XXX 589 - line_status : ines_line_status, 590 - update_status : ines_update_status, 591 - primary_address : ines_primary_address, 592 - secondary_address : ines_secondary_address, 593 - serial_poll_response : ines_serial_poll_response, 594 - serial_poll_status : ines_serial_poll_status, 595 - t1_delay : ines_t1_delay, 596 - return_to_local : ines_return_to_local, 571 + static gpib_interface_t ines_pci_interface = { 572 + .name = "ines_pci", 573 + .attach = ines_pci_accel_attach, 574 + .detach = ines_pci_detach, 575 + .read = ines_accel_read, 576 + .write = ines_accel_write, 577 + .command = ines_command, 578 + .take_control = ines_take_control, 579 + .go_to_standby = ines_go_to_standby, 580 + .request_system_control = ines_request_system_control, 581 + .interface_clear = ines_interface_clear, 582 + .remote_enable = ines_remote_enable, 583 + .enable_eos = ines_enable_eos, 584 + .disable_eos = ines_disable_eos, 585 + .parallel_poll = ines_parallel_poll, 586 + .parallel_poll_configure = ines_parallel_poll_configure, 587 + .parallel_poll_response = ines_parallel_poll_response, 588 + .local_parallel_poll_mode = NULL, // XXX 589 + .line_status = ines_line_status, 590 + .update_status = ines_update_status, 591 + .primary_address = ines_primary_address, 592 + .secondary_address = ines_secondary_address, 593 + .serial_poll_response = ines_serial_poll_response, 594 + .serial_poll_status = ines_serial_poll_status, 595 + .t1_delay = ines_t1_delay, 596 + .return_to_local = ines_return_to_local, 597 597 }; 598 598 599 - gpib_interface_t ines_pci_accel_interface = { 600 - name: "ines_pci_accel", 601 - attach : ines_pci_accel_attach, 602 - detach : ines_pci_detach, 603 - read : ines_accel_read, 604 - write : ines_accel_write, 605 - command : ines_command, 606 - take_control : ines_take_control, 607 - go_to_standby : ines_go_to_standby, 608 - request_system_control : ines_request_system_control, 609 - interface_clear : ines_interface_clear, 610 - remote_enable : ines_remote_enable, 611 - enable_eos : ines_enable_eos, 612 - disable_eos : ines_disable_eos, 613 - parallel_poll : ines_parallel_poll, 614 - parallel_poll_configure : ines_parallel_poll_configure, 615 - parallel_poll_response : ines_parallel_poll_response, 616 - local_parallel_poll_mode : NULL, // XXX 617 - line_status : ines_line_status, 618 - update_status : ines_update_status, 619 - primary_address : ines_primary_address, 620 - secondary_address : ines_secondary_address, 621 - serial_poll_response : ines_serial_poll_response, 622 - serial_poll_status : ines_serial_poll_status, 623 - t1_delay : ines_t1_delay, 624 - return_to_local : ines_return_to_local, 599 + static gpib_interface_t ines_pci_accel_interface = { 600 + .name = "ines_pci_accel", 601 + .attach = ines_pci_accel_attach, 602 + .detach = ines_pci_detach, 603 + .read = ines_accel_read, 604 + .write = ines_accel_write, 605 + .command = ines_command, 606 + .take_control = ines_take_control, 607 + .go_to_standby = ines_go_to_standby, 608 + .request_system_control = ines_request_system_control, 609 + .interface_clear = ines_interface_clear, 610 + .remote_enable = ines_remote_enable, 611 + .enable_eos = ines_enable_eos, 612 + .disable_eos = ines_disable_eos, 613 + .parallel_poll = ines_parallel_poll, 614 + .parallel_poll_configure = ines_parallel_poll_configure, 615 + .parallel_poll_response = ines_parallel_poll_response, 616 + .local_parallel_poll_mode = NULL, // XXX 617 + .line_status = ines_line_status, 618 + .update_status = ines_update_status, 619 + .primary_address = ines_primary_address, 620 + .secondary_address = ines_secondary_address, 621 + .serial_poll_response = ines_serial_poll_response, 622 + .serial_poll_status = ines_serial_poll_status, 623 + .t1_delay = ines_t1_delay, 624 + .return_to_local = ines_return_to_local, 625 625 }; 626 626 627 - gpib_interface_t ines_isa_interface = { 628 - name: "ines_isa", 629 - attach : ines_isa_attach, 630 - detach : ines_isa_detach, 631 - read : ines_accel_read, 632 - write : ines_accel_write, 633 - command : ines_command, 634 - take_control : ines_take_control, 635 - go_to_standby : ines_go_to_standby, 636 - request_system_control : ines_request_system_control, 637 - interface_clear : ines_interface_clear, 638 - remote_enable : ines_remote_enable, 639 - enable_eos : ines_enable_eos, 640 - disable_eos : ines_disable_eos, 641 - parallel_poll : ines_parallel_poll, 642 - parallel_poll_configure : ines_parallel_poll_configure, 643 - parallel_poll_response : ines_parallel_poll_response, 644 - local_parallel_poll_mode : NULL, // XXX 645 - line_status : ines_line_status, 646 - update_status : ines_update_status, 647 - primary_address : ines_primary_address, 648 - secondary_address : ines_secondary_address, 649 - serial_poll_response : ines_serial_poll_response, 650 - serial_poll_status : ines_serial_poll_status, 651 - t1_delay : ines_t1_delay, 652 - return_to_local : ines_return_to_local, 627 + static gpib_interface_t ines_isa_interface = { 628 + .name = "ines_isa", 629 + .attach = ines_isa_attach, 630 + .detach = ines_isa_detach, 631 + .read = ines_accel_read, 632 + .write = ines_accel_write, 633 + .command = ines_command, 634 + .take_control = ines_take_control, 635 + .go_to_standby = ines_go_to_standby, 636 + .request_system_control = ines_request_system_control, 637 + .interface_clear = ines_interface_clear, 638 + .remote_enable = ines_remote_enable, 639 + .enable_eos = ines_enable_eos, 640 + .disable_eos = ines_disable_eos, 641 + .parallel_poll = ines_parallel_poll, 642 + .parallel_poll_configure = ines_parallel_poll_configure, 643 + .parallel_poll_response = ines_parallel_poll_response, 644 + .local_parallel_poll_mode = NULL, // XXX 645 + .line_status = ines_line_status, 646 + .update_status = ines_update_status, 647 + .primary_address = ines_primary_address, 648 + .secondary_address = ines_secondary_address, 649 + .serial_poll_response = ines_serial_poll_response, 650 + .serial_poll_status = ines_serial_poll_status, 651 + .t1_delay = ines_t1_delay, 652 + .return_to_local = ines_return_to_local, 653 653 }; 654 654 655 655 static int ines_allocate_private(gpib_board_t *board) ··· 1122 1122 { 1123 1123 struct local_info *dev; 1124 1124 int retval; 1125 - void *virt; 1125 + void __iomem *virt; 1126 1126 1127 1127 dev = link->priv; 1128 1128 DEBUG(0, "%s(0x%p)\n", __func__, link); ··· 1156 1156 } 1157 1157 virt = ioremap(link->resource[2]->start, resource_size(link->resource[2])); 1158 1158 writeb((link->resource[2]->start >> 2) & 0xff, virt + 0xf0); // IOWindow base 1159 - iounmap((void *)virt); 1159 + iounmap(virt); 1160 1160 1161 1161 /* 1162 1162 * This actually configures the PCMCIA socket -- setting up ··· 1227 1227 .resume = ines_gpib_resume, 1228 1228 }; 1229 1229 1230 - int ines_pcmcia_init_module(void) 1231 - { 1232 - pcmcia_register_driver(&ines_gpib_cs_driver); 1233 - return 0; 1234 - } 1235 - 1236 1230 void ines_pcmcia_cleanup_module(void) 1237 1231 { 1238 1232 DEBUG(0, "ines_cs: unloading\n"); 1239 1233 pcmcia_unregister_driver(&ines_gpib_cs_driver); 1240 1234 } 1241 1235 1242 - gpib_interface_t ines_pcmcia_unaccel_interface = { 1243 - name: "ines_pcmcia_unaccel", 1244 - attach : ines_pcmcia_attach, 1245 - detach : ines_pcmcia_detach, 1246 - read : ines_read, 1247 - write : ines_write, 1248 - command : ines_command, 1249 - take_control : ines_take_control, 1250 - go_to_standby : ines_go_to_standby, 1251 - request_system_control : ines_request_system_control, 1252 - interface_clear : ines_interface_clear, 1253 - remote_enable : ines_remote_enable, 1254 - enable_eos : ines_enable_eos, 1255 - disable_eos : ines_disable_eos, 1256 - parallel_poll : ines_parallel_poll, 1257 - parallel_poll_configure : ines_parallel_poll_configure, 1258 - parallel_poll_response : ines_parallel_poll_response, 1259 - local_parallel_poll_mode : NULL, // XXX 1260 - line_status : ines_line_status, 1261 - update_status : ines_update_status, 1262 - primary_address : ines_primary_address, 1263 - secondary_address : ines_secondary_address, 1264 - serial_poll_response : ines_serial_poll_response, 1265 - serial_poll_status : ines_serial_poll_status, 1266 - t1_delay : ines_t1_delay, 1267 - return_to_local : ines_return_to_local, 1236 + static gpib_interface_t ines_pcmcia_unaccel_interface = { 1237 + .name = "ines_pcmcia_unaccel", 1238 + .attach = ines_pcmcia_attach, 1239 + .detach = ines_pcmcia_detach, 1240 + .read = ines_read, 1241 + .write = ines_write, 1242 + .command = ines_command, 1243 + .take_control = ines_take_control, 1244 + .go_to_standby = ines_go_to_standby, 1245 + .request_system_control = ines_request_system_control, 1246 + .interface_clear = ines_interface_clear, 1247 + .remote_enable = ines_remote_enable, 1248 + .enable_eos = ines_enable_eos, 1249 + .disable_eos = ines_disable_eos, 1250 + .parallel_poll = ines_parallel_poll, 1251 + .parallel_poll_configure = ines_parallel_poll_configure, 1252 + .parallel_poll_response = ines_parallel_poll_response, 1253 + .local_parallel_poll_mode = NULL, // XXX 1254 + .line_status = ines_line_status, 1255 + .update_status = ines_update_status, 1256 + .primary_address = ines_primary_address, 1257 + .secondary_address = ines_secondary_address, 1258 + .serial_poll_response = ines_serial_poll_response, 1259 + .serial_poll_status = ines_serial_poll_status, 1260 + .t1_delay = ines_t1_delay, 1261 + .return_to_local = ines_return_to_local, 1268 1262 }; 1269 1263 1270 - gpib_interface_t ines_pcmcia_accel_interface = { 1271 - name: "ines_pcmcia_accel", 1272 - attach : ines_pcmcia_accel_attach, 1273 - detach : ines_pcmcia_detach, 1274 - read : ines_accel_read, 1275 - write : ines_accel_write, 1276 - command : ines_command, 1277 - take_control : ines_take_control, 1278 - go_to_standby : ines_go_to_standby, 1279 - request_system_control : ines_request_system_control, 1280 - interface_clear : ines_interface_clear, 1281 - remote_enable : ines_remote_enable, 1282 - enable_eos : ines_enable_eos, 1283 - disable_eos : ines_disable_eos, 1284 - parallel_poll : ines_parallel_poll, 1285 - parallel_poll_configure : ines_parallel_poll_configure, 1286 - parallel_poll_response : ines_parallel_poll_response, 1287 - local_parallel_poll_mode : NULL, // XXX 1288 - line_status : ines_line_status, 1289 - update_status : ines_update_status, 1290 - primary_address : ines_primary_address, 1291 - secondary_address : ines_secondary_address, 1292 - serial_poll_response : ines_serial_poll_response, 1293 - serial_poll_status : ines_serial_poll_status, 1294 - t1_delay : ines_t1_delay, 1295 - return_to_local : ines_return_to_local, 1264 + static gpib_interface_t ines_pcmcia_accel_interface = { 1265 + .name = "ines_pcmcia_accel", 1266 + .attach = ines_pcmcia_accel_attach, 1267 + .detach = ines_pcmcia_detach, 1268 + .read = ines_accel_read, 1269 + .write = ines_accel_write, 1270 + .command = ines_command, 1271 + .take_control = ines_take_control, 1272 + .go_to_standby = ines_go_to_standby, 1273 + .request_system_control = ines_request_system_control, 1274 + .interface_clear = ines_interface_clear, 1275 + .remote_enable = ines_remote_enable, 1276 + .enable_eos = ines_enable_eos, 1277 + .disable_eos = ines_disable_eos, 1278 + .parallel_poll = ines_parallel_poll, 1279 + .parallel_poll_configure = ines_parallel_poll_configure, 1280 + .parallel_poll_response = ines_parallel_poll_response, 1281 + .local_parallel_poll_mode = NULL, // XXX 1282 + .line_status = ines_line_status, 1283 + .update_status = ines_update_status, 1284 + .primary_address = ines_primary_address, 1285 + .secondary_address = ines_secondary_address, 1286 + .serial_poll_response = ines_serial_poll_response, 1287 + .serial_poll_status = ines_serial_poll_status, 1288 + .t1_delay = ines_t1_delay, 1289 + .return_to_local = ines_return_to_local, 1296 1290 }; 1297 1291 1298 - gpib_interface_t ines_pcmcia_interface = { 1299 - name: "ines_pcmcia", 1300 - attach : ines_pcmcia_accel_attach, 1301 - detach : ines_pcmcia_detach, 1302 - read : ines_accel_read, 1303 - write : ines_accel_write, 1304 - command : ines_command, 1305 - take_control : ines_take_control, 1306 - go_to_standby : ines_go_to_standby, 1307 - request_system_control : ines_request_system_control, 1308 - interface_clear : ines_interface_clear, 1309 - remote_enable : ines_remote_enable, 1310 - enable_eos : ines_enable_eos, 1311 - disable_eos : ines_disable_eos, 1312 - parallel_poll : ines_parallel_poll, 1313 - parallel_poll_configure : ines_parallel_poll_configure, 1314 - parallel_poll_response : ines_parallel_poll_response, 1315 - local_parallel_poll_mode : NULL, // XXX 1316 - line_status : ines_line_status, 1317 - update_status : ines_update_status, 1318 - primary_address : ines_primary_address, 1319 - secondary_address : ines_secondary_address, 1320 - serial_poll_response : ines_serial_poll_response, 1321 - serial_poll_status : ines_serial_poll_status, 1322 - t1_delay : ines_t1_delay, 1323 - return_to_local : ines_return_to_local, 1292 + static gpib_interface_t ines_pcmcia_interface = { 1293 + .name = "ines_pcmcia", 1294 + .attach = ines_pcmcia_accel_attach, 1295 + .detach = ines_pcmcia_detach, 1296 + .read = ines_accel_read, 1297 + .write = ines_accel_write, 1298 + .command = ines_command, 1299 + .take_control = ines_take_control, 1300 + .go_to_standby = ines_go_to_standby, 1301 + .request_system_control = ines_request_system_control, 1302 + .interface_clear = ines_interface_clear, 1303 + .remote_enable = ines_remote_enable, 1304 + .enable_eos = ines_enable_eos, 1305 + .disable_eos = ines_disable_eos, 1306 + .parallel_poll = ines_parallel_poll, 1307 + .parallel_poll_configure = ines_parallel_poll_configure, 1308 + .parallel_poll_response = ines_parallel_poll_response, 1309 + .local_parallel_poll_mode = NULL, // XXX 1310 + .line_status = ines_line_status, 1311 + .update_status = ines_update_status, 1312 + .primary_address = ines_primary_address, 1313 + .secondary_address = ines_secondary_address, 1314 + .serial_poll_response = ines_serial_poll_response, 1315 + .serial_poll_status = ines_serial_poll_status, 1316 + .t1_delay = ines_t1_delay, 1317 + .return_to_local = ines_return_to_local, 1324 1318 }; 1325 1319 1326 1320 irqreturn_t ines_pcmcia_interrupt(int irq, void *arg) ··· 1342 1348 ines_priv = board->private_data; 1343 1349 nec_priv = &ines_priv->nec7210_priv; 1344 1350 1345 - if (request_region(curr_dev->resource[0]->start, 1346 - resource_size(curr_dev->resource[0]), "ines_gpib") == 0) { 1351 + if (!request_region(curr_dev->resource[0]->start, 1352 + resource_size(curr_dev->resource[0]), "ines_gpib")) { 1347 1353 pr_err("ines_gpib: ioports at 0x%lx already in use\n", 1348 1354 (unsigned long)(curr_dev->resource[0]->start)); 1349 1355 return -1; ··· 1414 1420 1415 1421 static int __init ines_init_module(void) 1416 1422 { 1417 - int err = 0; 1423 + int ret; 1418 1424 1419 - err = pci_register_driver(&ines_pci_driver); 1420 - if (err) { 1421 - pr_err("ines_gpib: pci_driver_register failed!\n"); 1422 - return err; 1425 + ret = pci_register_driver(&ines_pci_driver); 1426 + if (ret) { 1427 + pr_err("ines_gpib: pci_register_driver failed: error = %d\n", ret); 1428 + return ret; 1423 1429 } 1424 1430 1425 - gpib_register_driver(&ines_pci_interface, THIS_MODULE); 1426 - gpib_register_driver(&ines_pci_unaccel_interface, THIS_MODULE); 1427 - gpib_register_driver(&ines_pci_accel_interface, THIS_MODULE); 1428 - gpib_register_driver(&ines_isa_interface, THIS_MODULE); 1431 + ret = gpib_register_driver(&ines_pci_interface, THIS_MODULE); 1432 + if (ret) { 1433 + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); 1434 + goto err_pci; 1435 + } 1436 + 1437 + ret = gpib_register_driver(&ines_pci_unaccel_interface, THIS_MODULE); 1438 + if (ret) { 1439 + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); 1440 + goto err_pci_unaccel; 1441 + } 1442 + 1443 + ret = gpib_register_driver(&ines_pci_accel_interface, THIS_MODULE); 1444 + if (ret) { 1445 + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); 1446 + goto err_pci_accel; 1447 + } 1448 + 1449 + ret = gpib_register_driver(&ines_isa_interface, THIS_MODULE); 1450 + if (ret) { 1451 + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); 1452 + goto err_isa; 1453 + } 1454 + 1429 1455 #ifdef GPIB_PCMCIA 1430 - gpib_register_driver(&ines_pcmcia_interface, THIS_MODULE); 1431 - gpib_register_driver(&ines_pcmcia_unaccel_interface, THIS_MODULE); 1432 - gpib_register_driver(&ines_pcmcia_accel_interface, THIS_MODULE); 1433 - err += ines_pcmcia_init_module(); 1456 + ret = gpib_register_driver(&ines_pcmcia_interface, THIS_MODULE); 1457 + if (ret) { 1458 + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); 1459 + goto err_pcmcia; 1460 + } 1461 + 1462 + ret = gpib_register_driver(&ines_pcmcia_unaccel_interface, THIS_MODULE); 1463 + if (ret) { 1464 + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); 1465 + goto err_pcmcia_unaccel; 1466 + } 1467 + 1468 + ret = gpib_register_driver(&ines_pcmcia_accel_interface, THIS_MODULE); 1469 + if (ret) { 1470 + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); 1471 + goto err_pcmcia_accel; 1472 + } 1473 + 1474 + ret = pcmcia_register_driver(&ines_gpib_cs_driver); 1475 + if (ret) { 1476 + pr_err("ines_gpib: pcmcia_register_driver failed: error = %d\n", ret); 1477 + goto err_pcmcia_driver; 1478 + } 1434 1479 #endif 1435 - if (err) 1436 - return -1; 1437 1480 1438 1481 return 0; 1482 + 1483 + #ifdef GPIB_PCMCIA 1484 + err_pcmcia_driver: 1485 + gpib_unregister_driver(&ines_pcmcia_accel_interface); 1486 + err_pcmcia_accel: 1487 + gpib_unregister_driver(&ines_pcmcia_unaccel_interface); 1488 + err_pcmcia_unaccel: 1489 + gpib_unregister_driver(&ines_pcmcia_interface); 1490 + err_pcmcia: 1491 + #endif 1492 + gpib_unregister_driver(&ines_isa_interface); 1493 + err_isa: 1494 + gpib_unregister_driver(&ines_pci_accel_interface); 1495 + err_pci_accel: 1496 + gpib_unregister_driver(&ines_pci_unaccel_interface); 1497 + err_pci_unaccel: 1498 + gpib_unregister_driver(&ines_pci_interface); 1499 + err_pci: 1500 + pci_unregister_driver(&ines_pci_driver); 1501 + 1502 + return ret; 1439 1503 } 1440 1504 1441 1505 static void __exit ines_exit_module(void)
+34 -32
drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
··· 10 10 11 11 /* base module includes */ 12 12 13 - #include <linux/version.h> 14 13 #include <linux/module.h> 15 14 #include <linux/sched.h> 16 15 #include <linux/init.h> ··· 24 25 #include <linux/timer.h> 25 26 #include <linux/delay.h> 26 27 #include <linux/sched/signal.h> 27 - #include <linux/uaccess.h> 28 28 #include <linux/usb.h> 29 29 30 30 #include "gpibP.h" ··· 1131 1133 * *** module dispatch table and init/exit functions *** 1132 1134 */ 1133 1135 1134 - gpib_interface_t usb_gpib_interface = { 1135 - name: NAME, 1136 - attach : usb_gpib_attach, 1137 - detach : usb_gpib_detach, 1138 - read : usb_gpib_read, 1139 - write : usb_gpib_write, 1140 - command : usb_gpib_command, 1141 - take_control : usb_gpib_take_control, 1142 - go_to_standby : usb_gpib_go_to_standby, 1143 - request_system_control : usb_gpib_request_system_control, 1144 - interface_clear : usb_gpib_interface_clear, 1145 - remote_enable : usb_gpib_remote_enable, 1146 - enable_eos : usb_gpib_enable_eos, 1147 - disable_eos : usb_gpib_disable_eos, 1148 - parallel_poll : usb_gpib_parallel_poll, 1149 - parallel_poll_configure : usb_gpib_parallel_poll_configure, 1150 - parallel_poll_response : usb_gpib_parallel_poll_response, 1151 - local_parallel_poll_mode : NULL, // XXX 1152 - line_status : usb_gpib_line_status, 1153 - update_status : usb_gpib_update_status, 1154 - primary_address : usb_gpib_primary_address, 1155 - secondary_address : usb_gpib_secondary_address, 1156 - serial_poll_response : usb_gpib_serial_poll_response, 1157 - serial_poll_status : usb_gpib_serial_poll_status, 1158 - t1_delay : usb_gpib_t1_delay, 1159 - return_to_local : usb_gpib_return_to_local, 1160 - skip_check_for_command_acceptors : 1 1136 + static gpib_interface_t usb_gpib_interface = { 1137 + .name = NAME, 1138 + .attach = usb_gpib_attach, 1139 + .detach = usb_gpib_detach, 1140 + .read = usb_gpib_read, 1141 + .write = usb_gpib_write, 1142 + .command = usb_gpib_command, 1143 + .take_control = usb_gpib_take_control, 1144 + .go_to_standby = usb_gpib_go_to_standby, 1145 + .request_system_control = usb_gpib_request_system_control, 1146 + .interface_clear = usb_gpib_interface_clear, 1147 + .remote_enable = usb_gpib_remote_enable, 1148 + .enable_eos = usb_gpib_enable_eos, 1149 + .disable_eos = usb_gpib_disable_eos, 1150 + .parallel_poll = usb_gpib_parallel_poll, 1151 + .parallel_poll_configure = usb_gpib_parallel_poll_configure, 1152 + .parallel_poll_response = usb_gpib_parallel_poll_response, 1153 + .local_parallel_poll_mode = NULL, // XXX 1154 + .line_status = usb_gpib_line_status, 1155 + .update_status = usb_gpib_update_status, 1156 + .primary_address = usb_gpib_primary_address, 1157 + .secondary_address = usb_gpib_secondary_address, 1158 + .serial_poll_response = usb_gpib_serial_poll_response, 1159 + .serial_poll_status = usb_gpib_serial_poll_status, 1160 + .t1_delay = usb_gpib_t1_delay, 1161 + .return_to_local = usb_gpib_return_to_local, 1162 + .skip_check_for_command_acceptors = 1 1161 1163 }; 1162 1164 1163 1165 /* ··· 1179 1181 return rv; 1180 1182 1181 1183 if (!assigned_usb_minors) { 1182 - gpib_register_driver(&usb_gpib_interface, THIS_MODULE); 1184 + rv = gpib_register_driver(&usb_gpib_interface, THIS_MODULE); 1185 + if (rv) { 1186 + pr_err("lpvo_usb_gpib: gpib_register_driver failed: error = %d\n", rv); 1187 + goto exit; 1188 + } 1183 1189 } else { 1184 1190 /* check if minor is already registered - maybe useless, but if 1185 1191 * it happens the code is inconsistent somewhere ··· 1880 1878 * user space access to read function 1881 1879 */ 1882 1880 1883 - static ssize_t skel_read(struct file *file, char *buffer, size_t count, 1881 + static ssize_t skel_read(struct file *file, char __user *buffer, size_t count, 1884 1882 loff_t *ppos) 1885 1883 { 1886 1884 struct usb_skel *dev; ··· 1911 1909 * user space access to write function 1912 1910 */ 1913 1911 1914 - static ssize_t skel_write(struct file *file, const char *user_buffer, 1912 + static ssize_t skel_write(struct file *file, const char __user *user_buffer, 1915 1913 size_t count, loff_t *ppos) 1916 1914 { 1917 1915 struct usb_skel *dev;
+51 -38
drivers/staging/gpib/ni_usb/ni_usb_gpib.c
··· 85 85 86 86 // printk("debug: %s: status=0x%x, error_count=%i, actual_length=%i\n", __func__, 87 87 // urb->status, urb->error_count, urb->actual_length); 88 - up(&context->complete); 88 + complete(&context->complete); 89 89 } 90 90 91 91 static void ni_usb_timeout_handler(struct timer_list *t) ··· 94 94 struct ni_usb_urb_ctx *context = &ni_priv->context; 95 95 96 96 context->timed_out = 1; 97 - up(&context->complete); 97 + complete(&context->complete); 98 98 }; 99 99 100 100 // I'm using nonblocking loosely here, it only means -EAGAIN can be returned in certain cases ··· 124 124 } 125 125 usb_dev = interface_to_usbdev(ni_priv->bus_interface); 126 126 out_pipe = usb_sndbulkpipe(usb_dev, ni_priv->bulk_out_endpoint); 127 - sema_init(&context->complete, 0); 127 + init_completion(&context->complete); 128 128 context->timed_out = 0; 129 129 usb_fill_bulk_urb(ni_priv->bulk_urb, usb_dev, out_pipe, data, data_length, 130 130 &ni_usb_bulk_complete, context); ··· 143 143 return retval; 144 144 } 145 145 mutex_unlock(&ni_priv->bulk_transfer_lock); 146 - down(&context->complete); // wait for ni_usb_bulk_complete 146 + wait_for_completion(&context->complete); // wait for ni_usb_bulk_complete 147 147 if (context->timed_out) { 148 148 usb_kill_urb(ni_priv->bulk_urb); 149 149 dev_err(&usb_dev->dev, "%s: killed urb due to timeout\n", __func__); ··· 210 210 } 211 211 usb_dev = interface_to_usbdev(ni_priv->bus_interface); 212 212 in_pipe = usb_rcvbulkpipe(usb_dev, ni_priv->bulk_in_endpoint); 213 - sema_init(&context->complete, 0); 213 + init_completion(&context->complete); 214 214 context->timed_out = 0; 215 215 usb_fill_bulk_urb(ni_priv->bulk_urb, usb_dev, in_pipe, data, data_length, 216 216 &ni_usb_bulk_complete, context); ··· 231 231 } 232 232 mutex_unlock(&ni_priv->bulk_transfer_lock); 233 233 if (interruptible) { 234 - if (down_interruptible(&context->complete)) { 234 + if (wait_for_completion_interruptible(&context->complete)) { 235 235 /* If we got interrupted by a signal while 236 236 * waiting for the usb gpib to respond, we 237 237 * should send a stop command so it will ··· 243 243 /* now do an uninterruptible wait, it shouldn't take long 244 244 * for the board to respond now. 245 245 */ 246 - down(&context->complete); 246 + wait_for_completion(&context->complete); 247 247 } 248 248 } else { 249 - down(&context->complete); 249 + wait_for_completion(&context->complete); 250 250 } 251 251 if (context->timed_out) { 252 252 usb_kill_urb(ni_priv->bulk_urb); ··· 783 783 } 784 784 785 785 in_data = kmalloc(in_data_length, GFP_KERNEL); 786 - if (!in_data) 786 + if (!in_data) { 787 + mutex_unlock(&ni_priv->addressed_transfer_lock); 787 788 return -ENOMEM; 789 + } 788 790 retval = ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &usb_bytes_read, 789 791 ni_usb_timeout_msecs(board->usec_timeout), 1); 790 792 ··· 2353 2351 mutex_unlock(&ni_usb_hotplug_lock); 2354 2352 } 2355 2353 2356 - gpib_interface_t ni_usb_gpib_interface = { 2357 - name: "ni_usb_b", 2358 - attach : ni_usb_attach, 2359 - detach : ni_usb_detach, 2360 - read : ni_usb_read, 2361 - write : ni_usb_write, 2362 - command : ni_usb_command, 2363 - take_control : ni_usb_take_control, 2364 - go_to_standby : ni_usb_go_to_standby, 2365 - request_system_control : ni_usb_request_system_control, 2366 - interface_clear : ni_usb_interface_clear, 2367 - remote_enable : ni_usb_remote_enable, 2368 - enable_eos : ni_usb_enable_eos, 2369 - disable_eos : ni_usb_disable_eos, 2370 - parallel_poll : ni_usb_parallel_poll, 2371 - parallel_poll_configure : ni_usb_parallel_poll_configure, 2372 - parallel_poll_response : ni_usb_parallel_poll_response, 2373 - local_parallel_poll_mode : NULL, // XXX 2374 - line_status : ni_usb_line_status, 2375 - update_status : ni_usb_update_status, 2376 - primary_address : ni_usb_primary_address, 2377 - secondary_address : ni_usb_secondary_address, 2378 - serial_poll_response : ni_usb_serial_poll_response, 2379 - serial_poll_status : ni_usb_serial_poll_status, 2380 - t1_delay : ni_usb_t1_delay, 2381 - return_to_local : ni_usb_return_to_local, 2382 - skip_check_for_command_acceptors : 1 2354 + static gpib_interface_t ni_usb_gpib_interface = { 2355 + .name = "ni_usb_b", 2356 + .attach = ni_usb_attach, 2357 + .detach = ni_usb_detach, 2358 + .read = ni_usb_read, 2359 + .write = ni_usb_write, 2360 + .command = ni_usb_command, 2361 + .take_control = ni_usb_take_control, 2362 + .go_to_standby = ni_usb_go_to_standby, 2363 + .request_system_control = ni_usb_request_system_control, 2364 + .interface_clear = ni_usb_interface_clear, 2365 + .remote_enable = ni_usb_remote_enable, 2366 + .enable_eos = ni_usb_enable_eos, 2367 + .disable_eos = ni_usb_disable_eos, 2368 + .parallel_poll = ni_usb_parallel_poll, 2369 + .parallel_poll_configure = ni_usb_parallel_poll_configure, 2370 + .parallel_poll_response = ni_usb_parallel_poll_response, 2371 + .local_parallel_poll_mode = NULL, // XXX 2372 + .line_status = ni_usb_line_status, 2373 + .update_status = ni_usb_update_status, 2374 + .primary_address = ni_usb_primary_address, 2375 + .secondary_address = ni_usb_secondary_address, 2376 + .serial_poll_response = ni_usb_serial_poll_response, 2377 + .serial_poll_status = ni_usb_serial_poll_status, 2378 + .t1_delay = ni_usb_t1_delay, 2379 + .return_to_local = ni_usb_return_to_local, 2380 + .skip_check_for_command_acceptors = 1 2383 2381 }; 2384 2382 2385 2383 // Table with the USB-devices: just now only testing IDs ··· 2621 2619 static int __init ni_usb_init_module(void) 2622 2620 { 2623 2621 int i; 2622 + int ret; 2624 2623 2625 2624 pr_info("ni_usb_gpib driver loading\n"); 2626 2625 for (i = 0; i < MAX_NUM_NI_USB_INTERFACES; i++) 2627 2626 ni_usb_driver_interfaces[i] = NULL; 2628 - usb_register(&ni_usb_bus_driver); 2629 - gpib_register_driver(&ni_usb_gpib_interface, THIS_MODULE); 2627 + 2628 + ret = usb_register(&ni_usb_bus_driver); 2629 + if (ret) { 2630 + pr_err("ni_usb_gpib: usb_register failed: error = %d\n", ret); 2631 + return ret; 2632 + } 2633 + 2634 + ret = gpib_register_driver(&ni_usb_gpib_interface, THIS_MODULE); 2635 + if (ret) { 2636 + pr_err("ni_usb_gpib: gpib_register_driver failed: error = %d\n", ret); 2637 + return ret; 2638 + } 2630 2639 2631 2640 return 0; 2632 2641 }
+1 -1
drivers/staging/gpib/ni_usb/ni_usb_gpib.h
··· 56 56 }; 57 57 58 58 struct ni_usb_urb_ctx { 59 - struct semaphore complete; 59 + struct completion complete; 60 60 unsigned timed_out : 1; 61 61 }; 62 62
+139 -109
drivers/staging/gpib/pc2/pc2_gpib.c
··· 238 238 nec7210_return_to_local(board, &priv->nec7210_priv); 239 239 } 240 240 241 - gpib_interface_t pc2_interface = { 242 - name: "pcII", 243 - attach : pc2_attach, 244 - detach : pc2_detach, 245 - read : pc2_read, 246 - write : pc2_write, 247 - command : pc2_command, 248 - take_control : pc2_take_control, 249 - go_to_standby : pc2_go_to_standby, 250 - request_system_control : pc2_request_system_control, 251 - interface_clear : pc2_interface_clear, 252 - remote_enable : pc2_remote_enable, 253 - enable_eos : pc2_enable_eos, 254 - disable_eos : pc2_disable_eos, 255 - parallel_poll : pc2_parallel_poll, 256 - parallel_poll_configure : pc2_parallel_poll_configure, 257 - parallel_poll_response : pc2_parallel_poll_response, 258 - local_parallel_poll_mode : NULL, // XXX 259 - line_status : NULL, 260 - update_status : pc2_update_status, 261 - primary_address : pc2_primary_address, 262 - secondary_address : pc2_secondary_address, 263 - serial_poll_response : pc2_serial_poll_response, 264 - serial_poll_status : pc2_serial_poll_status, 265 - t1_delay : pc2_t1_delay, 266 - return_to_local : pc2_return_to_local, 241 + static gpib_interface_t pc2_interface = { 242 + .name = "pcII", 243 + .attach = pc2_attach, 244 + .detach = pc2_detach, 245 + .read = pc2_read, 246 + .write = pc2_write, 247 + .command = pc2_command, 248 + .take_control = pc2_take_control, 249 + .go_to_standby = pc2_go_to_standby, 250 + .request_system_control = pc2_request_system_control, 251 + .interface_clear = pc2_interface_clear, 252 + .remote_enable = pc2_remote_enable, 253 + .enable_eos = pc2_enable_eos, 254 + .disable_eos = pc2_disable_eos, 255 + .parallel_poll = pc2_parallel_poll, 256 + .parallel_poll_configure = pc2_parallel_poll_configure, 257 + .parallel_poll_response = pc2_parallel_poll_response, 258 + .local_parallel_poll_mode = NULL, // XXX 259 + .line_status = NULL, 260 + .update_status = pc2_update_status, 261 + .primary_address = pc2_primary_address, 262 + .secondary_address = pc2_secondary_address, 263 + .serial_poll_response = pc2_serial_poll_response, 264 + .serial_poll_status = pc2_serial_poll_status, 265 + .t1_delay = pc2_t1_delay, 266 + .return_to_local = pc2_return_to_local, 267 267 }; 268 268 269 - gpib_interface_t pc2a_interface = { 270 - name: "pcIIa", 271 - attach : pc2a_attach, 272 - detach : pc2a_detach, 273 - read : pc2_read, 274 - write : pc2_write, 275 - command : pc2_command, 276 - take_control : pc2_take_control, 277 - go_to_standby : pc2_go_to_standby, 278 - request_system_control : pc2_request_system_control, 279 - interface_clear : pc2_interface_clear, 280 - remote_enable : pc2_remote_enable, 281 - enable_eos : pc2_enable_eos, 282 - disable_eos : pc2_disable_eos, 283 - parallel_poll : pc2_parallel_poll, 284 - parallel_poll_configure : pc2_parallel_poll_configure, 285 - parallel_poll_response : pc2_parallel_poll_response, 286 - local_parallel_poll_mode : NULL, // XXX 287 - line_status : NULL, 288 - update_status : pc2_update_status, 289 - primary_address : pc2_primary_address, 290 - secondary_address : pc2_secondary_address, 291 - serial_poll_response : pc2_serial_poll_response, 292 - serial_poll_status : pc2_serial_poll_status, 293 - t1_delay : pc2_t1_delay, 294 - return_to_local : pc2_return_to_local, 269 + static gpib_interface_t pc2a_interface = { 270 + .name = "pcIIa", 271 + .attach = pc2a_attach, 272 + .detach = pc2a_detach, 273 + .read = pc2_read, 274 + .write = pc2_write, 275 + .command = pc2_command, 276 + .take_control = pc2_take_control, 277 + .go_to_standby = pc2_go_to_standby, 278 + .request_system_control = pc2_request_system_control, 279 + .interface_clear = pc2_interface_clear, 280 + .remote_enable = pc2_remote_enable, 281 + .enable_eos = pc2_enable_eos, 282 + .disable_eos = pc2_disable_eos, 283 + .parallel_poll = pc2_parallel_poll, 284 + .parallel_poll_configure = pc2_parallel_poll_configure, 285 + .parallel_poll_response = pc2_parallel_poll_response, 286 + .local_parallel_poll_mode = NULL, // XXX 287 + .line_status = NULL, 288 + .update_status = pc2_update_status, 289 + .primary_address = pc2_primary_address, 290 + .secondary_address = pc2_secondary_address, 291 + .serial_poll_response = pc2_serial_poll_response, 292 + .serial_poll_status = pc2_serial_poll_status, 293 + .t1_delay = pc2_t1_delay, 294 + .return_to_local = pc2_return_to_local, 295 295 }; 296 296 297 - gpib_interface_t pc2a_cb7210_interface = { 298 - name: "pcIIa_cb7210", 299 - attach : pc2a_cb7210_attach, 300 - detach : pc2a_detach, 301 - read : pc2_read, 302 - write : pc2_write, 303 - command : pc2_command, 304 - take_control : pc2_take_control, 305 - go_to_standby : pc2_go_to_standby, 306 - request_system_control : pc2_request_system_control, 307 - interface_clear : pc2_interface_clear, 308 - remote_enable : pc2_remote_enable, 309 - enable_eos : pc2_enable_eos, 310 - disable_eos : pc2_disable_eos, 311 - parallel_poll : pc2_parallel_poll, 312 - parallel_poll_configure : pc2_parallel_poll_configure, 313 - parallel_poll_response : pc2_parallel_poll_response, 314 - local_parallel_poll_mode : NULL, // XXX 315 - line_status : NULL, //XXX 316 - update_status : pc2_update_status, 317 - primary_address : pc2_primary_address, 318 - secondary_address : pc2_secondary_address, 319 - serial_poll_response : pc2_serial_poll_response, 320 - serial_poll_status : pc2_serial_poll_status, 321 - t1_delay : pc2_t1_delay, 322 - return_to_local : pc2_return_to_local, 297 + static gpib_interface_t pc2a_cb7210_interface = { 298 + .name = "pcIIa_cb7210", 299 + .attach = pc2a_cb7210_attach, 300 + .detach = pc2a_detach, 301 + .read = pc2_read, 302 + .write = pc2_write, 303 + .command = pc2_command, 304 + .take_control = pc2_take_control, 305 + .go_to_standby = pc2_go_to_standby, 306 + .request_system_control = pc2_request_system_control, 307 + .interface_clear = pc2_interface_clear, 308 + .remote_enable = pc2_remote_enable, 309 + .enable_eos = pc2_enable_eos, 310 + .disable_eos = pc2_disable_eos, 311 + .parallel_poll = pc2_parallel_poll, 312 + .parallel_poll_configure = pc2_parallel_poll_configure, 313 + .parallel_poll_response = pc2_parallel_poll_response, 314 + .local_parallel_poll_mode = NULL, // XXX 315 + .line_status = NULL, //XXX 316 + .update_status = pc2_update_status, 317 + .primary_address = pc2_primary_address, 318 + .secondary_address = pc2_secondary_address, 319 + .serial_poll_response = pc2_serial_poll_response, 320 + .serial_poll_status = pc2_serial_poll_status, 321 + .t1_delay = pc2_t1_delay, 322 + .return_to_local = pc2_return_to_local, 323 323 }; 324 324 325 - gpib_interface_t pc2_2a_interface = { 326 - name: "pcII_IIa", 327 - attach : pc2_2a_attach, 328 - detach : pc2_2a_detach, 329 - read : pc2_read, 330 - write : pc2_write, 331 - command : pc2_command, 332 - take_control : pc2_take_control, 333 - go_to_standby : pc2_go_to_standby, 334 - request_system_control : pc2_request_system_control, 335 - interface_clear : pc2_interface_clear, 336 - remote_enable : pc2_remote_enable, 337 - enable_eos : pc2_enable_eos, 338 - disable_eos : pc2_disable_eos, 339 - parallel_poll : pc2_parallel_poll, 340 - parallel_poll_configure : pc2_parallel_poll_configure, 341 - parallel_poll_response : pc2_parallel_poll_response, 342 - local_parallel_poll_mode : NULL, // XXX 343 - line_status : NULL, 344 - update_status : pc2_update_status, 345 - primary_address : pc2_primary_address, 346 - secondary_address : pc2_secondary_address, 347 - serial_poll_response : pc2_serial_poll_response, 348 - serial_poll_status : pc2_serial_poll_status, 349 - t1_delay : pc2_t1_delay, 350 - return_to_local : pc2_return_to_local, 325 + static gpib_interface_t pc2_2a_interface = { 326 + .name = "pcII_IIa", 327 + .attach = pc2_2a_attach, 328 + .detach = pc2_2a_detach, 329 + .read = pc2_read, 330 + .write = pc2_write, 331 + .command = pc2_command, 332 + .take_control = pc2_take_control, 333 + .go_to_standby = pc2_go_to_standby, 334 + .request_system_control = pc2_request_system_control, 335 + .interface_clear = pc2_interface_clear, 336 + .remote_enable = pc2_remote_enable, 337 + .enable_eos = pc2_enable_eos, 338 + .disable_eos = pc2_disable_eos, 339 + .parallel_poll = pc2_parallel_poll, 340 + .parallel_poll_configure = pc2_parallel_poll_configure, 341 + .parallel_poll_response = pc2_parallel_poll_response, 342 + .local_parallel_poll_mode = NULL, // XXX 343 + .line_status = NULL, 344 + .update_status = pc2_update_status, 345 + .primary_address = pc2_primary_address, 346 + .secondary_address = pc2_secondary_address, 347 + .serial_poll_response = pc2_serial_poll_response, 348 + .serial_poll_status = pc2_serial_poll_status, 349 + .t1_delay = pc2_t1_delay, 350 + .return_to_local = pc2_return_to_local, 351 351 }; 352 352 353 353 static int allocate_private(gpib_board_t *board) ··· 426 426 nec_priv = &pc2_priv->nec7210_priv; 427 427 nec_priv->offset = pc2_reg_offset; 428 428 429 - if (request_region(config->ibbase, pc2_iosize, "pc2") == 0) { 429 + if (!request_region(config->ibbase, pc2_iosize, "pc2")) { 430 430 pr_err("gpib: ioports are already in use\n"); 431 431 return -1; 432 432 } ··· 635 635 636 636 static int __init pc2_init_module(void) 637 637 { 638 - gpib_register_driver(&pc2_interface, THIS_MODULE); 639 - gpib_register_driver(&pc2a_interface, THIS_MODULE); 640 - gpib_register_driver(&pc2a_cb7210_interface, THIS_MODULE); 641 - gpib_register_driver(&pc2_2a_interface, THIS_MODULE); 638 + int ret; 639 + 640 + ret = gpib_register_driver(&pc2_interface, THIS_MODULE); 641 + if (ret) { 642 + pr_err("pc2_gpib: gpib_register_driver failed: error = %d\n", ret); 643 + return ret; 644 + } 645 + 646 + ret = gpib_register_driver(&pc2a_interface, THIS_MODULE); 647 + if (ret) { 648 + pr_err("pc2_gpib: gpib_register_driver failed: error = %d\n", ret); 649 + goto err_pc2a; 650 + } 651 + 652 + ret = gpib_register_driver(&pc2a_cb7210_interface, THIS_MODULE); 653 + if (ret) { 654 + pr_err("pc2_gpib: gpib_register_driver failed: error = %d\n", ret); 655 + goto err_cb7210; 656 + } 657 + 658 + ret = gpib_register_driver(&pc2_2a_interface, THIS_MODULE); 659 + if (ret) { 660 + pr_err("pc2_gpib: gpib_register_driver failed: error = %d\n", ret); 661 + goto err_pc2_2a; 662 + } 642 663 643 664 return 0; 665 + 666 + err_pc2_2a: 667 + gpib_unregister_driver(&pc2a_cb7210_interface); 668 + err_cb7210: 669 + gpib_unregister_driver(&pc2a_interface); 670 + err_pc2a: 671 + gpib_unregister_driver(&pc2_interface); 672 + 673 + return ret; 644 674 } 645 675 646 676 static void __exit pc2_exit_module(void)
+1 -1
drivers/staging/gpib/tnt4882/mite.c
··· 1 - // SPDX-License-Identifier: GPL-2 1 + // SPDX-License-Identifier: GPL-2.0-only 2 2 3 3 /* 4 4 * Hardware driver for NI Mite PCI interface chip,
+1 -1
drivers/staging/gpib/tnt4882/mite.h
··· 1 - /* SPDX-License-Identifier: GPL-2 */ 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 3 3 /* 4 4 * Hardware driver for NI Mite PCI interface chip
+357 -277
drivers/staging/gpib/tnt4882/tnt4882_gpib.c
··· 116 116 /* readb/writeb wrappers */ 117 117 static inline unsigned short tnt_readb(struct tnt4882_priv *priv, unsigned long offset) 118 118 { 119 - void *address = priv->nec7210_priv.mmiobase + offset; 119 + void __iomem *address = priv->nec7210_priv.mmiobase + offset; 120 120 unsigned long flags; 121 121 unsigned short retval; 122 122 spinlock_t *register_lock = &priv->nec7210_priv.register_page_lock; ··· 154 154 155 155 static inline void tnt_writeb(struct tnt4882_priv *priv, unsigned short value, unsigned long offset) 156 156 { 157 - void *address = priv->nec7210_priv.mmiobase + offset; 157 + void __iomem *address = priv->nec7210_priv.mmiobase + offset; 158 158 unsigned long flags; 159 159 spinlock_t *register_lock = &priv->nec7210_priv.register_page_lock; 160 160 ··· 890 890 nec7210_return_to_local(board, &priv->nec7210_priv); 891 891 } 892 892 893 - gpib_interface_t ni_pci_interface = { 894 - name: "ni_pci", 895 - attach : ni_pci_attach, 896 - detach : ni_pci_detach, 897 - read : tnt4882_accel_read, 898 - write : tnt4882_accel_write, 899 - command : tnt4882_command, 900 - take_control : tnt4882_take_control, 901 - go_to_standby : tnt4882_go_to_standby, 902 - request_system_control : tnt4882_request_system_control, 903 - interface_clear : tnt4882_interface_clear, 904 - remote_enable : tnt4882_remote_enable, 905 - enable_eos : tnt4882_enable_eos, 906 - disable_eos : tnt4882_disable_eos, 907 - parallel_poll : tnt4882_parallel_poll, 908 - parallel_poll_configure : tnt4882_parallel_poll_configure, 909 - parallel_poll_response : tnt4882_parallel_poll_response, 910 - local_parallel_poll_mode : NULL, // XXX 911 - line_status : tnt4882_line_status, 912 - update_status : tnt4882_update_status, 913 - primary_address : tnt4882_primary_address, 914 - secondary_address : tnt4882_secondary_address, 915 - serial_poll_response2 : tnt4882_serial_poll_response2, 916 - serial_poll_status : tnt4882_serial_poll_status, 917 - t1_delay : tnt4882_t1_delay, 918 - return_to_local : tnt4882_return_to_local, 893 + static gpib_interface_t ni_pci_interface = { 894 + .name = "ni_pci", 895 + .attach = ni_pci_attach, 896 + .detach = ni_pci_detach, 897 + .read = tnt4882_accel_read, 898 + .write = tnt4882_accel_write, 899 + .command = tnt4882_command, 900 + .take_control = tnt4882_take_control, 901 + .go_to_standby = tnt4882_go_to_standby, 902 + .request_system_control = tnt4882_request_system_control, 903 + .interface_clear = tnt4882_interface_clear, 904 + .remote_enable = tnt4882_remote_enable, 905 + .enable_eos = tnt4882_enable_eos, 906 + .disable_eos = tnt4882_disable_eos, 907 + .parallel_poll = tnt4882_parallel_poll, 908 + .parallel_poll_configure = tnt4882_parallel_poll_configure, 909 + .parallel_poll_response = tnt4882_parallel_poll_response, 910 + .local_parallel_poll_mode = NULL, // XXX 911 + .line_status = tnt4882_line_status, 912 + .update_status = tnt4882_update_status, 913 + .primary_address = tnt4882_primary_address, 914 + .secondary_address = tnt4882_secondary_address, 915 + .serial_poll_response2 = tnt4882_serial_poll_response2, 916 + .serial_poll_status = tnt4882_serial_poll_status, 917 + .t1_delay = tnt4882_t1_delay, 918 + .return_to_local = tnt4882_return_to_local, 919 919 }; 920 920 921 - gpib_interface_t ni_pci_accel_interface = { 922 - name: "ni_pci_accel", 923 - attach : ni_pci_attach, 924 - detach : ni_pci_detach, 925 - read : tnt4882_accel_read, 926 - write : tnt4882_accel_write, 927 - command : tnt4882_command, 928 - take_control : tnt4882_take_control, 929 - go_to_standby : tnt4882_go_to_standby, 930 - request_system_control : tnt4882_request_system_control, 931 - interface_clear : tnt4882_interface_clear, 932 - remote_enable : tnt4882_remote_enable, 933 - enable_eos : tnt4882_enable_eos, 934 - disable_eos : tnt4882_disable_eos, 935 - parallel_poll : tnt4882_parallel_poll, 936 - parallel_poll_configure : tnt4882_parallel_poll_configure, 937 - parallel_poll_response : tnt4882_parallel_poll_response, 938 - local_parallel_poll_mode : NULL, // XXX 939 - line_status : tnt4882_line_status, 940 - update_status : tnt4882_update_status, 941 - primary_address : tnt4882_primary_address, 942 - secondary_address : tnt4882_secondary_address, 943 - serial_poll_response2 : tnt4882_serial_poll_response2, 944 - serial_poll_status : tnt4882_serial_poll_status, 945 - t1_delay : tnt4882_t1_delay, 946 - return_to_local : tnt4882_return_to_local, 921 + static gpib_interface_t ni_pci_accel_interface = { 922 + .name = "ni_pci_accel", 923 + .attach = ni_pci_attach, 924 + .detach = ni_pci_detach, 925 + .read = tnt4882_accel_read, 926 + .write = tnt4882_accel_write, 927 + .command = tnt4882_command, 928 + .take_control = tnt4882_take_control, 929 + .go_to_standby = tnt4882_go_to_standby, 930 + .request_system_control = tnt4882_request_system_control, 931 + .interface_clear = tnt4882_interface_clear, 932 + .remote_enable = tnt4882_remote_enable, 933 + .enable_eos = tnt4882_enable_eos, 934 + .disable_eos = tnt4882_disable_eos, 935 + .parallel_poll = tnt4882_parallel_poll, 936 + .parallel_poll_configure = tnt4882_parallel_poll_configure, 937 + .parallel_poll_response = tnt4882_parallel_poll_response, 938 + .local_parallel_poll_mode = NULL, // XXX 939 + .line_status = tnt4882_line_status, 940 + .update_status = tnt4882_update_status, 941 + .primary_address = tnt4882_primary_address, 942 + .secondary_address = tnt4882_secondary_address, 943 + .serial_poll_response2 = tnt4882_serial_poll_response2, 944 + .serial_poll_status = tnt4882_serial_poll_status, 945 + .t1_delay = tnt4882_t1_delay, 946 + .return_to_local = tnt4882_return_to_local, 947 947 }; 948 948 949 - gpib_interface_t ni_isa_interface = { 950 - name: "ni_isa", 951 - attach : ni_tnt_isa_attach, 952 - detach : ni_isa_detach, 953 - read : tnt4882_accel_read, 954 - write : tnt4882_accel_write, 955 - command : tnt4882_command, 956 - take_control : tnt4882_take_control, 957 - go_to_standby : tnt4882_go_to_standby, 958 - request_system_control : tnt4882_request_system_control, 959 - interface_clear : tnt4882_interface_clear, 960 - remote_enable : tnt4882_remote_enable, 961 - enable_eos : tnt4882_enable_eos, 962 - disable_eos : tnt4882_disable_eos, 963 - parallel_poll : tnt4882_parallel_poll, 964 - parallel_poll_configure : tnt4882_parallel_poll_configure, 965 - parallel_poll_response : tnt4882_parallel_poll_response, 966 - local_parallel_poll_mode : NULL, // XXX 967 - line_status : tnt4882_line_status, 968 - update_status : tnt4882_update_status, 969 - primary_address : tnt4882_primary_address, 970 - secondary_address : tnt4882_secondary_address, 971 - serial_poll_response2 : tnt4882_serial_poll_response2, 972 - serial_poll_status : tnt4882_serial_poll_status, 973 - t1_delay : tnt4882_t1_delay, 974 - return_to_local : tnt4882_return_to_local, 949 + static gpib_interface_t ni_isa_interface = { 950 + .name = "ni_isa", 951 + .attach = ni_tnt_isa_attach, 952 + .detach = ni_isa_detach, 953 + .read = tnt4882_accel_read, 954 + .write = tnt4882_accel_write, 955 + .command = tnt4882_command, 956 + .take_control = tnt4882_take_control, 957 + .go_to_standby = tnt4882_go_to_standby, 958 + .request_system_control = tnt4882_request_system_control, 959 + .interface_clear = tnt4882_interface_clear, 960 + .remote_enable = tnt4882_remote_enable, 961 + .enable_eos = tnt4882_enable_eos, 962 + .disable_eos = tnt4882_disable_eos, 963 + .parallel_poll = tnt4882_parallel_poll, 964 + .parallel_poll_configure = tnt4882_parallel_poll_configure, 965 + .parallel_poll_response = tnt4882_parallel_poll_response, 966 + .local_parallel_poll_mode = NULL, // XXX 967 + .line_status = tnt4882_line_status, 968 + .update_status = tnt4882_update_status, 969 + .primary_address = tnt4882_primary_address, 970 + .secondary_address = tnt4882_secondary_address, 971 + .serial_poll_response2 = tnt4882_serial_poll_response2, 972 + .serial_poll_status = tnt4882_serial_poll_status, 973 + .t1_delay = tnt4882_t1_delay, 974 + .return_to_local = tnt4882_return_to_local, 975 975 }; 976 976 977 - gpib_interface_t ni_nat4882_isa_interface = { 978 - name: "ni_nat4882_isa", 979 - attach : ni_nat4882_isa_attach, 980 - detach : ni_isa_detach, 981 - read : tnt4882_read, 982 - write : tnt4882_write, 983 - command : tnt4882_command_unaccel, 984 - take_control : tnt4882_take_control, 985 - go_to_standby : tnt4882_go_to_standby, 986 - request_system_control : tnt4882_request_system_control, 987 - interface_clear : tnt4882_interface_clear, 988 - remote_enable : tnt4882_remote_enable, 989 - enable_eos : tnt4882_enable_eos, 990 - disable_eos : tnt4882_disable_eos, 991 - parallel_poll : tnt4882_parallel_poll, 992 - parallel_poll_configure : tnt4882_parallel_poll_configure, 993 - parallel_poll_response : tnt4882_parallel_poll_response, 994 - local_parallel_poll_mode : NULL, // XXX 995 - line_status : tnt4882_line_status, 996 - update_status : tnt4882_update_status, 997 - primary_address : tnt4882_primary_address, 998 - secondary_address : tnt4882_secondary_address, 999 - serial_poll_response2 : tnt4882_serial_poll_response2, 1000 - serial_poll_status : tnt4882_serial_poll_status, 1001 - t1_delay : tnt4882_t1_delay, 1002 - return_to_local : tnt4882_return_to_local, 977 + static gpib_interface_t ni_nat4882_isa_interface = { 978 + .name = "ni_nat4882_isa", 979 + .attach = ni_nat4882_isa_attach, 980 + .detach = ni_isa_detach, 981 + .read = tnt4882_read, 982 + .write = tnt4882_write, 983 + .command = tnt4882_command_unaccel, 984 + .take_control = tnt4882_take_control, 985 + .go_to_standby = tnt4882_go_to_standby, 986 + .request_system_control = tnt4882_request_system_control, 987 + .interface_clear = tnt4882_interface_clear, 988 + .remote_enable = tnt4882_remote_enable, 989 + .enable_eos = tnt4882_enable_eos, 990 + .disable_eos = tnt4882_disable_eos, 991 + .parallel_poll = tnt4882_parallel_poll, 992 + .parallel_poll_configure = tnt4882_parallel_poll_configure, 993 + .parallel_poll_response = tnt4882_parallel_poll_response, 994 + .local_parallel_poll_mode = NULL, // XXX 995 + .line_status = tnt4882_line_status, 996 + .update_status = tnt4882_update_status, 997 + .primary_address = tnt4882_primary_address, 998 + .secondary_address = tnt4882_secondary_address, 999 + .serial_poll_response2 = tnt4882_serial_poll_response2, 1000 + .serial_poll_status = tnt4882_serial_poll_status, 1001 + .t1_delay = tnt4882_t1_delay, 1002 + .return_to_local = tnt4882_return_to_local, 1003 1003 }; 1004 1004 1005 - gpib_interface_t ni_nec_isa_interface = { 1006 - name: "ni_nec_isa", 1007 - attach : ni_nec_isa_attach, 1008 - detach : ni_isa_detach, 1009 - read : tnt4882_read, 1010 - write : tnt4882_write, 1011 - command : tnt4882_command_unaccel, 1012 - take_control : tnt4882_take_control, 1013 - go_to_standby : tnt4882_go_to_standby, 1014 - request_system_control : tnt4882_request_system_control, 1015 - interface_clear : tnt4882_interface_clear, 1016 - remote_enable : tnt4882_remote_enable, 1017 - enable_eos : tnt4882_enable_eos, 1018 - disable_eos : tnt4882_disable_eos, 1019 - parallel_poll : tnt4882_parallel_poll, 1020 - parallel_poll_configure : tnt4882_parallel_poll_configure, 1021 - parallel_poll_response : tnt4882_parallel_poll_response, 1022 - local_parallel_poll_mode : NULL, // XXX 1023 - line_status : NULL, 1024 - update_status : tnt4882_update_status, 1025 - primary_address : tnt4882_primary_address, 1026 - secondary_address : tnt4882_secondary_address, 1027 - serial_poll_response : tnt4882_serial_poll_response, 1028 - serial_poll_status : tnt4882_serial_poll_status, 1029 - t1_delay : tnt4882_t1_delay, 1030 - return_to_local : tnt4882_return_to_local, 1005 + static gpib_interface_t ni_nec_isa_interface = { 1006 + .name = "ni_nec_isa", 1007 + .attach = ni_nec_isa_attach, 1008 + .detach = ni_isa_detach, 1009 + .read = tnt4882_read, 1010 + .write = tnt4882_write, 1011 + .command = tnt4882_command_unaccel, 1012 + .take_control = tnt4882_take_control, 1013 + .go_to_standby = tnt4882_go_to_standby, 1014 + .request_system_control = tnt4882_request_system_control, 1015 + .interface_clear = tnt4882_interface_clear, 1016 + .remote_enable = tnt4882_remote_enable, 1017 + .enable_eos = tnt4882_enable_eos, 1018 + .disable_eos = tnt4882_disable_eos, 1019 + .parallel_poll = tnt4882_parallel_poll, 1020 + .parallel_poll_configure = tnt4882_parallel_poll_configure, 1021 + .parallel_poll_response = tnt4882_parallel_poll_response, 1022 + .local_parallel_poll_mode = NULL, // XXX 1023 + .line_status = NULL, 1024 + .update_status = tnt4882_update_status, 1025 + .primary_address = tnt4882_primary_address, 1026 + .secondary_address = tnt4882_secondary_address, 1027 + .serial_poll_response = tnt4882_serial_poll_response, 1028 + .serial_poll_status = tnt4882_serial_poll_status, 1029 + .t1_delay = tnt4882_t1_delay, 1030 + .return_to_local = tnt4882_return_to_local, 1031 1031 }; 1032 1032 1033 - gpib_interface_t ni_isa_accel_interface = { 1034 - name: "ni_isa_accel", 1035 - attach : ni_tnt_isa_attach, 1036 - detach : ni_isa_detach, 1037 - read : tnt4882_accel_read, 1038 - write : tnt4882_accel_write, 1039 - command : tnt4882_command, 1040 - take_control : tnt4882_take_control, 1041 - go_to_standby : tnt4882_go_to_standby, 1042 - request_system_control : tnt4882_request_system_control, 1043 - interface_clear : tnt4882_interface_clear, 1044 - remote_enable : tnt4882_remote_enable, 1045 - enable_eos : tnt4882_enable_eos, 1046 - disable_eos : tnt4882_disable_eos, 1047 - parallel_poll : tnt4882_parallel_poll, 1048 - parallel_poll_configure : tnt4882_parallel_poll_configure, 1049 - parallel_poll_response : tnt4882_parallel_poll_response, 1050 - local_parallel_poll_mode : NULL, // XXX 1051 - line_status : tnt4882_line_status, 1052 - update_status : tnt4882_update_status, 1053 - primary_address : tnt4882_primary_address, 1054 - secondary_address : tnt4882_secondary_address, 1055 - serial_poll_response2 : tnt4882_serial_poll_response2, 1056 - serial_poll_status : tnt4882_serial_poll_status, 1057 - t1_delay : tnt4882_t1_delay, 1058 - return_to_local : tnt4882_return_to_local, 1033 + static gpib_interface_t ni_isa_accel_interface = { 1034 + .name = "ni_isa_accel", 1035 + .attach = ni_tnt_isa_attach, 1036 + .detach = ni_isa_detach, 1037 + .read = tnt4882_accel_read, 1038 + .write = tnt4882_accel_write, 1039 + .command = tnt4882_command, 1040 + .take_control = tnt4882_take_control, 1041 + .go_to_standby = tnt4882_go_to_standby, 1042 + .request_system_control = tnt4882_request_system_control, 1043 + .interface_clear = tnt4882_interface_clear, 1044 + .remote_enable = tnt4882_remote_enable, 1045 + .enable_eos = tnt4882_enable_eos, 1046 + .disable_eos = tnt4882_disable_eos, 1047 + .parallel_poll = tnt4882_parallel_poll, 1048 + .parallel_poll_configure = tnt4882_parallel_poll_configure, 1049 + .parallel_poll_response = tnt4882_parallel_poll_response, 1050 + .local_parallel_poll_mode = NULL, // XXX 1051 + .line_status = tnt4882_line_status, 1052 + .update_status = tnt4882_update_status, 1053 + .primary_address = tnt4882_primary_address, 1054 + .secondary_address = tnt4882_secondary_address, 1055 + .serial_poll_response2 = tnt4882_serial_poll_response2, 1056 + .serial_poll_status = tnt4882_serial_poll_status, 1057 + .t1_delay = tnt4882_t1_delay, 1058 + .return_to_local = tnt4882_return_to_local, 1059 1059 }; 1060 1060 1061 - gpib_interface_t ni_nat4882_isa_accel_interface = { 1062 - name: "ni_nat4882_isa_accel", 1063 - attach : ni_nat4882_isa_attach, 1064 - detach : ni_isa_detach, 1065 - read : tnt4882_accel_read, 1066 - write : tnt4882_accel_write, 1067 - command : tnt4882_command_unaccel, 1068 - take_control : tnt4882_take_control, 1069 - go_to_standby : tnt4882_go_to_standby, 1070 - request_system_control : tnt4882_request_system_control, 1071 - interface_clear : tnt4882_interface_clear, 1072 - remote_enable : tnt4882_remote_enable, 1073 - enable_eos : tnt4882_enable_eos, 1074 - disable_eos : tnt4882_disable_eos, 1075 - parallel_poll : tnt4882_parallel_poll, 1076 - parallel_poll_configure : tnt4882_parallel_poll_configure, 1077 - parallel_poll_response : tnt4882_parallel_poll_response, 1078 - local_parallel_poll_mode : NULL, // XXX 1079 - line_status : tnt4882_line_status, 1080 - update_status : tnt4882_update_status, 1081 - primary_address : tnt4882_primary_address, 1082 - secondary_address : tnt4882_secondary_address, 1083 - serial_poll_response2 : tnt4882_serial_poll_response2, 1084 - serial_poll_status : tnt4882_serial_poll_status, 1085 - t1_delay : tnt4882_t1_delay, 1086 - return_to_local : tnt4882_return_to_local, 1061 + static gpib_interface_t ni_nat4882_isa_accel_interface = { 1062 + .name = "ni_nat4882_isa_accel", 1063 + .attach = ni_nat4882_isa_attach, 1064 + .detach = ni_isa_detach, 1065 + .read = tnt4882_accel_read, 1066 + .write = tnt4882_accel_write, 1067 + .command = tnt4882_command_unaccel, 1068 + .take_control = tnt4882_take_control, 1069 + .go_to_standby = tnt4882_go_to_standby, 1070 + .request_system_control = tnt4882_request_system_control, 1071 + .interface_clear = tnt4882_interface_clear, 1072 + .remote_enable = tnt4882_remote_enable, 1073 + .enable_eos = tnt4882_enable_eos, 1074 + .disable_eos = tnt4882_disable_eos, 1075 + .parallel_poll = tnt4882_parallel_poll, 1076 + .parallel_poll_configure = tnt4882_parallel_poll_configure, 1077 + .parallel_poll_response = tnt4882_parallel_poll_response, 1078 + .local_parallel_poll_mode = NULL, // XXX 1079 + .line_status = tnt4882_line_status, 1080 + .update_status = tnt4882_update_status, 1081 + .primary_address = tnt4882_primary_address, 1082 + .secondary_address = tnt4882_secondary_address, 1083 + .serial_poll_response2 = tnt4882_serial_poll_response2, 1084 + .serial_poll_status = tnt4882_serial_poll_status, 1085 + .t1_delay = tnt4882_t1_delay, 1086 + .return_to_local = tnt4882_return_to_local, 1087 1087 }; 1088 1088 1089 - gpib_interface_t ni_nec_isa_accel_interface = { 1090 - name: "ni_nec_isa_accel", 1091 - attach : ni_nec_isa_attach, 1092 - detach : ni_isa_detach, 1093 - read : tnt4882_accel_read, 1094 - write : tnt4882_accel_write, 1095 - command : tnt4882_command_unaccel, 1096 - take_control : tnt4882_take_control, 1097 - go_to_standby : tnt4882_go_to_standby, 1098 - request_system_control : tnt4882_request_system_control, 1099 - interface_clear : tnt4882_interface_clear, 1100 - remote_enable : tnt4882_remote_enable, 1101 - enable_eos : tnt4882_enable_eos, 1102 - disable_eos : tnt4882_disable_eos, 1103 - parallel_poll : tnt4882_parallel_poll, 1104 - parallel_poll_configure : tnt4882_parallel_poll_configure, 1105 - parallel_poll_response : tnt4882_parallel_poll_response, 1106 - local_parallel_poll_mode : NULL, // XXX 1107 - line_status : NULL, 1108 - update_status : tnt4882_update_status, 1109 - primary_address : tnt4882_primary_address, 1110 - secondary_address : tnt4882_secondary_address, 1111 - serial_poll_response : tnt4882_serial_poll_response, 1112 - serial_poll_status : tnt4882_serial_poll_status, 1113 - t1_delay : tnt4882_t1_delay, 1114 - return_to_local : tnt4882_return_to_local, 1089 + static gpib_interface_t ni_nec_isa_accel_interface = { 1090 + .name = "ni_nec_isa_accel", 1091 + .attach = ni_nec_isa_attach, 1092 + .detach = ni_isa_detach, 1093 + .read = tnt4882_accel_read, 1094 + .write = tnt4882_accel_write, 1095 + .command = tnt4882_command_unaccel, 1096 + .take_control = tnt4882_take_control, 1097 + .go_to_standby = tnt4882_go_to_standby, 1098 + .request_system_control = tnt4882_request_system_control, 1099 + .interface_clear = tnt4882_interface_clear, 1100 + .remote_enable = tnt4882_remote_enable, 1101 + .enable_eos = tnt4882_enable_eos, 1102 + .disable_eos = tnt4882_disable_eos, 1103 + .parallel_poll = tnt4882_parallel_poll, 1104 + .parallel_poll_configure = tnt4882_parallel_poll_configure, 1105 + .parallel_poll_response = tnt4882_parallel_poll_response, 1106 + .local_parallel_poll_mode = NULL, // XXX 1107 + .line_status = NULL, 1108 + .update_status = tnt4882_update_status, 1109 + .primary_address = tnt4882_primary_address, 1110 + .secondary_address = tnt4882_secondary_address, 1111 + .serial_poll_response = tnt4882_serial_poll_response, 1112 + .serial_poll_status = tnt4882_serial_poll_status, 1113 + .t1_delay = tnt4882_t1_delay, 1114 + .return_to_local = tnt4882_return_to_local, 1115 1115 }; 1116 1116 1117 1117 #ifdef GPIB_PCMCIA 1118 - gpib_interface_t ni_pcmcia_interface = { 1119 - name: "ni_pcmcia", 1120 - attach : ni_pcmcia_attach, 1121 - detach : ni_pcmcia_detach, 1122 - read : tnt4882_accel_read, 1123 - write : tnt4882_accel_write, 1124 - command : tnt4882_command, 1125 - take_control : tnt4882_take_control, 1126 - go_to_standby : tnt4882_go_to_standby, 1127 - request_system_control : tnt4882_request_system_control, 1128 - interface_clear : tnt4882_interface_clear, 1129 - remote_enable : tnt4882_remote_enable, 1130 - enable_eos : tnt4882_enable_eos, 1131 - disable_eos : tnt4882_disable_eos, 1132 - parallel_poll : tnt4882_parallel_poll, 1133 - parallel_poll_configure : tnt4882_parallel_poll_configure, 1134 - parallel_poll_response : tnt4882_parallel_poll_response, 1135 - local_parallel_poll_mode : NULL, // XXX 1136 - line_status : tnt4882_line_status, 1137 - update_status : tnt4882_update_status, 1138 - primary_address : tnt4882_primary_address, 1139 - secondary_address : tnt4882_secondary_address, 1140 - serial_poll_response : tnt4882_serial_poll_response, 1141 - serial_poll_status : tnt4882_serial_poll_status, 1142 - t1_delay : tnt4882_t1_delay, 1143 - return_to_local : tnt4882_return_to_local, 1118 + static gpib_interface_t ni_pcmcia_interface = { 1119 + .name = "ni_pcmcia", 1120 + .attach = ni_pcmcia_attach, 1121 + .detach = ni_pcmcia_detach, 1122 + .read = tnt4882_accel_read, 1123 + .write = tnt4882_accel_write, 1124 + .command = tnt4882_command, 1125 + .take_control = tnt4882_take_control, 1126 + .go_to_standby = tnt4882_go_to_standby, 1127 + .request_system_control = tnt4882_request_system_control, 1128 + .interface_clear = tnt4882_interface_clear, 1129 + .remote_enable = tnt4882_remote_enable, 1130 + .enable_eos = tnt4882_enable_eos, 1131 + .disable_eos = tnt4882_disable_eos, 1132 + .parallel_poll = tnt4882_parallel_poll, 1133 + .parallel_poll_configure = tnt4882_parallel_poll_configure, 1134 + .parallel_poll_response = tnt4882_parallel_poll_response, 1135 + .local_parallel_poll_mode = NULL, // XXX 1136 + .line_status = tnt4882_line_status, 1137 + .update_status = tnt4882_update_status, 1138 + .primary_address = tnt4882_primary_address, 1139 + .secondary_address = tnt4882_secondary_address, 1140 + .serial_poll_response = tnt4882_serial_poll_response, 1141 + .serial_poll_status = tnt4882_serial_poll_status, 1142 + .t1_delay = tnt4882_t1_delay, 1143 + .return_to_local = tnt4882_return_to_local, 1144 1144 }; 1145 1145 1146 - gpib_interface_t ni_pcmcia_accel_interface = { 1147 - name: "ni_pcmcia_accel", 1148 - attach : ni_pcmcia_attach, 1149 - detach : ni_pcmcia_detach, 1150 - read : tnt4882_accel_read, 1151 - write : tnt4882_accel_write, 1152 - command : tnt4882_command, 1153 - take_control : tnt4882_take_control, 1154 - go_to_standby : tnt4882_go_to_standby, 1155 - request_system_control : tnt4882_request_system_control, 1156 - interface_clear : tnt4882_interface_clear, 1157 - remote_enable : tnt4882_remote_enable, 1158 - enable_eos : tnt4882_enable_eos, 1159 - disable_eos : tnt4882_disable_eos, 1160 - parallel_poll : tnt4882_parallel_poll, 1161 - parallel_poll_configure : tnt4882_parallel_poll_configure, 1162 - parallel_poll_response : tnt4882_parallel_poll_response, 1163 - local_parallel_poll_mode : NULL, // XXX 1164 - line_status : tnt4882_line_status, 1165 - update_status : tnt4882_update_status, 1166 - primary_address : tnt4882_primary_address, 1167 - secondary_address : tnt4882_secondary_address, 1168 - serial_poll_response : tnt4882_serial_poll_response, 1169 - serial_poll_status : tnt4882_serial_poll_status, 1170 - t1_delay : tnt4882_t1_delay, 1171 - return_to_local : tnt4882_return_to_local, 1146 + static gpib_interface_t ni_pcmcia_accel_interface = { 1147 + .name = "ni_pcmcia_accel", 1148 + .attach = ni_pcmcia_attach, 1149 + .detach = ni_pcmcia_detach, 1150 + .read = tnt4882_accel_read, 1151 + .write = tnt4882_accel_write, 1152 + .command = tnt4882_command, 1153 + .take_control = tnt4882_take_control, 1154 + .go_to_standby = tnt4882_go_to_standby, 1155 + .request_system_control = tnt4882_request_system_control, 1156 + .interface_clear = tnt4882_interface_clear, 1157 + .remote_enable = tnt4882_remote_enable, 1158 + .enable_eos = tnt4882_enable_eos, 1159 + .disable_eos = tnt4882_disable_eos, 1160 + .parallel_poll = tnt4882_parallel_poll, 1161 + .parallel_poll_configure = tnt4882_parallel_poll_configure, 1162 + .parallel_poll_response = tnt4882_parallel_poll_response, 1163 + .local_parallel_poll_mode = NULL, // XXX 1164 + .line_status = tnt4882_line_status, 1165 + .update_status = tnt4882_update_status, 1166 + .primary_address = tnt4882_primary_address, 1167 + .secondary_address = tnt4882_secondary_address, 1168 + .serial_poll_response = tnt4882_serial_poll_response, 1169 + .serial_poll_status = tnt4882_serial_poll_status, 1170 + .t1_delay = tnt4882_t1_delay, 1171 + .return_to_local = tnt4882_return_to_local, 1172 1172 }; 1173 1173 #endif 1174 1174 ··· 1516 1516 1517 1517 result = pci_register_driver(&tnt4882_pci_driver); 1518 1518 if (result) { 1519 - pr_err("tnt4882: pci_driver_register failed!\n"); 1519 + pr_err("tnt4882_gpib: pci_register_driver failed: error = %d\n", result); 1520 1520 return result; 1521 1521 } 1522 1522 1523 - gpib_register_driver(&ni_isa_interface, THIS_MODULE); 1524 - gpib_register_driver(&ni_isa_accel_interface, THIS_MODULE); 1525 - gpib_register_driver(&ni_nat4882_isa_interface, THIS_MODULE); 1526 - gpib_register_driver(&ni_nat4882_isa_accel_interface, THIS_MODULE); 1527 - gpib_register_driver(&ni_nec_isa_interface, THIS_MODULE); 1528 - gpib_register_driver(&ni_nec_isa_accel_interface, THIS_MODULE); 1529 - gpib_register_driver(&ni_pci_interface, THIS_MODULE); 1530 - gpib_register_driver(&ni_pci_accel_interface, THIS_MODULE); 1523 + result = gpib_register_driver(&ni_isa_interface, THIS_MODULE); 1524 + if (result) { 1525 + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); 1526 + goto err_isa; 1527 + } 1528 + 1529 + result = gpib_register_driver(&ni_isa_accel_interface, THIS_MODULE); 1530 + if (result) { 1531 + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); 1532 + goto err_isa_accel; 1533 + } 1534 + 1535 + result = gpib_register_driver(&ni_nat4882_isa_interface, THIS_MODULE); 1536 + if (result) { 1537 + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); 1538 + goto err_nat4882_isa; 1539 + } 1540 + 1541 + result = gpib_register_driver(&ni_nat4882_isa_accel_interface, THIS_MODULE); 1542 + if (result) { 1543 + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); 1544 + goto err_nat4882_isa_accel; 1545 + } 1546 + 1547 + result = gpib_register_driver(&ni_nec_isa_interface, THIS_MODULE); 1548 + if (result) { 1549 + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); 1550 + goto err_nec_isa; 1551 + } 1552 + 1553 + result = gpib_register_driver(&ni_nec_isa_accel_interface, THIS_MODULE); 1554 + if (result) { 1555 + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); 1556 + goto err_nec_isa_accel; 1557 + } 1558 + 1559 + result = gpib_register_driver(&ni_pci_interface, THIS_MODULE); 1560 + if (result) { 1561 + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); 1562 + goto err_pci; 1563 + } 1564 + 1565 + result = gpib_register_driver(&ni_pci_accel_interface, THIS_MODULE); 1566 + if (result) { 1567 + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); 1568 + goto err_pci_accel; 1569 + } 1570 + 1531 1571 #ifdef GPIB_PCMCIA 1532 - gpib_register_driver(&ni_pcmcia_interface, THIS_MODULE); 1533 - gpib_register_driver(&ni_pcmcia_accel_interface, THIS_MODULE); 1534 - if (init_ni_gpib_cs() < 0) 1535 - return -1; 1572 + result = gpib_register_driver(&ni_pcmcia_interface, THIS_MODULE); 1573 + if (result) { 1574 + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); 1575 + goto err_pcmcia; 1576 + } 1577 + 1578 + result = gpib_register_driver(&ni_pcmcia_accel_interface, THIS_MODULE); 1579 + if (result) { 1580 + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); 1581 + goto err_pcmcia_accel; 1582 + } 1583 + 1584 + result = init_ni_gpib_cs(); 1585 + if (result) { 1586 + pr_err("tnt4882_gpib: pcmcia_register_driver failed: error = %d\n", result); 1587 + goto err_pcmcia_driver; 1588 + } 1536 1589 #endif 1537 1590 1538 1591 mite_init(); 1539 1592 mite_list_devices(); 1540 1593 1541 1594 return 0; 1595 + 1596 + #ifdef GPIB_PCMCIA 1597 + err_pcmcia_driver: 1598 + gpib_unregister_driver(&ni_pcmcia_accel_interface); 1599 + err_pcmcia_accel: 1600 + gpib_unregister_driver(&ni_pcmcia_interface); 1601 + err_pcmcia: 1602 + #endif 1603 + gpib_unregister_driver(&ni_pci_accel_interface); 1604 + err_pci_accel: 1605 + gpib_unregister_driver(&ni_pci_interface); 1606 + err_pci: 1607 + gpib_unregister_driver(&ni_nec_isa_accel_interface); 1608 + err_nec_isa_accel: 1609 + gpib_unregister_driver(&ni_nec_isa_interface); 1610 + err_nec_isa: 1611 + gpib_unregister_driver(&ni_nat4882_isa_accel_interface); 1612 + err_nat4882_isa_accel: 1613 + gpib_unregister_driver(&ni_nat4882_isa_interface); 1614 + err_nat4882_isa: 1615 + gpib_unregister_driver(&ni_isa_accel_interface); 1616 + err_isa_accel: 1617 + gpib_unregister_driver(&ni_isa_interface); 1618 + err_isa: 1619 + pci_unregister_driver(&tnt4882_pci_driver); 1620 + 1621 + return result; 1542 1622 } 1543 1623 1544 1624 static void __exit tnt4882_exit_module(void) ··· 1896 1816 nec_priv->offset = atgpib_reg_offset; 1897 1817 1898 1818 DEBUG(0, "ioport1 window attributes: 0x%lx\n", curr_dev->resource[0]->flags); 1899 - if (request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]), 1900 - "tnt4882") == 0) { 1819 + if (!request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]), 1820 + "tnt4882")) { 1901 1821 pr_err("gpib: ioports starting at 0x%lx are already in use\n", 1902 1822 (unsigned long)curr_dev->resource[0]->start); 1903 1823 return -EIO;
-1
drivers/staging/rtl8723bs/Makefile
··· 48 48 hal/HalHWImg8723B_RF.o \ 49 49 hal/HalPhyRf_8723B.o \ 50 50 os_dep/ioctl_cfg80211.o \ 51 - os_dep/ioctl_linux.o \ 52 51 os_dep/mlme_linux.o \ 53 52 os_dep/osdep_service.o \ 54 53 os_dep/os_intfs.o \
+5 -5
drivers/staging/rtl8723bs/core/rtw_io.c
··· 141 141 */ 142 142 int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj) 143 143 { 144 - int ret = false; 145 - int value = atomic_inc_return(&dvobj->continual_io_error); 146 - if (value > MAX_CONTINUAL_IO_ERR) 147 - ret = true; 144 + int error_count = atomic_inc_return(&dvobj->continual_io_error); 148 145 149 - return ret; 146 + if (error_count > MAX_CONTINUAL_IO_ERR) 147 + return true; 148 + 149 + return false; 150 150 } 151 151 152 152 /*
-1
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
··· 4959 4959 rtw_hal_get_def_var(padapter, HW_DEF_RA_INFO_DUMP, &i); 4960 4960 } 4961 4961 } 4962 - rtw_hal_set_def_var(padapter, HAL_DEF_DBG_RX_INFO_DUMP, NULL); 4963 4962 } 4964 4963 } 4965 4964
+4 -2
drivers/staging/rtl8723bs/core/rtw_xmit.c
··· 1467 1467 pxmitbuf->priv_data = NULL; 1468 1468 1469 1469 pxmitbuf->len = 0; 1470 - pxmitbuf->pdata = pxmitbuf->ptail = pxmitbuf->phead; 1470 + pxmitbuf->pdata = pxmitbuf->phead; 1471 + pxmitbuf->ptail = pxmitbuf->phead; 1471 1472 pxmitbuf->agg_num = 1; 1472 1473 1473 1474 if (pxmitbuf->sctx) ··· 1527 1526 pxmitbuf->priv_data = NULL; 1528 1527 1529 1528 pxmitbuf->len = 0; 1530 - pxmitbuf->pdata = pxmitbuf->ptail = pxmitbuf->phead; 1529 + pxmitbuf->pdata = pxmitbuf->phead; 1530 + pxmitbuf->ptail = pxmitbuf->phead; 1531 1531 pxmitbuf->agg_num = 0; 1532 1532 pxmitbuf->pg_num = 0; 1533 1533
-55
drivers/staging/rtl8723bs/hal/hal_com.c
··· 682 682 u8 bResult = _SUCCESS; 683 683 684 684 switch (variable) { 685 - case HAL_DEF_DBG_RX_INFO_DUMP: 686 - 687 - if (odm->bLinked) { 688 - #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA 689 - rtw_dump_raw_rssi_info(adapter); 690 - #endif 691 - } 692 - break; 693 685 case HW_DEF_ODM_DBG_FLAG: 694 686 ODM_CmnInfoUpdate(odm, ODM_CMNINFO_DBG_COMP, *((u64 *)value)); 695 687 break; ··· 870 878 pdbgpriv->dbg_rx_fifo_diff_overflow = pdbgpriv->dbg_rx_fifo_curr_overflow-pdbgpriv->dbg_rx_fifo_last_overflow; 871 879 } 872 880 } 873 - 874 - #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA 875 - void rtw_dump_raw_rssi_info(struct adapter *padapter) 876 - { 877 - u8 isCCKrate, rf_path; 878 - struct hal_com_data *pHalData = GET_HAL_DATA(padapter); 879 - struct rx_raw_rssi *psample_pkt_rssi = &padapter->recvpriv.raw_rssi_info; 880 - 881 - isCCKrate = psample_pkt_rssi->data_rate <= DESC_RATE11M; 882 - 883 - if (isCCKrate) 884 - psample_pkt_rssi->mimo_signal_strength[0] = psample_pkt_rssi->pwdball; 885 - 886 - for (rf_path = 0; rf_path < pHalData->NumTotalRFPath; rf_path++) { 887 - if (!isCCKrate) { 888 - netdev_dbg(padapter->pnetdev, ", rx_ofdm_pwr:%d(dBm), rx_ofdm_snr:%d(dB)\n", 889 - psample_pkt_rssi->ofdm_pwr[rf_path], 890 - psample_pkt_rssi->ofdm_snr[rf_path]); 891 - } 892 - } 893 - } 894 - 895 - void rtw_store_phy_info(struct adapter *padapter, union recv_frame *prframe) 896 - { 897 - u8 isCCKrate, rf_path; 898 - struct hal_com_data *pHalData = GET_HAL_DATA(padapter); 899 - struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; 900 - 901 - struct odm_phy_info *pPhyInfo = (PODM_PHY_INFO_T)(&pattrib->phy_info); 902 - struct rx_raw_rssi *psample_pkt_rssi = &padapter->recvpriv.raw_rssi_info; 903 - 904 - psample_pkt_rssi->data_rate = pattrib->data_rate; 905 - isCCKrate = pattrib->data_rate <= DESC_RATE11M; 906 - 907 - psample_pkt_rssi->pwdball = pPhyInfo->rx_pwd_ba11; 908 - psample_pkt_rssi->pwr_all = pPhyInfo->recv_signal_power; 909 - 910 - for (rf_path = 0; rf_path < pHalData->NumTotalRFPath; rf_path++) { 911 - psample_pkt_rssi->mimo_signal_strength[rf_path] = pPhyInfo->rx_mimo_signal_strength[rf_path]; 912 - psample_pkt_rssi->mimo_signal_quality[rf_path] = pPhyInfo->rx_mimo_signal_quality[rf_path]; 913 - if (!isCCKrate) { 914 - psample_pkt_rssi->ofdm_pwr[rf_path] = pPhyInfo->RxPwr[rf_path]; 915 - psample_pkt_rssi->ofdm_snr[rf_path] = pPhyInfo->RxSNR[rf_path]; 916 - } 917 - } 918 - } 919 - #endif 920 881 921 882 static u32 Array_kfreemap[] = { 922 883 0xf8, 0xe,
-4
drivers/staging/rtl8723bs/hal/rtl8723b_rxdesc.c
··· 67 67 /* Check EVM */ 68 68 /* */ 69 69 process_link_qual(padapter, precvframe); 70 - #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA 71 - rtw_store_phy_info(padapter, prframe); 72 - #endif 73 - 74 70 }
-5
drivers/staging/rtl8723bs/include/hal_com.h
··· 149 149 150 150 bool GetU1ByteIntegerFromStringInDecimal(char *str, u8 *in); 151 151 152 - #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA 153 - void rtw_store_phy_info(struct adapter *padapter, union recv_frame *prframe); 154 - void rtw_dump_raw_rssi_info(struct adapter *padapter); 155 - #endif 156 - 157 152 #define HWSET_MAX_SIZE 512 158 153 159 154 void rtw_bb_rf_gain_offset(struct adapter *padapter);
-1
drivers/staging/rtl8723bs/include/hal_intf.h
··· 144 144 HAL_DEF_PCI_AMD_L1_SUPPORT, 145 145 HAL_DEF_PCI_ASPM_OSC, /* Support for ASPM OSC, added by Roger, 2013.03.27. */ 146 146 HAL_DEF_MACID_SLEEP, /* Support for MACID sleep */ 147 - HAL_DEF_DBG_RX_INFO_DUMP, 148 147 }; 149 148 150 149 enum hal_odm_variable {
-2
drivers/staging/rtl8723bs/include/osdep_intf.h
··· 47 47 void rtw_stop_drv_threads(struct adapter *padapter); 48 48 void rtw_cancel_all_timer(struct adapter *padapter); 49 49 50 - int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 51 - 52 50 int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname); 53 51 struct net_device *rtw_init_netdev(struct adapter *padapter); 54 52 void rtw_unregister_netdevs(struct dvobj_priv *dvobj);
-18
drivers/staging/rtl8723bs/include/rtw_recv.h
··· 89 89 u8 btCoexPwrAdjust; 90 90 }; 91 91 92 - #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA 93 - struct rx_raw_rssi { 94 - u8 data_rate; 95 - u8 pwdball; 96 - s8 pwr_all; 97 - 98 - u8 mimo_signal_strength[4];/* in 0~100 index */ 99 - u8 mimo_signal_quality[4]; 100 - 101 - s8 ofdm_pwr[4]; 102 - u8 ofdm_snr[4]; 103 - 104 - }; 105 - #endif 106 - 107 92 struct rx_pkt_attrib { 108 93 u16 pkt_len; 109 94 u8 physt; ··· 206 221 u8 signal_strength; 207 222 u8 signal_qual; 208 223 s8 rssi; /* translate_percentage_to_dbm(ptarget_wlan->network.PhyInfo.SignalStrength); */ 209 - #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA 210 - struct rx_raw_rssi raw_rssi_info; 211 - #endif 212 224 /* s8 rxpwdb; */ 213 225 s16 noise; 214 226 /* int RxSNRdB[2]; */
-1286
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /****************************************************************************** 3 - * 4 - * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. 5 - * 6 - ******************************************************************************/ 7 - 8 - #include <linux/etherdevice.h> 9 - #include <drv_types.h> 10 - #include <rtw_mp.h> 11 - #include <hal_btcoex.h> 12 - #include <linux/jiffies.h> 13 - #include <linux/kernel.h> 14 - 15 - #define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30) 16 - 17 - static int wpa_set_auth_algs(struct net_device *dev, u32 value) 18 - { 19 - struct adapter *padapter = rtw_netdev_priv(dev); 20 - int ret = 0; 21 - 22 - if ((value & IW_AUTH_ALG_SHARED_KEY) && (value & IW_AUTH_ALG_OPEN_SYSTEM)) { 23 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; 24 - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeAutoSwitch; 25 - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; 26 - } else if (value & IW_AUTH_ALG_SHARED_KEY) { 27 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; 28 - 29 - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeShared; 30 - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; 31 - } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { 32 - /* padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; */ 33 - if (padapter->securitypriv.ndisauthtype < Ndis802_11AuthModeWPAPSK) { 34 - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; 35 - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open; 36 - } 37 - } else { 38 - ret = -EINVAL; 39 - } 40 - 41 - return ret; 42 - } 43 - 44 - static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) 45 - { 46 - int ret = 0; 47 - u8 max_idx; 48 - u32 wep_key_idx, wep_key_len, wep_total_len; 49 - struct ndis_802_11_wep *pwep = NULL; 50 - struct adapter *padapter = rtw_netdev_priv(dev); 51 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 52 - struct security_priv *psecuritypriv = &padapter->securitypriv; 53 - 54 - param->u.crypt.err = 0; 55 - param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; 56 - 57 - if (param_len < (u32)((u8 *)param->u.crypt.key - (u8 *)param) + param->u.crypt.key_len) { 58 - ret = -EINVAL; 59 - goto exit; 60 - } 61 - 62 - if (param->sta_addr[0] != 0xff || param->sta_addr[1] != 0xff || 63 - param->sta_addr[2] != 0xff || param->sta_addr[3] != 0xff || 64 - param->sta_addr[4] != 0xff || param->sta_addr[5] != 0xff) { 65 - ret = -EINVAL; 66 - goto exit; 67 - } 68 - 69 - if (strcmp(param->u.crypt.alg, "WEP") == 0) 70 - max_idx = WEP_KEYS - 1; 71 - else 72 - max_idx = BIP_MAX_KEYID; 73 - 74 - if (param->u.crypt.idx > max_idx) { 75 - netdev_err(dev, "Error crypt.idx %d > %d\n", param->u.crypt.idx, max_idx); 76 - ret = -EINVAL; 77 - goto exit; 78 - } 79 - 80 - if (strcmp(param->u.crypt.alg, "WEP") == 0) { 81 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; 82 - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_; 83 - padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_; 84 - 85 - wep_key_idx = param->u.crypt.idx; 86 - wep_key_len = param->u.crypt.key_len; 87 - 88 - if (wep_key_len > 0) { 89 - wep_key_len = wep_key_len <= 5 ? 5 : 13; 90 - wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material); 91 - /* Allocate a full structure to avoid potentially running off the end. */ 92 - pwep = kzalloc(sizeof(*pwep), GFP_KERNEL); 93 - if (!pwep) { 94 - ret = -ENOMEM; 95 - goto exit; 96 - } 97 - 98 - pwep->key_length = wep_key_len; 99 - pwep->length = wep_total_len; 100 - 101 - if (wep_key_len == 13) { 102 - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP104_; 103 - padapter->securitypriv.dot118021XGrpPrivacy = _WEP104_; 104 - } 105 - } else { 106 - ret = -EINVAL; 107 - goto exit; 108 - } 109 - 110 - pwep->key_index = wep_key_idx; 111 - pwep->key_index |= 0x80000000; 112 - 113 - memcpy(pwep->key_material, param->u.crypt.key, pwep->key_length); 114 - 115 - if (param->u.crypt.set_tx) { 116 - if (rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) 117 - ret = -EOPNOTSUPP; 118 - } else { 119 - /* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */ 120 - /* psecuritypriv->dot11PrivacyKeyIndex =keyid", but can rtw_set_key to fw/cam */ 121 - 122 - if (wep_key_idx >= WEP_KEYS) { 123 - ret = -EOPNOTSUPP; 124 - goto exit; 125 - } 126 - 127 - memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length); 128 - psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length; 129 - rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0, true); 130 - } 131 - 132 - goto exit; 133 - } 134 - 135 - if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) { /* 802_1x */ 136 - struct sta_info *psta, *pbcmc_sta; 137 - struct sta_priv *pstapriv = &padapter->stapriv; 138 - 139 - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == true) { /* sta mode */ 140 - psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); 141 - if (psta) { 142 - /* Jeff: don't disable ieee8021x_blocked while clearing key */ 143 - if (strcmp(param->u.crypt.alg, "none") != 0) 144 - psta->ieee8021x_blocked = false; 145 - 146 - if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) || 147 - (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { 148 - psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; 149 - } 150 - 151 - if (param->u.crypt.set_tx == 1) { /* pairwise key */ 152 - memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); 153 - 154 - if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */ 155 - memcpy(psta->dot11tkiptxmickey.skey, &param->u.crypt.key[16], 8); 156 - memcpy(psta->dot11tkiprxmickey.skey, &param->u.crypt.key[24], 8); 157 - 158 - padapter->securitypriv.busetkipkey = false; 159 - /* _set_timer(&padapter->securitypriv.tkip_timer, 50); */ 160 - } 161 - 162 - rtw_setstakey_cmd(padapter, psta, true, true); 163 - } else { /* group key */ 164 - if (strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) { 165 - memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); 166 - /* only TKIP group key need to install this */ 167 - if (param->u.crypt.key_len > 16) { 168 - memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey, &param->u.crypt.key[16], 8); 169 - memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, &param->u.crypt.key[24], 8); 170 - } 171 - padapter->securitypriv.binstallGrpkey = true; 172 - 173 - padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx; 174 - 175 - rtw_set_key(padapter, &padapter->securitypriv, param->u.crypt.idx, 1, true); 176 - } else if (strcmp(param->u.crypt.alg, "BIP") == 0) { 177 - /* save the IGTK key, length 16 bytes */ 178 - memcpy(padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); 179 - padapter->securitypriv.dot11wBIPKeyid = param->u.crypt.idx; 180 - padapter->securitypriv.binstallBIPkey = true; 181 - } 182 - } 183 - } 184 - 185 - pbcmc_sta = rtw_get_bcmc_stainfo(padapter); 186 - if (pbcmc_sta) { 187 - /* Jeff: don't disable ieee8021x_blocked while clearing key */ 188 - if (strcmp(param->u.crypt.alg, "none") != 0) 189 - pbcmc_sta->ieee8021x_blocked = false; 190 - 191 - if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) || 192 - (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { 193 - pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; 194 - } 195 - } 196 - } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { 197 - /* adhoc mode */ 198 - } 199 - } 200 - 201 - exit: 202 - 203 - kfree(pwep); 204 - return ret; 205 - } 206 - 207 - static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ielen) 208 - { 209 - u8 *buf = NULL; 210 - int group_cipher = 0, pairwise_cipher = 0; 211 - int ret = 0; 212 - u8 null_addr[] = {0, 0, 0, 0, 0, 0}; 213 - 214 - if (ielen > MAX_WPA_IE_LEN || !pie) { 215 - _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); 216 - if (!pie) 217 - return ret; 218 - else 219 - return -EINVAL; 220 - } 221 - 222 - if (ielen) { 223 - buf = rtw_zmalloc(ielen); 224 - if (!buf) { 225 - ret = -ENOMEM; 226 - goto exit; 227 - } 228 - 229 - memcpy(buf, pie, ielen); 230 - 231 - if (ielen < RSN_HEADER_LEN) { 232 - ret = -1; 233 - goto exit; 234 - } 235 - 236 - if (rtw_parse_wpa_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { 237 - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; 238 - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; 239 - memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); 240 - } 241 - 242 - if (rtw_parse_wpa2_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { 243 - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; 244 - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPA2PSK; 245 - memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); 246 - } 247 - 248 - if (group_cipher == 0) 249 - group_cipher = WPA_CIPHER_NONE; 250 - if (pairwise_cipher == 0) 251 - pairwise_cipher = WPA_CIPHER_NONE; 252 - 253 - switch (group_cipher) { 254 - case WPA_CIPHER_NONE: 255 - padapter->securitypriv.dot118021XGrpPrivacy = _NO_PRIVACY_; 256 - padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; 257 - break; 258 - case WPA_CIPHER_WEP40: 259 - padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_; 260 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; 261 - break; 262 - case WPA_CIPHER_TKIP: 263 - padapter->securitypriv.dot118021XGrpPrivacy = _TKIP_; 264 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; 265 - break; 266 - case WPA_CIPHER_CCMP: 267 - padapter->securitypriv.dot118021XGrpPrivacy = _AES_; 268 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; 269 - break; 270 - case WPA_CIPHER_WEP104: 271 - padapter->securitypriv.dot118021XGrpPrivacy = _WEP104_; 272 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; 273 - break; 274 - } 275 - 276 - switch (pairwise_cipher) { 277 - case WPA_CIPHER_NONE: 278 - padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_; 279 - padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; 280 - break; 281 - case WPA_CIPHER_WEP40: 282 - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_; 283 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; 284 - break; 285 - case WPA_CIPHER_TKIP: 286 - padapter->securitypriv.dot11PrivacyAlgrthm = _TKIP_; 287 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; 288 - break; 289 - case WPA_CIPHER_CCMP: 290 - padapter->securitypriv.dot11PrivacyAlgrthm = _AES_; 291 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; 292 - break; 293 - case WPA_CIPHER_WEP104: 294 - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP104_; 295 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; 296 - break; 297 - } 298 - 299 - _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); 300 - {/* set wps_ie */ 301 - u16 cnt = 0; 302 - u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04}; 303 - 304 - while (cnt < ielen) { 305 - eid = buf[cnt]; 306 - 307 - if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&buf[cnt + 2], wps_oui, 4))) { 308 - padapter->securitypriv.wps_ie_len = ((buf[cnt + 1] + 2) < MAX_WPS_IE_LEN) ? (buf[cnt + 1] + 2) : MAX_WPS_IE_LEN; 309 - 310 - memcpy(padapter->securitypriv.wps_ie, &buf[cnt], padapter->securitypriv.wps_ie_len); 311 - 312 - set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS); 313 - 314 - cnt += buf[cnt + 1] + 2; 315 - 316 - break; 317 - } else { 318 - cnt += buf[cnt + 1] + 2; /* goto next */ 319 - } 320 - } 321 - } 322 - } 323 - 324 - /* TKIP and AES disallow multicast packets until installing group key */ 325 - if (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ || 326 - padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ || 327 - padapter->securitypriv.dot11PrivacyAlgrthm == _AES_) 328 - /* WPS open need to enable multicast */ 329 - /* check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == true) */ 330 - rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr); 331 - 332 - exit: 333 - 334 - kfree(buf); 335 - 336 - return ret; 337 - } 338 - 339 - static int wpa_set_param(struct net_device *dev, u8 name, u32 value) 340 - { 341 - uint ret = 0; 342 - struct adapter *padapter = rtw_netdev_priv(dev); 343 - 344 - switch (name) { 345 - case IEEE_PARAM_WPA_ENABLED: 346 - 347 - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; /* 802.1x */ 348 - 349 - /* ret = ieee80211_wpa_enable(ieee, value); */ 350 - 351 - switch ((value) & 0xff) { 352 - case 1: /* WPA */ 353 - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; /* WPA_PSK */ 354 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; 355 - break; 356 - case 2: /* WPA2 */ 357 - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPA2PSK; /* WPA2_PSK */ 358 - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; 359 - break; 360 - } 361 - 362 - break; 363 - 364 - case IEEE_PARAM_TKIP_COUNTERMEASURES: 365 - /* ieee->tkip_countermeasures =value; */ 366 - break; 367 - 368 - case IEEE_PARAM_DROP_UNENCRYPTED: 369 - { 370 - /* HACK: 371 - * 372 - * wpa_supplicant calls set_wpa_enabled when the driver 373 - * is loaded and unloaded, regardless of if WPA is being 374 - * used. No other calls are made which can be used to 375 - * determine if encryption will be used or not prior to 376 - * association being expected. If encryption is not being 377 - * used, drop_unencrypted is set to false, else true -- we 378 - * can use this to determine if the CAP_PRIVACY_ON bit should 379 - * be set. 380 - */ 381 - break; 382 - } 383 - case IEEE_PARAM_PRIVACY_INVOKED: 384 - 385 - /* ieee->privacy_invoked =value; */ 386 - 387 - break; 388 - 389 - case IEEE_PARAM_AUTH_ALGS: 390 - 391 - ret = wpa_set_auth_algs(dev, value); 392 - 393 - break; 394 - 395 - case IEEE_PARAM_IEEE_802_1X: 396 - 397 - /* ieee->ieee802_1x =value; */ 398 - 399 - break; 400 - 401 - case IEEE_PARAM_WPAX_SELECT: 402 - 403 - /* added for WPA2 mixed mode */ 404 - /* 405 - spin_lock_irqsave(&ieee->wpax_suitlist_lock, flags); 406 - ieee->wpax_type_set = 1; 407 - ieee->wpax_type_notify = value; 408 - spin_unlock_irqrestore(&ieee->wpax_suitlist_lock, flags); 409 - */ 410 - 411 - break; 412 - 413 - default: 414 - 415 - ret = -EOPNOTSUPP; 416 - 417 - break; 418 - } 419 - 420 - return ret; 421 - } 422 - 423 - static int wpa_mlme(struct net_device *dev, u32 command, u32 reason) 424 - { 425 - int ret = 0; 426 - struct adapter *padapter = rtw_netdev_priv(dev); 427 - 428 - switch (command) { 429 - case IEEE_MLME_STA_DEAUTH: 430 - 431 - if (!rtw_set_802_11_disassociate(padapter)) 432 - ret = -1; 433 - 434 - break; 435 - 436 - case IEEE_MLME_STA_DISASSOC: 437 - 438 - if (!rtw_set_802_11_disassociate(padapter)) 439 - ret = -1; 440 - 441 - break; 442 - 443 - default: 444 - ret = -EOPNOTSUPP; 445 - break; 446 - } 447 - 448 - return ret; 449 - } 450 - 451 - static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) 452 - { 453 - struct ieee_param *param; 454 - uint ret = 0; 455 - 456 - /* down(&ieee->wx_sem); */ 457 - 458 - if (!p->pointer || p->length != sizeof(struct ieee_param)) 459 - return -EINVAL; 460 - 461 - param = rtw_malloc(p->length); 462 - if (!param) 463 - return -ENOMEM; 464 - 465 - if (copy_from_user(param, p->pointer, p->length)) { 466 - kfree(param); 467 - return -EFAULT; 468 - } 469 - 470 - switch (param->cmd) { 471 - case IEEE_CMD_SET_WPA_PARAM: 472 - ret = wpa_set_param(dev, param->u.wpa_param.name, param->u.wpa_param.value); 473 - break; 474 - 475 - case IEEE_CMD_SET_WPA_IE: 476 - /* ret = wpa_set_wpa_ie(dev, param, p->length); */ 477 - ret = rtw_set_wpa_ie(rtw_netdev_priv(dev), (char *)param->u.wpa_ie.data, (u16)param->u.wpa_ie.len); 478 - break; 479 - 480 - case IEEE_CMD_SET_ENCRYPTION: 481 - ret = wpa_set_encryption(dev, param, p->length); 482 - break; 483 - 484 - case IEEE_CMD_MLME: 485 - ret = wpa_mlme(dev, param->u.mlme.command, param->u.mlme.reason_code); 486 - break; 487 - 488 - default: 489 - ret = -EOPNOTSUPP; 490 - break; 491 - } 492 - 493 - if (ret == 0 && copy_to_user(p->pointer, param, p->length)) 494 - ret = -EFAULT; 495 - 496 - kfree(param); 497 - 498 - /* up(&ieee->wx_sem); */ 499 - return ret; 500 - } 501 - 502 - static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) 503 - { 504 - int ret = 0; 505 - u32 wep_key_idx, wep_key_len, wep_total_len; 506 - struct ndis_802_11_wep *pwep = NULL; 507 - struct sta_info *psta = NULL, *pbcmc_sta = NULL; 508 - struct adapter *padapter = rtw_netdev_priv(dev); 509 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 510 - struct security_priv *psecuritypriv = &padapter->securitypriv; 511 - struct sta_priv *pstapriv = &padapter->stapriv; 512 - char *txkey = padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey; 513 - char *rxkey = padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey; 514 - char *grpkey = psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey; 515 - 516 - param->u.crypt.err = 0; 517 - param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; 518 - 519 - /* sizeof(struct ieee_param) = 64 bytes; */ 520 - /* if (param_len != (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) */ 521 - if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len) { 522 - ret = -EINVAL; 523 - goto exit; 524 - } 525 - 526 - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && 527 - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && 528 - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { 529 - if (param->u.crypt.idx >= WEP_KEYS) { 530 - ret = -EINVAL; 531 - goto exit; 532 - } 533 - } else { 534 - psta = rtw_get_stainfo(pstapriv, param->sta_addr); 535 - if (!psta) 536 - /* ret = -EINVAL; */ 537 - goto exit; 538 - } 539 - 540 - if (strcmp(param->u.crypt.alg, "none") == 0 && !psta) { 541 - /* todo:clear default encryption keys */ 542 - 543 - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; 544 - psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled; 545 - psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; 546 - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; 547 - 548 - goto exit; 549 - } 550 - 551 - if (strcmp(param->u.crypt.alg, "WEP") == 0 && !psta) { 552 - wep_key_idx = param->u.crypt.idx; 553 - wep_key_len = param->u.crypt.key_len; 554 - 555 - if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0)) { 556 - ret = -EINVAL; 557 - goto exit; 558 - } 559 - 560 - if (wep_key_len > 0) { 561 - wep_key_len = wep_key_len <= 5 ? 5 : 13; 562 - wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material); 563 - /* Allocate a full structure to avoid potentially running off the end. */ 564 - pwep = kzalloc(sizeof(*pwep), GFP_KERNEL); 565 - if (!pwep) 566 - goto exit; 567 - 568 - pwep->key_length = wep_key_len; 569 - pwep->length = wep_total_len; 570 - } 571 - 572 - pwep->key_index = wep_key_idx; 573 - 574 - memcpy(pwep->key_material, param->u.crypt.key, pwep->key_length); 575 - 576 - if (param->u.crypt.set_tx) { 577 - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; 578 - psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; 579 - psecuritypriv->dot11PrivacyAlgrthm = _WEP40_; 580 - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; 581 - 582 - if (pwep->key_length == 13) { 583 - psecuritypriv->dot11PrivacyAlgrthm = _WEP104_; 584 - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; 585 - } 586 - 587 - psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx; 588 - 589 - memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length); 590 - 591 - psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length; 592 - 593 - rtw_ap_set_wep_key(padapter, pwep->key_material, pwep->key_length, wep_key_idx, 1); 594 - } else { 595 - /* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */ 596 - /* psecuritypriv->dot11PrivacyKeyIndex =keyid", but can rtw_set_key to cam */ 597 - 598 - memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length); 599 - 600 - psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length; 601 - 602 - rtw_ap_set_wep_key(padapter, pwep->key_material, pwep->key_length, wep_key_idx, 0); 603 - } 604 - 605 - goto exit; 606 - } 607 - 608 - if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* group key */ 609 - if (param->u.crypt.set_tx == 1) { 610 - if (strcmp(param->u.crypt.alg, "WEP") == 0) { 611 - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); 612 - 613 - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; 614 - if (param->u.crypt.key_len == 13) 615 - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; 616 - 617 - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { 618 - psecuritypriv->dot118021XGrpPrivacy = _TKIP_; 619 - 620 - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); 621 - 622 - /* set mic key */ 623 - memcpy(txkey, &param->u.crypt.key[16], 8); 624 - memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, &param->u.crypt.key[24], 8); 625 - 626 - psecuritypriv->busetkipkey = true; 627 - 628 - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { 629 - psecuritypriv->dot118021XGrpPrivacy = _AES_; 630 - 631 - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); 632 - } else { 633 - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; 634 - } 635 - 636 - psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; 637 - 638 - psecuritypriv->binstallGrpkey = true; 639 - 640 - psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/* */ 641 - 642 - rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); 643 - 644 - pbcmc_sta = rtw_get_bcmc_stainfo(padapter); 645 - if (pbcmc_sta) { 646 - pbcmc_sta->ieee8021x_blocked = false; 647 - pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ 648 - } 649 - } 650 - 651 - goto exit; 652 - } 653 - 654 - if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) { /* psk/802_1x */ 655 - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { 656 - if (param->u.crypt.set_tx == 1) { 657 - memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); 658 - 659 - if (strcmp(param->u.crypt.alg, "WEP") == 0) { 660 - psta->dot118021XPrivacy = _WEP40_; 661 - if (param->u.crypt.key_len == 13) 662 - psta->dot118021XPrivacy = _WEP104_; 663 - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { 664 - psta->dot118021XPrivacy = _TKIP_; 665 - 666 - /* set mic key */ 667 - memcpy(psta->dot11tkiptxmickey.skey, &param->u.crypt.key[16], 8); 668 - memcpy(psta->dot11tkiprxmickey.skey, &param->u.crypt.key[24], 8); 669 - 670 - psecuritypriv->busetkipkey = true; 671 - 672 - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { 673 - psta->dot118021XPrivacy = _AES_; 674 - } else { 675 - psta->dot118021XPrivacy = _NO_PRIVACY_; 676 - } 677 - 678 - rtw_ap_set_pairwise_key(padapter, psta); 679 - 680 - psta->ieee8021x_blocked = false; 681 - 682 - } else { /* group key??? */ 683 - if (strcmp(param->u.crypt.alg, "WEP") == 0) { 684 - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); 685 - 686 - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; 687 - if (param->u.crypt.key_len == 13) 688 - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; 689 - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { 690 - psecuritypriv->dot118021XGrpPrivacy = _TKIP_; 691 - 692 - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); 693 - 694 - /* set mic key */ 695 - memcpy(txkey, &param->u.crypt.key[16], 8); 696 - memcpy(rxkey, &param->u.crypt.key[24], 8); 697 - 698 - psecuritypriv->busetkipkey = true; 699 - 700 - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { 701 - psecuritypriv->dot118021XGrpPrivacy = _AES_; 702 - 703 - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); 704 - } else { 705 - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; 706 - } 707 - 708 - psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; 709 - 710 - psecuritypriv->binstallGrpkey = true; 711 - 712 - psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/* */ 713 - 714 - rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); 715 - 716 - pbcmc_sta = rtw_get_bcmc_stainfo(padapter); 717 - if (pbcmc_sta) { 718 - pbcmc_sta->ieee8021x_blocked = false; 719 - pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ 720 - } 721 - } 722 - } 723 - } 724 - 725 - exit: 726 - kfree(pwep); 727 - 728 - return ret; 729 - } 730 - 731 - static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int len) 732 - { 733 - int ret = 0; 734 - struct adapter *padapter = rtw_netdev_priv(dev); 735 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 736 - struct sta_priv *pstapriv = &padapter->stapriv; 737 - unsigned char *pbuf = param->u.bcn_ie.buf; 738 - 739 - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) 740 - return -EINVAL; 741 - 742 - memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); 743 - 744 - if ((pstapriv->max_num_sta > NUM_STA) || (pstapriv->max_num_sta <= 0)) 745 - pstapriv->max_num_sta = NUM_STA; 746 - 747 - if (rtw_check_beacon_data(padapter, pbuf, (len - 12 - 2)) == _SUCCESS)/* 12 = param header, 2:no packed */ 748 - ret = 0; 749 - else 750 - ret = -EINVAL; 751 - 752 - return ret; 753 - } 754 - 755 - static void rtw_hostapd_sta_flush(struct net_device *dev) 756 - { 757 - /* _irqL irqL; */ 758 - /* struct list_head *phead, *plist; */ 759 - /* struct sta_info *psta = NULL; */ 760 - struct adapter *padapter = rtw_netdev_priv(dev); 761 - /* struct sta_priv *pstapriv = &padapter->stapriv; */ 762 - 763 - flush_all_cam_entry(padapter); /* clear CAM */ 764 - 765 - rtw_sta_flush(padapter); 766 - } 767 - 768 - static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) 769 - { 770 - int ret = 0; 771 - struct sta_info *psta = NULL; 772 - struct adapter *padapter = rtw_netdev_priv(dev); 773 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 774 - struct sta_priv *pstapriv = &padapter->stapriv; 775 - 776 - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) 777 - return -EINVAL; 778 - 779 - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && 780 - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && 781 - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { 782 - return -EINVAL; 783 - } 784 - 785 - /* 786 - psta = rtw_get_stainfo(pstapriv, param->sta_addr); 787 - if (psta) 788 - { 789 - rtw_free_stainfo(padapter, psta); 790 - 791 - psta = NULL; 792 - } 793 - */ 794 - /* psta = rtw_alloc_stainfo(pstapriv, param->sta_addr); */ 795 - psta = rtw_get_stainfo(pstapriv, param->sta_addr); 796 - if (psta) { 797 - int flags = param->u.add_sta.flags; 798 - 799 - psta->aid = param->u.add_sta.aid;/* aid = 1~2007 */ 800 - 801 - memcpy(psta->bssrateset, param->u.add_sta.tx_supp_rates, 16); 802 - 803 - /* check wmm cap. */ 804 - if (WLAN_STA_WME & flags) 805 - psta->qos_option = 1; 806 - else 807 - psta->qos_option = 0; 808 - 809 - if (pmlmepriv->qospriv.qos_option == 0) 810 - psta->qos_option = 0; 811 - 812 - /* chec 802.11n ht cap. */ 813 - if (WLAN_STA_HT & flags) { 814 - psta->htpriv.ht_option = true; 815 - psta->qos_option = 1; 816 - memcpy((void *)&psta->htpriv.ht_cap, (void *)&param->u.add_sta.ht_cap, sizeof(struct ieee80211_ht_cap)); 817 - } else { 818 - psta->htpriv.ht_option = false; 819 - } 820 - 821 - if (!pmlmepriv->htpriv.ht_option) 822 - psta->htpriv.ht_option = false; 823 - 824 - update_sta_info_apmode(padapter, psta); 825 - 826 - } else { 827 - ret = -ENOMEM; 828 - } 829 - 830 - return ret; 831 - } 832 - 833 - static int rtw_del_sta(struct net_device *dev, struct ieee_param *param) 834 - { 835 - int ret = 0; 836 - struct sta_info *psta = NULL; 837 - struct adapter *padapter = rtw_netdev_priv(dev); 838 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 839 - struct sta_priv *pstapriv = &padapter->stapriv; 840 - 841 - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) 842 - return -EINVAL; 843 - 844 - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && 845 - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && 846 - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { 847 - return -EINVAL; 848 - } 849 - 850 - psta = rtw_get_stainfo(pstapriv, param->sta_addr); 851 - if (psta) { 852 - u8 updated = false; 853 - 854 - spin_lock_bh(&pstapriv->asoc_list_lock); 855 - if (list_empty(&psta->asoc_list) == false) { 856 - list_del_init(&psta->asoc_list); 857 - pstapriv->asoc_list_cnt--; 858 - updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING); 859 - } 860 - spin_unlock_bh(&pstapriv->asoc_list_lock); 861 - 862 - associated_clients_update(padapter, updated); 863 - 864 - psta = NULL; 865 - } 866 - 867 - return ret; 868 - } 869 - 870 - static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *param, int len) 871 - { 872 - int ret = 0; 873 - struct sta_info *psta = NULL; 874 - struct adapter *padapter = rtw_netdev_priv(dev); 875 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 876 - struct sta_priv *pstapriv = &padapter->stapriv; 877 - struct ieee_param_ex *param_ex = (struct ieee_param_ex *)param; 878 - struct sta_data *psta_data = (struct sta_data *)param_ex->data; 879 - 880 - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) 881 - return -EINVAL; 882 - 883 - if (param_ex->sta_addr[0] == 0xff && param_ex->sta_addr[1] == 0xff && 884 - param_ex->sta_addr[2] == 0xff && param_ex->sta_addr[3] == 0xff && 885 - param_ex->sta_addr[4] == 0xff && param_ex->sta_addr[5] == 0xff) { 886 - return -EINVAL; 887 - } 888 - 889 - psta = rtw_get_stainfo(pstapriv, param_ex->sta_addr); 890 - if (psta) { 891 - psta_data->aid = (u16)psta->aid; 892 - psta_data->capability = psta->capability; 893 - psta_data->flags = psta->flags; 894 - 895 - /* 896 - nonerp_set : BIT(0) 897 - no_short_slot_time_set : BIT(1) 898 - no_short_preamble_set : BIT(2) 899 - no_ht_gf_set : BIT(3) 900 - no_ht_set : BIT(4) 901 - ht_20mhz_set : BIT(5) 902 - */ 903 - 904 - psta_data->sta_set = ((psta->nonerp_set) | 905 - (psta->no_short_slot_time_set << 1) | 906 - (psta->no_short_preamble_set << 2) | 907 - (psta->no_ht_gf_set << 3) | 908 - (psta->no_ht_set << 4) | 909 - (psta->ht_20mhz_set << 5)); 910 - 911 - psta_data->tx_supp_rates_len = psta->bssratelen; 912 - memcpy(psta_data->tx_supp_rates, psta->bssrateset, psta->bssratelen); 913 - memcpy(&psta_data->ht_cap, &psta->htpriv.ht_cap, sizeof(struct ieee80211_ht_cap)); 914 - psta_data->rx_pkts = psta->sta_stats.rx_data_pkts; 915 - psta_data->rx_bytes = psta->sta_stats.rx_bytes; 916 - psta_data->rx_drops = psta->sta_stats.rx_drops; 917 - 918 - psta_data->tx_pkts = psta->sta_stats.tx_pkts; 919 - psta_data->tx_bytes = psta->sta_stats.tx_bytes; 920 - psta_data->tx_drops = psta->sta_stats.tx_drops; 921 - 922 - } else { 923 - ret = -1; 924 - } 925 - 926 - return ret; 927 - } 928 - 929 - static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) 930 - { 931 - int ret = 0; 932 - struct sta_info *psta = NULL; 933 - struct adapter *padapter = rtw_netdev_priv(dev); 934 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 935 - struct sta_priv *pstapriv = &padapter->stapriv; 936 - 937 - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) 938 - return -EINVAL; 939 - 940 - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && 941 - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && 942 - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { 943 - return -EINVAL; 944 - } 945 - 946 - psta = rtw_get_stainfo(pstapriv, param->sta_addr); 947 - if (psta) { 948 - if ((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == WLAN_EID_VENDOR_SPECIFIC)) { 949 - int wpa_ie_len; 950 - int copy_len; 951 - 952 - wpa_ie_len = psta->wpa_ie[1]; 953 - 954 - copy_len = ((wpa_ie_len + 2) > sizeof(psta->wpa_ie)) ? (sizeof(psta->wpa_ie)) : (wpa_ie_len + 2); 955 - 956 - param->u.wpa_ie.len = copy_len; 957 - 958 - memcpy(param->u.wpa_ie.reserved, psta->wpa_ie, copy_len); 959 - } 960 - } else { 961 - ret = -1; 962 - } 963 - 964 - return ret; 965 - } 966 - 967 - static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, int len) 968 - { 969 - int ret = 0; 970 - unsigned char wps_oui[4] = {0x0, 0x50, 0xf2, 0x04}; 971 - struct adapter *padapter = rtw_netdev_priv(dev); 972 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 973 - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 974 - int ie_len; 975 - 976 - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) 977 - return -EINVAL; 978 - 979 - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ 980 - 981 - kfree(pmlmepriv->wps_beacon_ie); 982 - pmlmepriv->wps_beacon_ie = NULL; 983 - 984 - if (ie_len > 0) { 985 - pmlmepriv->wps_beacon_ie = rtw_malloc(ie_len); 986 - pmlmepriv->wps_beacon_ie_len = ie_len; 987 - if (!pmlmepriv->wps_beacon_ie) 988 - return -EINVAL; 989 - 990 - memcpy(pmlmepriv->wps_beacon_ie, param->u.bcn_ie.buf, ie_len); 991 - 992 - update_beacon(padapter, WLAN_EID_VENDOR_SPECIFIC, wps_oui, true); 993 - 994 - pmlmeext->bstart_bss = true; 995 - } 996 - 997 - return ret; 998 - } 999 - 1000 - static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *param, int len) 1001 - { 1002 - int ret = 0; 1003 - struct adapter *padapter = rtw_netdev_priv(dev); 1004 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1005 - int ie_len; 1006 - 1007 - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) 1008 - return -EINVAL; 1009 - 1010 - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ 1011 - 1012 - kfree(pmlmepriv->wps_probe_resp_ie); 1013 - pmlmepriv->wps_probe_resp_ie = NULL; 1014 - 1015 - if (ie_len > 0) { 1016 - pmlmepriv->wps_probe_resp_ie = rtw_malloc(ie_len); 1017 - pmlmepriv->wps_probe_resp_ie_len = ie_len; 1018 - if (!pmlmepriv->wps_probe_resp_ie) 1019 - return -EINVAL; 1020 - 1021 - memcpy(pmlmepriv->wps_probe_resp_ie, param->u.bcn_ie.buf, ie_len); 1022 - } 1023 - 1024 - return ret; 1025 - } 1026 - 1027 - static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *param, int len) 1028 - { 1029 - int ret = 0; 1030 - struct adapter *padapter = rtw_netdev_priv(dev); 1031 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1032 - int ie_len; 1033 - 1034 - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) 1035 - return -EINVAL; 1036 - 1037 - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ 1038 - 1039 - kfree(pmlmepriv->wps_assoc_resp_ie); 1040 - pmlmepriv->wps_assoc_resp_ie = NULL; 1041 - 1042 - if (ie_len > 0) { 1043 - pmlmepriv->wps_assoc_resp_ie = rtw_malloc(ie_len); 1044 - pmlmepriv->wps_assoc_resp_ie_len = ie_len; 1045 - if (!pmlmepriv->wps_assoc_resp_ie) 1046 - return -EINVAL; 1047 - 1048 - memcpy(pmlmepriv->wps_assoc_resp_ie, param->u.bcn_ie.buf, ie_len); 1049 - } 1050 - 1051 - return ret; 1052 - } 1053 - 1054 - static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param, int len) 1055 - { 1056 - int ret = 0; 1057 - struct adapter *adapter = rtw_netdev_priv(dev); 1058 - struct mlme_priv *mlmepriv = &adapter->mlmepriv; 1059 - struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv; 1060 - struct mlme_ext_info *mlmeinfo = &mlmeext->mlmext_info; 1061 - int ie_len; 1062 - u8 *ssid_ie; 1063 - char ssid[NDIS_802_11_LENGTH_SSID + 1]; 1064 - signed int ssid_len; 1065 - u8 ignore_broadcast_ssid; 1066 - 1067 - if (check_fwstate(mlmepriv, WIFI_AP_STATE) != true) 1068 - return -EPERM; 1069 - 1070 - if (param->u.bcn_ie.reserved[0] != 0xea) 1071 - return -EINVAL; 1072 - 1073 - mlmeinfo->hidden_ssid_mode = ignore_broadcast_ssid = param->u.bcn_ie.reserved[1]; 1074 - 1075 - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ 1076 - ssid_ie = rtw_get_ie(param->u.bcn_ie.buf, WLAN_EID_SSID, &ssid_len, ie_len); 1077 - 1078 - if (ssid_ie && ssid_len > 0 && ssid_len <= NDIS_802_11_LENGTH_SSID) { 1079 - struct wlan_bssid_ex *pbss_network = &mlmepriv->cur_network.network; 1080 - struct wlan_bssid_ex *pbss_network_ext = &mlmeinfo->network; 1081 - 1082 - memcpy(ssid, ssid_ie + 2, ssid_len); 1083 - ssid[ssid_len] = 0x0; 1084 - 1085 - memcpy(pbss_network->ssid.ssid, (void *)ssid, ssid_len); 1086 - pbss_network->ssid.ssid_length = ssid_len; 1087 - memcpy(pbss_network_ext->ssid.ssid, (void *)ssid, ssid_len); 1088 - pbss_network_ext->ssid.ssid_length = ssid_len; 1089 - } 1090 - 1091 - return ret; 1092 - } 1093 - 1094 - static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *param, int len) 1095 - { 1096 - struct adapter *padapter = rtw_netdev_priv(dev); 1097 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1098 - 1099 - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) 1100 - return -EINVAL; 1101 - 1102 - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && 1103 - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && 1104 - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { 1105 - return -EINVAL; 1106 - } 1107 - 1108 - rtw_acl_remove_sta(padapter, param->sta_addr); 1109 - return 0; 1110 - } 1111 - 1112 - static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *param, int len) 1113 - { 1114 - struct adapter *padapter = rtw_netdev_priv(dev); 1115 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1116 - 1117 - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) 1118 - return -EINVAL; 1119 - 1120 - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && 1121 - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && 1122 - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { 1123 - return -EINVAL; 1124 - } 1125 - 1126 - return rtw_acl_add_sta(padapter, param->sta_addr); 1127 - } 1128 - 1129 - static int rtw_ioctl_set_macaddr_acl(struct net_device *dev, struct ieee_param *param, int len) 1130 - { 1131 - int ret = 0; 1132 - struct adapter *padapter = rtw_netdev_priv(dev); 1133 - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1134 - 1135 - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) 1136 - return -EINVAL; 1137 - 1138 - rtw_set_macaddr_acl(padapter, param->u.mlme.command); 1139 - 1140 - return ret; 1141 - } 1142 - 1143 - static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) 1144 - { 1145 - struct ieee_param *param; 1146 - int ret = 0; 1147 - struct adapter *padapter = rtw_netdev_priv(dev); 1148 - 1149 - /* 1150 - * this function is expect to call in master mode, which allows no power saving 1151 - * so, we just check hw_init_completed 1152 - */ 1153 - 1154 - if (!padapter->hw_init_completed) 1155 - return -EPERM; 1156 - 1157 - if (!p->pointer || p->length != sizeof(*param)) 1158 - return -EINVAL; 1159 - 1160 - param = rtw_malloc(p->length); 1161 - if (!param) 1162 - return -ENOMEM; 1163 - 1164 - if (copy_from_user(param, p->pointer, p->length)) { 1165 - kfree(param); 1166 - return -EFAULT; 1167 - } 1168 - 1169 - switch (param->cmd) { 1170 - case RTL871X_HOSTAPD_FLUSH: 1171 - 1172 - rtw_hostapd_sta_flush(dev); 1173 - 1174 - break; 1175 - 1176 - case RTL871X_HOSTAPD_ADD_STA: 1177 - 1178 - ret = rtw_add_sta(dev, param); 1179 - 1180 - break; 1181 - 1182 - case RTL871X_HOSTAPD_REMOVE_STA: 1183 - 1184 - ret = rtw_del_sta(dev, param); 1185 - 1186 - break; 1187 - 1188 - case RTL871X_HOSTAPD_SET_BEACON: 1189 - 1190 - ret = rtw_set_beacon(dev, param, p->length); 1191 - 1192 - break; 1193 - 1194 - case RTL871X_SET_ENCRYPTION: 1195 - 1196 - ret = rtw_set_encryption(dev, param, p->length); 1197 - 1198 - break; 1199 - 1200 - case RTL871X_HOSTAPD_GET_WPAIE_STA: 1201 - 1202 - ret = rtw_get_sta_wpaie(dev, param); 1203 - 1204 - break; 1205 - 1206 - case RTL871X_HOSTAPD_SET_WPS_BEACON: 1207 - 1208 - ret = rtw_set_wps_beacon(dev, param, p->length); 1209 - 1210 - break; 1211 - 1212 - case RTL871X_HOSTAPD_SET_WPS_PROBE_RESP: 1213 - 1214 - ret = rtw_set_wps_probe_resp(dev, param, p->length); 1215 - 1216 - break; 1217 - 1218 - case RTL871X_HOSTAPD_SET_WPS_ASSOC_RESP: 1219 - 1220 - ret = rtw_set_wps_assoc_resp(dev, param, p->length); 1221 - 1222 - break; 1223 - 1224 - case RTL871X_HOSTAPD_SET_HIDDEN_SSID: 1225 - 1226 - ret = rtw_set_hidden_ssid(dev, param, p->length); 1227 - 1228 - break; 1229 - 1230 - case RTL871X_HOSTAPD_GET_INFO_STA: 1231 - 1232 - ret = rtw_ioctl_get_sta_data(dev, param, p->length); 1233 - 1234 - break; 1235 - 1236 - case RTL871X_HOSTAPD_SET_MACADDR_ACL: 1237 - 1238 - ret = rtw_ioctl_set_macaddr_acl(dev, param, p->length); 1239 - 1240 - break; 1241 - 1242 - case RTL871X_HOSTAPD_ACL_ADD_STA: 1243 - 1244 - ret = rtw_ioctl_acl_add_sta(dev, param, p->length); 1245 - 1246 - break; 1247 - 1248 - case RTL871X_HOSTAPD_ACL_REMOVE_STA: 1249 - 1250 - ret = rtw_ioctl_acl_remove_sta(dev, param, p->length); 1251 - 1252 - break; 1253 - 1254 - default: 1255 - ret = -EOPNOTSUPP; 1256 - break; 1257 - } 1258 - 1259 - if (ret == 0 && copy_to_user(p->pointer, param, p->length)) 1260 - ret = -EFAULT; 1261 - 1262 - kfree(param); 1263 - return ret; 1264 - } 1265 - 1266 - /* copy from net/wireless/wext.c end */ 1267 - 1268 - int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 1269 - { 1270 - struct iwreq *wrq = (struct iwreq *)rq; 1271 - int ret = 0; 1272 - 1273 - switch (cmd) { 1274 - case RTL_IOCTL_WPA_SUPPLICANT: 1275 - ret = wpa_supplicant_ioctl(dev, &wrq->u.data); 1276 - break; 1277 - case RTL_IOCTL_HOSTAPD: 1278 - ret = rtw_hostapd_ioctl(dev, &wrq->u.data); 1279 - break; 1280 - default: 1281 - ret = -EOPNOTSUPP; 1282 - break; 1283 - } 1284 - 1285 - return ret; 1286 - }
-1
drivers/staging/rtl8723bs/os_dep/os_intfs.c
··· 407 407 .ndo_select_queue = rtw_select_queue, 408 408 .ndo_set_mac_address = rtw_net_set_mac_address, 409 409 .ndo_get_stats = rtw_net_get_stats, 410 - .ndo_do_ioctl = rtw_ioctl, 411 410 }; 412 411 413 412 int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname)
+1 -2
drivers/staging/vme_user/vme_tsi148.c
··· 761 761 goto err_resource; 762 762 } 763 763 764 - image->kern_base = ioremap( 765 - image->bus_resource.start, size); 764 + image->kern_base = ioremap(image->bus_resource.start, size); 766 765 if (!image->kern_base) { 767 766 dev_err(tsi148_bridge->parent, "Failed to remap resource\n"); 768 767 retval = -ENOMEM;