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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull staging driver updates from Greg KH:
"Here is the "big" set of staging driver changes for 6.16-rc1. Included
in here are:

- gpib driver cleanups and updates.

This subsystem is _almost_ ready to be merged into the main portion
of the kernel tree. Hopefully should happen in the next kernel
merge cycle if all goes well.

- sm750fb driver cleanups

- rtl8723bs driver cleanups

- other small driver cleanups for coding style issues

All of these have been in for over 2 weeks with no reported issues"

* tag 'staging-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (203 commits)
staging: rtl8723bs: remove unnecessary braces for single statement blocks
staging: rtl8723bs: Removed multiple blank lines of rtw_pwrctrl.c
staging: sm750fb: rename `hw_sm750le_setBLANK`
staging: sm750fb: rename `hw_sm750_setBLANK`
staging: sm750fb: rename `hw_sm750_setColReg`
staging: sm750fb: rename `hw_sm750_crtc_setMode`
staging: sm750fb: rename `hw_sm750_crtc_checkMode`
staging: sm750fb: rename `hw_sm750_output_setMode`
staging: sm750fb: rename `hw_sm750le_deWait`
staging: sm750fb: rename `hw_sm750_deWait`
staging: sm750fb: rename `hw_sm750_initAccel`
staging: gpib: switch to kmalloc(sizeof(*status))
staging: gpib: Fix secondary address restriction
staging: gpib: Fix uapi include header guard name
staging: gpib: Avoid unused variable warning
staging: gpib: Declare driver entry points static
staging: gpib: Fix PCMCIA config identifier
staging: gpib: Avoid unused variable warnings
staging: gpib: Fix lpvo request_system_control
staging: sm750fb: rename sm750_hw_cursor_setData2
...

+1592 -2612
+2 -1
MAINTAINERS
··· 9147 9147 F: tools/testing/fault-injection/ 9148 9148 9149 9149 FBTFT Framebuffer drivers 9150 + M: Andy Shevchenko <andy@kernel.org> 9150 9151 L: dri-devel@lists.freedesktop.org 9151 9152 L: linux-fbdev@vger.kernel.org 9152 - S: Orphan 9153 + S: Odd fixes 9153 9154 F: drivers/staging/fbtft/ 9154 9155 9155 9156 FC0011 TUNER DRIVER
+4 -31
drivers/staging/fbtft/Kconfig
··· 8 8 select FB_BACKLIGHT 9 9 select FB_SYSMEM_HELPERS_DEFERRED 10 10 11 + if FB_TFT 12 + 11 13 config FB_TFT_AGM1264K_FL 12 14 tristate "FB driver for the AGM1264K-FL LCD display" 13 - depends on FB_TFT 14 15 help 15 16 Framebuffer support for the AGM1264K-FL LCD display (two Samsung KS0108 compatible chips) 16 17 17 18 config FB_TFT_BD663474 18 19 tristate "FB driver for the BD663474 LCD Controller" 19 - depends on FB_TFT 20 20 help 21 21 Generic Framebuffer support for BD663474 22 22 23 23 config FB_TFT_HX8340BN 24 24 tristate "FB driver for the HX8340BN LCD Controller" 25 - depends on FB_TFT 26 25 help 27 26 Generic Framebuffer support for HX8340BN 28 27 29 28 config FB_TFT_HX8347D 30 29 tristate "FB driver for the HX8347D LCD Controller" 31 - depends on FB_TFT 32 30 help 33 31 Generic Framebuffer support for HX8347D 34 32 35 33 config FB_TFT_HX8353D 36 34 tristate "FB driver for the HX8353D LCD Controller" 37 - depends on FB_TFT 38 35 help 39 36 Generic Framebuffer support for HX8353D 40 37 41 38 config FB_TFT_HX8357D 42 39 tristate "FB driver for the HX8357D LCD Controller" 43 - depends on FB_TFT 44 40 help 45 41 Generic Framebuffer support for HX8357D 46 42 47 43 config FB_TFT_ILI9163 48 44 tristate "FB driver for the ILI9163 LCD Controller" 49 - depends on FB_TFT 50 45 help 51 46 Generic Framebuffer support for ILI9163 52 47 53 48 config FB_TFT_ILI9320 54 49 tristate "FB driver for the ILI9320 LCD Controller" 55 - depends on FB_TFT 56 50 help 57 51 Generic Framebuffer support for ILI9320 58 52 59 53 config FB_TFT_ILI9325 60 54 tristate "FB driver for the ILI9325 LCD Controller" 61 - depends on FB_TFT 62 55 help 63 56 Generic Framebuffer support for ILI9325 64 57 65 58 config FB_TFT_ILI9340 66 59 tristate "FB driver for the ILI9340 LCD Controller" 67 - depends on FB_TFT 68 60 help 69 61 Generic Framebuffer support for ILI9340 70 62 71 63 config FB_TFT_ILI9341 72 64 tristate "FB driver for the ILI9341 LCD Controller" 73 - depends on FB_TFT 74 65 help 75 66 Generic Framebuffer support for ILI9341 76 67 77 68 config FB_TFT_ILI9481 78 69 tristate "FB driver for the ILI9481 LCD Controller" 79 - depends on FB_TFT 80 70 help 81 71 Generic Framebuffer support for ILI9481 82 72 83 73 config FB_TFT_ILI9486 84 74 tristate "FB driver for the ILI9486 LCD Controller" 85 - depends on FB_TFT 86 75 help 87 76 Generic Framebuffer support for ILI9486 88 77 89 78 config FB_TFT_PCD8544 90 79 tristate "FB driver for the PCD8544 LCD Controller" 91 - depends on FB_TFT 92 80 help 93 81 Generic Framebuffer support for PCD8544 94 82 95 83 config FB_TFT_RA8875 96 84 tristate "FB driver for the RA8875 LCD Controller" 97 - depends on FB_TFT 98 85 help 99 86 Generic Framebuffer support for RA8875 100 87 101 88 config FB_TFT_S6D02A1 102 89 tristate "FB driver for the S6D02A1 LCD Controller" 103 - depends on FB_TFT 104 90 help 105 91 Generic Framebuffer support for S6D02A1 106 92 107 93 config FB_TFT_S6D1121 108 94 tristate "FB driver for the S6D1211 LCD Controller" 109 - depends on FB_TFT 110 95 help 111 96 Generic Framebuffer support for S6D1121 112 97 113 98 config FB_TFT_SEPS525 114 99 tristate "FB driver for the SEPS525 LCD Controller" 115 - depends on FB_TFT 116 100 help 117 101 Generic Framebuffer support for SEPS525 118 102 Say Y if you have such a display that utilizes this controller. 119 103 120 104 config FB_TFT_SH1106 121 105 tristate "FB driver for the SH1106 OLED Controller" 122 - depends on FB_TFT 123 106 help 124 107 Framebuffer support for SH1106 125 108 126 109 config FB_TFT_SSD1289 127 110 tristate "FB driver for the SSD1289 LCD Controller" 128 - depends on FB_TFT 129 111 help 130 112 Framebuffer support for SSD1289 131 113 132 114 config FB_TFT_SSD1305 133 115 tristate "FB driver for the SSD1305 OLED Controller" 134 - depends on FB_TFT 135 116 help 136 117 Framebuffer support for SSD1305 137 118 138 119 config FB_TFT_SSD1306 139 120 tristate "FB driver for the SSD1306 OLED Controller" 140 - depends on FB_TFT 141 121 help 142 122 Framebuffer support for SSD1306 143 123 144 124 config FB_TFT_SSD1331 145 125 tristate "FB driver for the SSD1331 LCD Controller" 146 - depends on FB_TFT 147 126 help 148 127 Framebuffer support for SSD1331 149 128 150 129 config FB_TFT_SSD1351 151 130 tristate "FB driver for the SSD1351 LCD Controller" 152 - depends on FB_TFT 153 131 help 154 132 Framebuffer support for SSD1351 155 133 156 134 config FB_TFT_ST7735R 157 135 tristate "FB driver for the ST7735R LCD Controller" 158 - depends on FB_TFT 159 136 help 160 137 Generic Framebuffer support for ST7735R 161 138 162 139 config FB_TFT_ST7789V 163 140 tristate "FB driver for the ST7789V LCD Controller" 164 - depends on FB_TFT 165 141 help 166 142 This enables generic framebuffer support for the Sitronix ST7789V 167 143 display controller. The controller is intended for small color ··· 147 171 148 172 config FB_TFT_TINYLCD 149 173 tristate "FB driver for tinylcd.com display" 150 - depends on FB_TFT 151 174 help 152 175 Custom Framebuffer support for tinylcd.com display 153 176 154 177 config FB_TFT_TLS8204 155 178 tristate "FB driver for the TLS8204 LCD Controller" 156 - depends on FB_TFT 157 179 help 158 180 Generic Framebuffer support for TLS8204 159 181 160 182 config FB_TFT_UC1611 161 183 tristate "FB driver for the UC1611 LCD controller" 162 - depends on FB_TFT 163 184 help 164 185 Generic Framebuffer support for UC1611 165 186 166 187 config FB_TFT_UC1701 167 188 tristate "FB driver for the UC1701 LCD Controller" 168 - depends on FB_TFT 169 189 help 170 190 Generic Framebuffer support for UC1701 171 191 172 192 config FB_TFT_UPD161704 173 193 tristate "FB driver for the uPD161704 LCD Controller" 174 - depends on FB_TFT 175 194 help 176 195 Generic Framebuffer support for uPD161704 196 + 197 + endif
+43 -43
drivers/staging/gpib/agilent_82350b/agilent_82350b.c
··· 27 27 static int read_transfer_counter(struct agilent_82350b_priv *a_priv); 28 28 static unsigned short read_and_clear_event_status(struct gpib_board *board); 29 29 static void set_transfer_counter(struct agilent_82350b_priv *a_priv, int count); 30 - static int agilent_82350b_write(struct gpib_board *board, uint8_t *buffer, 30 + static int agilent_82350b_write(struct gpib_board *board, u8 *buffer, 31 31 size_t length, int send_eoi, size_t *bytes_written); 32 32 33 - static int agilent_82350b_accel_read(struct gpib_board *board, uint8_t *buffer, 33 + static int agilent_82350b_accel_read(struct gpib_board *board, u8 *buffer, 34 34 size_t length, int *end, size_t *bytes_read) 35 35 36 36 { ··· 39 39 int retval = 0; 40 40 unsigned short event_status; 41 41 int i, num_fifo_bytes; 42 - //hardware doesn't support checking for end-of-string character when using fifo 42 + /* hardware doesn't support checking for end-of-string character when using fifo */ 43 43 if (tms_priv->eos_flags & REOS) 44 44 return tms9914_read(board, tms_priv, buffer, length, end, bytes_read); 45 45 ··· 50 50 *bytes_read = 0; 51 51 if (length == 0) 52 52 return 0; 53 - //disable fifo for the moment 53 + /* disable fifo for the moment */ 54 54 writeb(DIRECTION_GPIB_TO_HOST, a_priv->gpib_base + SRAM_ACCESS_CONTROL_REG); 55 - // handle corner case of board not in holdoff and one byte might slip in early 55 + /* handle corner case of board not in holdoff and one byte might slip in early */ 56 56 if (tms_priv->holdoff_active == 0 && length > 1) { 57 57 size_t num_bytes; 58 58 ··· 67 67 tms9914_release_holdoff(tms_priv); 68 68 i = 0; 69 69 num_fifo_bytes = length - 1; 70 - write_byte(tms_priv, tms_priv->imr0_bits & ~HR_BIIE, IMR0); // disable BI interrupts 70 + /* disable BI interrupts */ 71 + write_byte(tms_priv, tms_priv->imr0_bits & ~HR_BIIE, IMR0); 71 72 while (i < num_fifo_bytes && *end == 0) { 72 73 int block_size; 73 74 int j; ··· 112 111 break; 113 112 } 114 113 } 115 - write_byte(tms_priv, tms_priv->imr0_bits, IMR0); // re-enable BI interrupts 114 + /* re-enable BI interrupts */ 115 + write_byte(tms_priv, tms_priv->imr0_bits, IMR0); 116 116 *bytes_read += i; 117 117 buffer += i; 118 118 length -= i; 119 119 writeb(DIRECTION_GPIB_TO_HOST, a_priv->gpib_base + SRAM_ACCESS_CONTROL_REG); 120 120 if (retval < 0) 121 121 return retval; 122 - // read last bytes if we havn't received an END yet 122 + /* read last bytes if we havn't received an END yet */ 123 123 if (*end == 0) { 124 124 size_t num_bytes; 125 - // try to make sure we holdoff after last byte read 125 + /* try to make sure we holdoff after last byte read */ 126 126 retval = tms9914_read(board, tms_priv, buffer, length, end, &num_bytes); 127 127 *bytes_read += num_bytes; 128 128 if (retval < 0) ··· 147 145 return 0; 148 146 } 149 147 150 - static int agilent_82350b_accel_write(struct gpib_board *board, uint8_t *buffer, 148 + static int agilent_82350b_accel_write(struct gpib_board *board, u8 *buffer, 151 149 size_t length, int send_eoi, 152 150 size_t *bytes_written) 153 151 { ··· 171 169 event_status = read_and_clear_event_status(board); 172 170 173 171 #ifdef EXPERIMENTAL 174 - // wait for previous BO to complete if any 172 + /* wait for previous BO to complete if any */ 175 173 retval = wait_event_interruptible(board->wait, 176 174 test_bit(DEV_CLEAR_BN, &tms_priv->state) || 177 175 test_bit(WRITE_READY_BN, &tms_priv->state) || ··· 194 192 block_size = min(fifotransferlength - i, agilent_82350b_fifo_size); 195 193 set_transfer_counter(a_priv, block_size); 196 194 for (j = 0; j < block_size; ++j, ++i) { 197 - // load data into board's sram 195 + /* load data into board's sram */ 198 196 writeb(buffer[i], a_priv->sram_base + j); 199 197 } 200 198 writeb(ENABLE_TI_TO_SRAM, a_priv->gpib_base + SRAM_ACCESS_CONTROL_REG); ··· 264 262 tms9914_interrupt_have_status(board, &a_priv->tms9914_priv, tms9914_status1, 265 263 tms9914_status2); 266 264 } 267 - //write-clear status bits 265 + /* write-clear status bits */ 268 266 if (event_status & (BUFFER_END_STATUS_BIT | TERM_COUNT_STATUS_BIT)) { 269 267 writeb(event_status & (BUFFER_END_STATUS_BIT | TERM_COUNT_STATUS_BIT), 270 268 a_priv->gpib_base + EVENT_STATUS_REG); ··· 294 292 295 293 writeb(complement & 0xff, a_priv->gpib_base + XFER_COUNT_LO_REG); 296 294 writeb((complement >> 8) & 0xff, a_priv->gpib_base + XFER_COUNT_MID_REG); 297 - //I don't think the hi count reg is even used, but oh well 295 + /* I don't think the hi count reg is even used, but oh well */ 298 296 writeb((complement >> 16) & 0xf, a_priv->gpib_base + XFER_COUNT_HI_REG); 299 297 } 300 298 301 - // wrappers for interface functions 302 - static int agilent_82350b_read(struct gpib_board *board, uint8_t *buffer, 299 + /* wrappers for interface functions */ 300 + static int agilent_82350b_read(struct gpib_board *board, u8 *buffer, 303 301 size_t length, int *end, size_t *bytes_read) 304 302 { 305 303 struct agilent_82350b_priv *priv = board->private_data; ··· 307 305 return tms9914_read(board, &priv->tms9914_priv, buffer, length, end, bytes_read); 308 306 } 309 307 310 - static int agilent_82350b_write(struct gpib_board *board, uint8_t *buffer, 308 + static int agilent_82350b_write(struct gpib_board *board, u8 *buffer, 311 309 size_t length, int send_eoi, size_t *bytes_written) 312 310 313 311 { ··· 316 314 return tms9914_write(board, &priv->tms9914_priv, buffer, length, send_eoi, bytes_written); 317 315 } 318 316 319 - static int agilent_82350b_command(struct gpib_board *board, uint8_t *buffer, 317 + static int agilent_82350b_command(struct gpib_board *board, u8 *buffer, 320 318 size_t length, size_t *bytes_written) 321 319 322 320 { ··· 341 339 return tms9914_go_to_standby(board, &priv->tms9914_priv); 342 340 } 343 341 344 - static void agilent_82350b_request_system_control(struct gpib_board *board, 345 - int request_control) 346 - 342 + static int agilent_82350b_request_system_control(struct gpib_board *board, int request_control) 347 343 { 348 344 struct agilent_82350b_priv *a_priv = board->private_data; 349 345 ··· 355 355 writeb(0, a_priv->gpib_base + INTERNAL_CONFIG_REG); 356 356 } 357 357 writeb(a_priv->card_mode_bits, a_priv->gpib_base + CARD_MODE_REG); 358 - tms9914_request_system_control(board, &a_priv->tms9914_priv, request_control); 358 + return tms9914_request_system_control(board, &a_priv->tms9914_priv, request_control); 359 359 } 360 360 361 361 static void agilent_82350b_interface_clear(struct gpib_board *board, int assert) ··· 373 373 tms9914_remote_enable(board, &priv->tms9914_priv, enable); 374 374 } 375 375 376 - static int agilent_82350b_enable_eos(struct gpib_board *board, uint8_t eos_byte, 376 + static int agilent_82350b_enable_eos(struct gpib_board *board, u8 eos_byte, 377 377 int compare_8_bits) 378 378 { 379 379 struct agilent_82350b_priv *priv = board->private_data; ··· 412 412 return tms9914_secondary_address(board, &priv->tms9914_priv, address, enable); 413 413 } 414 414 415 - static int agilent_82350b_parallel_poll(struct gpib_board *board, uint8_t *result) 415 + static int agilent_82350b_parallel_poll(struct gpib_board *board, u8 *result) 416 416 { 417 417 struct agilent_82350b_priv *priv = board->private_data; 418 418 ··· 420 420 } 421 421 422 422 static void agilent_82350b_parallel_poll_configure(struct gpib_board *board, 423 - uint8_t config) 423 + u8 config) 424 424 { 425 425 struct agilent_82350b_priv *priv = board->private_data; 426 426 ··· 434 434 tms9914_parallel_poll_response(board, &priv->tms9914_priv, ist); 435 435 } 436 436 437 - static void agilent_82350b_serial_poll_response(struct gpib_board *board, uint8_t status) 437 + static void agilent_82350b_serial_poll_response(struct gpib_board *board, u8 status) 438 438 { 439 439 struct agilent_82350b_priv *priv = board->private_data; 440 440 441 441 tms9914_serial_poll_response(board, &priv->tms9914_priv, status); 442 442 } 443 443 444 - static uint8_t agilent_82350b_serial_poll_status(struct gpib_board *board) 444 + static u8 agilent_82350b_serial_poll_status(struct gpib_board *board) 445 445 { 446 446 struct agilent_82350b_priv *priv = board->private_data; 447 447 ··· 492 492 } 493 493 494 494 static int init_82350a_hardware(struct gpib_board *board, 495 - const gpib_board_config_t *config) 495 + const struct gpib_board_config *config) 496 496 { 497 497 struct agilent_82350b_priv *a_priv = board->private_data; 498 498 static const unsigned int firmware_length = 5302; ··· 511 511 PLX9050_PCI_RETRY_DELAY_BITS(64) | 512 512 PLX9050_DIRECT_SLAVE_LOCK_ENABLE_BIT; 513 513 514 - // load borg data 514 + /* load borg data */ 515 515 borg_status = readb(a_priv->borg_base); 516 516 if ((borg_status & BORG_DONE_BIT)) 517 517 return 0; 518 - // need to programme borg 518 + /* need to programme borg */ 519 519 if (!config->init_data || config->init_data_length != firmware_length) { 520 520 dev_err(board->gpib_dev, "the 82350A board requires firmware after powering on.\n"); 521 521 return -EIO; 522 522 } 523 523 dev_dbg(board->gpib_dev, "Loading firmware...\n"); 524 524 525 - // tickle the borg 525 + /* tickle the borg */ 526 526 writel(plx_cntrl_static_bits | PLX9050_USER3_DATA_BIT, 527 527 a_priv->plx_base + PLX9050_CNTRL_REG); 528 528 usleep_range(1000, 2000); ··· 563 563 struct agilent_82350b_priv *a_priv = board->private_data; 564 564 unsigned int i; 565 565 const unsigned int sram_length = pci_resource_len(a_priv->pci_device, SRAM_82350A_REGION); 566 - // test SRAM 566 + /* test SRAM */ 567 567 const unsigned int byte_mask = 0xff; 568 568 569 569 for (i = 0; i < sram_length; ++i) { ··· 587 587 } 588 588 589 589 static int agilent_82350b_generic_attach(struct gpib_board *board, 590 - const gpib_board_config_t *config, 590 + const struct gpib_board_config *config, 591 591 int use_fifos) 592 592 593 593 { ··· 606 606 tms_priv->write_byte = tms9914_iomem_write_byte; 607 607 tms_priv->offset = 1; 608 608 609 - // find board 609 + /* find board */ 610 610 a_priv->pci_device = gpib_pci_get_device(config, PCI_VENDOR_ID_AGILENT, 611 611 PCI_DEVICE_ID_82350B, NULL); 612 612 if (a_priv->pci_device) { ··· 702 702 writeb(a_priv->card_mode_bits, a_priv->gpib_base + CARD_MODE_REG); 703 703 704 704 if (a_priv->model == MODEL_82350A) { 705 - // enable PCI interrupts for 82350a 705 + /* enable PCI interrupts for 82350a */ 706 706 writel(PLX9050_LINTR1_EN_BIT | PLX9050_LINTR2_POLARITY_BIT | 707 707 PLX9050_PCI_INTR_EN_BIT, 708 708 a_priv->plx_base + PLX9050_INTCSR_REG); ··· 713 713 a_priv->gpib_base + EVENT_ENABLE_REG); 714 714 writeb(ENABLE_TERM_COUNT_INTERRUPT_BIT | ENABLE_BUFFER_END_INTERRUPT_BIT | 715 715 ENABLE_TMS9914_INTERRUPTS_BIT, a_priv->gpib_base + INTERRUPT_ENABLE_REG); 716 - //write-clear event status bits 716 + /* write-clear event status bits */ 717 717 writeb(BUFFER_END_STATUS_BIT | TERM_COUNT_STATUS_BIT, 718 718 a_priv->gpib_base + EVENT_STATUS_REG); 719 719 } else { ··· 730 730 } 731 731 732 732 static int agilent_82350b_unaccel_attach(struct gpib_board *board, 733 - const gpib_board_config_t *config) 733 + const struct gpib_board_config *config) 734 734 { 735 735 return agilent_82350b_generic_attach(board, config, 0); 736 736 } 737 737 738 738 static int agilent_82350b_accel_attach(struct gpib_board *board, 739 - const gpib_board_config_t *config) 739 + const struct gpib_board_config *config) 740 740 { 741 741 return agilent_82350b_generic_attach(board, config, 1); 742 742 } ··· 747 747 struct tms9914_priv *tms_priv; 748 748 749 749 if (a_priv) { 750 - if (a_priv->plx_base) // disable interrupts 750 + if (a_priv->plx_base) /* disable interrupts */ 751 751 writel(0, a_priv->plx_base + PLX9050_INTCSR_REG); 752 752 753 753 tms_priv = &a_priv->tms9914_priv; ··· 773 773 agilent_82350b_free_private(board); 774 774 } 775 775 776 - static gpib_interface_t agilent_82350b_unaccel_interface = { 776 + static struct gpib_interface agilent_82350b_unaccel_interface = { 777 777 .name = "agilent_82350b_unaccel", 778 778 .attach = agilent_82350b_unaccel_attach, 779 779 .detach = agilent_82350b_detach, ··· 790 790 .parallel_poll = agilent_82350b_parallel_poll, 791 791 .parallel_poll_configure = agilent_82350b_parallel_poll_configure, 792 792 .parallel_poll_response = agilent_82350b_parallel_poll_response, 793 - .local_parallel_poll_mode = NULL, // XXX 793 + .local_parallel_poll_mode = NULL, /* XXX */ 794 794 .line_status = agilent_82350b_line_status, 795 795 .update_status = agilent_82350b_update_status, 796 796 .primary_address = agilent_82350b_primary_address, ··· 801 801 .return_to_local = agilent_82350b_return_to_local, 802 802 }; 803 803 804 - static gpib_interface_t agilent_82350b_interface = { 804 + static struct gpib_interface agilent_82350b_interface = { 805 805 .name = "agilent_82350b", 806 806 .attach = agilent_82350b_accel_attach, 807 807 .detach = agilent_82350b_detach, ··· 818 818 .parallel_poll = agilent_82350b_parallel_poll, 819 819 .parallel_poll_configure = agilent_82350b_parallel_poll_configure, 820 820 .parallel_poll_response = agilent_82350b_parallel_poll_response, 821 - .local_parallel_poll_mode = NULL, // XXX 821 + .local_parallel_poll_mode = NULL, /* XXX */ 822 822 .line_status = agilent_82350b_line_status, 823 823 .update_status = agilent_82350b_update_status, 824 824 .primary_address = agilent_82350b_primary_address,
+14 -14
drivers/staging/gpib/agilent_82350b/agilent_82350b.h
··· 41 41 MODEL_82351A 42 42 }; 43 43 44 - // struct which defines private_data for board 44 + /* struct which defines private_data for board */ 45 45 struct agilent_82350b_priv { 46 46 struct tms9914_priv tms9914_priv; 47 47 struct pci_dev *pci_device; 48 - void __iomem *plx_base; //82350a only 48 + void __iomem *plx_base; /* 82350a only */ 49 49 void __iomem *gpib_base; 50 50 void __iomem *sram_base; 51 51 void __iomem *misc_base; ··· 57 57 bool using_fifos; 58 58 }; 59 59 60 - //registers 60 + /* registers */ 61 61 enum agilent_82350b_gpib_registers 62 62 63 63 { 64 64 CARD_MODE_REG = 0x1, 65 - CONFIG_DATA_REG = 0x2, // 82350A specific 65 + CONFIG_DATA_REG = 0x2, /* 82350A specific */ 66 66 INTERRUPT_ENABLE_REG = 0x3, 67 67 EVENT_STATUS_REG = 0x4, 68 68 EVENT_ENABLE_REG = 0x5, ··· 76 76 XFER_COUNT_HI_REG = 0xe, 77 77 TMS9914_BASE_REG = 0x10, 78 78 INTERNAL_CONFIG_REG = 0x18, 79 - IMR0_READ_REG = 0x19, //read 80 - T1_DELAY_REG = 0x19, // write 79 + IMR0_READ_REG = 0x19, /* read */ 80 + T1_DELAY_REG = 0x19, /* write */ 81 81 IMR1_READ_REG = 0x1a, 82 82 ADR_READ_REG = 0x1b, 83 83 SPMR_READ_REG = 0x1c, ··· 89 89 enum card_mode_bits 90 90 91 91 { 92 - ACTIVE_CONTROLLER_BIT = 0x2, // read-only 92 + ACTIVE_CONTROLLER_BIT = 0x2, /* read-only */ 93 93 CM_SYSTEM_CONTROLLER_BIT = 0x8, 94 94 ENABLE_BUS_MONITOR_BIT = 0x10, 95 95 ENABLE_PCI_IRQ_BIT = 0x20, ··· 115 115 { 116 116 TMS9914_IRQ_STATUS_BIT = 0x1, 117 117 IRQ_STATUS_BIT = 0x2, 118 - BUFFER_END_STATUS_BIT = 0x10, // write-clear 119 - TERM_COUNT_STATUS_BIT = 0x20, // write-clear 118 + BUFFER_END_STATUS_BIT = 0x10, /* write-clear */ 119 + TERM_COUNT_STATUS_BIT = 0x20, /* write-clear */ 120 120 }; 121 121 122 122 enum stream_status_bits 123 123 124 124 { 125 - HALTED_STATUS_BIT = 0x1, //read 126 - RESTART_STREAM_BIT = 0x1, //write 125 + HALTED_STATUS_BIT = 0x1, /* read */ 126 + RESTART_STREAM_BIT = 0x1, /* write */ 127 127 }; 128 128 129 129 enum internal_config_bits ··· 135 135 enum sram_access_control_bits 136 136 137 137 { 138 - DIRECTION_GPIB_TO_HOST = 0x20, // transfer direction 139 - ENABLE_TI_TO_SRAM = 0x40, // enable fifo 140 - ENABLE_FAST_TALKER = 0x80 // added for 82350A (not used) 138 + DIRECTION_GPIB_TO_HOST = 0x20, /* transfer direction */ 139 + ENABLE_TI_TO_SRAM = 0x40, /* enable fifo */ 140 + ENABLE_FAST_TALKER = 0x80 /* added for 82350A (not used) */ 141 141 }; 142 142 143 143 enum borg_bits
+38 -38
drivers/staging/gpib/agilent_82357a/agilent_82357a.c
··· 26 26 static DEFINE_MUTEX(agilent_82357a_hotplug_lock); // protect board insertion and removal 27 27 28 28 static unsigned int agilent_82357a_update_status(struct gpib_board *board, 29 - unsigned int clear_mask); 29 + unsigned int clear_mask); 30 30 31 31 static int agilent_82357a_take_control_internal(struct gpib_board *board, int synchronous); 32 32 ··· 34 34 { 35 35 struct agilent_82357a_urb_ctx *context = urb->context; 36 36 37 - up(&context->complete); 37 + complete(&context->complete); 38 38 } 39 39 40 40 static void agilent_82357a_timeout_handler(struct timer_list *t) ··· 43 43 struct agilent_82357a_urb_ctx *context = &a_priv->context; 44 44 45 45 context->timed_out = 1; 46 - up(&context->complete); 46 + complete(&context->complete); 47 47 } 48 48 49 49 static int agilent_82357a_send_bulk_msg(struct agilent_82357a_priv *a_priv, void *data, ··· 74 74 } 75 75 usb_dev = interface_to_usbdev(a_priv->bus_interface); 76 76 out_pipe = usb_sndbulkpipe(usb_dev, a_priv->bulk_out_endpoint); 77 - sema_init(&context->complete, 0); 77 + init_completion(&context->complete); 78 78 context->timed_out = 0; 79 79 usb_fill_bulk_urb(a_priv->bulk_urb, usb_dev, out_pipe, data, data_length, 80 80 &agilent_82357a_bulk_complete, context); ··· 89 89 goto cleanup; 90 90 } 91 91 mutex_unlock(&a_priv->bulk_alloc_lock); 92 - if (down_interruptible(&context->complete)) { 92 + if (wait_for_completion_interruptible(&context->complete)) { 93 93 retval = -ERESTARTSYS; 94 94 goto cleanup; 95 95 } ··· 142 142 } 143 143 usb_dev = interface_to_usbdev(a_priv->bus_interface); 144 144 in_pipe = usb_rcvbulkpipe(usb_dev, AGILENT_82357_BULK_IN_ENDPOINT); 145 - sema_init(&context->complete, 0); 145 + init_completion(&context->complete); 146 146 context->timed_out = 0; 147 147 usb_fill_bulk_urb(a_priv->bulk_urb, usb_dev, in_pipe, data, data_length, 148 148 &agilent_82357a_bulk_complete, context); ··· 157 157 goto cleanup; 158 158 } 159 159 mutex_unlock(&a_priv->bulk_alloc_lock); 160 - if (down_interruptible(&context->complete)) { 160 + if (wait_for_completion_interruptible(&context->complete)) { 161 161 retval = -ERESTARTSYS; 162 162 goto cleanup; 163 163 } ··· 420 420 } 421 421 422 422 // interface functions 423 - int agilent_82357a_command(struct gpib_board *board, uint8_t *buffer, size_t length, 423 + int agilent_82357a_command(struct gpib_board *board, u8 *buffer, size_t length, 424 424 size_t *bytes_written); 425 425 426 - static int agilent_82357a_read(struct gpib_board *board, uint8_t *buffer, size_t length, int *end, 426 + static int agilent_82357a_read(struct gpib_board *board, u8 *buffer, size_t length, int *end, 427 427 size_t *nbytes) 428 428 { 429 429 int retval; ··· 524 524 } 525 525 kfree(in_data); 526 526 527 - /* Fix for a bug in 9914A that does not return the contents of ADSR 528 - * when the board is in listener active state and ATN is not asserted. 529 - * Set ATN here to obtain a valid board level ibsta 527 + /* 528 + * Fix for a bug in 9914A that does not return the contents of ADSR 529 + * when the board is in listener active state and ATN is not asserted. 530 + * Set ATN here to obtain a valid board level ibsta 530 531 */ 531 532 agilent_82357a_take_control_internal(board, 0); 532 533 ··· 536 535 } 537 536 538 537 static ssize_t agilent_82357a_generic_write(struct gpib_board *board, 539 - uint8_t *buffer, size_t length, 538 + u8 *buffer, size_t length, 540 539 int send_commands, int send_eoi, 541 540 size_t *bytes_written) 542 541 { ··· 676 675 return 0; 677 676 } 678 677 679 - static int agilent_82357a_write(struct gpib_board *board, uint8_t *buffer, 678 + static int agilent_82357a_write(struct gpib_board *board, u8 *buffer, 680 679 size_t length, int send_eoi, size_t *bytes_written) 681 680 { 682 681 return agilent_82357a_generic_write(board, buffer, length, 0, send_eoi, bytes_written); 683 682 } 684 683 685 - int agilent_82357a_command(struct gpib_board *board, uint8_t *buffer, size_t length, 684 + int agilent_82357a_command(struct gpib_board *board, u8 *buffer, size_t length, 686 685 size_t *bytes_written) 687 686 { 688 687 return agilent_82357a_generic_write(board, buffer, length, 1, 0, bytes_written); ··· 716 715 if (!a_priv->bus_interface) 717 716 return -ENODEV; 718 717 719 - /* It looks like the 9914 does not handle tcs properly. 720 - * See comment above tms9914_take_control_workaround() in 721 - * drivers/gpib/tms9914/tms9914_aux.c 718 + /* 719 + * It looks like the 9914 does not handle tcs properly. 720 + * See comment above tms9914_take_control_workaround() in 721 + * drivers/gpib/tms9914/tms9914_aux.c 722 722 */ 723 723 if (synchronous) 724 724 return -ETIMEDOUT; ··· 756 754 return 0; 757 755 } 758 756 759 - //FIXME should change prototype to return int 760 - static void agilent_82357a_request_system_control(struct gpib_board *board, 761 - int request_control) 757 + static int agilent_82357a_request_system_control(struct gpib_board *board, int request_control) 762 758 { 763 759 struct agilent_82357a_priv *a_priv = board->private_data; 764 760 struct usb_device *usb_dev; ··· 765 765 int i = 0; 766 766 767 767 if (!a_priv->bus_interface) 768 - return; // -ENODEV; 768 + return -ENODEV; 769 769 770 770 usb_dev = interface_to_usbdev(a_priv->bus_interface); 771 771 /* 82357B needs bit to be set in 9914 AUXCR register */ ··· 774 774 writes[i].value = AUX_RQC; 775 775 a_priv->hw_control_bits |= SYSTEM_CONTROLLER; 776 776 } else { 777 - writes[i].value = AUX_RLC; 778 - a_priv->is_cic = 0; 779 - a_priv->hw_control_bits &= ~SYSTEM_CONTROLLER; 777 + return -EINVAL; 780 778 } 781 779 ++i; 782 780 writes[i].address = HW_CONTROL; ··· 783 785 retval = agilent_82357a_write_registers(a_priv, writes, i); 784 786 if (retval) 785 787 dev_err(&usb_dev->dev, "write_registers() returned error\n"); 786 - return;// retval; 788 + return retval; 787 789 } 788 790 789 791 static void agilent_82357a_interface_clear(struct gpib_board *board, int assert) ··· 830 832 return;// 0; 831 833 } 832 834 833 - static int agilent_82357a_enable_eos(struct gpib_board *board, uint8_t eos_byte, 835 + static int agilent_82357a_enable_eos(struct gpib_board *board, u8 eos_byte, 834 836 int compare_8_bits) 835 837 { 836 838 struct agilent_82357a_priv *a_priv = board->private_data; ··· 944 946 return 0; 945 947 } 946 948 947 - static int agilent_82357a_parallel_poll(struct gpib_board *board, uint8_t *result) 949 + static int agilent_82357a_parallel_poll(struct gpib_board *board, u8 *result) 948 950 { 949 951 struct agilent_82357a_priv *a_priv = board->private_data; 950 952 struct usb_device *usb_dev; ··· 986 988 return 0; 987 989 } 988 990 989 - static void agilent_82357a_parallel_poll_configure(struct gpib_board *board, uint8_t config) 991 + static void agilent_82357a_parallel_poll_configure(struct gpib_board *board, u8 config) 990 992 { 991 993 //board can only be system controller 992 994 return;// 0; ··· 998 1000 return;// 0; 999 1001 } 1000 1002 1001 - static void agilent_82357a_serial_poll_response(struct gpib_board *board, uint8_t status) 1003 + static void agilent_82357a_serial_poll_response(struct gpib_board *board, u8 status) 1002 1004 { 1003 1005 //board can only be system controller 1004 1006 return;// 0; 1005 1007 } 1006 1008 1007 - static uint8_t agilent_82357a_serial_poll_status(struct gpib_board *board) 1009 + static u8 agilent_82357a_serial_poll_status(struct gpib_board *board) 1008 1010 { 1009 1011 //board can only be system controller 1010 1012 return 0; ··· 1290 1292 } 1291 1293 1292 1294 static inline int agilent_82357a_device_match(struct usb_interface *interface, 1293 - const gpib_board_config_t *config) 1295 + const struct gpib_board_config *config) 1294 1296 { 1295 1297 struct usb_device * const usbdev = interface_to_usbdev(interface); 1296 1298 ··· 1303 1305 return 1; 1304 1306 } 1305 1307 1306 - static int agilent_82357a_attach(struct gpib_board *board, const gpib_board_config_t *config) 1308 + static int agilent_82357a_attach(struct gpib_board *board, const struct gpib_board_config *config) 1307 1309 { 1308 1310 int retval; 1309 1311 int i; ··· 1430 1432 mutex_unlock(&agilent_82357a_hotplug_lock); 1431 1433 } 1432 1434 1433 - static gpib_interface_t agilent_82357a_gpib_interface = { 1435 + static struct gpib_interface agilent_82357a_gpib_interface = { 1434 1436 .name = "agilent_82357a", 1435 1437 .attach = agilent_82357a_attach, 1436 1438 .detach = agilent_82357a_detach, ··· 1589 1591 { 1590 1592 struct usb_device *usb_dev = interface_to_usbdev(interface); 1591 1593 struct gpib_board *board; 1592 - int i, retval; 1594 + int i, retval = 0; 1593 1595 1594 1596 mutex_lock(&agilent_82357a_hotplug_lock); 1595 1597 ··· 1600 1602 break; 1601 1603 } 1602 1604 } 1603 - if (i == MAX_NUM_82357A_INTERFACES) 1605 + if (i == MAX_NUM_82357A_INTERFACES) { 1606 + retval = -ENOENT; 1604 1607 goto resume_exit; 1608 + } 1605 1609 1606 1610 struct agilent_82357a_priv *a_priv = board->private_data; 1607 1611 ··· 1626 1626 return retval; 1627 1627 } 1628 1628 // set/unset system controller 1629 - agilent_82357a_request_system_control(board, board->master); 1629 + retval = agilent_82357a_request_system_control(board, board->master); 1630 1630 // toggle ifc if master 1631 1631 if (board->master) { 1632 1632 agilent_82357a_interface_clear(board, 1); ··· 1644 1644 resume_exit: 1645 1645 mutex_unlock(&agilent_82357a_hotplug_lock); 1646 1646 1647 - return 0; 1647 + return retval; 1648 1648 } 1649 1649 1650 1650 static struct usb_driver agilent_82357a_bus_driver = {
+2 -2
drivers/staging/gpib/agilent_82357a/agilent_82357a.h
··· 6 6 7 7 #include <linux/kernel.h> 8 8 #include <linux/mutex.h> 9 - #include <linux/semaphore.h> 9 + #include <linux/completion.h> 10 10 #include <linux/usb.h> 11 11 #include <linux/timer.h> 12 12 #include <linux/compiler_attributes.h> ··· 115 115 #define INTERRUPT_BUF_LEN 8 116 116 117 117 struct agilent_82357a_urb_ctx { 118 - struct semaphore complete; 118 + struct completion complete; 119 119 unsigned timed_out : 1; 120 120 }; 121 121
+35 -39
drivers/staging/gpib/cb7210/cb7210.c
··· 27 27 MODULE_LICENSE("GPL"); 28 28 MODULE_DESCRIPTION("GPIB driver Measurement Computing boards using cb7210.2 and cbi488.2"); 29 29 30 - static int cb7210_read(struct gpib_board *board, uint8_t *buffer, size_t length, 30 + static int cb7210_read(struct gpib_board *board, u8 *buffer, size_t length, 31 31 int *end, size_t *bytes_read); 32 32 33 33 static inline int have_fifo_word(const struct cb7210_priv *cb_priv) ··· 76 76 spin_unlock_irqrestore(&board->spinlock, flags); 77 77 } 78 78 79 - static int fifo_read(struct gpib_board *board, struct cb7210_priv *cb_priv, uint8_t *buffer, 79 + static int fifo_read(struct gpib_board *board, struct cb7210_priv *cb_priv, u8 *buffer, 80 80 size_t length, int *end, size_t *bytes_read) 81 81 { 82 82 ssize_t retval = 0; ··· 170 170 return retval; 171 171 } 172 172 173 - static int cb7210_accel_read(struct gpib_board *board, uint8_t *buffer, 173 + static int cb7210_accel_read(struct gpib_board *board, u8 *buffer, 174 174 size_t length, int *end, size_t *bytes_read) 175 175 { 176 176 ssize_t retval; ··· 264 264 spin_unlock_irqrestore(&board->spinlock, flags); 265 265 } 266 266 267 - static int fifo_write(struct gpib_board *board, uint8_t *buffer, size_t length, 267 + static int fifo_write(struct gpib_board *board, u8 *buffer, size_t length, 268 268 size_t *bytes_written) 269 269 { 270 270 size_t count = 0; ··· 350 350 return retval; 351 351 } 352 352 353 - static int cb7210_accel_write(struct gpib_board *board, uint8_t *buffer, 353 + static int cb7210_accel_write(struct gpib_board *board, u8 *buffer, 354 354 size_t length, int send_eoi, size_t *bytes_written) 355 355 { 356 356 struct cb7210_priv *cb_priv = board->private_data; ··· 533 533 return cb7210_internal_interrupt(arg); 534 534 } 535 535 536 - static int cb_pci_attach(struct gpib_board *board, const gpib_board_config_t *config); 537 - static int cb_isa_attach(struct gpib_board *board, const gpib_board_config_t *config); 536 + static int cb_pci_attach(struct gpib_board *board, const struct gpib_board_config *config); 537 + static int cb_isa_attach(struct gpib_board *board, const struct gpib_board_config *config); 538 538 539 539 static void cb_pci_detach(struct gpib_board *board); 540 540 static void cb_isa_detach(struct gpib_board *board); 541 541 542 542 // wrappers for interface functions 543 - static int cb7210_read(struct gpib_board *board, uint8_t *buffer, size_t length, 543 + static int cb7210_read(struct gpib_board *board, u8 *buffer, size_t length, 544 544 int *end, size_t *bytes_read) 545 545 { 546 546 struct cb7210_priv *priv = board->private_data; ··· 548 548 return nec7210_read(board, &priv->nec7210_priv, buffer, length, end, bytes_read); 549 549 } 550 550 551 - static int cb7210_write(struct gpib_board *board, uint8_t *buffer, size_t length, 551 + static int cb7210_write(struct gpib_board *board, u8 *buffer, size_t length, 552 552 int send_eoi, size_t *bytes_written) 553 553 { 554 554 struct cb7210_priv *priv = board->private_data; ··· 556 556 return nec7210_write(board, &priv->nec7210_priv, buffer, length, send_eoi, bytes_written); 557 557 } 558 558 559 - static int cb7210_command(struct gpib_board *board, uint8_t *buffer, size_t length, 559 + static int cb7210_command(struct gpib_board *board, u8 *buffer, size_t length, 560 560 size_t *bytes_written) 561 561 { 562 562 struct cb7210_priv *priv = board->private_data; ··· 578 578 return nec7210_go_to_standby(board, &priv->nec7210_priv); 579 579 } 580 580 581 - static void cb7210_request_system_control(struct gpib_board *board, int request_control) 581 + static int cb7210_request_system_control(struct gpib_board *board, int request_control) 582 582 { 583 583 struct cb7210_priv *priv = board->private_data; 584 584 struct nec7210_priv *nec_priv = &priv->nec7210_priv; ··· 589 589 priv->hs_mode_bits &= ~HS_SYS_CONTROL; 590 590 591 591 cb7210_write_byte(priv, priv->hs_mode_bits, HS_MODE); 592 - nec7210_request_system_control(board, nec_priv, request_control); 592 + return nec7210_request_system_control(board, nec_priv, request_control); 593 593 } 594 594 595 595 static void cb7210_interface_clear(struct gpib_board *board, int assert) ··· 606 606 nec7210_remote_enable(board, &priv->nec7210_priv, enable); 607 607 } 608 608 609 - static int cb7210_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits) 609 + static int cb7210_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits) 610 610 { 611 611 struct cb7210_priv *priv = board->private_data; 612 612 ··· 641 641 return nec7210_secondary_address(board, &priv->nec7210_priv, address, enable); 642 642 } 643 643 644 - static int cb7210_parallel_poll(struct gpib_board *board, uint8_t *result) 644 + static int cb7210_parallel_poll(struct gpib_board *board, u8 *result) 645 645 { 646 646 struct cb7210_priv *priv = board->private_data; 647 647 648 648 return nec7210_parallel_poll(board, &priv->nec7210_priv, result); 649 649 } 650 650 651 - static void cb7210_parallel_poll_configure(struct gpib_board *board, uint8_t configuration) 651 + static void cb7210_parallel_poll_configure(struct gpib_board *board, u8 configuration) 652 652 { 653 653 struct cb7210_priv *priv = board->private_data; 654 654 ··· 662 662 nec7210_parallel_poll_response(board, &priv->nec7210_priv, ist); 663 663 } 664 664 665 - static void cb7210_serial_poll_response(struct gpib_board *board, uint8_t status) 665 + static void cb7210_serial_poll_response(struct gpib_board *board, u8 status) 666 666 { 667 667 struct cb7210_priv *priv = board->private_data; 668 668 669 669 nec7210_serial_poll_response(board, &priv->nec7210_priv, status); 670 670 } 671 671 672 - static uint8_t cb7210_serial_poll_status(struct gpib_board *board) 672 + static u8 cb7210_serial_poll_status(struct gpib_board *board) 673 673 { 674 674 struct cb7210_priv *priv = board->private_data; 675 675 ··· 686 686 write_byte(nec_priv, AUX_RTL, AUXMR); 687 687 } 688 688 689 - static gpib_interface_t cb_pci_unaccel_interface = { 689 + static struct gpib_interface cb_pci_unaccel_interface = { 690 690 .name = "cbi_pci_unaccel", 691 691 .attach = cb_pci_attach, 692 692 .detach = cb_pci_detach, ··· 714 714 .return_to_local = cb7210_return_to_local, 715 715 }; 716 716 717 - static gpib_interface_t cb_pci_accel_interface = { 717 + static struct gpib_interface cb_pci_accel_interface = { 718 718 .name = "cbi_pci_accel", 719 719 .attach = cb_pci_attach, 720 720 .detach = cb_pci_detach, ··· 742 742 .return_to_local = cb7210_return_to_local, 743 743 }; 744 744 745 - static gpib_interface_t cb_pci_interface = { 745 + static struct gpib_interface cb_pci_interface = { 746 746 .name = "cbi_pci", 747 747 .attach = cb_pci_attach, 748 748 .detach = cb_pci_detach, ··· 769 769 .return_to_local = cb7210_return_to_local, 770 770 }; 771 771 772 - static gpib_interface_t cb_isa_unaccel_interface = { 772 + static struct gpib_interface cb_isa_unaccel_interface = { 773 773 .name = "cbi_isa_unaccel", 774 774 .attach = cb_isa_attach, 775 775 .detach = cb_isa_detach, ··· 797 797 .return_to_local = cb7210_return_to_local, 798 798 }; 799 799 800 - static gpib_interface_t cb_isa_interface = { 800 + static struct gpib_interface cb_isa_interface = { 801 801 .name = "cbi_isa", 802 802 .attach = cb_isa_attach, 803 803 .detach = cb_isa_detach, ··· 824 824 .return_to_local = cb7210_return_to_local, 825 825 }; 826 826 827 - static gpib_interface_t cb_isa_accel_interface = { 827 + static struct gpib_interface cb_isa_accel_interface = { 828 828 .name = "cbi_isa_accel", 829 829 .attach = cb_isa_attach, 830 830 .detach = cb_isa_detach, ··· 905 905 cb7210_write_byte(cb_priv, cb_priv->hs_mode_bits, HS_MODE); 906 906 907 907 write_byte(nec_priv, AUX_LO_SPEED, AUXMR); 908 - /* set clock register for maximum (20 MHz) driving frequency 908 + /* 909 + * set clock register for maximum (20 MHz) driving frequency 909 910 * ICR should be set to clock in megahertz (1-15) and to zero 910 911 * for clocks faster than 15 MHz (max 20MHz) 911 912 */ ··· 927 926 return 0; 928 927 } 929 928 930 - static int cb_pci_attach(struct gpib_board *board, const gpib_board_config_t *config) 929 + static int cb_pci_attach(struct gpib_board *board, const struct gpib_board_config *config) 931 930 { 932 931 struct cb7210_priv *cb_priv; 933 932 struct nec7210_priv *nec_priv; ··· 1032 1031 cb7210_generic_detach(board); 1033 1032 } 1034 1033 1035 - static int cb_isa_attach(struct gpib_board *board, const gpib_board_config_t *config) 1034 + static int cb_isa_attach(struct gpib_board *board, const struct gpib_board_config *config) 1036 1035 { 1037 1036 int isr_flags = 0; 1038 1037 struct cb7210_priv *cb_priv; ··· 1134 1133 1135 1134 static int cb_gpib_config(struct pcmcia_device *link); 1136 1135 static void cb_gpib_release(struct pcmcia_device *link); 1137 - static int cb_pcmcia_attach(struct gpib_board *board, const gpib_board_config_t *config); 1136 + static int cb_pcmcia_attach(struct gpib_board *board, const struct gpib_board_config *config); 1138 1137 static void cb_pcmcia_detach(struct gpib_board *board); 1139 1138 1140 1139 /* ··· 1247 1246 1248 1247 static int cb_gpib_config(struct pcmcia_device *link) 1249 1248 { 1250 - struct pcmcia_device *handle; 1251 - struct local_info *dev; 1252 1249 int retval; 1253 - 1254 - handle = link; 1255 - dev = link->priv; 1256 1250 1257 1251 retval = pcmcia_loop_config(link, &cb_gpib_config_iteration, NULL); 1258 1252 if (retval) { ··· 1271 1275 } /* gpib_config */ 1272 1276 1273 1277 /* 1274 - * After a card is removed, gpib_release() will unregister the net 1275 - * device, and release the PCMCIA configuration. If the device is 1276 - * still open, this will be postponed until it is closed. 1278 + * After a card is removed, gpib_release() will unregister the net 1279 + * device, and release the PCMCIA configuration. If the device is 1280 + * still open, this will be postponed until it is closed. 1277 1281 */ 1278 1282 1279 1283 static void cb_gpib_release(struct pcmcia_device *link) ··· 1329 1333 pcmcia_unregister_driver(&cb_gpib_cs_driver); 1330 1334 } 1331 1335 1332 - static gpib_interface_t cb_pcmcia_unaccel_interface = { 1336 + static struct gpib_interface cb_pcmcia_unaccel_interface = { 1333 1337 .name = "cbi_pcmcia_unaccel", 1334 1338 .attach = cb_pcmcia_attach, 1335 1339 .detach = cb_pcmcia_detach, ··· 1357 1361 .return_to_local = cb7210_return_to_local, 1358 1362 }; 1359 1363 1360 - static gpib_interface_t cb_pcmcia_interface = { 1364 + static struct gpib_interface cb_pcmcia_interface = { 1361 1365 .name = "cbi_pcmcia", 1362 1366 .attach = cb_pcmcia_attach, 1363 1367 .detach = cb_pcmcia_detach, ··· 1385 1389 .return_to_local = cb7210_return_to_local, 1386 1390 }; 1387 1391 1388 - static gpib_interface_t cb_pcmcia_accel_interface = { 1392 + static struct gpib_interface cb_pcmcia_accel_interface = { 1389 1393 .name = "cbi_pcmcia_accel", 1390 1394 .attach = cb_pcmcia_attach, 1391 1395 .detach = cb_pcmcia_detach, ··· 1413 1417 .return_to_local = cb7210_return_to_local, 1414 1418 }; 1415 1419 1416 - static int cb_pcmcia_attach(struct gpib_board *board, const gpib_board_config_t *config) 1420 + static int cb_pcmcia_attach(struct gpib_board *board, const struct gpib_board_config *config) 1417 1421 { 1418 1422 struct cb7210_priv *cb_priv; 1419 1423 struct nec7210_priv *nec_priv;
+14 -12
drivers/staging/gpib/cb7210/cb7210.h
··· 73 73 return 0x50 | (page & 0xf); 74 74 } 75 75 76 - static inline uint8_t cb7210_paged_read_byte(struct cb7210_priv *cb_priv, 77 - unsigned int register_num, unsigned int page) 76 + static inline u8 cb7210_paged_read_byte(struct cb7210_priv *cb_priv, 77 + unsigned int register_num, unsigned int page) 78 78 { 79 79 struct nec7210_priv *nec_priv = &cb_priv->nec7210_priv; 80 80 u8 retval; ··· 89 89 } 90 90 91 91 // don't use for register_num < 8, since it doesn't lock 92 - static inline uint8_t cb7210_read_byte(const struct cb7210_priv *cb_priv, 93 - enum hs_regs register_num) 92 + static inline u8 cb7210_read_byte(const struct cb7210_priv *cb_priv, 93 + enum hs_regs register_num) 94 94 { 95 95 const struct nec7210_priv *nec_priv = &cb_priv->nec7210_priv; 96 96 u8 retval; ··· 99 99 return retval; 100 100 } 101 101 102 - static inline void cb7210_paged_write_byte(struct cb7210_priv *cb_priv, uint8_t data, 102 + static inline void cb7210_paged_write_byte(struct cb7210_priv *cb_priv, u8 data, 103 103 unsigned int register_num, unsigned int page) 104 104 { 105 105 struct nec7210_priv *nec_priv = &cb_priv->nec7210_priv; ··· 113 113 } 114 114 115 115 // don't use for register_num < 8, since it doesn't lock 116 - static inline void cb7210_write_byte(const struct cb7210_priv *cb_priv, uint8_t data, 116 + static inline void cb7210_write_byte(const struct cb7210_priv *cb_priv, u8 data, 117 117 enum hs_regs register_num) 118 118 { 119 119 const struct nec7210_priv *nec_priv = &cb_priv->nec7210_priv; ··· 134 134 135 135 /* CBI 488.2 HS control */ 136 136 137 - /* when both bit 0 and 1 are set, it 137 + /* 138 + * when both bit 0 and 1 are set, it 138 139 * 1 clears the transmit state machine to an initial condition 139 140 * 2 clears any residual interrupts left latched on cbi488.2 140 141 * 3 resets all control bits in HS_MODE to zero ··· 190 189 } 191 190 192 191 enum cb7210_aux_cmds { 193 - /* AUX_RTL2 is an undocumented aux command which causes cb7210 to assert 194 - * (and keep asserted) local rtl message. This is used in conjunction 195 - * with the (stupid) cb7210 implementation 196 - * of the normal nec7210 AUX_RTL aux command, which 197 - * causes the rtl message to toggle between on and off. 192 + /* 193 + * AUX_RTL2 is an undocumented aux command which causes cb7210 to assert 194 + * (and keep asserted) local rtl message. This is used in conjunction 195 + * with the (stupid) cb7210 implementation 196 + * of the normal nec7210 AUX_RTL aux command, which 197 + * causes the rtl message to toggle between on and off. 198 198 */ 199 199 AUX_RTL2 = 0xd, 200 200 AUX_LO_SPEED = 0x40,
+13 -13
drivers/staging/gpib/cec/cec_gpib.c
··· 40 40 #define CEC_DEV_ID 0x5cec 41 41 #define CEC_SUBID 0x9050 42 42 43 - static int cec_pci_attach(struct gpib_board *board, const gpib_board_config_t *config); 43 + static int cec_pci_attach(struct gpib_board *board, const struct gpib_board_config *config); 44 44 45 45 static void cec_pci_detach(struct gpib_board *board); 46 46 47 47 // wrappers for interface functions 48 - static int cec_read(struct gpib_board *board, uint8_t *buffer, size_t length, int *end, 48 + static int cec_read(struct gpib_board *board, u8 *buffer, size_t length, int *end, 49 49 size_t *bytes_read) 50 50 { 51 51 struct cec_priv *priv = board->private_data; ··· 53 53 return nec7210_read(board, &priv->nec7210_priv, buffer, length, end, bytes_read); 54 54 } 55 55 56 - static int cec_write(struct gpib_board *board, uint8_t *buffer, size_t length, int send_eoi, 56 + static int cec_write(struct gpib_board *board, u8 *buffer, size_t length, int send_eoi, 57 57 size_t *bytes_written) 58 58 { 59 59 struct cec_priv *priv = board->private_data; ··· 61 61 return nec7210_write(board, &priv->nec7210_priv, buffer, length, send_eoi, bytes_written); 62 62 } 63 63 64 - static int cec_command(struct gpib_board *board, uint8_t *buffer, 64 + static int cec_command(struct gpib_board *board, u8 *buffer, 65 65 size_t length, size_t *bytes_written) 66 66 { 67 67 struct cec_priv *priv = board->private_data; ··· 83 83 return nec7210_go_to_standby(board, &priv->nec7210_priv); 84 84 } 85 85 86 - static void cec_request_system_control(struct gpib_board *board, int request_control) 86 + static int cec_request_system_control(struct gpib_board *board, int request_control) 87 87 { 88 88 struct cec_priv *priv = board->private_data; 89 89 90 - nec7210_request_system_control(board, &priv->nec7210_priv, request_control); 90 + return nec7210_request_system_control(board, &priv->nec7210_priv, request_control); 91 91 } 92 92 93 93 static void cec_interface_clear(struct gpib_board *board, int assert) ··· 104 104 nec7210_remote_enable(board, &priv->nec7210_priv, enable); 105 105 } 106 106 107 - static int cec_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits) 107 + static int cec_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits) 108 108 { 109 109 struct cec_priv *priv = board->private_data; 110 110 ··· 139 139 return nec7210_secondary_address(board, &priv->nec7210_priv, address, enable); 140 140 } 141 141 142 - static int cec_parallel_poll(struct gpib_board *board, uint8_t *result) 142 + static int cec_parallel_poll(struct gpib_board *board, u8 *result) 143 143 { 144 144 struct cec_priv *priv = board->private_data; 145 145 146 146 return nec7210_parallel_poll(board, &priv->nec7210_priv, result); 147 147 } 148 148 149 - static void cec_parallel_poll_configure(struct gpib_board *board, uint8_t config) 149 + static void cec_parallel_poll_configure(struct gpib_board *board, u8 config) 150 150 { 151 151 struct cec_priv *priv = board->private_data; 152 152 ··· 160 160 nec7210_parallel_poll_response(board, &priv->nec7210_priv, ist); 161 161 } 162 162 163 - static void cec_serial_poll_response(struct gpib_board *board, uint8_t status) 163 + static void cec_serial_poll_response(struct gpib_board *board, u8 status) 164 164 { 165 165 struct cec_priv *priv = board->private_data; 166 166 167 167 nec7210_serial_poll_response(board, &priv->nec7210_priv, status); 168 168 } 169 169 170 - static uint8_t cec_serial_poll_status(struct gpib_board *board) 170 + static u8 cec_serial_poll_status(struct gpib_board *board) 171 171 { 172 172 struct cec_priv *priv = board->private_data; 173 173 ··· 188 188 nec7210_return_to_local(board, &priv->nec7210_priv); 189 189 } 190 190 191 - static gpib_interface_t cec_pci_interface = { 191 + static struct gpib_interface cec_pci_interface = { 192 192 .name = "cec_pci", 193 193 .attach = cec_pci_attach, 194 194 .detach = cec_pci_detach, ··· 265 265 nec7210_board_online(nec_priv, board); 266 266 } 267 267 268 - static int cec_pci_attach(struct gpib_board *board, const gpib_board_config_t *config) 268 + static int cec_pci_attach(struct gpib_board *board, const struct gpib_board_config *config) 269 269 { 270 270 struct cec_priv *cec_priv; 271 271 struct nec7210_priv *nec_priv;
+166 -150
drivers/staging/gpib/common/gpib_os.c
··· 26 26 MODULE_DESCRIPTION("GPIB base support"); 27 27 MODULE_ALIAS_CHARDEV_MAJOR(GPIB_CODE); 28 28 29 - static int board_type_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board, unsigned long arg); 30 - static int read_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board, 29 + static int board_type_ioctl(struct gpib_file_private *file_priv, 30 + struct gpib_board *board, unsigned long arg); 31 + static int read_ioctl(struct gpib_file_private *file_priv, struct gpib_board *board, 31 32 unsigned long arg); 32 - static int write_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board, 33 + static int write_ioctl(struct gpib_file_private *file_priv, struct gpib_board *board, 33 34 unsigned long arg); 34 - static int command_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board, 35 + static int command_ioctl(struct gpib_file_private *file_priv, struct gpib_board *board, 35 36 unsigned long arg); 36 37 static int open_dev_ioctl(struct file *filep, struct gpib_board *board, unsigned long arg); 37 38 static int close_dev_ioctl(struct file *filep, struct gpib_board *board, unsigned long arg); 38 39 static int serial_poll_ioctl(struct gpib_board *board, unsigned long arg); 39 - static int wait_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board, unsigned long arg); 40 + static int wait_ioctl(struct gpib_file_private *file_priv, 41 + struct gpib_board *board, unsigned long arg); 40 42 static int parallel_poll_ioctl(struct gpib_board *board, unsigned long arg); 41 43 static int online_ioctl(struct gpib_board *board, unsigned long arg); 42 44 static int remote_enable_ioctl(struct gpib_board *board, unsigned long arg); 43 45 static int take_control_ioctl(struct gpib_board *board, unsigned long arg); 44 46 static int line_status_ioctl(struct gpib_board *board, unsigned long arg); 45 - static int pad_ioctl(struct gpib_board *board, gpib_file_private_t *file_priv, 47 + static int pad_ioctl(struct gpib_board *board, struct gpib_file_private *file_priv, 46 48 unsigned long arg); 47 - static int sad_ioctl(struct gpib_board *board, gpib_file_private_t *file_priv, 49 + static int sad_ioctl(struct gpib_board *board, struct gpib_file_private *file_priv, 48 50 unsigned long arg); 49 51 static int eos_ioctl(struct gpib_board *board, unsigned long arg); 50 52 static int request_service_ioctl(struct gpib_board *board, unsigned long arg); 51 53 static int request_service2_ioctl(struct gpib_board *board, unsigned long arg); 52 - static int iobase_ioctl(gpib_board_config_t *config, unsigned long arg); 53 - static int irq_ioctl(gpib_board_config_t *config, unsigned long arg); 54 - static int dma_ioctl(gpib_board_config_t *config, unsigned long arg); 55 - static int autospoll_ioctl(struct gpib_board *board, gpib_file_private_t *file_priv, 54 + static int iobase_ioctl(struct gpib_board_config *config, unsigned long arg); 55 + static int irq_ioctl(struct gpib_board_config *config, unsigned long arg); 56 + static int dma_ioctl(struct gpib_board_config *config, unsigned long arg); 57 + static int autospoll_ioctl(struct gpib_board *board, struct gpib_file_private *file_priv, 56 58 unsigned long arg); 57 - static int mutex_ioctl(struct gpib_board *board, gpib_file_private_t *file_priv, 59 + static int mutex_ioctl(struct gpib_board *board, struct gpib_file_private *file_priv, 58 60 unsigned long arg); 59 61 static int timeout_ioctl(struct gpib_board *board, unsigned long arg); 60 62 static int status_bytes_ioctl(struct gpib_board *board, unsigned long arg); ··· 66 64 static int get_local_ppoll_mode_ioctl(struct gpib_board *board, unsigned long arg); 67 65 static int query_board_rsv_ioctl(struct gpib_board *board, unsigned long arg); 68 66 static int interface_clear_ioctl(struct gpib_board *board, unsigned long arg); 69 - static int select_pci_ioctl(gpib_board_config_t *config, unsigned long arg); 70 - static int select_device_path_ioctl(gpib_board_config_t *config, unsigned long arg); 67 + static int select_pci_ioctl(struct gpib_board_config *config, unsigned long arg); 68 + static int select_device_path_ioctl(struct gpib_board_config *config, unsigned long arg); 71 69 static int event_ioctl(struct gpib_board *board, unsigned long arg); 72 70 static int request_system_control_ioctl(struct gpib_board *board, unsigned long arg); 73 71 static int t1_delay_ioctl(struct gpib_board *board, unsigned long arg); 74 72 75 - static int cleanup_open_devices(gpib_file_private_t *file_priv, struct gpib_board *board); 73 + static int cleanup_open_devices(struct gpib_file_private *file_priv, struct gpib_board *board); 76 74 77 - static int pop_gpib_event_nolock(struct gpib_board *board, gpib_event_queue_t *queue, short *event_type); 75 + static int pop_gpib_event_nolock(struct gpib_board *board, 76 + struct gpib_event_queue *queue, short *event_type); 78 77 79 78 /* 80 79 * Timer functions ··· 122 119 return 0; 123 120 } 124 121 125 - /* this is a function instead of a constant because of Suse 122 + /* 123 + * this is a function instead of a constant because of Suse 126 124 * defining HZ to be a function call to get_hz() 127 125 */ 128 126 static inline int pseudo_irq_period(void) ··· 174 170 175 171 static const unsigned int serial_timeout = 1000000; 176 172 177 - unsigned int num_status_bytes(const gpib_status_queue_t *dev) 173 + unsigned int num_status_bytes(const struct gpib_status_queue *dev) 178 174 { 179 175 if (!dev) 180 176 return 0; ··· 182 178 } 183 179 184 180 // push status byte onto back of status byte fifo 185 - int push_status_byte(struct gpib_board *board, gpib_status_queue_t *device, u8 poll_byte) 181 + int push_status_byte(struct gpib_board *board, struct gpib_status_queue *device, u8 poll_byte) 186 182 { 187 183 struct list_head *head = &device->status_bytes; 188 - status_byte_t *status; 184 + struct gpib_status_byte *status; 189 185 static const unsigned int max_num_status_bytes = 1024; 190 186 int retval; 191 187 ··· 198 194 return retval; 199 195 } 200 196 201 - status = kmalloc(sizeof(status_byte_t), GFP_KERNEL); 197 + status = kmalloc(sizeof(*status), GFP_KERNEL); 202 198 if (!status) 203 199 return -ENOMEM; 204 200 ··· 216 212 } 217 213 218 214 // pop status byte from front of status byte fifo 219 - int pop_status_byte(struct gpib_board *board, gpib_status_queue_t *device, u8 *poll_byte) 215 + int pop_status_byte(struct gpib_board *board, struct gpib_status_queue *device, u8 *poll_byte) 220 216 { 221 217 struct list_head *head = &device->status_bytes; 222 218 struct list_head *front = head->next; 223 - status_byte_t *status; 219 + struct gpib_status_byte *status; 224 220 225 221 if (num_status_bytes(device) == 0) 226 222 return -EIO; ··· 233 229 return -EPIPE; 234 230 } 235 231 236 - status = list_entry(front, status_byte_t, list); 232 + status = list_entry(front, struct gpib_status_byte, list); 237 233 *poll_byte = status->poll_byte; 238 234 239 235 list_del(front); ··· 247 243 return 0; 248 244 } 249 245 250 - gpib_status_queue_t *get_gpib_status_queue(struct gpib_board *board, unsigned int pad, int sad) 246 + struct gpib_status_queue *get_gpib_status_queue(struct gpib_board *board, unsigned int pad, int sad) 251 247 { 252 - gpib_status_queue_t *device; 248 + struct gpib_status_queue *device; 253 249 struct list_head *list_ptr; 254 250 const struct list_head *head = &board->device_list; 255 251 256 252 for (list_ptr = head->next; list_ptr != head; list_ptr = list_ptr->next) { 257 - device = list_entry(list_ptr, gpib_status_queue_t, list); 253 + device = list_entry(list_ptr, struct gpib_status_queue, list); 258 254 if (gpib_address_equal(device->pad, device->sad, pad, sad)) 259 255 return device; 260 256 } ··· 262 258 return NULL; 263 259 } 264 260 265 - int get_serial_poll_byte(struct gpib_board *board, unsigned int pad, int sad, unsigned int usec_timeout, 266 - uint8_t *poll_byte) 261 + int get_serial_poll_byte(struct gpib_board *board, unsigned int pad, int sad, 262 + unsigned int usec_timeout, u8 *poll_byte) 267 263 { 268 - gpib_status_queue_t *device; 264 + struct gpib_status_queue *device; 269 265 270 266 device = get_gpib_status_queue(board, pad, sad); 271 267 if (num_status_bytes(device)) ··· 295 291 } 296 292 297 293 dev_dbg(board->gpib_dev, "complete\n"); 298 - /* need to wake wait queue in case someone is 294 + /* 295 + * need to wake wait queue in case someone is 299 296 * waiting on RQS 300 297 */ 301 298 wake_up_interruptible(&board->wait); ··· 339 334 } 340 335 341 336 static int read_serial_poll_byte(struct gpib_board *board, unsigned int pad, 342 - int sad, unsigned int usec_timeout, uint8_t *result) 337 + int sad, unsigned int usec_timeout, u8 *result) 343 338 { 344 339 u8 cmd_string[8]; 345 340 int end_flag; ··· 410 405 } 411 406 412 407 static int serial_poll_single(struct gpib_board *board, unsigned int pad, int sad, 413 - unsigned int usec_timeout, uint8_t *result) 408 + unsigned int usec_timeout, u8 *result) 414 409 { 415 410 int retval, cleanup_retval; 416 411 ··· 432 427 int retval = 0; 433 428 struct list_head *cur; 434 429 const struct list_head *head = NULL; 435 - gpib_status_queue_t *device; 430 + struct gpib_status_queue *device; 436 431 u8 result; 437 432 unsigned int num_bytes = 0; 438 433 ··· 445 440 return retval; 446 441 447 442 for (cur = head->next; cur != head; cur = cur->next) { 448 - device = list_entry(cur, gpib_status_queue_t, list); 443 + device = list_entry(cur, struct gpib_status_queue, list); 449 444 retval = read_serial_poll_byte(board, 450 445 device->pad, device->sad, usec_timeout, &result); 451 446 if (retval < 0) ··· 475 470 */ 476 471 477 472 int dvrsp(struct gpib_board *board, unsigned int pad, int sad, 478 - unsigned int usec_timeout, uint8_t *result) 473 + unsigned int usec_timeout, u8 *result) 479 474 { 480 475 int status = ibstatus(board); 481 476 int retval; ··· 497 492 return retval; 498 493 } 499 494 500 - static gpib_descriptor_t *handle_to_descriptor(const gpib_file_private_t *file_priv, 501 - int handle) 495 + static struct gpib_descriptor *handle_to_descriptor(const struct gpib_file_private *file_priv, 496 + int handle) 502 497 { 503 498 if (handle < 0 || handle >= GPIB_MAX_NUM_DESCRIPTORS) { 504 499 pr_err("gpib: invalid handle %i\n", handle); ··· 508 503 return file_priv->descriptors[handle]; 509 504 } 510 505 511 - static int init_gpib_file_private(gpib_file_private_t *priv) 506 + static int init_gpib_file_private(struct gpib_file_private *priv) 512 507 { 513 508 memset(priv, 0, sizeof(*priv)); 514 509 atomic_set(&priv->holding_mutex, 0); 515 - priv->descriptors[0] = kmalloc(sizeof(gpib_descriptor_t), GFP_KERNEL); 510 + priv->descriptors[0] = kmalloc(sizeof(struct gpib_descriptor), GFP_KERNEL); 516 511 if (!priv->descriptors[0]) { 517 512 pr_err("gpib: failed to allocate default board descriptor\n"); 518 513 return -ENOMEM; ··· 527 522 { 528 523 unsigned int minor = iminor(inode); 529 524 struct gpib_board *board; 530 - gpib_file_private_t *priv; 525 + struct gpib_file_private *priv; 531 526 532 527 if (minor >= GPIB_MAX_NUM_BOARDS) { 533 528 pr_err("gpib: invalid minor number of device file\n"); ··· 536 531 537 532 board = &board_array[minor]; 538 533 539 - filep->private_data = kmalloc(sizeof(gpib_file_private_t), GFP_KERNEL); 534 + filep->private_data = kmalloc(sizeof(struct gpib_file_private), GFP_KERNEL); 540 535 if (!filep->private_data) 541 536 return -ENOMEM; 542 537 543 538 priv = filep->private_data; 544 - init_gpib_file_private((gpib_file_private_t *)filep->private_data); 539 + init_gpib_file_private((struct gpib_file_private *)filep->private_data); 545 540 546 541 if (board->use_count == 0) { 547 542 int retval; ··· 565 560 { 566 561 unsigned int minor = iminor(inode); 567 562 struct gpib_board *board; 568 - gpib_file_private_t *priv = filep->private_data; 569 - gpib_descriptor_t *desc; 563 + struct gpib_file_private *priv = filep->private_data; 564 + struct gpib_descriptor *desc; 570 565 571 566 if (minor >= GPIB_MAX_NUM_BOARDS) { 572 567 pr_err("gpib: invalid minor number of device file\n"); ··· 611 606 { 612 607 unsigned int minor = iminor(filep->f_path.dentry->d_inode); 613 608 struct gpib_board *board; 614 - gpib_file_private_t *file_priv = filep->private_data; 609 + struct gpib_file_private *file_priv = filep->private_data; 615 610 long retval = -ENOTTY; 616 611 617 612 if (minor >= GPIB_MAX_NUM_BOARDS) { ··· 670 665 retval = board_info_ioctl(board, arg); 671 666 goto done; 672 667 case IBMUTEX: 673 - /* Need to unlock board->big_gpib_mutex before potentially locking board->user_mutex 674 - * to maintain consistent locking order 668 + /* 669 + * Need to unlock board->big_gpib_mutex before potentially locking board->user_mutex 670 + * to maintain consistent locking order 675 671 */ 676 672 mutex_unlock(&board->big_gpib_mutex); 677 673 return mutex_ioctl(board, file_priv, arg); ··· 742 736 retval = take_control_ioctl(board, arg); 743 737 goto done; 744 738 case IBCMD: 745 - /* IO ioctls can take a long time, we need to unlock board->big_gpib_mutex 746 - * before we call them. 739 + /* 740 + * IO ioctls can take a long time, we need to unlock board->big_gpib_mutex 741 + * before we call them. 747 742 */ 748 743 mutex_unlock(&board->big_gpib_mutex); 749 744 return command_ioctl(file_priv, board, arg); ··· 767 760 retval = query_board_rsv_ioctl(board, arg); 768 761 goto done; 769 762 case IBRD: 770 - /* IO ioctls can take a long time, we need to unlock board->big_gpib_mutex 771 - * before we call them. 763 + /* 764 + * IO ioctls can take a long time, we need to unlock board->big_gpib_mutex 765 + * before we call them. 772 766 */ 773 767 mutex_unlock(&board->big_gpib_mutex); 774 768 return read_ioctl(file_priv, board, arg); ··· 798 790 retval = timeout_ioctl(board, arg); 799 791 goto done; 800 792 case IBWRT: 801 - /* IO ioctls can take a long time, we need to unlock board->big_gpib_mutex 802 - * before we call them. 793 + /* 794 + * IO ioctls can take a long time, we need to unlock board->big_gpib_mutex 795 + * before we call them. 803 796 */ 804 797 mutex_unlock(&board->big_gpib_mutex); 805 798 return write_ioctl(file_priv, board, arg); ··· 815 806 return retval; 816 807 } 817 808 818 - static int board_type_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board, unsigned long arg) 809 + static int board_type_ioctl(struct gpib_file_private *file_priv, 810 + struct gpib_board *board, unsigned long arg) 819 811 { 820 812 struct list_head *list_ptr; 821 - board_type_ioctl_t cmd; 813 + struct gpib_board_type_ioctl cmd; 822 814 int retval; 823 815 824 816 if (!capable(CAP_SYS_ADMIN)) ··· 827 817 if (board->online) 828 818 return -EBUSY; 829 819 830 - retval = copy_from_user(&cmd, (void __user *)arg, sizeof(board_type_ioctl_t)); 820 + retval = copy_from_user(&cmd, (void __user *)arg, 821 + sizeof(struct gpib_board_type_ioctl)); 831 822 if (retval) 832 823 return retval; 833 824 834 825 for (list_ptr = registered_drivers.next; list_ptr != &registered_drivers; 835 826 list_ptr = list_ptr->next) { 836 - gpib_interface_list_t *entry; 827 + struct gpib_interface_list *entry; 837 828 838 - entry = list_entry(list_ptr, gpib_interface_list_t, list); 829 + entry = list_entry(list_ptr, struct gpib_interface_list, list); 839 830 if (strcmp(entry->interface->name, cmd.name) == 0) { 840 831 int i; 841 832 int had_module = file_priv->got_module; ··· 868 857 return -EINVAL; 869 858 } 870 859 871 - static int read_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board, 860 + static int read_ioctl(struct gpib_file_private *file_priv, struct gpib_board *board, 872 861 unsigned long arg) 873 862 { 874 - read_write_ioctl_t read_cmd; 863 + struct gpib_read_write_ioctl read_cmd; 875 864 u8 __user *userbuf; 876 865 unsigned long remain; 877 866 int end_flag = 0; 878 867 int retval; 879 868 ssize_t read_ret = 0; 880 - gpib_descriptor_t *desc; 869 + struct gpib_descriptor *desc; 881 870 size_t nbytes; 882 871 883 872 retval = copy_from_user(&read_cmd, (void __user *)arg, sizeof(read_cmd)); ··· 924 913 } 925 914 read_cmd.completed_transfer_count = read_cmd.requested_transfer_count - remain; 926 915 read_cmd.end = end_flag; 927 - /* suppress errors (for example due to timeout or interruption by device clear) 916 + /* 917 + * suppress errors (for example due to timeout or interruption by device clear) 928 918 * if all bytes got sent. This prevents races that can occur in the various drivers 929 919 * if a device receives a device clear immediately after a transfer completes and 930 920 * the driver code wasn't careful enough to handle that case. ··· 944 932 return read_ret; 945 933 } 946 934 947 - static int command_ioctl(gpib_file_private_t *file_priv, 935 + static int command_ioctl(struct gpib_file_private *file_priv, 948 936 struct gpib_board *board, unsigned long arg) 949 937 { 950 - read_write_ioctl_t cmd; 938 + struct gpib_read_write_ioctl cmd; 951 939 u8 __user *userbuf; 952 940 unsigned long remain; 953 941 int retval; 954 942 int fault = 0; 955 - gpib_descriptor_t *desc; 943 + struct gpib_descriptor *desc; 956 944 size_t bytes_written; 957 945 int no_clear_io_in_prog; 958 946 ··· 979 967 if (!access_ok(userbuf, remain)) 980 968 return -EFAULT; 981 969 982 - /* Write buffer loads till we empty the user supplied buffer. 983 - * Call drivers at least once, even if remain is zero, in 984 - * order to allow them to insure previous commands were 985 - * completely finished, in the case of a restarted ioctl. 970 + /* 971 + * Write buffer loads till we empty the user supplied buffer. 972 + * Call drivers at least once, even if remain is zero, in 973 + * order to allow them to insure previous commands were 974 + * completely finished, in the case of a restarted ioctl. 986 975 */ 987 976 988 977 atomic_set(&desc->io_in_progress, 1); ··· 1029 1016 return retval; 1030 1017 } 1031 1018 1032 - static int write_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board, 1019 + static int write_ioctl(struct gpib_file_private *file_priv, struct gpib_board *board, 1033 1020 unsigned long arg) 1034 1021 { 1035 - read_write_ioctl_t write_cmd; 1022 + struct gpib_read_write_ioctl write_cmd; 1036 1023 u8 __user *userbuf; 1037 1024 unsigned long remain; 1038 1025 int retval = 0; 1039 1026 int fault; 1040 - gpib_descriptor_t *desc; 1027 + struct gpib_descriptor *desc; 1041 1028 1042 1029 fault = copy_from_user(&write_cmd, (void __user *)arg, sizeof(write_cmd)); 1043 1030 if (fault) ··· 1081 1068 break; 1082 1069 } 1083 1070 write_cmd.completed_transfer_count = write_cmd.requested_transfer_count - remain; 1084 - /* suppress errors (for example due to timeout or interruption by device clear) 1071 + /* 1072 + * suppress errors (for example due to timeout or interruption by device clear) 1085 1073 * if all bytes got sent. This prevents races that can occur in the various drivers 1086 1074 * if a device receives a device clear immediately after a transfer completes and 1087 1075 * the driver code wasn't careful enough to handle that case. ··· 1103 1089 1104 1090 static int status_bytes_ioctl(struct gpib_board *board, unsigned long arg) 1105 1091 { 1106 - gpib_status_queue_t *device; 1107 - spoll_bytes_ioctl_t cmd; 1092 + struct gpib_status_queue *device; 1093 + struct gpib_spoll_bytes_ioctl cmd; 1108 1094 int retval; 1109 1095 1110 1096 retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); ··· 1128 1114 unsigned int pad, int sad) 1129 1115 { 1130 1116 struct list_head *list_ptr; 1131 - gpib_status_queue_t *device; 1117 + struct gpib_status_queue *device; 1132 1118 1133 - /* first see if address has already been opened, then increment 1119 + /* 1120 + * first see if address has already been opened, then increment 1134 1121 * open count 1135 1122 */ 1136 1123 for (list_ptr = head->next; list_ptr != head; list_ptr = list_ptr->next) { 1137 - device = list_entry(list_ptr, gpib_status_queue_t, list); 1124 + device = list_entry(list_ptr, struct gpib_status_queue, list); 1138 1125 if (gpib_address_equal(device->pad, device->sad, pad, sad)) { 1139 1126 dev_dbg(board->gpib_dev, "incrementing open count for pad %i, sad %i\n", 1140 1127 device->pad, device->sad); ··· 1144 1129 } 1145 1130 } 1146 1131 1147 - /* otherwise we need to allocate a new gpib_status_queue_t */ 1148 - device = kmalloc(sizeof(gpib_status_queue_t), GFP_ATOMIC); 1132 + /* otherwise we need to allocate a new struct gpib_status_queue */ 1133 + device = kmalloc(sizeof(struct gpib_status_queue), GFP_ATOMIC); 1149 1134 if (!device) 1150 1135 return -ENOMEM; 1151 1136 init_gpib_status_queue(device); ··· 1163 1148 static int subtract_open_device_count(struct gpib_board *board, struct list_head *head, 1164 1149 unsigned int pad, int sad, unsigned int count) 1165 1150 { 1166 - gpib_status_queue_t *device; 1151 + struct gpib_status_queue *device; 1167 1152 struct list_head *list_ptr; 1168 1153 1169 1154 for (list_ptr = head->next; list_ptr != head; list_ptr = list_ptr->next) { 1170 - device = list_entry(list_ptr, gpib_status_queue_t, list); 1155 + device = list_entry(list_ptr, struct gpib_status_queue, list); 1171 1156 if (gpib_address_equal(device->pad, device->sad, pad, sad)) { 1172 1157 dev_dbg(board->gpib_dev, "decrementing open count for pad %i, sad %i\n", 1173 1158 device->pad, device->sad); ··· 1195 1180 return subtract_open_device_count(board, head, pad, sad, 1); 1196 1181 } 1197 1182 1198 - static int cleanup_open_devices(gpib_file_private_t *file_priv, struct gpib_board *board) 1183 + static int cleanup_open_devices(struct gpib_file_private *file_priv, struct gpib_board *board) 1199 1184 { 1200 1185 int retval = 0; 1201 1186 int i; 1202 1187 1203 1188 for (i = 0; i < GPIB_MAX_NUM_DESCRIPTORS; i++) { 1204 - gpib_descriptor_t *desc; 1189 + struct gpib_descriptor *desc; 1205 1190 1206 1191 desc = file_priv->descriptors[i]; 1207 1192 if (!desc) ··· 1222 1207 1223 1208 static int open_dev_ioctl(struct file *filep, struct gpib_board *board, unsigned long arg) 1224 1209 { 1225 - open_dev_ioctl_t open_dev_cmd; 1210 + struct gpib_open_dev_ioctl open_dev_cmd; 1226 1211 int retval; 1227 - gpib_file_private_t *file_priv = filep->private_data; 1212 + struct gpib_file_private *file_priv = filep->private_data; 1228 1213 int i; 1229 1214 1230 1215 retval = copy_from_user(&open_dev_cmd, (void __user *)arg, sizeof(open_dev_cmd)); ··· 1240 1225 mutex_unlock(&file_priv->descriptors_mutex); 1241 1226 return -ERANGE; 1242 1227 } 1243 - file_priv->descriptors[i] = kmalloc(sizeof(gpib_descriptor_t), GFP_KERNEL); 1228 + file_priv->descriptors[i] = kmalloc(sizeof(struct gpib_descriptor), GFP_KERNEL); 1244 1229 if (!file_priv->descriptors[i]) { 1245 1230 mutex_unlock(&file_priv->descriptors_mutex); 1246 1231 return -ENOMEM; ··· 1257 1242 if (retval < 0) 1258 1243 return retval; 1259 1244 1260 - /* clear stuck srq state, since we may be able to find service request on 1245 + /* 1246 + * clear stuck srq state, since we may be able to find service request on 1261 1247 * the new device 1262 1248 */ 1263 1249 atomic_set(&board->stuck_srq, 0); ··· 1273 1257 1274 1258 static int close_dev_ioctl(struct file *filep, struct gpib_board *board, unsigned long arg) 1275 1259 { 1276 - close_dev_ioctl_t cmd; 1277 - gpib_file_private_t *file_priv = filep->private_data; 1260 + struct gpib_close_dev_ioctl cmd; 1261 + struct gpib_file_private *file_priv = filep->private_data; 1278 1262 int retval; 1279 1263 1280 1264 retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); ··· 1300 1284 1301 1285 static int serial_poll_ioctl(struct gpib_board *board, unsigned long arg) 1302 1286 { 1303 - serial_poll_ioctl_t serial_cmd; 1287 + struct gpib_serial_poll_ioctl serial_cmd; 1304 1288 int retval; 1305 1289 1306 1290 retval = copy_from_user(&serial_cmd, (void __user *)arg, sizeof(serial_cmd)); ··· 1319 1303 return 0; 1320 1304 } 1321 1305 1322 - static int wait_ioctl(gpib_file_private_t *file_priv, struct gpib_board *board, 1306 + static int wait_ioctl(struct gpib_file_private *file_priv, struct gpib_board *board, 1323 1307 unsigned long arg) 1324 1308 { 1325 - wait_ioctl_t wait_cmd; 1309 + struct gpib_wait_ioctl wait_cmd; 1326 1310 int retval; 1327 - gpib_descriptor_t *desc; 1311 + struct gpib_descriptor *desc; 1328 1312 1329 1313 retval = copy_from_user(&wait_cmd, (void __user *)arg, sizeof(wait_cmd)); 1330 1314 if (retval) ··· 1364 1348 1365 1349 static int online_ioctl(struct gpib_board *board, unsigned long arg) 1366 1350 { 1367 - online_ioctl_t online_cmd; 1351 + struct gpib_online_ioctl online_cmd; 1368 1352 int retval; 1369 1353 void __user *init_data = NULL; 1370 1354 ··· 1446 1430 return 0; 1447 1431 } 1448 1432 1449 - static int pad_ioctl(struct gpib_board *board, gpib_file_private_t *file_priv, 1433 + static int pad_ioctl(struct gpib_board *board, struct gpib_file_private *file_priv, 1450 1434 unsigned long arg) 1451 1435 { 1452 - pad_ioctl_t cmd; 1436 + struct gpib_pad_ioctl cmd; 1453 1437 int retval; 1454 - gpib_descriptor_t *desc; 1438 + struct gpib_descriptor *desc; 1455 1439 1456 1440 retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); 1457 1441 if (retval) ··· 1482 1466 return 0; 1483 1467 } 1484 1468 1485 - static int sad_ioctl(struct gpib_board *board, gpib_file_private_t *file_priv, 1469 + static int sad_ioctl(struct gpib_board *board, struct gpib_file_private *file_priv, 1486 1470 unsigned long arg) 1487 1471 { 1488 - sad_ioctl_t cmd; 1472 + struct gpib_sad_ioctl cmd; 1489 1473 int retval; 1490 - gpib_descriptor_t *desc; 1474 + struct gpib_descriptor *desc; 1491 1475 1492 1476 retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); 1493 1477 if (retval) ··· 1519 1503 1520 1504 static int eos_ioctl(struct gpib_board *board, unsigned long arg) 1521 1505 { 1522 - eos_ioctl_t eos_cmd; 1506 + struct gpib_eos_ioctl eos_cmd; 1523 1507 int retval; 1524 1508 1525 1509 retval = copy_from_user(&eos_cmd, (void __user *)arg, sizeof(eos_cmd)); ··· 1543 1527 1544 1528 static int request_service2_ioctl(struct gpib_board *board, unsigned long arg) 1545 1529 { 1546 - request_service2_t request_service2_cmd; 1530 + struct gpib_request_service2 request_service2_cmd; 1547 1531 int retval; 1548 1532 1549 1533 retval = copy_from_user(&request_service2_cmd, (void __user *)arg, 1550 - sizeof(request_service2_t)); 1534 + sizeof(struct gpib_request_service2)); 1551 1535 if (retval) 1552 1536 return -EFAULT; 1553 1537 ··· 1555 1539 request_service2_cmd.new_reason_for_service); 1556 1540 } 1557 1541 1558 - static int iobase_ioctl(gpib_board_config_t *config, unsigned long arg) 1542 + static int iobase_ioctl(struct gpib_board_config *config, unsigned long arg) 1559 1543 { 1560 1544 u64 base_addr; 1561 1545 int retval; ··· 1574 1558 return 0; 1575 1559 } 1576 1560 1577 - static int irq_ioctl(gpib_board_config_t *config, unsigned long arg) 1561 + static int irq_ioctl(struct gpib_board_config *config, unsigned long arg) 1578 1562 { 1579 1563 unsigned int irq; 1580 1564 int retval; ··· 1591 1575 return 0; 1592 1576 } 1593 1577 1594 - static int dma_ioctl(gpib_board_config_t *config, unsigned long arg) 1578 + static int dma_ioctl(struct gpib_board_config *config, unsigned long arg) 1595 1579 { 1596 1580 unsigned int dma_channel; 1597 1581 int retval; ··· 1608 1592 return 0; 1609 1593 } 1610 1594 1611 - static int autospoll_ioctl(struct gpib_board *board, gpib_file_private_t *file_priv, 1595 + static int autospoll_ioctl(struct gpib_board *board, struct gpib_file_private *file_priv, 1612 1596 unsigned long arg) 1613 1597 { 1614 - autospoll_ioctl_t enable; 1598 + short enable; 1615 1599 int retval; 1616 - gpib_descriptor_t *desc; 1600 + struct gpib_descriptor *desc; 1617 1601 1618 1602 retval = copy_from_user(&enable, (void __user *)arg, sizeof(enable)); 1619 1603 if (retval) ··· 1646 1630 return retval; 1647 1631 } 1648 1632 1649 - static int mutex_ioctl(struct gpib_board *board, gpib_file_private_t *file_priv, 1633 + static int mutex_ioctl(struct gpib_board *board, struct gpib_file_private *file_priv, 1650 1634 unsigned long arg) 1651 1635 { 1652 1636 int retval, lock_mutex; ··· 1703 1687 1704 1688 static int ppc_ioctl(struct gpib_board *board, unsigned long arg) 1705 1689 { 1706 - ppoll_config_ioctl_t cmd; 1690 + struct gpib_ppoll_config_ioctl cmd; 1707 1691 int retval; 1708 1692 1709 1693 retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); ··· 1729 1713 1730 1714 static int set_local_ppoll_mode_ioctl(struct gpib_board *board, unsigned long arg) 1731 1715 { 1732 - local_ppoll_mode_ioctl_t cmd; 1716 + short cmd; 1733 1717 int retval; 1734 1718 1735 1719 retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); ··· 1746 1730 1747 1731 static int get_local_ppoll_mode_ioctl(struct gpib_board *board, unsigned long arg) 1748 1732 { 1749 - local_ppoll_mode_ioctl_t cmd; 1733 + short cmd; 1750 1734 int retval; 1751 1735 1752 1736 cmd = board->local_ppoll_mode; ··· 1773 1757 1774 1758 static int board_info_ioctl(const struct gpib_board *board, unsigned long arg) 1775 1759 { 1776 - board_info_ioctl_t info; 1760 + struct gpib_board_info_ioctl info; 1777 1761 int retval; 1778 1762 1779 1763 info.pad = board->pad; ··· 1806 1790 return ibsic(board, usec_duration); 1807 1791 } 1808 1792 1809 - static int select_pci_ioctl(gpib_board_config_t *config, unsigned long arg) 1793 + static int select_pci_ioctl(struct gpib_board_config *config, unsigned long arg) 1810 1794 { 1811 - select_pci_ioctl_t selection; 1795 + struct gpib_select_pci_ioctl selection; 1812 1796 int retval; 1813 1797 1814 1798 if (!capable(CAP_SYS_ADMIN)) ··· 1824 1808 return 0; 1825 1809 } 1826 1810 1827 - static int select_device_path_ioctl(gpib_board_config_t *config, unsigned long arg) 1811 + static int select_device_path_ioctl(struct gpib_board_config *config, unsigned long arg) 1828 1812 { 1829 - select_device_path_ioctl_t *selection; 1813 + struct gpib_select_device_path_ioctl *selection; 1830 1814 int retval; 1831 1815 1832 1816 if (!capable(CAP_SYS_ADMIN)) 1833 1817 return -EPERM; 1834 1818 1835 - selection = vmalloc(sizeof(select_device_path_ioctl_t)); 1819 + selection = vmalloc(sizeof(struct gpib_select_device_path_ioctl)); 1836 1820 if (!selection) 1837 1821 return -ENOMEM; 1838 1822 1839 - retval = copy_from_user(selection, (void __user *)arg, sizeof(select_device_path_ioctl_t)); 1823 + retval = copy_from_user(selection, (void __user *)arg, 1824 + sizeof(struct gpib_select_device_path_ioctl)); 1840 1825 if (retval) { 1841 1826 vfree(selection); 1842 1827 return -EFAULT; ··· 1853 1836 return 0; 1854 1837 } 1855 1838 1856 - unsigned int num_gpib_events(const gpib_event_queue_t *queue) 1839 + unsigned int num_gpib_events(const struct gpib_event_queue *queue) 1857 1840 { 1858 1841 return queue->num_events; 1859 1842 } 1860 1843 1861 1844 static int push_gpib_event_nolock(struct gpib_board *board, short event_type) 1862 1845 { 1863 - gpib_event_queue_t *queue = &board->event_queue; 1846 + struct gpib_event_queue *queue = &board->event_queue; 1864 1847 struct list_head *head = &queue->event_head; 1865 - gpib_event_t *event; 1848 + struct gpib_event *event; 1866 1849 static const unsigned int max_num_events = 1024; 1867 1850 int retval; 1868 1851 ··· 1875 1858 return retval; 1876 1859 } 1877 1860 1878 - event = kmalloc(sizeof(gpib_event_t), GFP_ATOMIC); 1861 + event = kmalloc(sizeof(struct gpib_event), GFP_ATOMIC); 1879 1862 if (!event) { 1880 1863 queue->dropped_event = 1; 1881 1864 dev_err(board->gpib_dev, "failed to allocate memory for event\n"); ··· 1905 1888 retval = push_gpib_event_nolock(board, event_type); 1906 1889 spin_unlock_irqrestore(&board->event_queue.lock, flags); 1907 1890 1908 - if (event_type == EventDevTrg) 1891 + if (event_type == EVENT_DEV_TRG) 1909 1892 board->status |= DTAS; 1910 - if (event_type == EventDevClr) 1893 + if (event_type == EVENT_DEV_CLR) 1911 1894 board->status |= DCAS; 1912 1895 1913 1896 return retval; 1914 1897 } 1915 1898 EXPORT_SYMBOL(push_gpib_event); 1916 1899 1917 - static int pop_gpib_event_nolock(struct gpib_board *board, gpib_event_queue_t *queue, short *event_type) 1900 + static int pop_gpib_event_nolock(struct gpib_board *board, 1901 + struct gpib_event_queue *queue, short *event_type) 1918 1902 { 1919 1903 struct list_head *head = &queue->event_head; 1920 1904 struct list_head *front = head->next; 1921 - gpib_event_t *event; 1905 + struct gpib_event *event; 1922 1906 1923 1907 if (num_gpib_events(queue) == 0) { 1924 - *event_type = EventNone; 1908 + *event_type = EVENT_NONE; 1925 1909 return 0; 1926 1910 } 1927 1911 ··· 1934 1916 return -EPIPE; 1935 1917 } 1936 1918 1937 - event = list_entry(front, gpib_event_t, list); 1919 + event = list_entry(front, struct gpib_event, list); 1938 1920 *event_type = event->event_type; 1939 1921 1940 1922 list_del(front); ··· 1949 1931 } 1950 1932 1951 1933 // pop event from front of event queue 1952 - int pop_gpib_event(struct gpib_board *board, gpib_event_queue_t *queue, short *event_type) 1934 + int pop_gpib_event(struct gpib_board *board, struct gpib_event_queue *queue, short *event_type) 1953 1935 { 1954 1936 unsigned long flags; 1955 1937 int retval; ··· 1962 1944 1963 1945 static int event_ioctl(struct gpib_board *board, unsigned long arg) 1964 1946 { 1965 - event_ioctl_t user_event; 1947 + short user_event; 1966 1948 int retval; 1967 1949 short event; 1968 1950 ··· 1981 1963 1982 1964 static int request_system_control_ioctl(struct gpib_board *board, unsigned long arg) 1983 1965 { 1984 - rsc_ioctl_t request_control; 1966 + int request_control; 1985 1967 int retval; 1986 1968 1987 1969 retval = copy_from_user(&request_control, (void __user *)arg, sizeof(request_control)); 1988 1970 if (retval) 1989 1971 return -EFAULT; 1990 1972 1991 - ibrsc(board, request_control); 1992 - 1993 - return 0; 1973 + return ibrsc(board, request_control); 1994 1974 } 1995 1975 1996 1976 static int t1_delay_ioctl(struct gpib_board *board, unsigned long arg) 1997 1977 { 1998 - t1_delay_ioctl_t cmd; 1978 + unsigned int cmd; 1999 1979 unsigned int delay; 2000 1980 int retval; 2001 1981 ··· 2027 2011 2028 2012 LIST_HEAD(registered_drivers); 2029 2013 2030 - void init_gpib_descriptor(gpib_descriptor_t *desc) 2014 + void init_gpib_descriptor(struct gpib_descriptor *desc) 2031 2015 { 2032 2016 desc->pad = 0; 2033 2017 desc->sad = -1; ··· 2036 2020 atomic_set(&desc->io_in_progress, 0); 2037 2021 } 2038 2022 2039 - int gpib_register_driver(gpib_interface_t *interface, struct module *provider_module) 2023 + int gpib_register_driver(struct gpib_interface *interface, struct module *provider_module) 2040 2024 { 2041 - struct gpib_interface_list_struct *entry; 2025 + struct gpib_interface_list *entry; 2042 2026 2043 2027 entry = kmalloc(sizeof(*entry), GFP_KERNEL); 2044 2028 if (!entry) ··· 2052 2036 } 2053 2037 EXPORT_SYMBOL(gpib_register_driver); 2054 2038 2055 - void gpib_unregister_driver(gpib_interface_t *interface) 2039 + void gpib_unregister_driver(struct gpib_interface *interface) 2056 2040 { 2057 2041 int i; 2058 2042 struct list_head *list_ptr; ··· 2069 2053 } 2070 2054 } 2071 2055 for (list_ptr = registered_drivers.next; list_ptr != &registered_drivers;) { 2072 - gpib_interface_list_t *entry; 2056 + struct gpib_interface_list *entry; 2073 2057 2074 - entry = list_entry(list_ptr, gpib_interface_list_t, list); 2058 + entry = list_entry(list_ptr, struct gpib_interface_list, list); 2075 2059 list_ptr = list_ptr->next; 2076 2060 if (entry->interface == interface) { 2077 2061 list_del(&entry->list); ··· 2081 2065 } 2082 2066 EXPORT_SYMBOL(gpib_unregister_driver); 2083 2067 2084 - static void init_gpib_board_config(gpib_board_config_t *config) 2068 + static void init_gpib_board_config(struct gpib_board_config *config) 2085 2069 { 2086 - memset(config, 0, sizeof(gpib_board_config_t)); 2070 + memset(config, 0, sizeof(struct gpib_board_config)); 2087 2071 config->pci_bus = -1; 2088 2072 config->pci_slot = -1; 2089 2073 } ··· 2159 2143 } 2160 2144 } 2161 2145 2162 - void init_gpib_status_queue(gpib_status_queue_t *device) 2146 + void init_gpib_status_queue(struct gpib_status_queue *device) 2163 2147 { 2164 2148 INIT_LIST_HEAD(&device->list); 2165 2149 INIT_LIST_HEAD(&device->status_bytes); ··· 2224 2208 } 2225 2209 EXPORT_SYMBOL(gpib_match_device_path); 2226 2210 2227 - struct pci_dev *gpib_pci_get_device(const gpib_board_config_t *config, unsigned int vendor_id, 2211 + struct pci_dev *gpib_pci_get_device(const struct gpib_board_config *config, unsigned int vendor_id, 2228 2212 unsigned int device_id, struct pci_dev *from) 2229 2213 { 2230 2214 struct pci_dev *pci_device = from; ··· 2243 2227 } 2244 2228 EXPORT_SYMBOL(gpib_pci_get_device); 2245 2229 2246 - struct pci_dev *gpib_pci_get_subsys(const gpib_board_config_t *config, unsigned int vendor_id, 2230 + struct pci_dev *gpib_pci_get_subsys(const struct gpib_board_config *config, unsigned int vendor_id, 2247 2231 unsigned int device_id, unsigned int ss_vendor, 2248 2232 unsigned int ss_device, 2249 2233 struct pci_dev *from)
+37 -23
drivers/staging/gpib/common/iblib.c
··· 33 33 return 0; 34 34 35 35 if (sync && (status & LACS) == 0) 36 - /* tcs (take control synchronously) can only possibly work when 37 - * controller is listener. Error code also needs to be -ETIMEDOUT 38 - * or it will giveout without doing fallback. 36 + /* 37 + * tcs (take control synchronously) can only possibly work when 38 + * controller is listener. Error code also needs to be -ETIMEDOUT 39 + * or it will giveout without doing fallback. 39 40 */ 40 41 retval = -ETIMEDOUT; 41 42 else ··· 51 50 return retval; 52 51 } 53 52 54 - /* After ATN is asserted, it should cause any connected devices 53 + /* 54 + * After ATN is asserted, it should cause any connected devices 55 55 * to start listening for command bytes and leave acceptor idle state. 56 56 * So if ATN is asserted and neither NDAC or NRFD are asserted, 57 57 * then there are no devices and ibcmd should error out immediately. ··· 98 96 * must be called to initialize the GPIB and enable 99 97 * the interface to leave the controller idle state. 100 98 */ 101 - int ibcmd(struct gpib_board *board, uint8_t *buf, size_t length, size_t *bytes_written) 99 + int ibcmd(struct gpib_board *board, u8 *buf, size_t length, size_t *bytes_written) 102 100 { 103 101 ssize_t ret = 0; 104 102 int status; ··· 220 218 board->interface->detach(board); 221 219 return retval; 222 220 } 223 - /* nios2nommu on 2.6.11 uclinux kernel has weird problems 221 + /* 222 + * nios2nommu on 2.6.11 uclinux kernel has weird problems 224 223 * with autospoll thread causing huge slowdowns 225 224 */ 226 225 #ifndef CONFIG_NIOS2 ··· 300 297 * calling ibcmd. 301 298 */ 302 299 303 - int ibrd(struct gpib_board *board, uint8_t *buf, size_t length, int *end_flag, size_t *nbytes) 300 + int ibrd(struct gpib_board *board, u8 *buf, size_t length, int *end_flag, size_t *nbytes) 304 301 { 305 302 ssize_t ret = 0; 306 303 int retval; ··· 316 313 if (retval < 0) 317 314 return retval; 318 315 } 319 - /* XXX resetting timer here could cause timeouts take longer than they should, 316 + /* 317 + * XXX resetting timer here could cause timeouts take longer than they should, 320 318 * since read_ioctl calls this 321 319 * function in a loop, there is probably a similar problem with writes/commands 322 320 */ ··· 347 343 * 1. Prior to conducting the poll the interface is placed 348 344 * in the controller active state. 349 345 */ 350 - int ibrpp(struct gpib_board *board, uint8_t *result) 346 + int ibrpp(struct gpib_board *board, u8 *result) 351 347 { 352 348 int retval = 0; 353 349 ··· 362 358 return retval; 363 359 } 364 360 365 - int ibppc(struct gpib_board *board, uint8_t configuration) 361 + int ibppc(struct gpib_board *board, u8 configuration) 366 362 { 367 363 configuration &= 0x1f; 368 364 board->interface->parallel_poll_configure(board, configuration); ··· 371 367 return 0; 372 368 } 373 369 374 - int ibrsv2(struct gpib_board *board, uint8_t status_byte, int new_reason_for_service) 370 + int ibrsv2(struct gpib_board *board, u8 status_byte, int new_reason_for_service) 375 371 { 376 372 int board_status = ibstatus(board); 377 373 const unsigned int MSS = status_byte & request_service_bit; ··· 422 418 return 0; 423 419 } 424 420 425 - /* FIXME make int */ 426 - void ibrsc(struct gpib_board *board, int request_control) 421 + int ibrsc(struct gpib_board *board, int request_control) 427 422 { 423 + int retval; 424 + 425 + if (!board->interface->request_system_control) 426 + return -EPERM; 427 + 428 + retval = board->interface->request_system_control(board, request_control); 429 + 430 + if (retval) 431 + return retval; 432 + 428 433 board->master = request_control != 0; 429 - if (board->interface->request_system_control) 430 - board->interface->request_system_control(board, request_control); 434 + 435 + return 0; 431 436 } 432 437 433 438 /* ··· 519 506 return general_ibstatus(board, NULL, 0, 0, NULL); 520 507 } 521 508 522 - int general_ibstatus(struct gpib_board *board, const gpib_status_queue_t *device, 523 - int clear_mask, int set_mask, gpib_descriptor_t *desc) 509 + int general_ibstatus(struct gpib_board *board, const struct gpib_status_queue *device, 510 + int clear_mask, int set_mask, struct gpib_descriptor *desc) 524 511 { 525 512 int status = 0; 526 513 short line_status; 527 514 528 515 if (board->private_data) { 529 516 status = board->interface->update_status(board, clear_mask); 530 - /* XXX should probably stop having drivers use TIMO bit in 517 + /* 518 + * XXX should probably stop having drivers use TIMO bit in 531 519 * board->status to avoid confusion 532 520 */ 533 521 status &= ~TIMO; ··· 587 573 timer_setup_on_stack(&winfo->timer, wait_timeout, 0); 588 574 } 589 575 590 - static int wait_satisfied(struct wait_info *winfo, gpib_status_queue_t *status_queue, 591 - int wait_mask, int *status, gpib_descriptor_t *desc) 576 + static int wait_satisfied(struct wait_info *winfo, struct gpib_status_queue *status_queue, 577 + int wait_mask, int *status, struct gpib_descriptor *desc) 592 578 { 593 579 struct gpib_board *board = winfo->board; 594 580 int temp_status; ··· 637 623 * no condition is waited for. 638 624 */ 639 625 int ibwait(struct gpib_board *board, int wait_mask, int clear_mask, int set_mask, 640 - int *status, unsigned long usec_timeout, gpib_descriptor_t *desc) 626 + int *status, unsigned long usec_timeout, struct gpib_descriptor *desc) 641 627 { 642 628 int retval = 0; 643 - gpib_status_queue_t *status_queue; 629 + struct gpib_status_queue *status_queue; 644 630 struct wait_info winfo; 645 631 646 632 if (desc->is_board) ··· 691 677 * well as the interface board itself must be 692 678 * addressed by calling ibcmd. 693 679 */ 694 - int ibwrt(struct gpib_board *board, uint8_t *buf, size_t cnt, int send_eoi, size_t *bytes_written) 680 + int ibwrt(struct gpib_board *board, u8 *buf, size_t cnt, int send_eoi, size_t *bytes_written) 695 681 { 696 682 int ret = 0; 697 683 int retval;
+8 -5
drivers/staging/gpib/common/ibsys.h
··· 22 22 int gpib_allocate_board(struct gpib_board *board); 23 23 void gpib_deallocate_board(struct gpib_board *board); 24 24 25 - unsigned int num_status_bytes(const gpib_status_queue_t *dev); 26 - int push_status_byte(struct gpib_board *board, gpib_status_queue_t *device, uint8_t poll_byte); 27 - int pop_status_byte(struct gpib_board *board, gpib_status_queue_t *device, uint8_t *poll_byte); 28 - gpib_status_queue_t *get_gpib_status_queue(struct gpib_board *board, unsigned int pad, int sad); 25 + unsigned int num_status_bytes(const struct gpib_status_queue *dev); 26 + int push_status_byte(struct gpib_board *board, struct gpib_status_queue *device, 27 + u8 poll_byte); 28 + int pop_status_byte(struct gpib_board *board, struct gpib_status_queue *device, 29 + u8 *poll_byte); 30 + struct gpib_status_queue *get_gpib_status_queue(struct gpib_board *board, 31 + unsigned int pad, int sad); 29 32 int get_serial_poll_byte(struct gpib_board *board, unsigned int pad, int sad, 30 - unsigned int usec_timeout, uint8_t *poll_byte); 33 + unsigned int usec_timeout, u8 *poll_byte); 31 34 int autopoll_all_devices(struct gpib_board *board);
+62 -45
drivers/staging/gpib/eastwood/fluke_gpib.c
··· 24 24 MODULE_LICENSE("GPL"); 25 25 MODULE_DESCRIPTION("GPIB Driver for Fluke cda devices"); 26 26 27 - static int fluke_attach_holdoff_all(struct gpib_board *board, const gpib_board_config_t *config); 28 - static int fluke_attach_holdoff_end(struct gpib_board *board, const gpib_board_config_t *config); 27 + static int fluke_attach_holdoff_all(struct gpib_board *board, 28 + const struct gpib_board_config *config); 29 + static int fluke_attach_holdoff_end(struct gpib_board *board, 30 + const struct gpib_board_config *config); 29 31 static void fluke_detach(struct gpib_board *board); 30 32 static int fluke_config_dma(struct gpib_board *board, int output); 31 33 static irqreturn_t fluke_gpib_internal_interrupt(struct gpib_board *board); 32 34 33 35 static struct platform_device *fluke_gpib_pdev; 34 36 35 - static uint8_t fluke_locking_read_byte(struct nec7210_priv *nec_priv, unsigned int register_number) 37 + static u8 fluke_locking_read_byte(struct nec7210_priv *nec_priv, unsigned int register_number) 36 38 { 37 39 u8 retval; 38 40 unsigned long flags; ··· 45 43 return retval; 46 44 } 47 45 48 - static void fluke_locking_write_byte(struct nec7210_priv *nec_priv, uint8_t byte, 46 + static void fluke_locking_write_byte(struct nec7210_priv *nec_priv, u8 byte, 49 47 unsigned int register_number) 50 48 { 51 49 unsigned long flags; ··· 56 54 } 57 55 58 56 // wrappers for interface functions 59 - static int fluke_read(struct gpib_board *board, uint8_t *buffer, size_t length, int *end, 57 + static int fluke_read(struct gpib_board *board, u8 *buffer, size_t length, int *end, 60 58 size_t *bytes_read) 61 59 { 62 60 struct fluke_priv *priv = board->private_data; ··· 64 62 return nec7210_read(board, &priv->nec7210_priv, buffer, length, end, bytes_read); 65 63 } 66 64 67 - static int fluke_write(struct gpib_board *board, uint8_t *buffer, size_t length, 65 + static int fluke_write(struct gpib_board *board, u8 *buffer, size_t length, 68 66 int send_eoi, size_t *bytes_written) 69 67 { 70 68 struct fluke_priv *priv = board->private_data; ··· 72 70 return nec7210_write(board, &priv->nec7210_priv, buffer, length, send_eoi, bytes_written); 73 71 } 74 72 75 - static int fluke_command(struct gpib_board *board, uint8_t *buffer, 73 + static int fluke_command(struct gpib_board *board, u8 *buffer, 76 74 size_t length, size_t *bytes_written) 77 75 { 78 76 struct fluke_priv *priv = board->private_data; ··· 94 92 return nec7210_go_to_standby(board, &priv->nec7210_priv); 95 93 } 96 94 97 - static void fluke_request_system_control(struct gpib_board *board, int request_control) 95 + static int fluke_request_system_control(struct gpib_board *board, int request_control) 98 96 { 99 97 struct fluke_priv *priv = board->private_data; 100 98 struct nec7210_priv *nec_priv = &priv->nec7210_priv; 101 99 102 - nec7210_request_system_control(board, nec_priv, request_control); 100 + return nec7210_request_system_control(board, nec_priv, request_control); 103 101 } 104 102 105 103 static void fluke_interface_clear(struct gpib_board *board, int assert) ··· 116 114 nec7210_remote_enable(board, &priv->nec7210_priv, enable); 117 115 } 118 116 119 - static int fluke_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits) 117 + static int fluke_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits) 120 118 { 121 119 struct fluke_priv *priv = board->private_data; 122 120 ··· 151 149 return nec7210_secondary_address(board, &priv->nec7210_priv, address, enable); 152 150 } 153 151 154 - static int fluke_parallel_poll(struct gpib_board *board, uint8_t *result) 152 + static int fluke_parallel_poll(struct gpib_board *board, u8 *result) 155 153 { 156 154 struct fluke_priv *priv = board->private_data; 157 155 158 156 return nec7210_parallel_poll(board, &priv->nec7210_priv, result); 159 157 } 160 158 161 - static void fluke_parallel_poll_configure(struct gpib_board *board, uint8_t configuration) 159 + static void fluke_parallel_poll_configure(struct gpib_board *board, u8 configuration) 162 160 { 163 161 struct fluke_priv *priv = board->private_data; 164 162 ··· 172 170 nec7210_parallel_poll_response(board, &priv->nec7210_priv, ist); 173 171 } 174 172 175 - static void fluke_serial_poll_response(struct gpib_board *board, uint8_t status) 173 + static void fluke_serial_poll_response(struct gpib_board *board, u8 status) 176 174 { 177 175 struct fluke_priv *priv = board->private_data; 178 176 179 177 nec7210_serial_poll_response(board, &priv->nec7210_priv, status); 180 178 } 181 179 182 - static uint8_t fluke_serial_poll_status(struct gpib_board *board) 180 + static u8 fluke_serial_poll_status(struct gpib_board *board) 183 181 { 184 182 struct fluke_priv *priv = board->private_data; 185 183 ··· 256 254 return retval; 257 255 } 258 256 259 - /* Wait until it is possible for a read to do something useful. This 257 + /* 258 + * Wait until it is possible for a read to do something useful. This 260 259 * is not essential, it only exists to prevent RFD holdoff from being released pointlessly. 261 260 */ 262 261 static int wait_for_read(struct gpib_board *board) ··· 279 276 return retval; 280 277 } 281 278 282 - /* Check if the SH state machine is in SGNS. We check twice since there is a very small chance 279 + /* 280 + * Check if the SH state machine is in SGNS. We check twice since there is a very small chance 283 281 * we could be blowing through SGNS from SIDS to SDYS if there is already a 284 282 * byte available in the handshake state machine. We are interested 285 283 * in the case where the handshake is stuck in SGNS due to no byte being ··· 314 310 (source_handshake_bits == SOURCE_HANDSHAKE_SIDS_BITS); 315 311 } 316 312 317 - /* Wait until the gpib chip is ready to accept a data out byte. 313 + /* 314 + * Wait until the gpib chip is ready to accept a data out byte. 318 315 * If the chip is SGNS it is probably waiting for a a byte to 319 316 * be written to it. 320 317 */ ··· 376 371 spin_unlock_irqrestore(&board->spinlock, flags); 377 372 } 378 373 379 - static int fluke_dma_write(struct gpib_board *board, uint8_t *buffer, size_t length, 374 + static int fluke_dma_write(struct gpib_board *board, u8 *buffer, size_t length, 380 375 size_t *bytes_written) 381 376 { 382 377 struct fluke_priv *e_priv = board->private_data; ··· 446 441 if (test_bit(DMA_WRITE_IN_PROGRESS_BN, &nec_priv->state)) 447 442 fluke_dma_callback(board); 448 443 449 - /* if everything went fine, try to wait until last byte is actually 444 + /* 445 + * if everything went fine, try to wait until last byte is actually 450 446 * transmitted across gpib (but don't try _too_ hard) 451 447 */ 452 448 if (retval == 0) ··· 462 456 return retval; 463 457 } 464 458 465 - static int fluke_accel_write(struct gpib_board *board, uint8_t *buffer, size_t length, 459 + static int fluke_accel_write(struct gpib_board *board, u8 *buffer, size_t length, 466 460 int send_eoi, size_t *bytes_written) 467 461 { 468 462 struct fluke_priv *e_priv = board->private_data; ··· 514 508 if (WARN_ON_ONCE(remainder != 1)) 515 509 return -EFAULT; 516 510 517 - /* wait until we are sure we will be able to write the data byte 511 + /* 512 + * wait until we are sure we will be able to write the data byte 518 513 * into the chip before we send AUX_SEOI. This prevents a timeout 519 514 * scenerio where we send AUX_SEOI but then timeout without getting 520 515 * any bytes into the gpib chip. This will result in the first byte ··· 546 539 return result; 547 540 } 548 541 dmaengine_tx_status(chan, cookie, &state); 549 - // hardware doesn't support resume, so dont call this 550 - // method unless the dma transfer is done. 542 + /* 543 + * hardware doesn't support resume, so dont call this 544 + * method unless the dma transfer is done. 545 + */ 551 546 return state.residue; 552 547 } 553 548 554 - static int fluke_dma_read(struct gpib_board *board, uint8_t *buffer, 549 + static int fluke_dma_read(struct gpib_board *board, u8 *buffer, 555 550 size_t length, int *end, size_t *bytes_read) 556 551 { 557 552 struct fluke_priv *e_priv = board->private_data; ··· 617 608 if (test_bit(DEV_CLEAR_BN, &nec_priv->state)) 618 609 retval = -EINTR; 619 610 620 - /* If we woke up because of end, wait until the dma transfer has pulled 611 + /* 612 + * If we woke up because of end, wait until the dma transfer has pulled 621 613 * the data byte associated with the end before we cancel the dma transfer. 622 614 */ 623 615 if (test_bit(RECEIVED_END_BN, &nec_priv->state)) { ··· 635 625 636 626 // stop the dma transfer 637 627 nec7210_set_reg_bits(nec_priv, IMR2, HR_DMAI, 0); 638 - /* delay a little just to make sure any bytes in dma controller's fifo get 628 + /* 629 + * delay a little just to make sure any bytes in dma controller's fifo get 639 630 * written to memory before we disable it 640 631 */ 641 632 usleep_range(10, 15); ··· 652 641 dma_unmap_single(board->dev, bus_address, length, DMA_FROM_DEVICE); 653 642 memcpy(buffer, e_priv->dma_buffer, *bytes_read); 654 643 655 - /* If we got an end interrupt, figure out if it was 644 + /* 645 + * If we got an end interrupt, figure out if it was 656 646 * associated with the last byte we dma'd or with a 657 647 * byte still sitting on the cb7210. 658 648 */ 659 649 spin_lock_irqsave(&board->spinlock, flags); 660 650 if (test_bit(READ_READY_BN, &nec_priv->state) == 0) { 661 - // There is no byte sitting on the cb7210. If we 662 - // saw an end interrupt, we need to deal with it now 651 + /* 652 + * There is no byte sitting on the cb7210. If we 653 + * saw an end interrupt, we need to deal with it now 654 + */ 663 655 if (test_and_clear_bit(RECEIVED_END_BN, &nec_priv->state)) 664 656 *end = 1; 665 657 } ··· 671 657 return retval; 672 658 } 673 659 674 - static int fluke_accel_read(struct gpib_board *board, uint8_t *buffer, size_t length, 660 + static int fluke_accel_read(struct gpib_board *board, u8 *buffer, size_t length, 675 661 int *end, size_t *bytes_read) 676 662 { 677 663 struct fluke_priv *e_priv = board->private_data; ··· 712 698 return retval; 713 699 } 714 700 715 - static gpib_interface_t fluke_unaccel_interface = { 701 + static struct gpib_interface fluke_unaccel_interface = { 716 702 .name = "fluke_unaccel", 717 703 .attach = fluke_attach_holdoff_all, 718 704 .detach = fluke_detach, ··· 739 725 .return_to_local = fluke_return_to_local, 740 726 }; 741 727 742 - /* fluke_hybrid uses dma for writes but not for reads. Added 728 + /* 729 + * fluke_hybrid uses dma for writes but not for reads. Added 743 730 * to deal with occasional corruption of bytes seen when doing dma 744 731 * reads. From looking at the cb7210 vhdl, I believe the corruption 745 732 * is due to a hardware bug triggered by the cpu reading a cb7210 ··· 748 733 * register just as the dma controller is also doing a read. 749 734 */ 750 735 751 - static gpib_interface_t fluke_hybrid_interface = { 736 + static struct gpib_interface fluke_hybrid_interface = { 752 737 .name = "fluke_hybrid", 753 738 .attach = fluke_attach_holdoff_all, 754 739 .detach = fluke_detach, ··· 775 760 .return_to_local = fluke_return_to_local, 776 761 }; 777 762 778 - static gpib_interface_t fluke_interface = { 763 + static struct gpib_interface fluke_interface = { 779 764 .name = "fluke", 780 765 .attach = fluke_attach_holdoff_end, 781 766 .detach = fluke_detach, ··· 817 802 status2 = read_byte(nec_priv, ISR2); 818 803 819 804 if (status0 & FLUKE_IFCI_BIT) { 820 - push_gpib_event(board, EventIFC); 805 + push_gpib_event(board, EVENT_IFC); 821 806 retval = IRQ_HANDLED; 822 807 } 823 808 ··· 929 914 930 915 nec7210_board_reset(nec_priv, board); 931 916 write_byte(nec_priv, AUX_LO_SPEED, AUXMR); 932 - /* set clock register for driving frequency 917 + /* 918 + * set clock register for driving frequency 933 919 * ICR should be set to clock in megahertz (1-15) and to zero 934 920 * for clocks faster than 15 MHz (max 20MHz) 935 921 */ ··· 949 933 return 0; 950 934 } 951 935 952 - /* This function is passed to dma_request_channel() in order to 936 + /* 937 + * This function is passed to dma_request_channel() in order to 953 938 * select the pl330 dma channel which has been hardwired to 954 939 * the gpib controller. 955 940 */ ··· 960 943 return chan->chan_id == 0; 961 944 } 962 945 963 - static int fluke_attach_impl(struct gpib_board *board, const gpib_board_config_t *config, 946 + static int fluke_attach_impl(struct gpib_board *board, const struct gpib_board_config *config, 964 947 unsigned int handshake_mode) 965 948 { 966 949 struct fluke_priv *e_priv; ··· 1041 1024 } 1042 1025 1043 1026 irq = platform_get_irq(fluke_gpib_pdev, 0); 1044 - if (irq < 0) { 1045 - dev_err(&fluke_gpib_pdev->dev, "failed to obtain IRQ\n"); 1027 + if (irq < 0) 1046 1028 return -EBUSY; 1047 - } 1048 1029 retval = request_irq(irq, fluke_gpib_interrupt, isr_flags, fluke_gpib_pdev->name, board); 1049 1030 if (retval) { 1050 1031 dev_err(&fluke_gpib_pdev->dev, ··· 1057 1042 e_priv->dma_channel = dma_request_channel(dma_cap, gpib_dma_channel_filter, NULL); 1058 1043 if (!e_priv->dma_channel) { 1059 1044 dev_err(board->gpib_dev, "failed to allocate a dma channel.\n"); 1060 - // we don't error out here because unaccel interface will still 1061 - // work without dma 1045 + /* 1046 + * we don't error out here because unaccel interface will still 1047 + * work without dma 1048 + */ 1062 1049 } 1063 1050 1064 1051 return fluke_init(e_priv, board, handshake_mode); 1065 1052 } 1066 1053 1067 - int fluke_attach_holdoff_all(struct gpib_board *board, const gpib_board_config_t *config) 1054 + int fluke_attach_holdoff_all(struct gpib_board *board, const struct gpib_board_config *config) 1068 1055 { 1069 1056 return fluke_attach_impl(board, config, HR_HLDA); 1070 1057 } 1071 1058 1072 - int fluke_attach_holdoff_end(struct gpib_board *board, const gpib_board_config_t *config) 1059 + int fluke_attach_holdoff_end(struct gpib_board *board, const struct gpib_board_config *config) 1073 1060 { 1074 1061 return fluke_attach_impl(board, config, HR_HLDE); 1075 1062 }
+16 -13
drivers/staging/gpib/eastwood/fluke_gpib.h
··· 55 55 SOURCE_HANDSHAKE_MASK = 0x7 56 56 }; 57 57 58 - // we customized the cb7210 vhdl to give the "data in" status 59 - // on the unused bit 7 of the address0 register. 58 + /* 59 + * we customized the cb7210 vhdl to give the "data in" status 60 + * on the unused bit 7 of the address0 register. 61 + */ 60 62 enum cb7210_address0 { 61 63 DATA_IN_STATUS = 0x80 62 64 }; ··· 69 67 } 70 68 71 69 // don't use without locking nec_priv->register_page_lock 72 - static inline uint8_t fluke_read_byte_nolock(struct nec7210_priv *nec_priv, 73 - int register_num) 70 + static inline u8 fluke_read_byte_nolock(struct nec7210_priv *nec_priv, 71 + int register_num) 74 72 { 75 73 u8 retval; 76 74 ··· 79 77 } 80 78 81 79 // don't use without locking nec_priv->register_page_lock 82 - static inline void fluke_write_byte_nolock(struct nec7210_priv *nec_priv, uint8_t data, 80 + static inline void fluke_write_byte_nolock(struct nec7210_priv *nec_priv, u8 data, 83 81 int register_num) 84 82 { 85 83 writel(data, nec_priv->mmiobase + register_num * nec_priv->offset); 86 84 } 87 85 88 - static inline uint8_t fluke_paged_read_byte(struct fluke_priv *e_priv, 89 - unsigned int register_num, unsigned int page) 86 + static inline u8 fluke_paged_read_byte(struct fluke_priv *e_priv, 87 + unsigned int register_num, unsigned int page) 90 88 { 91 89 struct nec7210_priv *nec_priv = &e_priv->nec7210_priv; 92 90 u8 retval; ··· 101 99 return retval; 102 100 } 103 101 104 - static inline void fluke_paged_write_byte(struct fluke_priv *e_priv, uint8_t data, 102 + static inline void fluke_paged_write_byte(struct fluke_priv *e_priv, u8 data, 105 103 unsigned int register_num, unsigned int page) 106 104 { 107 105 struct nec7210_priv *nec_priv = &e_priv->nec7210_priv; ··· 126 124 }; 127 125 128 126 enum cb7210_aux_cmds { 129 - /* AUX_RTL2 is an undocumented aux command which causes cb7210 to assert 130 - * (and keep asserted) local rtl message. This is used in conjunction 131 - * with the (stupid) cb7210 implementation 132 - * of the normal nec7210 AUX_RTL aux command, which 133 - * causes the rtl message to toggle between on and off. 127 + /* 128 + * AUX_RTL2 is an undocumented aux command which causes cb7210 to assert 129 + * (and keep asserted) local rtl message. This is used in conjunction 130 + * with the (stupid) cb7210 implementation 131 + * of the normal nec7210 AUX_RTL aux command, which 132 + * causes the rtl message to toggle between on and off. 134 133 */ 135 134 AUX_RTL2 = 0xd, 136 135 AUX_NBAF = 0xe, // new byte available false (also clears seoi)
+84 -60
drivers/staging/gpib/fmh_gpib/fmh_gpib.c
··· 32 32 MODULE_AUTHOR("Frank Mori Hess <fmh6jj@gmail.com>"); 33 33 34 34 static irqreturn_t fmh_gpib_interrupt(int irq, void *arg); 35 - static int fmh_gpib_attach_holdoff_all(struct gpib_board *board, const gpib_board_config_t *config); 36 - static int fmh_gpib_attach_holdoff_end(struct gpib_board *board, const gpib_board_config_t *config); 35 + static int fmh_gpib_attach_holdoff_all(struct gpib_board *board, 36 + const struct gpib_board_config *config); 37 + static int fmh_gpib_attach_holdoff_end(struct gpib_board *board, 38 + const struct gpib_board_config *config); 37 39 static void fmh_gpib_detach(struct gpib_board *board); 38 40 static int fmh_gpib_pci_attach_holdoff_all(struct gpib_board *board, 39 - const gpib_board_config_t *config); 41 + const struct gpib_board_config *config); 40 42 static int fmh_gpib_pci_attach_holdoff_end(struct gpib_board *board, 41 - const gpib_board_config_t *config); 43 + const struct gpib_board_config *config); 42 44 static void fmh_gpib_pci_detach(struct gpib_board *board); 43 45 static int fmh_gpib_config_dma(struct gpib_board *board, int output); 44 46 static irqreturn_t fmh_gpib_internal_interrupt(struct gpib_board *board); ··· 48 46 static struct pci_driver fmh_gpib_pci_driver; 49 47 50 48 // wrappers for interface functions 51 - static int fmh_gpib_read(struct gpib_board *board, uint8_t *buffer, size_t length, 49 + static int fmh_gpib_read(struct gpib_board *board, u8 *buffer, size_t length, 52 50 int *end, size_t *bytes_read) 53 51 { 54 52 struct fmh_priv *priv = board->private_data; ··· 56 54 return nec7210_read(board, &priv->nec7210_priv, buffer, length, end, bytes_read); 57 55 } 58 56 59 - static int fmh_gpib_write(struct gpib_board *board, uint8_t *buffer, size_t length, 57 + static int fmh_gpib_write(struct gpib_board *board, u8 *buffer, size_t length, 60 58 int send_eoi, size_t *bytes_written) 61 59 { 62 60 struct fmh_priv *priv = board->private_data; ··· 64 62 return nec7210_write(board, &priv->nec7210_priv, buffer, length, send_eoi, bytes_written); 65 63 } 66 64 67 - static int fmh_gpib_command(struct gpib_board *board, uint8_t *buffer, size_t length, 65 + static int fmh_gpib_command(struct gpib_board *board, u8 *buffer, size_t length, 68 66 size_t *bytes_written) 69 67 { 70 68 struct fmh_priv *priv = board->private_data; ··· 86 84 return nec7210_go_to_standby(board, &priv->nec7210_priv); 87 85 } 88 86 89 - static void fmh_gpib_request_system_control(struct gpib_board *board, int request_control) 87 + static int fmh_gpib_request_system_control(struct gpib_board *board, int request_control) 90 88 { 91 89 struct fmh_priv *priv = board->private_data; 92 90 struct nec7210_priv *nec_priv = &priv->nec7210_priv; 93 91 94 - nec7210_request_system_control(board, nec_priv, request_control); 92 + return nec7210_request_system_control(board, nec_priv, request_control); 95 93 } 96 94 97 95 static void fmh_gpib_interface_clear(struct gpib_board *board, int assert) ··· 108 106 nec7210_remote_enable(board, &priv->nec7210_priv, enable); 109 107 } 110 108 111 - static int fmh_gpib_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits) 109 + static int fmh_gpib_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits) 112 110 { 113 111 struct fmh_priv *priv = board->private_data; 114 112 ··· 143 141 return nec7210_secondary_address(board, &priv->nec7210_priv, address, enable); 144 142 } 145 143 146 - static int fmh_gpib_parallel_poll(struct gpib_board *board, uint8_t *result) 144 + static int fmh_gpib_parallel_poll(struct gpib_board *board, u8 *result) 147 145 { 148 146 struct fmh_priv *priv = board->private_data; 149 147 150 148 return nec7210_parallel_poll(board, &priv->nec7210_priv, result); 151 149 } 152 150 153 - static void fmh_gpib_parallel_poll_configure(struct gpib_board *board, uint8_t configuration) 151 + static void fmh_gpib_parallel_poll_configure(struct gpib_board *board, u8 configuration) 154 152 { 155 153 struct fmh_priv *priv = board->private_data; 156 154 ··· 171 169 if (local) { 172 170 write_byte(&priv->nec7210_priv, AUX_I_REG | LOCAL_PPOLL_MODE_BIT, AUXMR); 173 171 } else { 174 - /* For fmh_gpib_core, remote parallel poll config mode is unaffected by the 172 + /* 173 + * For fmh_gpib_core, remote parallel poll config mode is unaffected by the 175 174 * state of the disable bit of the parallel poll register (unlike the tnt4882). 176 175 * So, we don't need to worry about that. 177 176 */ ··· 180 177 } 181 178 } 182 179 183 - static void fmh_gpib_serial_poll_response2(struct gpib_board *board, uint8_t status, 180 + static void fmh_gpib_serial_poll_response2(struct gpib_board *board, u8 status, 184 181 int new_reason_for_service) 185 182 { 186 183 struct fmh_priv *priv = board->private_data; ··· 198 195 } 199 196 200 197 if (reqt) { 201 - /* It may seem like a race to issue reqt before updating 198 + /* 199 + * It may seem like a race to issue reqt before updating 202 200 * the status byte, but it is not. The chip does not 203 201 * issue the reqt until the SPMR is written to at 204 202 * a later time. ··· 208 204 } else if (reqf) { 209 205 write_byte(&priv->nec7210_priv, AUX_REQF, AUXMR); 210 206 } 211 - /* We need to always zero bit 6 of the status byte before writing it to 207 + /* 208 + * We need to always zero bit 6 of the status byte before writing it to 212 209 * the SPMR to insure we are using 213 210 * serial poll mode SP1, and not accidentally triggering mode SP3. 214 211 */ ··· 217 212 spin_unlock_irqrestore(&board->spinlock, flags); 218 213 } 219 214 220 - static uint8_t fmh_gpib_serial_poll_status(struct gpib_board *board) 215 + static u8 fmh_gpib_serial_poll_status(struct gpib_board *board) 221 216 { 222 217 struct fmh_priv *priv = board->private_data; 223 218 ··· 338 333 return retval; 339 334 } 340 335 341 - /* Wait until the gpib chip is ready to accept a data out byte. 336 + /* 337 + * Wait until the gpib chip is ready to accept a data out byte. 342 338 */ 343 339 static int wait_for_data_out_ready(struct gpib_board *board) 344 340 { ··· 383 377 spin_unlock_irqrestore(&board->spinlock, flags); 384 378 } 385 379 386 - /* returns true when all the bytes of a write have been transferred to 380 + /* 381 + * returns true when all the bytes of a write have been transferred to 387 382 * the chip and successfully transferred out over the gpib bus. 388 383 */ 389 384 static int fmh_gpib_all_bytes_are_sent(struct fmh_priv *e_priv) ··· 398 391 return 1; 399 392 } 400 393 401 - static int fmh_gpib_dma_write(struct gpib_board *board, uint8_t *buffer, size_t length, 394 + static int fmh_gpib_dma_write(struct gpib_board *board, u8 *buffer, size_t length, 402 395 size_t *bytes_written) 403 396 { 404 397 struct fmh_priv *e_priv = board->private_data; ··· 476 469 return retval; 477 470 } 478 471 479 - static int fmh_gpib_accel_write(struct gpib_board *board, uint8_t *buffer, 472 + static int fmh_gpib_accel_write(struct gpib_board *board, u8 *buffer, 480 473 size_t length, int send_eoi, size_t *bytes_written) 481 474 { 482 475 struct fmh_priv *e_priv = board->private_data; ··· 530 523 if (WARN_ON_ONCE(remainder != 1)) 531 524 return -EFAULT; 532 525 533 - /* wait until we are sure we will be able to write the data byte 526 + /* 527 + * wait until we are sure we will be able to write the data byte 534 528 * into the chip before we send AUX_SEOI. This prevents a timeout 535 529 * scenario where we send AUX_SEOI but then timeout without getting 536 530 * any bytes into the gpib chip. This will result in the first byte ··· 562 554 return result; 563 555 } 564 556 dmaengine_tx_status(chan, cookie, &state); 565 - // dma330 hardware doesn't support resume, so dont call this 566 - // method unless the dma transfer is done. 557 + /* 558 + * dma330 hardware doesn't support resume, so dont call this 559 + * method unless the dma transfer is done. 560 + */ 567 561 return state.residue; 568 562 } 569 563 ··· 591 581 return retval; 592 582 } 593 583 594 - /* supports writing a chunk of data whose length must fit into the hardware'd xfer counter, 584 + /* 585 + * supports writing a chunk of data whose length must fit into the hardware'd xfer counter, 595 586 * called in a loop by fmh_gpib_fifo_write() 596 587 */ 597 - static int fmh_gpib_fifo_write_countable(struct gpib_board *board, uint8_t *buffer, 588 + static int fmh_gpib_fifo_write_countable(struct gpib_board *board, u8 *buffer, 598 589 size_t length, int send_eoi, size_t *bytes_written) 599 590 { 600 591 struct fmh_priv *e_priv = board->private_data; ··· 661 650 return retval; 662 651 } 663 652 664 - static int fmh_gpib_fifo_write(struct gpib_board *board, uint8_t *buffer, size_t length, 653 + static int fmh_gpib_fifo_write(struct gpib_board *board, u8 *buffer, size_t length, 665 654 int send_eoi, size_t *bytes_written) 666 655 { 667 656 struct fmh_priv *e_priv = board->private_data; ··· 708 697 return retval; 709 698 } 710 699 711 - static int fmh_gpib_dma_read(struct gpib_board *board, uint8_t *buffer, 700 + static int fmh_gpib_dma_read(struct gpib_board *board, u8 *buffer, 712 701 size_t length, int *end, size_t *bytes_read) 713 702 { 714 703 struct fmh_priv *e_priv = board->private_data; ··· 779 768 // stop the dma transfer 780 769 nec7210_set_reg_bits(nec_priv, IMR2, HR_DMAI, 0); 781 770 fifos_write(e_priv, 0, FIFO_CONTROL_STATUS_REG); 782 - // give time for pl330 to transfer any in-flight data, since 783 - // pl330 will throw it away when dmaengine_pause is called. 771 + /* 772 + * give time for pl330 to transfer any in-flight data, since 773 + * pl330 will throw it away when dmaengine_pause is called. 774 + */ 784 775 usleep_range(10, 15); 785 776 residue = fmh_gpib_get_dma_residue(e_priv->dma_channel, dma_cookie); 786 777 if (WARN_ON_ONCE(residue > length || residue < 0)) ··· 806 793 buffer[(*bytes_read)++] = fifos_read(e_priv, FIFO_DATA_REG) & fifo_data_mask; 807 794 } 808 795 809 - /* If we got an end interrupt, figure out if it was 796 + /* 797 + * If we got an end interrupt, figure out if it was 810 798 * associated with the last byte we dma'd or with a 811 799 * byte still sitting on the cb7210. 812 800 */ 813 801 spin_lock_irqsave(&board->spinlock, flags); 814 802 if (*bytes_read > 0 && test_bit(READ_READY_BN, &nec_priv->state) == 0) { 815 - // If there is no byte sitting on the cb7210 and we 816 - // saw an end, we need to deal with it now 803 + /* 804 + * If there is no byte sitting on the cb7210 and we 805 + * saw an end, we need to deal with it now 806 + */ 817 807 if (test_and_clear_bit(RECEIVED_END_BN, &nec_priv->state)) 818 808 *end = 1; 819 809 } ··· 835 819 836 820 ext_status_1 = read_byte(nec_priv, EXT_STATUS_1_REG); 837 821 838 - /* if there is an end byte sitting on the chip, don't release 822 + /* 823 + * if there is an end byte sitting on the chip, don't release 839 824 * holdoff. We want it left set after we read out the end 840 825 * byte. 841 826 */ ··· 845 828 if (ext_status_1 & RFD_HOLDOFF_STATUS_BIT) 846 829 write_byte(nec_priv, AUX_FH, AUXMR); 847 830 848 - /* Check if an end byte raced in before we executed the AUX_FH command. 831 + /* 832 + * Check if an end byte raced in before we executed the AUX_FH command. 849 833 * If it did, we want to make sure the rfd holdoff is in effect. The end 850 834 * byte can arrive since 851 835 * AUX_RFD_HOLDOFF_ASAP doesn't immediately force the acceptor handshake ··· 864 846 spin_unlock_irqrestore(&board->spinlock, flags); 865 847 } 866 848 867 - static int fmh_gpib_accel_read(struct gpib_board *board, uint8_t *buffer, size_t length, 849 + static int fmh_gpib_accel_read(struct gpib_board *board, u8 *buffer, size_t length, 868 850 int *end, size_t *bytes_read) 869 851 { 870 852 struct fmh_priv *e_priv = board->private_data; ··· 911 893 return retval; 912 894 } 913 895 914 - /* Read a chunk of data whose length is within the limits of the hardware's 896 + /* 897 + * Read a chunk of data whose length is within the limits of the hardware's 915 898 * xfer counter. Called in a loop from fmh_gpib_fifo_read(). 916 899 */ 917 - static int fmh_gpib_fifo_read_countable(struct gpib_board *board, uint8_t *buffer, 900 + static int fmh_gpib_fifo_read_countable(struct gpib_board *board, u8 *buffer, 918 901 size_t length, int *end, size_t *bytes_read) 919 902 { 920 903 struct fmh_priv *e_priv = board->private_data; ··· 973 954 return retval; 974 955 } 975 956 976 - static int fmh_gpib_fifo_read(struct gpib_board *board, uint8_t *buffer, size_t length, 957 + static int fmh_gpib_fifo_read(struct gpib_board *board, u8 *buffer, size_t length, 977 958 int *end, size_t *bytes_read) 978 959 { 979 960 struct fmh_priv *e_priv = board->private_data; ··· 988 969 *end = 0; 989 970 *bytes_read = 0; 990 971 991 - /* Do a little prep with data in interrupt so that following wait_for_read() 972 + /* 973 + * Do a little prep with data in interrupt so that following wait_for_read() 992 974 * will wake up if a data byte is received. 993 975 */ 994 976 nec7210_set_reg_bits(nec_priv, IMR1, HR_DIIE, HR_DIIE); ··· 1031 1011 return retval; 1032 1012 } 1033 1013 1034 - static gpib_interface_t fmh_gpib_unaccel_interface = { 1014 + static struct gpib_interface fmh_gpib_unaccel_interface = { 1035 1015 .name = "fmh_gpib_unaccel", 1036 1016 .attach = fmh_gpib_attach_holdoff_all, 1037 1017 .detach = fmh_gpib_detach, ··· 1059 1039 .return_to_local = fmh_gpib_return_to_local, 1060 1040 }; 1061 1041 1062 - static gpib_interface_t fmh_gpib_interface = { 1042 + static struct gpib_interface fmh_gpib_interface = { 1063 1043 .name = "fmh_gpib", 1064 1044 .attach = fmh_gpib_attach_holdoff_end, 1065 1045 .detach = fmh_gpib_detach, ··· 1087 1067 .return_to_local = fmh_gpib_return_to_local, 1088 1068 }; 1089 1069 1090 - static gpib_interface_t fmh_gpib_pci_interface = { 1070 + static struct gpib_interface fmh_gpib_pci_interface = { 1091 1071 .name = "fmh_gpib_pci", 1092 1072 .attach = fmh_gpib_pci_attach_holdoff_end, 1093 1073 .detach = fmh_gpib_pci_detach, ··· 1115 1095 .return_to_local = fmh_gpib_return_to_local, 1116 1096 }; 1117 1097 1118 - static gpib_interface_t fmh_gpib_pci_unaccel_interface = { 1098 + static struct gpib_interface fmh_gpib_pci_unaccel_interface = { 1119 1099 .name = "fmh_gpib_pci_unaccel", 1120 1100 .attach = fmh_gpib_pci_attach_holdoff_all, 1121 1101 .detach = fmh_gpib_pci_detach, ··· 1156 1136 fifo_status = fifos_read(priv, FIFO_CONTROL_STATUS_REG); 1157 1137 1158 1138 if (status0 & IFC_INTERRUPT_BIT) { 1159 - push_gpib_event(board, EventIFC); 1139 + push_gpib_event(board, EVENT_IFC); 1160 1140 retval = IRQ_HANDLED; 1161 1141 } 1162 1142 ··· 1186 1166 clear_bit(RFD_HOLDOFF_BN, &nec_priv->state); 1187 1167 1188 1168 if (ext_status_1 & END_STATUS_BIT) { 1189 - /* only set RECEIVED_END while there is still a data 1169 + /* 1170 + * only set RECEIVED_END while there is still a data 1190 1171 * byte sitting in the chip, to avoid spuriously 1191 1172 * setting it multiple times after it has been cleared 1192 1173 * during a read. ··· 1200 1179 1201 1180 if ((fifo_status & TX_FIFO_HALF_EMPTY_INTERRUPT_IS_ENABLED) && 1202 1181 (fifo_status & TX_FIFO_HALF_EMPTY)) { 1203 - /* We really only want to clear the 1182 + /* 1183 + * We really only want to clear the 1204 1184 * TX_FIFO_HALF_EMPTY_INTERRUPT_ENABLE bit in the 1205 1185 * FIFO_CONTROL_STATUS_REG. Since we are not being 1206 1186 * careful, this also has a side effect of disabling ··· 1215 1193 1216 1194 if ((fifo_status & RX_FIFO_HALF_FULL_INTERRUPT_IS_ENABLED) && 1217 1195 (fifo_status & RX_FIFO_HALF_FULL)) { 1218 - /* We really only want to clear the 1196 + /* 1197 + * We really only want to clear the 1219 1198 * RX_FIFO_HALF_FULL_INTERRUPT_ENABLE bit in the 1220 1199 * FIFO_CONTROL_STATUS_REG. Since we are not being 1221 1200 * careful, this also has a side effect of disabling ··· 1358 1335 /* Match callback for driver_find_device */ 1359 1336 static int fmh_gpib_device_match(struct device *dev, const void *data) 1360 1337 { 1361 - const gpib_board_config_t *config = data; 1338 + const struct gpib_board_config *config = data; 1362 1339 1363 1340 if (dev_get_drvdata(dev)) 1364 1341 return 0; ··· 1374 1351 return 1; 1375 1352 } 1376 1353 1377 - static int fmh_gpib_attach_impl(struct gpib_board *board, const gpib_board_config_t *config, 1354 + static int fmh_gpib_attach_impl(struct gpib_board *board, const struct gpib_board_config *config, 1378 1355 unsigned int handshake_mode, int acquire_dma) 1379 1356 { 1380 1357 struct fmh_priv *e_priv; ··· 1447 1424 (unsigned long)resource_size(e_priv->dma_port_res)); 1448 1425 1449 1426 irq = platform_get_irq(pdev, 0); 1450 - if (irq < 0) { 1451 - dev_err(board->dev, "request for IRQ failed\n"); 1427 + if (irq < 0) 1452 1428 return -EBUSY; 1453 - } 1454 1429 retval = request_irq(irq, fmh_gpib_interrupt, IRQF_SHARED, pdev->name, board); 1455 1430 if (retval) { 1456 1431 dev_err(board->dev, ··· 1465 1444 return -EIO; 1466 1445 } 1467 1446 } 1468 - /* in the future we might want to know the half-fifo size 1447 + /* 1448 + * in the future we might want to know the half-fifo size 1469 1449 * (dma_burst_length) even when not using dma, so go ahead an 1470 1450 * initialize it unconditionally. 1471 1451 */ ··· 1476 1454 return fmh_gpib_init(e_priv, board, handshake_mode); 1477 1455 } 1478 1456 1479 - int fmh_gpib_attach_holdoff_all(struct gpib_board *board, const gpib_board_config_t *config) 1457 + int fmh_gpib_attach_holdoff_all(struct gpib_board *board, const struct gpib_board_config *config) 1480 1458 { 1481 1459 return fmh_gpib_attach_impl(board, config, HR_HLDA, 0); 1482 1460 } 1483 1461 1484 - int fmh_gpib_attach_holdoff_end(struct gpib_board *board, const gpib_board_config_t *config) 1462 + int fmh_gpib_attach_holdoff_end(struct gpib_board *board, const struct gpib_board_config *config) 1485 1463 { 1486 1464 return fmh_gpib_attach_impl(board, config, HR_HLDE, 1); 1487 1465 } ··· 1519 1497 fmh_gpib_generic_detach(board); 1520 1498 } 1521 1499 1522 - static int fmh_gpib_pci_attach_impl(struct gpib_board *board, const gpib_board_config_t *config, 1500 + static int fmh_gpib_pci_attach_impl(struct gpib_board *board, 1501 + const struct gpib_board_config *config, 1523 1502 unsigned int handshake_mode) 1524 1503 { 1525 1504 struct fmh_priv *e_priv; ··· 1593 1570 return fmh_gpib_init(e_priv, board, handshake_mode); 1594 1571 } 1595 1572 1596 - int fmh_gpib_pci_attach_holdoff_all(struct gpib_board *board, const gpib_board_config_t *config) 1573 + int fmh_gpib_pci_attach_holdoff_all(struct gpib_board *board, 1574 + const struct gpib_board_config *config) 1597 1575 { 1598 1576 return fmh_gpib_pci_attach_impl(board, config, HR_HLDA); 1599 1577 } 1600 1578 1601 - int fmh_gpib_pci_attach_holdoff_end(struct gpib_board *board, const gpib_board_config_t *config) 1579 + int fmh_gpib_pci_attach_holdoff_end(struct gpib_board *board, 1580 + const struct gpib_board_config *config) 1602 1581 { 1603 1582 int retval; 1604 1583 struct fmh_priv *e_priv; ··· 1656 1631 static struct platform_driver fmh_gpib_platform_driver = { 1657 1632 .driver = { 1658 1633 .name = DRV_NAME, 1659 - .owner = THIS_MODULE, 1660 1634 .of_match_table = fmh_gpib_of_match, 1661 1635 }, 1662 1636 .probe = &fmh_gpib_platform_probe
+3 -3
drivers/staging/gpib/fmh_gpib/fmh_gpib.h
··· 124 124 static const unsigned int fifo_xfer_counter_mask = 0x0fff; 125 125 static const unsigned int fifo_max_burst_length_mask = 0x00ff; 126 126 127 - static inline uint8_t gpib_cs_read_byte(struct nec7210_priv *nec_priv, 128 - unsigned int register_num) 127 + static inline u8 gpib_cs_read_byte(struct nec7210_priv *nec_priv, 128 + unsigned int register_num) 129 129 { 130 130 return readb(nec_priv->mmiobase + register_num * nec_priv->offset); 131 131 } 132 132 133 - static inline void gpib_cs_write_byte(struct nec7210_priv *nec_priv, uint8_t data, 133 + static inline void gpib_cs_write_byte(struct nec7210_priv *nec_priv, u8 data, 134 134 unsigned int register_num) 135 135 { 136 136 writeb(data, nec_priv->mmiobase + register_num * nec_priv->offset);
+70 -72
drivers/staging/gpib/gpio/gpib_bitbang.c
··· 32 32 #define ENABLE_IRQ(IRQ, TYPE) irq_set_irq_type(IRQ, TYPE) 33 33 #define DISABLE_IRQ(IRQ) irq_set_irq_type(IRQ, IRQ_TYPE_NONE) 34 34 35 - /* Debug print levels: 35 + /* 36 + * Debug print levels: 36 37 * 0 = load/unload info and errors that make the driver fail; 37 38 * 1 = + warnings for unforeseen events that may break the current 38 39 * operation and lead to a timeout, but do not affect the ··· 66 65 #include <linux/gpio/machine.h> 67 66 #include <linux/gpio.h> 68 67 #include <linux/irq.h> 69 - #include <linux/leds.h> 70 68 71 69 static int sn7516x_used = 1, sn7516x; 72 70 module_param(sn7516x_used, int, 0660); ··· 135 135 #define SN7516X_PINS 4 136 136 #define NUM_PINS (GPIB_PINS + SN7516X_PINS) 137 137 138 - DEFINE_LED_TRIGGER(ledtrig_gpib); 139 - #define ACT_LED_ON do { \ 138 + #define ACT_LED_ON do { \ 140 139 if (ACT_LED) \ 141 - gpiod_direction_output(ACT_LED, 1); \ 142 - else \ 143 - led_trigger_event(ledtrig_gpib, LED_FULL); } \ 144 - while (0) 145 - #define ACT_LED_OFF do { \ 140 + gpiod_direction_output(ACT_LED, 1); \ 141 + } while (0) 142 + #define ACT_LED_OFF do { \ 146 143 if (ACT_LED) \ 147 - gpiod_direction_output(ACT_LED, 0); \ 148 - else \ 149 - led_trigger_event(ledtrig_gpib, LED_OFF); } \ 150 - while (0) 144 + gpiod_direction_output(ACT_LED, 0); \ 145 + } while (0) 151 146 152 147 static struct gpio_desc *all_descriptors[GPIB_PINS + SN7516X_PINS]; 153 148 ··· 306 311 int dav_seq; 307 312 long all_irqs; 308 313 int dav_idle; 309 - int atn_asserted; 310 314 311 315 enum talker_function_state talker_state; 312 316 enum listener_function_state listener_state; ··· 318 324 static u8 get_data_lines(void); 319 325 static void set_data_lines_input(void); 320 326 static void set_data_lines_output(void); 321 - static inline int check_for_eos(struct bb_priv *priv, uint8_t byte); 327 + static inline int check_for_eos(struct bb_priv *priv, u8 byte); 322 328 static void set_atn(struct gpib_board *board, int atn_asserted); 323 329 324 330 static inline void SET_DIR_WRITE(struct bb_priv *priv); ··· 347 353 * * 348 354 ***************************************************************************/ 349 355 350 - static int bb_read(struct gpib_board *board, uint8_t *buffer, size_t length, 356 + static int bb_read(struct gpib_board *board, u8 *buffer, size_t length, 351 357 int *end, size_t *bytes_read) 352 358 { 353 359 struct bb_priv *priv = board->private_data; ··· 485 491 * * 486 492 ***************************************************************************/ 487 493 488 - static int bb_write(struct gpib_board *board, uint8_t *buffer, size_t length, 494 + static int bb_write(struct gpib_board *board, u8 *buffer, size_t length, 489 495 int send_eoi, size_t *bytes_written) 490 496 { 491 497 unsigned long flags; ··· 516 522 gpiod_get_value(NRFD), gpiod_get_value(NDAC)); 517 523 518 524 if (gpiod_get_value(NRFD) && gpiod_get_value(NDAC)) { /* check for listener */ 519 - retval = -ENODEV; 525 + retval = -ENOTCONN; 520 526 goto write_end; 521 527 } 522 528 ··· 613 619 goto nrfd_exit; 614 620 } 615 621 616 - if (priv->atn_asserted && priv->w_cnt >= priv->length) { // test for end of transfer 622 + if (priv->w_cnt >= priv->length) { // test for missed NDAC end of transfer 623 + dev_err(board->gpib_dev, "Unexpected NRFD exit\n"); 617 624 priv->write_done = 1; 618 625 priv->w_busy = 0; 619 626 wake_up_interruptible(&board->wait); ··· 686 691 687 692 dbg_printk(3, "accepted %zu\n", priv->w_cnt - 1); 688 693 689 - if (!priv->atn_asserted && priv->w_cnt >= priv->length) { // test for end of transfer 694 + gpiod_set_value(DAV, 1); // Data not available 695 + priv->dav_tx = 1; 696 + priv->phase = 510; 697 + 698 + if (priv->w_cnt >= priv->length) { // test for end of transfer 690 699 priv->write_done = 1; 691 700 priv->w_busy = 0; 692 701 wake_up_interruptible(&board->wait); 693 - } else { 694 - gpiod_set_value(DAV, 1); // Data not available 695 - priv->dav_tx = 1; 696 - priv->phase = 510; 697 702 } 698 703 699 704 ndac_exit: ··· 723 728 return IRQ_HANDLED; 724 729 } 725 730 726 - static int bb_command(struct gpib_board *board, uint8_t *buffer, 731 + static int bb_command(struct gpib_board *board, u8 *buffer, 727 732 size_t length, size_t *bytes_written) 728 733 { 729 734 size_t ret; ··· 850 855 priv->listener_state = listener_addressed; 851 856 if (priv->talker_state == talker_active) 852 857 priv->talker_state = talker_addressed; 858 + SET_DIR_WRITE(priv); // need to be able to read bus NRFD/NDAC 853 859 } else { 854 860 if (priv->listener_state == listener_addressed) { 855 861 priv->listener_state = listener_active; ··· 860 864 priv->talker_state = talker_active; 861 865 } 862 866 gpiod_direction_output(_ATN, !atn_asserted); 863 - priv->atn_asserted = atn_asserted; 864 867 } 865 868 866 869 static int bb_take_control(struct gpib_board *board, int synchronous) 867 870 { 868 871 dbg_printk(2, "%d\n", synchronous); 869 872 set_atn(board, 1); 870 - set_bit(CIC_NUM, &board->status); 871 873 return 0; 872 874 } 873 875 ··· 876 882 return 0; 877 883 } 878 884 879 - static void bb_request_system_control(struct gpib_board *board, int request_control) 885 + static int bb_request_system_control(struct gpib_board *board, int request_control) 880 886 { 887 + struct bb_priv *priv = board->private_data; 888 + 881 889 dbg_printk(2, "%d\n", request_control); 882 - if (request_control) { 883 - set_bit(CIC_NUM, &board->status); 884 - // drive DAV & EOI false, enable NRFD & NDAC irqs 885 - SET_DIR_WRITE(board->private_data); 886 - } else { 887 - clear_bit(CIC_NUM, &board->status); 888 - } 890 + if (!request_control) 891 + return -EINVAL; 892 + 893 + gpiod_direction_output(REN, 1); /* user space must enable REN if needed */ 894 + gpiod_direction_output(IFC, 1); /* user space must toggle IFC if needed */ 895 + if (sn7516x) 896 + gpiod_direction_output(DC, 0); /* enable ATN as output on SN75161/2 */ 897 + 898 + gpiod_direction_input(SRQ); 899 + 900 + ENABLE_IRQ(priv->irq_SRQ, IRQ_TYPE_EDGE_FALLING); 901 + 902 + return 0; 889 903 } 890 904 891 905 static void bb_interface_clear(struct gpib_board *board, int assert) ··· 905 903 gpiod_direction_output(IFC, 0); 906 904 priv->talker_state = talker_idle; 907 905 priv->listener_state = listener_idle; 906 + set_bit(CIC_NUM, &board->status); 908 907 } else { 909 908 gpiod_direction_output(IFC, 1); 910 909 } ··· 923 920 } 924 921 } 925 922 926 - static int bb_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits) 923 + static int bb_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits) 927 924 { 928 925 struct bb_priv *priv = board->private_data; 929 926 ··· 990 987 return 0; 991 988 } 992 989 993 - static int bb_parallel_poll(struct gpib_board *board, uint8_t *result) 990 + static int bb_parallel_poll(struct gpib_board *board, u8 *result) 994 991 { 995 992 return -ENOENT; 996 993 } 997 994 998 - static void bb_parallel_poll_configure(struct gpib_board *board, uint8_t config) 995 + static void bb_parallel_poll_configure(struct gpib_board *board, u8 config) 999 996 { 1000 997 } 1001 998 ··· 1003 1000 { 1004 1001 } 1005 1002 1006 - static void bb_serial_poll_response(struct gpib_board *board, uint8_t status) 1003 + static void bb_serial_poll_response(struct gpib_board *board, u8 status) 1007 1004 { 1008 1005 } 1009 1006 1010 - static uint8_t bb_serial_poll_status(struct gpib_board *board) 1007 + static u8 bb_serial_poll_status(struct gpib_board *board) 1011 1008 { 1012 1009 return 0; // -ENOENT; 1013 1010 } ··· 1123 1120 1124 1121 static int allocate_gpios(struct gpib_board *board) 1125 1122 { 1126 - int j, retval = 0; 1127 - bool error = false; 1123 + int j; 1128 1124 int table_index = 0; 1129 1125 char name[256]; 1130 1126 struct gpio_desc *desc; ··· 1134 1132 return -ENOENT; 1135 1133 } 1136 1134 1137 - lookup_table = lookup_tables[0]; 1138 - lookup_table->dev_id = dev_name(board->gpib_dev); 1135 + lookup_table = lookup_tables[table_index]; 1136 + lookup_table->dev_id = dev_name(board->gpib_dev); 1139 1137 gpiod_add_lookup_table(lookup_table); 1140 1138 dbg_printk(1, "Allocating gpios using table index %d\n", table_index); 1141 1139 ··· 1152 1150 gpiod_remove_lookup_table(lookup_table); 1153 1151 table_index++; 1154 1152 lookup_table = lookup_tables[table_index]; 1155 - if (lookup_table) { 1156 - dbg_printk(1, "Allocation failed, now using table_index %d\n", 1157 - table_index); 1158 - lookup_table->dev_id = dev_name(board->gpib_dev); 1159 - gpiod_add_lookup_table(lookup_table); 1160 - goto try_again; 1153 + if (!lookup_table) { 1154 + dev_err(board->gpib_dev, "Unable to obtain gpio descriptor for pin %d error %ld\n", 1155 + gpios_vector[j], PTR_ERR(desc)); 1156 + goto alloc_gpios_fail; 1161 1157 } 1162 - dev_err(board->gpib_dev, "Unable to obtain gpio descriptor for pin %d error %ld\n", 1163 - gpios_vector[j], PTR_ERR(desc)); 1164 - error = true; 1165 - break; 1158 + dbg_printk(1, "Allocation failed, now using table_index %d\n", table_index); 1159 + lookup_table->dev_id = dev_name(board->gpib_dev); 1160 + gpiod_add_lookup_table(lookup_table); 1161 + goto try_again; 1166 1162 } 1167 1163 all_descriptors[j] = desc; 1168 1164 } 1169 1165 1170 - if (error) { /* undo what already done */ 1171 - release_gpios(); 1172 - retval = -1; 1173 - } 1174 - if (lookup_table) 1175 - gpiod_remove_lookup_table(lookup_table); 1176 - // Initialize LED trigger 1177 - led_trigger_register_simple("gpib", &ledtrig_gpib); 1178 - return retval; 1166 + gpiod_remove_lookup_table(lookup_table); 1167 + 1168 + return 0; 1169 + 1170 + alloc_gpios_fail: 1171 + release_gpios(); 1172 + return -1; 1179 1173 } 1180 1174 1181 1175 static void bb_detach(struct gpib_board *board) ··· 1181 1183 dbg_printk(2, "Enter with data %p\n", board->private_data); 1182 1184 if (!board->private_data) 1183 1185 return; 1184 - 1185 - led_trigger_unregister_simple(ledtrig_gpib); 1186 1186 1187 1187 bb_free_irq(board, &priv->irq_DAV, NAME "_DAV"); 1188 1188 bb_free_irq(board, &priv->irq_NRFD, NAME "_NRFD"); ··· 1202 1206 free_private(board); 1203 1207 } 1204 1208 1205 - static int bb_attach(struct gpib_board *board, const gpib_board_config_t *config) 1209 + static int bb_attach(struct gpib_board *board, const struct gpib_board_config *config) 1206 1210 { 1207 1211 struct bb_priv *priv; 1208 1212 int retval = 0; ··· 1241 1245 gpios_vector[&(D06) - &all_descriptors[0]] = YOGA_D06_pin_nr; 1242 1246 gpios_vector[&(PE) - &all_descriptors[0]] = -1; 1243 1247 gpios_vector[&(DC) - &all_descriptors[0]] = -1; 1244 - gpios_vector[&(ACT_LED) - &all_descriptors[0]] = -1; 1245 1248 } else { 1246 1249 dev_err(board->gpib_dev, "Unrecognized pin map %s\n", pin_map); 1247 1250 goto bb_attach_fail; ··· 1251 1256 if (allocate_gpios(board)) 1252 1257 goto bb_attach_fail; 1253 1258 1254 - /* Configure SN7516X control lines. 1259 + /* 1260 + * Configure SN7516X control lines. 1255 1261 * drive ATN, IFC and REN as outputs only when master 1256 1262 * i.e. system controller. In this mode can only be the CIC 1257 1263 * When not master then enable device mode ATN, IFC & REN as inputs ··· 1262 1266 gpiod_direction_output(TE, 1); 1263 1267 gpiod_direction_output(PE, 1); 1264 1268 } 1269 + /* Set main control lines to a known state */ 1270 + gpiod_direction_output(IFC, 1); 1271 + gpiod_direction_output(REN, 1); 1272 + gpiod_direction_output(_ATN, 1); 1265 1273 1266 1274 if (strcmp(PINMAP_2, pin_map) == 0) { /* YOGA: enable level shifters */ 1267 1275 gpiod_direction_output(YOGA_ENABLE, 1); ··· 1293 1293 IRQF_TRIGGER_NONE)) 1294 1294 goto bb_attach_fail_r; 1295 1295 1296 - ENABLE_IRQ(priv->irq_SRQ, IRQ_TYPE_EDGE_FALLING); 1297 - 1298 1296 dbg_printk(0, "attached board %d\n", board->minor); 1299 1297 goto bb_attach_out; 1300 1298 ··· 1304 1306 return retval; 1305 1307 } 1306 1308 1307 - static gpib_interface_t bb_interface = { 1309 + static struct gpib_interface bb_interface = { 1308 1310 .name = NAME, 1309 1311 .attach = bb_attach, 1310 1312 .detach = bb_detach, ··· 1362 1364 (a->tv_nsec - b->tv_nsec) / 1000); 1363 1365 } 1364 1366 1365 - static inline int check_for_eos(struct bb_priv *priv, uint8_t byte) 1367 + static inline int check_for_eos(struct bb_priv *priv, u8 byte) 1366 1368 { 1367 1369 if (priv->eos_check) 1368 1370 return 0;
+18 -17
drivers/staging/gpib/hp_82335/hp82335.c
··· 4 4 * copyright : (C) 2002 by Frank Mori Hess * 5 5 ***************************************************************************/ 6 6 7 - /*should enable ATN interrupts (and update board->status on occurrence), 8 - * implement recovery from bus errors (if necessary) 7 + /* 8 + * should enable ATN interrupts (and update board->status on occurrence), 9 + * implement recovery from bus errors (if necessary) 9 10 */ 10 11 11 12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ··· 25 24 MODULE_LICENSE("GPL"); 26 25 MODULE_DESCRIPTION("GPIB driver for HP 82335 interface cards"); 27 26 28 - static int hp82335_attach(struct gpib_board *board, const gpib_board_config_t *config); 27 + static int hp82335_attach(struct gpib_board *board, const struct gpib_board_config *config); 29 28 static void hp82335_detach(struct gpib_board *board); 30 29 static irqreturn_t hp82335_interrupt(int irq, void *arg); 31 30 32 31 // wrappers for interface functions 33 - static int hp82335_read(struct gpib_board *board, uint8_t *buffer, size_t length, 32 + static int hp82335_read(struct gpib_board *board, u8 *buffer, size_t length, 34 33 int *end, size_t *bytes_read) 35 34 { 36 35 struct hp82335_priv *priv = board->private_data; ··· 38 37 return tms9914_read(board, &priv->tms9914_priv, buffer, length, end, bytes_read); 39 38 } 40 39 41 - static int hp82335_write(struct gpib_board *board, uint8_t *buffer, size_t length, int send_eoi, 40 + static int hp82335_write(struct gpib_board *board, u8 *buffer, size_t length, int send_eoi, 42 41 size_t *bytes_written) 43 42 { 44 43 struct hp82335_priv *priv = board->private_data; ··· 46 45 return tms9914_write(board, &priv->tms9914_priv, buffer, length, send_eoi, bytes_written); 47 46 } 48 47 49 - static int hp82335_command(struct gpib_board *board, uint8_t *buffer, size_t length, 48 + static int hp82335_command(struct gpib_board *board, u8 *buffer, size_t length, 50 49 size_t *bytes_written) 51 50 { 52 51 struct hp82335_priv *priv = board->private_data; ··· 68 67 return tms9914_go_to_standby(board, &priv->tms9914_priv); 69 68 } 70 69 71 - static void hp82335_request_system_control(struct gpib_board *board, int request_control) 70 + static int hp82335_request_system_control(struct gpib_board *board, int request_control) 72 71 { 73 72 struct hp82335_priv *priv = board->private_data; 74 73 75 - tms9914_request_system_control(board, &priv->tms9914_priv, request_control); 74 + return tms9914_request_system_control(board, &priv->tms9914_priv, request_control); 76 75 } 77 76 78 77 static void hp82335_interface_clear(struct gpib_board *board, int assert) ··· 89 88 tms9914_remote_enable(board, &priv->tms9914_priv, enable); 90 89 } 91 90 92 - static int hp82335_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits) 91 + static int hp82335_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits) 93 92 { 94 93 struct hp82335_priv *priv = board->private_data; 95 94 ··· 124 123 return tms9914_secondary_address(board, &priv->tms9914_priv, address, enable); 125 124 } 126 125 127 - static int hp82335_parallel_poll(struct gpib_board *board, uint8_t *result) 126 + static int hp82335_parallel_poll(struct gpib_board *board, u8 *result) 128 127 { 129 128 struct hp82335_priv *priv = board->private_data; 130 129 131 130 return tms9914_parallel_poll(board, &priv->tms9914_priv, result); 132 131 } 133 132 134 - static void hp82335_parallel_poll_configure(struct gpib_board *board, uint8_t config) 133 + static void hp82335_parallel_poll_configure(struct gpib_board *board, u8 config) 135 134 { 136 135 struct hp82335_priv *priv = board->private_data; 137 136 ··· 145 144 tms9914_parallel_poll_response(board, &priv->tms9914_priv, ist); 146 145 } 147 146 148 - static void hp82335_serial_poll_response(struct gpib_board *board, uint8_t status) 147 + static void hp82335_serial_poll_response(struct gpib_board *board, u8 status) 149 148 { 150 149 struct hp82335_priv *priv = board->private_data; 151 150 152 151 tms9914_serial_poll_response(board, &priv->tms9914_priv, status); 153 152 } 154 153 155 - static uint8_t hp82335_serial_poll_status(struct gpib_board *board) 154 + static u8 hp82335_serial_poll_status(struct gpib_board *board) 156 155 { 157 156 struct hp82335_priv *priv = board->private_data; 158 157 ··· 180 179 tms9914_return_to_local(board, &priv->tms9914_priv); 181 180 } 182 181 183 - static gpib_interface_t hp82335_interface = { 182 + static struct gpib_interface hp82335_interface = { 184 183 .name = "hp82335", 185 184 .attach = hp82335_attach, 186 185 .detach = hp82335_detach, ··· 227 226 return 0x1ff8 + register_num; 228 227 } 229 228 230 - static uint8_t hp82335_read_byte(struct tms9914_priv *priv, unsigned int register_num) 229 + static u8 hp82335_read_byte(struct tms9914_priv *priv, unsigned int register_num) 231 230 { 232 231 return tms9914_iomem_read_byte(priv, tms9914_to_hp82335_offset(register_num)); 233 232 } 234 233 235 - static void hp82335_write_byte(struct tms9914_priv *priv, uint8_t data, unsigned int register_num) 234 + static void hp82335_write_byte(struct tms9914_priv *priv, u8 data, unsigned int register_num) 236 235 { 237 236 tms9914_iomem_write_byte(priv, data, tms9914_to_hp82335_offset(register_num)); 238 237 } ··· 244 243 writeb(0, tms_priv->mmiobase + HPREG_INTR_CLEAR); 245 244 } 246 245 247 - static int hp82335_attach(struct gpib_board *board, const gpib_board_config_t *config) 246 + static int hp82335_attach(struct gpib_board *board, const struct gpib_board_config *config) 248 247 { 249 248 struct hp82335_priv *hp_priv; 250 249 struct tms9914_priv *tms_priv;
+27 -25
drivers/staging/gpib/hp_82341/hp_82341.c
··· 25 25 static unsigned short read_and_clear_event_status(struct gpib_board *board); 26 26 static void set_transfer_counter(struct hp_82341_priv *hp_priv, int count); 27 27 static int read_transfer_counter(struct hp_82341_priv *hp_priv); 28 - static int hp_82341_write(struct gpib_board *board, uint8_t *buffer, size_t length, int send_eoi, 28 + static int hp_82341_write(struct gpib_board *board, u8 *buffer, size_t length, int send_eoi, 29 29 size_t *bytes_written); 30 30 static irqreturn_t hp_82341_interrupt(int irq, void *arg); 31 31 32 - static int hp_82341_accel_read(struct gpib_board *board, uint8_t *buffer, size_t length, int *end, 32 + static int hp_82341_accel_read(struct gpib_board *board, u8 *buffer, size_t length, int *end, 33 33 size_t *bytes_read) 34 34 { 35 35 struct hp_82341_priv *hp_priv = board->private_data; ··· 51 51 return 0; 52 52 //disable fifo for the moment 53 53 outb(DIRECTION_GPIB_TO_HOST_BIT, hp_priv->iobase[3] + BUFFER_CONTROL_REG); 54 - // Handle corner case of board not in holdoff and one byte has slipped in already. 55 - // Also, board sometimes has problems (spurious 1 byte reads) when read fifo is 56 - // started up with board in 57 - // TACS under certain data holdoff conditions. Doing a 1 byte tms9914-style 58 - // read avoids these problems. 54 + /* 55 + * Handle corner case of board not in holdoff and one byte has slipped in already. 56 + * Also, board sometimes has problems (spurious 1 byte reads) when read fifo is 57 + * started up with board in TACS under certain data holdoff conditions. 58 + * Doing a 1 byte tms9914-style read avoids these problems. 59 + */ 59 60 if (/*tms_priv->holdoff_active == 0 && */length > 1) { 60 61 size_t num_bytes; 61 62 ··· 173 172 return 0; 174 173 } 175 174 176 - static int hp_82341_accel_write(struct gpib_board *board, uint8_t *buffer, size_t length, 175 + static int hp_82341_accel_write(struct gpib_board *board, u8 *buffer, size_t length, 177 176 int send_eoi, size_t *bytes_written) 178 177 { 179 178 struct hp_82341_priv *hp_priv = board->private_data; ··· 251 250 return 0; 252 251 } 253 252 254 - static int hp_82341_attach(struct gpib_board *board, const gpib_board_config_t *config); 253 + static int hp_82341_attach(struct gpib_board *board, const struct gpib_board_config *config); 255 254 256 255 static void hp_82341_detach(struct gpib_board *board); 257 256 258 257 // wrappers for interface functions 259 - static int hp_82341_read(struct gpib_board *board, uint8_t *buffer, size_t length, int *end, 258 + static int hp_82341_read(struct gpib_board *board, u8 *buffer, size_t length, int *end, 260 259 size_t *bytes_read) 261 260 { 262 261 struct hp_82341_priv *priv = board->private_data; ··· 264 263 return tms9914_read(board, &priv->tms9914_priv, buffer, length, end, bytes_read); 265 264 } 266 265 267 - static int hp_82341_write(struct gpib_board *board, uint8_t *buffer, size_t length, int send_eoi, 266 + static int hp_82341_write(struct gpib_board *board, u8 *buffer, size_t length, int send_eoi, 268 267 size_t *bytes_written) 269 268 { 270 269 struct hp_82341_priv *priv = board->private_data; ··· 272 271 return tms9914_write(board, &priv->tms9914_priv, buffer, length, send_eoi, bytes_written); 273 272 } 274 273 275 - static int hp_82341_command(struct gpib_board *board, uint8_t *buffer, size_t length, 274 + static int hp_82341_command(struct gpib_board *board, u8 *buffer, size_t length, 276 275 size_t *bytes_written) 277 276 { 278 277 struct hp_82341_priv *priv = board->private_data; ··· 294 293 return tms9914_go_to_standby(board, &priv->tms9914_priv); 295 294 } 296 295 297 - static void hp_82341_request_system_control(struct gpib_board *board, int request_control) 296 + static int hp_82341_request_system_control(struct gpib_board *board, int request_control) 298 297 { 299 298 struct hp_82341_priv *priv = board->private_data; 300 299 ··· 303 302 else 304 303 priv->mode_control_bits &= ~SYSTEM_CONTROLLER_BIT; 305 304 outb(priv->mode_control_bits, priv->iobase[0] + MODE_CONTROL_STATUS_REG); 306 - tms9914_request_system_control(board, &priv->tms9914_priv, request_control); 305 + return tms9914_request_system_control(board, &priv->tms9914_priv, request_control); 307 306 } 308 307 309 308 static void hp_82341_interface_clear(struct gpib_board *board, int assert) ··· 320 319 tms9914_remote_enable(board, &priv->tms9914_priv, enable); 321 320 } 322 321 323 - static int hp_82341_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits) 322 + static int hp_82341_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits) 324 323 { 325 324 struct hp_82341_priv *priv = board->private_data; 326 325 ··· 355 354 return tms9914_secondary_address(board, &priv->tms9914_priv, address, enable); 356 355 } 357 356 358 - static int hp_82341_parallel_poll(struct gpib_board *board, uint8_t *result) 357 + static int hp_82341_parallel_poll(struct gpib_board *board, u8 *result) 359 358 { 360 359 struct hp_82341_priv *priv = board->private_data; 361 360 362 361 return tms9914_parallel_poll(board, &priv->tms9914_priv, result); 363 362 } 364 363 365 - static void hp_82341_parallel_poll_configure(struct gpib_board *board, uint8_t config) 364 + static void hp_82341_parallel_poll_configure(struct gpib_board *board, u8 config) 366 365 { 367 366 struct hp_82341_priv *priv = board->private_data; 368 367 ··· 376 375 tms9914_parallel_poll_response(board, &priv->tms9914_priv, ist); 377 376 } 378 377 379 - static void hp_82341_serial_poll_response(struct gpib_board *board, uint8_t status) 378 + static void hp_82341_serial_poll_response(struct gpib_board *board, u8 status) 380 379 { 381 380 struct hp_82341_priv *priv = board->private_data; 382 381 383 382 tms9914_serial_poll_response(board, &priv->tms9914_priv, status); 384 383 } 385 384 386 - static uint8_t hp_82341_serial_poll_status(struct gpib_board *board) 385 + static u8 hp_82341_serial_poll_status(struct gpib_board *board) 387 386 { 388 387 struct hp_82341_priv *priv = board->private_data; 389 388 ··· 411 410 tms9914_return_to_local(board, &priv->tms9914_priv); 412 411 } 413 412 414 - static gpib_interface_t hp_82341_unaccel_interface = { 413 + static struct gpib_interface hp_82341_unaccel_interface = { 415 414 .name = "hp_82341_unaccel", 416 415 .attach = hp_82341_attach, 417 416 .detach = hp_82341_detach, ··· 439 438 .return_to_local = hp_82341_return_to_local, 440 439 }; 441 440 442 - static gpib_interface_t hp_82341_interface = { 441 + static struct gpib_interface hp_82341_interface = { 443 442 .name = "hp_82341", 444 443 .attach = hp_82341_attach, 445 444 .detach = hp_82341_detach, ··· 480 479 board->private_data = NULL; 481 480 } 482 481 483 - static uint8_t hp_82341_read_byte(struct tms9914_priv *priv, unsigned int register_num) 482 + static u8 hp_82341_read_byte(struct tms9914_priv *priv, unsigned int register_num) 484 483 { 485 484 return inb(priv->iobase + register_num); 486 485 } 487 486 488 - static void hp_82341_write_byte(struct tms9914_priv *priv, uint8_t data, unsigned int register_num) 487 + static void hp_82341_write_byte(struct tms9914_priv *priv, u8 data, unsigned int register_num) 489 488 { 490 489 outb(data, priv->iobase + register_num); 491 490 } ··· 620 619 return 0; 621 620 } 622 621 623 - static int hp_82341_load_firmware(struct hp_82341_priv *hp_priv, const gpib_board_config_t *config) 622 + static int hp_82341_load_firmware(struct hp_82341_priv *hp_priv, 623 + const struct gpib_board_config *config) 624 624 { 625 625 if (config->init_data_length == 0) { 626 626 if (xilinx_done(hp_priv)) ··· 688 686 return 0; 689 687 } 690 688 691 - static int hp_82341_attach(struct gpib_board *board, const gpib_board_config_t *config) 689 + static int hp_82341_attach(struct gpib_board *board, const struct gpib_board_config *config) 692 690 { 693 691 struct hp_82341_priv *hp_priv; 694 692 struct tms9914_priv *tms_priv;
+7 -7
drivers/staging/gpib/include/gpibP.h
··· 11 11 12 12 #include "gpib_types.h" 13 13 #include "gpib_proto.h" 14 - #include "gpib_user.h" 14 + #include "gpib.h" 15 15 #include "gpib_ioctl.h" 16 16 17 17 #include <linux/fs.h> 18 18 #include <linux/interrupt.h> 19 19 #include <linux/io.h> 20 20 21 - int gpib_register_driver(gpib_interface_t *interface, struct module *mod); 22 - void gpib_unregister_driver(gpib_interface_t *interface); 23 - struct pci_dev *gpib_pci_get_device(const gpib_board_config_t *config, unsigned int vendor_id, 21 + int gpib_register_driver(struct gpib_interface *interface, struct module *mod); 22 + void gpib_unregister_driver(struct gpib_interface *interface); 23 + struct pci_dev *gpib_pci_get_device(const struct gpib_board_config *config, unsigned int vendor_id, 24 24 unsigned int device_id, struct pci_dev *from); 25 - struct pci_dev *gpib_pci_get_subsys(const gpib_board_config_t *config, unsigned int vendor_id, 25 + struct pci_dev *gpib_pci_get_subsys(const struct gpib_board_config *config, unsigned int vendor_id, 26 26 unsigned int device_id, unsigned int ss_vendor, 27 27 unsigned int ss_device, struct pci_dev *from); 28 - unsigned int num_gpib_events(const gpib_event_queue_t *queue); 28 + unsigned int num_gpib_events(const struct gpib_event_queue *queue); 29 29 int push_gpib_event(struct gpib_board *board, short event_type); 30 - int pop_gpib_event(struct gpib_board *board, gpib_event_queue_t *queue, short *event_type); 30 + int pop_gpib_event(struct gpib_board *board, struct gpib_event_queue *queue, short *event_type); 31 31 int gpib_request_pseudo_irq(struct gpib_board *board, irqreturn_t (*handler)(int, void *)); 32 32 void gpib_free_pseudo_irq(struct gpib_board *board); 33 33 int gpib_match_device_path(struct device *dev, const char *device_path_in);
+12 -19
drivers/staging/gpib/include/gpib_proto.h
··· 8 8 int ibopen(struct inode *inode, struct file *filep); 9 9 int ibclose(struct inode *inode, struct file *file); 10 10 long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg); 11 - int osInit(void); 12 - void osReset(void); 13 11 void os_start_timer(struct gpib_board *board, unsigned int usec_timeout); 14 12 void os_remove_timer(struct gpib_board *board); 15 - void osSendEOI(void); 16 - void osSendEOI(void); 17 13 void init_gpib_board(struct gpib_board *board); 18 14 static inline unsigned long usec_to_jiffies(unsigned int usec) 19 15 { ··· 19 23 }; 20 24 21 25 int serial_poll_all(struct gpib_board *board, unsigned int usec_timeout); 22 - void init_gpib_descriptor(gpib_descriptor_t *desc); 26 + void init_gpib_descriptor(struct gpib_descriptor *desc); 23 27 int dvrsp(struct gpib_board *board, unsigned int pad, int sad, 24 - unsigned int usec_timeout, uint8_t *result); 25 - int ibAPWait(struct gpib_board *board, int pad); 26 - int ibAPrsp(struct gpib_board *board, int padsad, char *spb); 27 - void ibAPE(struct gpib_board *board, int pad, int v); 28 + unsigned int usec_timeout, u8 *result); 28 29 int ibcac(struct gpib_board *board, int sync, int fallback_to_async); 29 - int ibcmd(struct gpib_board *board, uint8_t *buf, size_t length, size_t *bytes_written); 30 + int ibcmd(struct gpib_board *board, u8 *buf, size_t length, size_t *bytes_written); 30 31 int ibgts(struct gpib_board *board); 31 32 int ibonline(struct gpib_board *board); 32 33 int iboffline(struct gpib_board *board); 33 34 int iblines(const struct gpib_board *board, short *lines); 34 - int ibrd(struct gpib_board *board, uint8_t *buf, size_t length, int *end_flag, size_t *bytes_read); 35 - int ibrpp(struct gpib_board *board, uint8_t *buf); 36 - int ibrsv2(struct gpib_board *board, uint8_t status_byte, int new_reason_for_service); 37 - void ibrsc(struct gpib_board *board, int request_control); 35 + int ibrd(struct gpib_board *board, u8 *buf, size_t length, int *end_flag, size_t *bytes_read); 36 + int ibrpp(struct gpib_board *board, u8 *buf); 37 + int ibrsv2(struct gpib_board *board, u8 status_byte, int new_reason_for_service); 38 + int ibrsc(struct gpib_board *board, int request_control); 38 39 int ibsic(struct gpib_board *board, unsigned int usec_duration); 39 40 int ibsre(struct gpib_board *board, int enable); 40 41 int ibpad(struct gpib_board *board, unsigned int addr); 41 42 int ibsad(struct gpib_board *board, int addr); 42 43 int ibeos(struct gpib_board *board, int eos, int eosflags); 43 44 int ibwait(struct gpib_board *board, int wait_mask, int clear_mask, int set_mask, 44 - int *status, unsigned long usec_timeout, gpib_descriptor_t *desc); 45 - int ibwrt(struct gpib_board *board, uint8_t *buf, size_t cnt, int send_eoi, size_t *bytes_written); 45 + int *status, unsigned long usec_timeout, struct gpib_descriptor *desc); 46 + int ibwrt(struct gpib_board *board, u8 *buf, size_t cnt, int send_eoi, size_t *bytes_written); 46 47 int ibstatus(struct gpib_board *board); 47 - int general_ibstatus(struct gpib_board *board, const gpib_status_queue_t *device, 48 - int clear_mask, int set_mask, gpib_descriptor_t *desc); 48 + int general_ibstatus(struct gpib_board *board, const struct gpib_status_queue *device, 49 + int clear_mask, int set_mask, struct gpib_descriptor *desc); 49 50 int io_timed_out(struct gpib_board *board); 50 - int ibppc(struct gpib_board *board, uint8_t configuration); 51 + int ibppc(struct gpib_board *board, u8 configuration); 51 52 52 53 #endif /* GPIB_PROTO_INCLUDED */
+94 -68
drivers/staging/gpib/include/gpib_types.h
··· 8 8 #define _GPIB_TYPES_H 9 9 10 10 #ifdef __KERNEL__ 11 - /* gpib_interface_t defines the interface 12 - * between the board-specific details dealt with in the drivers 13 - * and generic interface provided by gpib-common. 14 - * This really should be in a different header file. 15 - */ 16 - #include "gpib_user.h" 11 + #include "gpib.h" 17 12 #include <linux/atomic.h> 18 13 #include <linux/device.h> 19 14 #include <linux/mutex.h> ··· 17 22 #include <linux/timer.h> 18 23 #include <linux/interrupt.h> 19 24 20 - typedef struct gpib_interface_struct gpib_interface_t; 21 25 struct gpib_board; 22 26 23 27 /* config parameters that are only used by driver attach functions */ 24 - typedef struct { 28 + struct gpib_board_config { 25 29 /* firmware blob */ 26 30 void *init_data; 27 31 int init_data_length; ··· 31 37 unsigned int ibirq; 32 38 /* dma channel to use for non-pnp cards (set by core, driver should make local copy) */ 33 39 unsigned int ibdma; 34 - /* pci bus of card, useful for distinguishing multiple identical pci cards 40 + /* 41 + * pci bus of card, useful for distinguishing multiple identical pci cards 35 42 * (negative means don't care) 36 43 */ 37 44 int pci_bus; 38 - /* pci slot of card, useful for distinguishing multiple identical pci cards 45 + /* 46 + * pci slot of card, useful for distinguishing multiple identical pci cards 39 47 * (negative means don't care) 40 48 */ 41 49 int pci_slot; ··· 45 49 char *device_path; 46 50 /* serial number of hardware to attach */ 47 51 char *serial_number; 48 - } gpib_board_config_t; 52 + }; 49 53 50 - struct gpib_interface_struct { 54 + /* 55 + * struct gpib_interface defines the interface 56 + * between the board-specific details dealt with in the drivers 57 + * and generic interface provided by gpib-common. 58 + * This really should be in a different header file. 59 + */ 60 + struct gpib_interface { 51 61 /* name of board */ 52 62 char *name; 53 63 /* attach() initializes board and allocates resources */ 54 - int (*attach)(struct gpib_board *board, const gpib_board_config_t *config); 64 + int (*attach)(struct gpib_board *board, const struct gpib_board_config *config); 55 65 /* detach() shuts down board and frees resources */ 56 66 void (*detach)(struct gpib_board *board); 57 - /* read() should read at most 'length' bytes from the bus into 67 + /* 68 + * read() should read at most 'length' bytes from the bus into 58 69 * 'buffer'. It should return when it fills the buffer or 59 70 * encounters an END (EOI and or EOS if appropriate). It should set 'end' 60 71 * to be nonzero if the read was terminated by an END, otherwise 'end' ··· 71 68 * return indicates error. 72 69 * nbytes returns number of bytes read 73 70 */ 74 - int (*read)(struct gpib_board *board, uint8_t *buffer, size_t length, int *end, 71 + int (*read)(struct gpib_board *board, u8 *buffer, size_t length, int *end, 75 72 size_t *bytes_read); 76 - /* write() should write 'length' bytes from buffer to the bus. 73 + /* 74 + * write() should write 'length' bytes from buffer to the bus. 77 75 * If the boolean value send_eoi is nonzero, then EOI should 78 76 * be sent along with the last byte. Returns number of bytes 79 77 * written or negative value on error. 80 78 */ 81 - int (*write)(struct gpib_board *board, uint8_t *buffer, size_t length, int send_eoi, 79 + int (*write)(struct gpib_board *board, u8 *buffer, size_t length, int send_eoi, 82 80 size_t *bytes_written); 83 - /* command() writes the command bytes in 'buffer' to the bus 81 + /* 82 + * command() writes the command bytes in 'buffer' to the bus 84 83 * Returns zero on success or negative value on error. 85 84 */ 86 - int (*command)(struct gpib_board *board, uint8_t *buffer, size_t length, 85 + int (*command)(struct gpib_board *board, u8 *buffer, size_t length, 87 86 size_t *bytes_written); 88 - /* Take control (assert ATN). If 'asyncronous' is nonzero, take 87 + /* 88 + * Take control (assert ATN). If 'asyncronous' is nonzero, take 89 89 * control asyncronously (assert ATN immediately without waiting 90 90 * for other processes to complete first). Should not return 91 91 * until board becomes controller in charge. Returns zero no success, 92 92 * nonzero on error. 93 93 */ 94 94 int (*take_control)(struct gpib_board *board, int asyncronous); 95 - /* De-assert ATN. Returns zero on success, nonzer on error. 95 + /* 96 + * De-assert ATN. Returns zero on success, nonzer on error. 96 97 */ 97 98 int (*go_to_standby)(struct gpib_board *board); 98 99 /* request/release control of the IFC and REN lines (system controller) */ 99 - void (*request_system_control)(struct gpib_board *board, int request_control); 100 - /* Asserts or de-asserts 'interface clear' (IFC) depending on 100 + int (*request_system_control)(struct gpib_board *board, int request_control); 101 + /* 102 + * Asserts or de-asserts 'interface clear' (IFC) depending on 101 103 * boolean value of 'assert' 102 104 */ 103 105 void (*interface_clear)(struct gpib_board *board, int assert); 104 - /* Sends remote enable command if 'enable' is nonzero, disables remote mode 106 + /* 107 + * Sends remote enable command if 'enable' is nonzero, disables remote mode 105 108 * if 'enable' is zero 106 109 */ 107 110 void (*remote_enable)(struct gpib_board *board, int enable); 108 - /* enable END for reads, when byte 'eos' is received. If 111 + /* 112 + * enable END for reads, when byte 'eos' is received. If 109 113 * 'compare_8_bits' is nonzero, then all 8 bits are compared 110 114 * with the eos bytes. Otherwise only the 7 least significant 111 115 * bits are compared. 112 116 */ 113 - int (*enable_eos)(struct gpib_board *board, uint8_t eos, int compare_8_bits); 117 + int (*enable_eos)(struct gpib_board *board, u8 eos, int compare_8_bits); 114 118 /* disable END on eos byte (END on EOI only)*/ 115 119 void (*disable_eos)(struct gpib_board *board); 116 120 /* configure parallel poll */ 117 - void (*parallel_poll_configure)(struct gpib_board *board, uint8_t configuration); 121 + void (*parallel_poll_configure)(struct gpib_board *board, u8 configuration); 118 122 /* conduct parallel poll */ 119 - int (*parallel_poll)(struct gpib_board *board, uint8_t *result); 123 + int (*parallel_poll)(struct gpib_board *board, u8 *result); 120 124 /* set/clear ist (individual status bit) */ 121 125 void (*parallel_poll_response)(struct gpib_board *board, int ist); 122 126 /* select local parallel poll configuration mode PP2 versus remote PP1 */ 123 127 void (*local_parallel_poll_mode)(struct gpib_board *board, int local); 124 - /* Returns current status of the bus lines. Should be set to 128 + /* 129 + * Returns current status of the bus lines. Should be set to 125 130 * NULL if your board does not have the ability to query the 126 131 * state of the bus lines. 127 132 */ 128 133 int (*line_status)(const struct gpib_board *board); 129 - /* updates and returns the board's current status. 134 + /* 135 + * updates and returns the board's current status. 130 136 * The meaning of the bits are specified in gpib_user.h 131 137 * in the IBSTA section. The driver does not need to 132 138 * worry about setting the CMPL, END, TIMO, or ERR bits. 133 139 */ 134 140 unsigned int (*update_status)(struct gpib_board *board, unsigned int clear_mask); 135 - /* Sets primary address 0-30 for gpib interface card. 141 + /* 142 + * Sets primary address 0-30 for gpib interface card. 136 143 */ 137 144 int (*primary_address)(struct gpib_board *board, unsigned int address); 138 - /* Sets and enables, or disables secondary address 0-30 145 + /* 146 + * Sets and enables, or disables secondary address 0-30 139 147 * for gpib interface card. 140 148 */ 141 149 int (*secondary_address)(struct gpib_board *board, unsigned int address, 142 150 int enable); 143 - /* Sets the byte the board should send in response to a serial poll. 151 + /* 152 + * Sets the byte the board should send in response to a serial poll. 144 153 * This function should also start or stop requests for service via 145 154 * IEEE 488.2 reqt/reqf, based on MSS (bit 6 of the status_byte). 146 155 * If the more flexible serial_poll_response2 is implemented by the ··· 164 149 * by IEEE 488.2 section 11.3.3.4.3 "Allowed Coupled Control of 165 150 * STB, reqt, and reqf". 166 151 */ 167 - void (*serial_poll_response)(struct gpib_board *board, uint8_t status_byte); 168 - /* Sets the byte the board should send in response to a serial poll. 152 + void (*serial_poll_response)(struct gpib_board *board, u8 status_byte); 153 + /* 154 + * Sets the byte the board should send in response to a serial poll. 169 155 * This function should also request service via IEEE 488.2 reqt/reqf 170 156 * based on MSS (bit 6 of the status_byte) and new_reason_for_service. 171 157 * reqt should be set true if new_reason_for_service is true, ··· 180 164 * If this method is left NULL by the driver, then the user library 181 165 * function ibrsv2 will not work. 182 166 */ 183 - void (*serial_poll_response2)(struct gpib_board *board, uint8_t status_byte, 167 + void (*serial_poll_response2)(struct gpib_board *board, u8 status_byte, 184 168 int new_reason_for_service); 185 - /* returns the byte the board will send in response to a serial poll. 169 + /* 170 + * returns the byte the board will send in response to a serial poll. 186 171 */ 187 - uint8_t (*serial_poll_status)(struct gpib_board *board); 172 + u8 (*serial_poll_status)(struct gpib_board *board); 188 173 /* adjust T1 delay */ 189 174 int (*t1_delay)(struct gpib_board *board, unsigned int nano_sec); 190 175 /* go to local mode */ ··· 196 179 unsigned skip_check_for_command_acceptors : 1; 197 180 }; 198 181 199 - typedef struct { 182 + struct gpib_event_queue { 200 183 struct list_head event_head; 201 184 spinlock_t lock; // for access to event list 202 185 unsigned int num_events; 203 186 unsigned dropped_event : 1; 204 - } gpib_event_queue_t; 187 + }; 205 188 206 - static inline void init_event_queue(gpib_event_queue_t *queue) 189 + static inline void init_event_queue(struct gpib_event_queue *queue) 207 190 { 208 191 INIT_LIST_HEAD(&queue->event_head); 209 192 queue->num_events = 0; ··· 227 210 } 228 211 229 212 /* list so we can make a linked list of drivers */ 230 - typedef struct gpib_interface_list_struct { 213 + struct gpib_interface_list { 231 214 struct list_head list; 232 - gpib_interface_t *interface; 215 + struct gpib_interface *interface; 233 216 struct module *module; 234 - } gpib_interface_list_t; 217 + }; 235 218 236 - /* One struct gpib_board is allocated for each physical board in the computer. 219 + /* 220 + * One struct gpib_board is allocated for each physical board in the computer. 237 221 * It provides storage for variables local to each board, and interface 238 222 * functions for performing operations on the board 239 223 */ 240 224 struct gpib_board { 241 225 /* functions used by this board */ 242 - gpib_interface_t *interface; 243 - /* Pointer to module whose use count we should increment when 226 + struct gpib_interface *interface; 227 + /* 228 + * Pointer to module whose use count we should increment when 244 229 * interface is in use 245 230 */ 246 231 struct module *provider_module; ··· 250 231 u8 *buffer; 251 232 /* length of buffer */ 252 233 unsigned int buffer_length; 253 - /* Used to hold the board's current status (see update_status() above) 234 + /* 235 + * Used to hold the board's current status (see update_status() above) 254 236 */ 255 237 unsigned long status; 256 - /* Driver should only sleep on this wait queue. It is special in that the 238 + /* 239 + * Driver should only sleep on this wait queue. It is special in that the 257 240 * core will wake this queue and set the TIMO bit in 'status' when the 258 241 * watchdog timer times out. 259 242 */ 260 243 wait_queue_head_t wait; 261 - /* Lock that only allows one process to access this board at a time. 244 + /* 245 + * Lock that only allows one process to access this board at a time. 262 246 * Has to be first in any locking order, since it can be locked over 263 247 * multiple ioctls. 264 248 */ 265 249 struct mutex user_mutex; 266 - /* Mutex which compensates for removal of "big kernel lock" from kernel. 250 + /* 251 + * Mutex which compensates for removal of "big kernel lock" from kernel. 267 252 * Should not be held for extended waits. 268 253 */ 269 254 struct mutex big_gpib_mutex; ··· 282 259 struct device *dev; 283 260 /* gpib_common device gpibN */ 284 261 struct device *gpib_dev; 285 - /* 'private_data' can be used as seen fit by the driver to 262 + /* 263 + * 'private_data' can be used as seen fit by the driver to 286 264 * store additional variables for this board 287 265 */ 288 266 void *private_data; ··· 308 284 /* autospoll kernel thread */ 309 285 struct task_struct *autospoll_task; 310 286 /* queue for recording received trigger/clear/ifc events */ 311 - gpib_event_queue_t event_queue; 287 + struct gpib_event_queue event_queue; 312 288 /* minor number for this board's device file */ 313 289 int minor; 314 290 /* struct to deal with polling mode*/ 315 291 struct gpib_pseudo_irq pseudo_irq; 316 292 /* error dong autopoll */ 317 293 atomic_t stuck_srq; 318 - gpib_board_config_t config; 294 + struct gpib_board_config config; 319 295 /* Flag that indicates whether board is system controller of the bus */ 320 296 unsigned master : 1; 321 297 /* individual status bit */ 322 298 unsigned ist : 1; 323 - /* one means local parallel poll mode ieee 488.1 PP2 (or no parallel poll PP0), 299 + /* 300 + * one means local parallel poll mode ieee 488.1 PP2 (or no parallel poll PP0), 324 301 * zero means remote parallel poll configuration mode ieee 488.1 PP1 325 302 */ 326 303 unsigned local_ppoll_mode : 1; 327 304 }; 328 305 329 306 /* element of event queue */ 330 - typedef struct { 307 + struct gpib_event { 331 308 struct list_head list; 332 309 short event_type; 333 - } gpib_event_t; 310 + }; 334 311 335 - /* Each board has a list of gpib_status_queue_t to keep track of all open devices 312 + /* 313 + * Each board has a list of gpib_status_queue to keep track of all open devices 336 314 * on the bus, so we know what address to poll when we get a service request 337 315 */ 338 - typedef struct { 316 + struct gpib_status_queue { 339 317 /* list_head so we can make a linked list of devices */ 340 318 struct list_head list; 341 319 unsigned int pad; /* primary gpib address */ ··· 349 323 unsigned int reference_count; 350 324 /* flags loss of status byte error due to limit on size of queue */ 351 325 unsigned dropped_byte : 1; 352 - } gpib_status_queue_t; 326 + }; 353 327 354 - typedef struct { 328 + struct gpib_status_byte { 355 329 struct list_head list; 356 330 u8 poll_byte; 357 - } status_byte_t; 331 + }; 358 332 359 - void init_gpib_status_queue(gpib_status_queue_t *device); 333 + void init_gpib_status_queue(struct gpib_status_queue *device); 360 334 361 335 /* Used to store device-descriptor-specific information */ 362 - typedef struct { 336 + struct gpib_descriptor { 363 337 unsigned int pad; /* primary gpib address */ 364 338 int sad; /* secondary gpib address (negative means disabled) */ 365 339 atomic_t io_in_progress; 366 340 unsigned is_board : 1; 367 341 unsigned autopoll_enabled : 1; 368 - } gpib_descriptor_t; 342 + }; 369 343 370 - typedef struct { 344 + struct gpib_file_private { 371 345 atomic_t holding_mutex; 372 - gpib_descriptor_t *descriptors[GPIB_MAX_NUM_DESCRIPTORS]; 346 + struct gpib_descriptor *descriptors[GPIB_MAX_NUM_DESCRIPTORS]; 373 347 /* locked while descriptors are being allocated/deallocated */ 374 348 struct mutex descriptors_mutex; 375 349 unsigned got_module : 1; 376 - } gpib_file_private_t; 350 + }; 377 351 378 352 #endif /* __KERNEL__ */ 379 353
+20 -20
drivers/staging/gpib/include/nec7210.h
··· 1 - //* SPDX-License-Identifier: GPL-2.0 */ 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 2 3 3 /*************************************************************************** 4 4 * copyright : (C) 2002 by Frank Mori Hess ··· 78 78 }; 79 79 80 80 // interface functions 81 - int nec7210_read(struct gpib_board *board, struct nec7210_priv *priv, uint8_t *buffer, 81 + int nec7210_read(struct gpib_board *board, struct nec7210_priv *priv, u8 *buffer, 82 82 size_t length, int *end, size_t *bytes_read); 83 - int nec7210_write(struct gpib_board *board, struct nec7210_priv *priv, uint8_t *buffer, 83 + int nec7210_write(struct gpib_board *board, struct nec7210_priv *priv, u8 *buffer, 84 84 size_t length, int send_eoi, size_t *bytes_written); 85 - int nec7210_command(struct gpib_board *board, struct nec7210_priv *priv, uint8_t *buffer, 85 + int nec7210_command(struct gpib_board *board, struct nec7210_priv *priv, u8 *buffer, 86 86 size_t length, size_t *bytes_written); 87 87 int nec7210_take_control(struct gpib_board *board, struct nec7210_priv *priv, int syncronous); 88 88 int nec7210_go_to_standby(struct gpib_board *board, struct nec7210_priv *priv); 89 - void nec7210_request_system_control(struct gpib_board *board, 90 - struct nec7210_priv *priv, int request_control); 89 + int nec7210_request_system_control(struct gpib_board *board, 90 + struct nec7210_priv *priv, int request_control); 91 91 void nec7210_interface_clear(struct gpib_board *board, struct nec7210_priv *priv, int assert); 92 92 void nec7210_remote_enable(struct gpib_board *board, struct nec7210_priv *priv, int enable); 93 - int nec7210_enable_eos(struct gpib_board *board, struct nec7210_priv *priv, uint8_t eos_bytes, 93 + int nec7210_enable_eos(struct gpib_board *board, struct nec7210_priv *priv, u8 eos_bytes, 94 94 int compare_8_bits); 95 95 void nec7210_disable_eos(struct gpib_board *board, struct nec7210_priv *priv); 96 96 unsigned int nec7210_update_status(struct gpib_board *board, struct nec7210_priv *priv, ··· 100 100 struct nec7210_priv *priv, unsigned int address); 101 101 int nec7210_secondary_address(const struct gpib_board *board, struct nec7210_priv *priv, 102 102 unsigned int address, int enable); 103 - int nec7210_parallel_poll(struct gpib_board *board, struct nec7210_priv *priv, uint8_t *result); 104 - void nec7210_serial_poll_response(struct gpib_board *board, struct nec7210_priv *priv, uint8_t status); 103 + int nec7210_parallel_poll(struct gpib_board *board, struct nec7210_priv *priv, u8 *result); 104 + void nec7210_serial_poll_response(struct gpib_board *board, 105 + struct nec7210_priv *priv, u8 status); 105 106 void nec7210_parallel_poll_configure(struct gpib_board *board, 106 107 struct nec7210_priv *priv, unsigned int configuration); 107 108 void nec7210_parallel_poll_response(struct gpib_board *board, 108 109 struct nec7210_priv *priv, int ist); 109 - uint8_t nec7210_serial_poll_status(struct gpib_board *board, 110 - struct nec7210_priv *priv); 110 + u8 nec7210_serial_poll_status(struct gpib_board *board, struct nec7210_priv *priv); 111 111 int nec7210_t1_delay(struct gpib_board *board, 112 112 struct nec7210_priv *priv, unsigned int nano_sec); 113 113 void nec7210_return_to_local(const struct gpib_board *board, struct nec7210_priv *priv); ··· 119 119 unsigned int mask, unsigned int bits); 120 120 void nec7210_set_handshake_mode(struct gpib_board *board, struct nec7210_priv *priv, int mode); 121 121 void nec7210_release_rfd_holdoff(struct gpib_board *board, struct nec7210_priv *priv); 122 - uint8_t nec7210_read_data_in(struct gpib_board *board, struct nec7210_priv *priv, int *end); 122 + u8 nec7210_read_data_in(struct gpib_board *board, struct nec7210_priv *priv, int *end); 123 123 124 124 // wrappers for io functions 125 - uint8_t nec7210_ioport_read_byte(struct nec7210_priv *priv, unsigned int register_num); 126 - void nec7210_ioport_write_byte(struct nec7210_priv *priv, uint8_t data, unsigned int register_num); 127 - uint8_t nec7210_iomem_read_byte(struct nec7210_priv *priv, unsigned int register_num); 128 - void nec7210_iomem_write_byte(struct nec7210_priv *priv, uint8_t data, unsigned int register_num); 129 - uint8_t nec7210_locking_ioport_read_byte(struct nec7210_priv *priv, unsigned int register_num); 130 - void nec7210_locking_ioport_write_byte(struct nec7210_priv *priv, uint8_t data, 125 + u8 nec7210_ioport_read_byte(struct nec7210_priv *priv, unsigned int register_num); 126 + void nec7210_ioport_write_byte(struct nec7210_priv *priv, u8 data, unsigned int register_num); 127 + u8 nec7210_iomem_read_byte(struct nec7210_priv *priv, unsigned int register_num); 128 + void nec7210_iomem_write_byte(struct nec7210_priv *priv, u8 data, unsigned int register_num); 129 + u8 nec7210_locking_ioport_read_byte(struct nec7210_priv *priv, unsigned int register_num); 130 + void nec7210_locking_ioport_write_byte(struct nec7210_priv *priv, u8 data, 131 131 unsigned int register_num); 132 - uint8_t nec7210_locking_iomem_read_byte(struct nec7210_priv *priv, unsigned int register_num); 133 - void nec7210_locking_iomem_write_byte(struct nec7210_priv *priv, uint8_t data, 132 + u8 nec7210_locking_iomem_read_byte(struct nec7210_priv *priv, unsigned int register_num); 133 + void nec7210_locking_iomem_write_byte(struct nec7210_priv *priv, u8 data, 134 134 unsigned int register_num); 135 135 136 136 // interrupt service routine
+2 -1
drivers/staging/gpib/include/nec7210_registers.h
··· 17 17 TNT5004, // NI (minor differences to TNT4882) 18 18 }; 19 19 20 - /* nec7210 register numbers (might need to be multiplied by 20 + /* 21 + * nec7210 register numbers (might need to be multiplied by 21 22 * a board-dependent offset to get actually io address offset) 22 23 */ 23 24 // write registers
+20 -17
drivers/staging/gpib/include/tms9914.h
··· 1 - //* SPDX-License-Identifier: GPL-2.0 */ 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 2 3 3 /*************************************************************************** 4 4 * copyright : (C) 2002 by Frank Mori Hess ··· 79 79 }; 80 80 81 81 // interface functions 82 - int tms9914_read(struct gpib_board *board, struct tms9914_priv *priv, uint8_t *buffer, 82 + int tms9914_read(struct gpib_board *board, struct tms9914_priv *priv, u8 *buffer, 83 83 size_t length, int *end, size_t *bytes_read); 84 - int tms9914_write(struct gpib_board *board, struct tms9914_priv *priv, uint8_t *buffer, 84 + int tms9914_write(struct gpib_board *board, struct tms9914_priv *priv, u8 *buffer, 85 85 size_t length, int send_eoi, size_t *bytes_written); 86 - int tms9914_command(struct gpib_board *board, struct tms9914_priv *priv, uint8_t *buffer, 86 + int tms9914_command(struct gpib_board *board, struct tms9914_priv *priv, u8 *buffer, 87 87 size_t length, size_t *bytes_written); 88 88 int tms9914_take_control(struct gpib_board *board, struct tms9914_priv *priv, int syncronous); 89 - /* alternate version of tms9914_take_control which works around buggy tcs 89 + /* 90 + * alternate version of tms9914_take_control which works around buggy tcs 90 91 * implementation. 91 92 */ 92 93 int tms9914_take_control_workaround(struct gpib_board *board, struct tms9914_priv *priv, 93 94 int syncronous); 94 95 int tms9914_go_to_standby(struct gpib_board *board, struct tms9914_priv *priv); 95 - void tms9914_request_system_control(struct gpib_board *board, struct tms9914_priv *priv, 96 - int request_control); 96 + int tms9914_request_system_control(struct gpib_board *board, struct tms9914_priv *priv, 97 + int request_control); 97 98 void tms9914_interface_clear(struct gpib_board *board, struct tms9914_priv *priv, int assert); 98 99 void tms9914_remote_enable(struct gpib_board *board, struct tms9914_priv *priv, int enable); 99 - int tms9914_enable_eos(struct gpib_board *board, struct tms9914_priv *priv, uint8_t eos_bytes, 100 + int tms9914_enable_eos(struct gpib_board *board, struct tms9914_priv *priv, u8 eos_bytes, 100 101 int compare_8_bits); 101 102 void tms9914_disable_eos(struct gpib_board *board, struct tms9914_priv *priv); 102 103 unsigned int tms9914_update_status(struct gpib_board *board, struct tms9914_priv *priv, ··· 106 105 struct tms9914_priv *priv, unsigned int address); 107 106 int tms9914_secondary_address(struct gpib_board *board, struct tms9914_priv *priv, 108 107 unsigned int address, int enable); 109 - int tms9914_parallel_poll(struct gpib_board *board, struct tms9914_priv *priv, uint8_t *result); 108 + int tms9914_parallel_poll(struct gpib_board *board, struct tms9914_priv *priv, u8 *result); 110 109 void tms9914_parallel_poll_configure(struct gpib_board *board, 111 - struct tms9914_priv *priv, uint8_t config); 110 + struct tms9914_priv *priv, u8 config); 112 111 void tms9914_parallel_poll_response(struct gpib_board *board, 113 112 struct tms9914_priv *priv, int ist); 114 - void tms9914_serial_poll_response(struct gpib_board *board, struct tms9914_priv *priv, uint8_t status); 115 - uint8_t tms9914_serial_poll_status(struct gpib_board *board, struct tms9914_priv *priv); 113 + void tms9914_serial_poll_response(struct gpib_board *board, 114 + struct tms9914_priv *priv, u8 status); 115 + u8 tms9914_serial_poll_status(struct gpib_board *board, struct tms9914_priv *priv); 116 116 int tms9914_line_status(const struct gpib_board *board, struct tms9914_priv *priv); 117 117 unsigned int tms9914_t1_delay(struct gpib_board *board, struct tms9914_priv *priv, 118 118 unsigned int nano_sec); ··· 126 124 void tms9914_set_holdoff_mode(struct tms9914_priv *priv, enum tms9914_holdoff_mode mode); 127 125 128 126 // wrappers for io functions 129 - uint8_t tms9914_ioport_read_byte(struct tms9914_priv *priv, unsigned int register_num); 130 - void tms9914_ioport_write_byte(struct tms9914_priv *priv, uint8_t data, unsigned int register_num); 131 - uint8_t tms9914_iomem_read_byte(struct tms9914_priv *priv, unsigned int register_num); 132 - void tms9914_iomem_write_byte(struct tms9914_priv *priv, uint8_t data, unsigned int register_num); 127 + u8 tms9914_ioport_read_byte(struct tms9914_priv *priv, unsigned int register_num); 128 + void tms9914_ioport_write_byte(struct tms9914_priv *priv, u8 data, unsigned int register_num); 129 + u8 tms9914_iomem_read_byte(struct tms9914_priv *priv, unsigned int register_num); 130 + void tms9914_iomem_write_byte(struct tms9914_priv *priv, u8 data, unsigned int register_num); 133 131 134 132 // interrupt service routine 135 133 irqreturn_t tms9914_interrupt(struct gpib_board *board, struct tms9914_priv *priv); ··· 141 139 ms9914_num_registers = 8, 142 140 }; 143 141 144 - /* tms9914 register numbers (might need to be multiplied by 142 + /* 143 + * tms9914 register numbers (might need to be multiplied by 145 144 * a board-dependent offset to get actually io address offset) 146 145 */ 147 146 // write registers
-43
drivers/staging/gpib/ines/ines.h
··· 35 35 u8 extend_mode_bits; 36 36 }; 37 37 38 - // interface functions 39 - int ines_read(struct gpib_board *board, uint8_t *buffer, size_t length, int *end, size_t *bytes_read); 40 - int ines_write(struct gpib_board *board, uint8_t *buffer, size_t length, 41 - int send_eoi, size_t *bytes_written); 42 - int ines_accel_read(struct gpib_board *board, uint8_t *buffer, size_t length, 43 - int *end, size_t *bytes_read); 44 - int ines_accel_write(struct gpib_board *board, uint8_t *buffer, size_t length, 45 - int send_eoi, size_t *bytes_written); 46 - int ines_command(struct gpib_board *board, uint8_t *buffer, size_t length, size_t *bytes_written); 47 - int ines_take_control(struct gpib_board *board, int synchronous); 48 - int ines_go_to_standby(struct gpib_board *board); 49 - void ines_request_system_control(struct gpib_board *board, int request_control); 50 - void ines_interface_clear(struct gpib_board *board, int assert); 51 - void ines_remote_enable(struct gpib_board *board, int enable); 52 - int ines_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits); 53 - void ines_disable_eos(struct gpib_board *board); 54 - unsigned int ines_update_status(struct gpib_board *board, unsigned int clear_mask); 55 - int ines_primary_address(struct gpib_board *board, unsigned int address); 56 - int ines_secondary_address(struct gpib_board *board, unsigned int address, int enable); 57 - int ines_parallel_poll(struct gpib_board *board, uint8_t *result); 58 - void ines_parallel_poll_configure(struct gpib_board *board, uint8_t config); 59 - void ines_parallel_poll_response(struct gpib_board *board, int ist); 60 - void ines_serial_poll_response(struct gpib_board *board, uint8_t status); 61 - uint8_t ines_serial_poll_status(struct gpib_board *board); 62 - int ines_line_status(const struct gpib_board *board); 63 - int ines_t1_delay(struct gpib_board *board, unsigned int nano_sec); 64 - void ines_return_to_local(struct gpib_board *board); 65 - 66 - // interrupt service routines 67 - irqreturn_t ines_pci_interrupt(int irq, void *arg); 68 - irqreturn_t ines_interrupt(struct gpib_board *board); 69 - 70 - // utility functions 71 - void ines_free_private(struct gpib_board *board); 72 - int ines_generic_attach(struct gpib_board *board); 73 - void ines_online(struct ines_priv *priv, const struct gpib_board *board, int use_accel); 74 - void ines_set_xfer_counter(struct ines_priv *priv, unsigned int count); 75 - 76 38 /* inb/outb wrappers */ 77 39 static inline unsigned int ines_inb(struct ines_priv *priv, unsigned int register_number) 78 40 { ··· 48 86 outb(value, priv->nec7210_priv.iobase + 49 87 register_number * priv->nec7210_priv.offset); 50 88 } 51 - 52 - // pcmcia init/cleanup 53 - 54 - int ines_pcmcia_init_module(void); 55 - void ines_pcmcia_cleanup_module(void); 56 89 57 90 enum ines_regs { 58 91 // read
+109 -107
drivers/staging/gpib/ines/ines_gpib.c
··· 25 25 MODULE_LICENSE("GPL"); 26 26 MODULE_DESCRIPTION("GPIB driver for Ines iGPIB 72010"); 27 27 28 - int ines_line_status(const struct gpib_board *board) 28 + static irqreturn_t ines_interrupt(struct gpib_board *board); 29 + 30 + static int ines_line_status(const struct gpib_board *board) 29 31 { 30 32 int status = VALID_ALL; 31 33 int bcm_bits; ··· 57 55 return status; 58 56 } 59 57 60 - void ines_set_xfer_counter(struct ines_priv *priv, unsigned int count) 58 + static void ines_set_xfer_counter(struct ines_priv *priv, unsigned int count) 61 59 { 62 60 if (count > 0xffff) { 63 61 pr_err("bug! tried to set xfer counter > 0xffff\n"); ··· 67 65 ines_outb(priv, count & 0xff, XFER_COUNT_LOWER); 68 66 } 69 67 70 - int ines_t1_delay(struct gpib_board *board, unsigned int nano_sec) 68 + static int ines_t1_delay(struct gpib_board *board, unsigned int nano_sec) 71 69 { 72 70 struct ines_priv *ines_priv = board->private_data; 73 71 struct nec7210_priv *nec_priv = &ines_priv->nec7210_priv; ··· 97 95 return ines_inb(ines_priv, IN_FIFO_COUNT); 98 96 } 99 97 100 - static ssize_t pio_read(struct gpib_board *board, struct ines_priv *ines_priv, uint8_t *buffer, 98 + static ssize_t pio_read(struct gpib_board *board, struct ines_priv *ines_priv, u8 *buffer, 101 99 size_t length, size_t *nbytes) 102 100 { 103 101 ssize_t retval = 0; ··· 135 133 return retval; 136 134 } 137 135 138 - int ines_accel_read(struct gpib_board *board, uint8_t *buffer, 139 - size_t length, int *end, size_t *bytes_read) 136 + static int ines_accel_read(struct gpib_board *board, u8 *buffer, 137 + size_t length, int *end, size_t *bytes_read) 140 138 { 141 139 ssize_t retval = 0; 142 140 struct ines_priv *ines_priv = board->private_data; ··· 215 213 return 0; 216 214 } 217 215 218 - int ines_accel_write(struct gpib_board *board, uint8_t *buffer, size_t length, 219 - int send_eoi, size_t *bytes_written) 216 + static int ines_accel_write(struct gpib_board *board, u8 *buffer, size_t length, 217 + int send_eoi, size_t *bytes_written) 220 218 { 221 219 size_t count = 0; 222 220 ssize_t retval = 0; ··· 266 264 return retval; 267 265 } 268 266 269 - irqreturn_t ines_pci_interrupt(int irq, void *arg) 267 + static irqreturn_t ines_pci_interrupt(int irq, void *arg) 270 268 { 271 269 struct gpib_board *board = arg; 272 270 struct ines_priv *priv = board->private_data; ··· 283 281 return ines_interrupt(board); 284 282 } 285 283 286 - irqreturn_t ines_interrupt(struct gpib_board *board) 284 + static irqreturn_t ines_interrupt(struct gpib_board *board) 287 285 { 288 286 struct ines_priv *priv = board->private_data; 289 287 struct nec7210_priv *nec_priv = &priv->nec7210_priv; ··· 297 295 isr3_bits = ines_inb(priv, ISR3); 298 296 isr4_bits = ines_inb(priv, ISR4); 299 297 if (isr3_bits & IFC_ACTIVE_BIT) { 300 - push_gpib_event(board, EventIFC); 298 + push_gpib_event(board, EVENT_IFC); 301 299 wake++; 302 300 } 303 301 if (isr3_bits & FIFO_ERROR_BIT) ··· 315 313 return IRQ_HANDLED; 316 314 } 317 315 318 - static int ines_pci_attach(struct gpib_board *board, const gpib_board_config_t *config); 319 - static int ines_pci_accel_attach(struct gpib_board *board, const gpib_board_config_t *config); 320 - static int ines_isa_attach(struct gpib_board *board, const gpib_board_config_t *config); 316 + static int ines_pci_attach(struct gpib_board *board, const struct gpib_board_config *config); 317 + static int ines_pci_accel_attach(struct gpib_board *board, const struct gpib_board_config *config); 318 + static int ines_isa_attach(struct gpib_board *board, const struct gpib_board_config *config); 321 319 322 320 static void ines_pci_detach(struct gpib_board *board); 323 321 static void ines_isa_detach(struct gpib_board *board); ··· 395 393 static const int num_pci_chips = ARRAY_SIZE(pci_ids); 396 394 397 395 // wrappers for interface functions 398 - int ines_read(struct gpib_board *board, uint8_t *buffer, size_t length, 399 - int *end, size_t *bytes_read) 396 + static int ines_read(struct gpib_board *board, u8 *buffer, size_t length, 397 + int *end, size_t *bytes_read) 400 398 { 401 399 struct ines_priv *priv = board->private_data; 402 400 struct nec7210_priv *nec_priv = &priv->nec7210_priv; ··· 414 412 return retval; 415 413 } 416 414 417 - int ines_write(struct gpib_board *board, uint8_t *buffer, size_t length, int send_eoi, 418 - size_t *bytes_written) 415 + static int ines_write(struct gpib_board *board, u8 *buffer, size_t length, int send_eoi, 416 + size_t *bytes_written) 419 417 { 420 418 struct ines_priv *priv = board->private_data; 421 419 422 420 return nec7210_write(board, &priv->nec7210_priv, buffer, length, send_eoi, bytes_written); 423 421 } 424 422 425 - int ines_command(struct gpib_board *board, uint8_t *buffer, size_t length, size_t *bytes_written) 423 + static int ines_command(struct gpib_board *board, u8 *buffer, size_t length, size_t *bytes_written) 426 424 { 427 425 struct ines_priv *priv = board->private_data; 428 426 429 427 return nec7210_command(board, &priv->nec7210_priv, buffer, length, bytes_written); 430 428 } 431 429 432 - int ines_take_control(struct gpib_board *board, int synchronous) 430 + static int ines_take_control(struct gpib_board *board, int synchronous) 433 431 { 434 432 struct ines_priv *priv = board->private_data; 435 433 436 434 return nec7210_take_control(board, &priv->nec7210_priv, synchronous); 437 435 } 438 436 439 - int ines_go_to_standby(struct gpib_board *board) 437 + static int ines_go_to_standby(struct gpib_board *board) 440 438 { 441 439 struct ines_priv *priv = board->private_data; 442 440 443 441 return nec7210_go_to_standby(board, &priv->nec7210_priv); 444 442 } 445 443 446 - void ines_request_system_control(struct gpib_board *board, int request_control) 444 + static int ines_request_system_control(struct gpib_board *board, int request_control) 447 445 { 448 446 struct ines_priv *priv = board->private_data; 449 447 450 - nec7210_request_system_control(board, &priv->nec7210_priv, request_control); 448 + return nec7210_request_system_control(board, &priv->nec7210_priv, request_control); 451 449 } 452 450 453 - void ines_interface_clear(struct gpib_board *board, int assert) 451 + static void ines_interface_clear(struct gpib_board *board, int assert) 454 452 { 455 453 struct ines_priv *priv = board->private_data; 456 454 457 455 nec7210_interface_clear(board, &priv->nec7210_priv, assert); 458 456 } 459 457 460 - void ines_remote_enable(struct gpib_board *board, int enable) 458 + static void ines_remote_enable(struct gpib_board *board, int enable) 461 459 { 462 460 struct ines_priv *priv = board->private_data; 463 461 464 462 nec7210_remote_enable(board, &priv->nec7210_priv, enable); 465 463 } 466 464 467 - int ines_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits) 465 + static int ines_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits) 468 466 { 469 467 struct ines_priv *priv = board->private_data; 470 468 471 469 return nec7210_enable_eos(board, &priv->nec7210_priv, eos_byte, compare_8_bits); 472 470 } 473 471 474 - void ines_disable_eos(struct gpib_board *board) 472 + static void ines_disable_eos(struct gpib_board *board) 475 473 { 476 474 struct ines_priv *priv = board->private_data; 477 475 478 476 nec7210_disable_eos(board, &priv->nec7210_priv); 479 477 } 480 478 481 - unsigned int ines_update_status(struct gpib_board *board, unsigned int clear_mask) 479 + static unsigned int ines_update_status(struct gpib_board *board, unsigned int clear_mask) 482 480 { 483 481 struct ines_priv *priv = board->private_data; 484 482 485 483 return nec7210_update_status(board, &priv->nec7210_priv, clear_mask); 486 484 } 487 485 488 - int ines_primary_address(struct gpib_board *board, unsigned int address) 486 + static int ines_primary_address(struct gpib_board *board, unsigned int address) 489 487 { 490 488 struct ines_priv *priv = board->private_data; 491 489 492 490 return nec7210_primary_address(board, &priv->nec7210_priv, address); 493 491 } 494 492 495 - int ines_secondary_address(struct gpib_board *board, unsigned int address, int enable) 493 + static int ines_secondary_address(struct gpib_board *board, unsigned int address, int enable) 496 494 { 497 495 struct ines_priv *priv = board->private_data; 498 496 499 497 return nec7210_secondary_address(board, &priv->nec7210_priv, address, enable); 500 498 } 501 499 502 - int ines_parallel_poll(struct gpib_board *board, uint8_t *result) 500 + static int ines_parallel_poll(struct gpib_board *board, u8 *result) 503 501 { 504 502 struct ines_priv *priv = board->private_data; 505 503 506 504 return nec7210_parallel_poll(board, &priv->nec7210_priv, result); 507 505 } 508 506 509 - void ines_parallel_poll_configure(struct gpib_board *board, uint8_t config) 507 + static void ines_parallel_poll_configure(struct gpib_board *board, u8 config) 510 508 { 511 509 struct ines_priv *priv = board->private_data; 512 510 513 511 nec7210_parallel_poll_configure(board, &priv->nec7210_priv, config); 514 512 } 515 513 516 - void ines_parallel_poll_response(struct gpib_board *board, int ist) 514 + static void ines_parallel_poll_response(struct gpib_board *board, int ist) 517 515 { 518 516 struct ines_priv *priv = board->private_data; 519 517 520 518 nec7210_parallel_poll_response(board, &priv->nec7210_priv, ist); 521 519 } 522 520 523 - void ines_serial_poll_response(struct gpib_board *board, uint8_t status) 521 + static void ines_serial_poll_response(struct gpib_board *board, u8 status) 524 522 { 525 523 struct ines_priv *priv = board->private_data; 526 524 527 525 nec7210_serial_poll_response(board, &priv->nec7210_priv, status); 528 526 } 529 527 530 - uint8_t ines_serial_poll_status(struct gpib_board *board) 528 + static u8 ines_serial_poll_status(struct gpib_board *board) 531 529 { 532 530 struct ines_priv *priv = board->private_data; 533 531 534 532 return nec7210_serial_poll_status(board, &priv->nec7210_priv); 535 533 } 536 534 537 - void ines_return_to_local(struct gpib_board *board) 535 + static void ines_return_to_local(struct gpib_board *board) 538 536 { 539 537 struct ines_priv *priv = board->private_data; 540 538 541 539 nec7210_return_to_local(board, &priv->nec7210_priv); 542 540 } 543 541 544 - static gpib_interface_t ines_pci_unaccel_interface = { 542 + static struct gpib_interface ines_pci_unaccel_interface = { 545 543 .name = "ines_pci_unaccel", 546 544 .attach = ines_pci_attach, 547 545 .detach = ines_pci_detach, ··· 569 567 .return_to_local = ines_return_to_local, 570 568 }; 571 569 572 - static gpib_interface_t ines_pci_interface = { 570 + static struct gpib_interface ines_pci_interface = { 573 571 .name = "ines_pci", 574 572 .attach = ines_pci_accel_attach, 575 573 .detach = ines_pci_detach, ··· 597 595 .return_to_local = ines_return_to_local, 598 596 }; 599 597 600 - static gpib_interface_t ines_pci_accel_interface = { 598 + static struct gpib_interface ines_pci_accel_interface = { 601 599 .name = "ines_pci_accel", 602 600 .attach = ines_pci_accel_attach, 603 601 .detach = ines_pci_detach, ··· 625 623 .return_to_local = ines_return_to_local, 626 624 }; 627 625 628 - static gpib_interface_t ines_isa_interface = { 626 + static struct gpib_interface ines_isa_interface = { 629 627 .name = "ines_isa", 630 628 .attach = ines_isa_attach, 631 629 .detach = ines_isa_detach, ··· 666 664 return 0; 667 665 } 668 666 669 - void ines_free_private(struct gpib_board *board) 667 + static void ines_free_private(struct gpib_board *board) 670 668 { 671 669 kfree(board->private_data); 672 670 board->private_data = NULL; 673 671 } 674 672 675 - int ines_generic_attach(struct gpib_board *board) 673 + static int ines_generic_attach(struct gpib_board *board) 676 674 { 677 675 struct ines_priv *ines_priv; 678 676 struct nec7210_priv *nec_priv; ··· 692 690 return 0; 693 691 } 694 692 695 - void ines_online(struct ines_priv *ines_priv, const struct gpib_board *board, int use_accel) 693 + static void ines_online(struct ines_priv *ines_priv, const struct gpib_board *board, int use_accel) 696 694 { 697 695 struct nec7210_priv *nec_priv = &ines_priv->nec7210_priv; 698 696 ··· 726 724 nec7210_set_reg_bits(nec_priv, IMR1, HR_DOIE | HR_DIIE, 0); 727 725 } 728 726 729 - static int ines_common_pci_attach(struct gpib_board *board, const gpib_board_config_t *config) 727 + static int ines_common_pci_attach(struct gpib_board *board, const struct gpib_board_config *config) 730 728 { 731 729 struct ines_priv *ines_priv; 732 730 struct nec7210_priv *nec_priv; ··· 854 852 return 0; 855 853 } 856 854 857 - int ines_pci_attach(struct gpib_board *board, const gpib_board_config_t *config) 855 + static int ines_pci_attach(struct gpib_board *board, const struct gpib_board_config *config) 858 856 { 859 857 struct ines_priv *ines_priv; 860 858 int retval; ··· 869 867 return 0; 870 868 } 871 869 872 - int ines_pci_accel_attach(struct gpib_board *board, const gpib_board_config_t *config) 870 + static int ines_pci_accel_attach(struct gpib_board *board, const struct gpib_board_config *config) 873 871 { 874 872 struct ines_priv *ines_priv; 875 873 int retval; ··· 886 884 887 885 static const int ines_isa_iosize = 0x20; 888 886 889 - int ines_isa_attach(struct gpib_board *board, const gpib_board_config_t *config) 887 + static int ines_isa_attach(struct gpib_board *board, const struct gpib_board_config *config) 890 888 { 891 889 struct ines_priv *ines_priv; 892 890 struct nec7210_priv *nec_priv; ··· 917 915 return 0; 918 916 } 919 917 920 - void ines_pci_detach(struct gpib_board *board) 918 + static void ines_pci_detach(struct gpib_board *board) 921 919 { 922 920 struct ines_priv *ines_priv = board->private_data; 923 921 struct nec7210_priv *nec_priv; ··· 951 949 ines_free_private(board); 952 950 } 953 951 954 - void ines_isa_detach(struct gpib_board *board) 952 + static void ines_isa_detach(struct gpib_board *board) 955 953 { 956 954 struct ines_priv *ines_priv = board->private_data; 957 955 struct nec7210_priv *nec_priv; ··· 992 990 993 991 static const int ines_pcmcia_iosize = 0x20; 994 992 995 - /* The event() function is this driver's Card Services event handler. 996 - * It will be called by Card Services when an appropriate card status 997 - * event is received. The config() and release() entry points are 998 - * used to configure or release a socket, in response to card insertion 999 - * and ejection events. They are invoked from the gpib event 1000 - * handler. 993 + /* 994 + * The event() function is this driver's Card Services event handler. 995 + * It will be called by Card Services when an appropriate card status 996 + * event is received. The config() and release() entry points are 997 + * used to configure or release a socket, in response to card insertion 998 + * and ejection events. They are invoked from the gpib event 999 + * handler. 1001 1000 */ 1002 1001 1003 1002 static int ines_gpib_config(struct pcmcia_device *link); 1004 1003 static void ines_gpib_release(struct pcmcia_device *link); 1005 - static int ines_pcmcia_attach(struct gpib_board *board, const gpib_board_config_t *config); 1006 - static int ines_pcmcia_accel_attach(struct gpib_board *board, const gpib_board_config_t *config); 1004 + static int ines_pcmcia_attach(struct gpib_board *board, const struct gpib_board_config *config); 1005 + static int ines_pcmcia_accel_attach(struct gpib_board *board, 1006 + const struct gpib_board_config *config); 1007 1007 static void ines_pcmcia_detach(struct gpib_board *board); 1008 - static irqreturn_t ines_pcmcia_interrupt(int irq, void *arg); 1009 1008 static int ines_common_pcmcia_attach(struct gpib_board *board); 1010 1009 /* 1011 1010 * A linked list of "instances" of the gpib device. Each actual 1012 - * PCMCIA card corresponds to one device instance, and is described 1013 - * by one dev_link_t structure (defined in ds.h). 1011 + * PCMCIA card corresponds to one device instance, and is described 1012 + * by one dev_link_t structure (defined in ds.h). 1014 1013 * 1015 - * You may not want to use a linked list for this -- for example, the 1016 - * memory card driver uses an array of dev_link_t pointers, where minor 1017 - * device numbers are used to derive the corresponding array index. 1014 + * You may not want to use a linked list for this -- for example, the 1015 + * memory card driver uses an array of dev_link_t pointers, where minor 1016 + * device numbers are used to derive the corresponding array index. 1018 1017 */ 1019 1018 1020 1019 static struct pcmcia_device *curr_dev; 1021 1020 1022 1021 /* 1023 - * A dev_link_t structure has fields for most things that are needed 1024 - * to keep track of a socket, but there will usually be some device 1025 - * specific information that also needs to be kept track of. The 1026 - * 'priv' pointer in a dev_link_t structure can be used to point to 1027 - * a device-specific private data structure, like this. 1022 + * A dev_link_t structure has fields for most things that are needed 1023 + * to keep track of a socket, but there will usually be some device 1024 + * specific information that also needs to be kept track of. The 1025 + * 'priv' pointer in a dev_link_t structure can be used to point to 1026 + * a device-specific private data structure, like this. 1028 1027 * 1029 - * A driver needs to provide a dev_node_t structure for each device 1030 - * on a card. In some cases, there is only one device per card (for 1031 - * example, ethernet cards, modems). In other cases, there may be 1032 - * many actual or logical devices (SCSI adapters, memory cards with 1033 - * multiple partitions). The dev_node_t structures need to be kept 1034 - * in a linked list starting at the 'dev' field of a dev_link_t 1035 - * structure. We allocate them in the card's private data structure, 1036 - * because they generally can't be allocated dynamically. 1028 + * A driver needs to provide a dev_node_t structure for each device 1029 + * on a card. In some cases, there is only one device per card (for 1030 + * example, ethernet cards, modems). In other cases, there may be 1031 + * many actual or logical devices (SCSI adapters, memory cards with 1032 + * multiple partitions). The dev_node_t structures need to be kept 1033 + * in a linked list starting at the 'dev' field of a dev_link_t 1034 + * structure. We allocate them in the card's private data structure, 1035 + * because they generally can't be allocated dynamically. 1037 1036 */ 1038 1037 1039 1038 struct local_info { ··· 1045 1042 }; 1046 1043 1047 1044 /* 1048 - * gpib_attach() creates an "instance" of the driver, allocating 1049 - * local data structures for one device. The device is registered 1050 - * with Card Services. 1045 + * gpib_attach() creates an "instance" of the driver, allocating 1046 + * local data structures for one device. The device is registered 1047 + * with Card Services. 1051 1048 * 1052 - * The dev_link structure is initialized, but we don't actually 1053 - * configure the card at this point -- we wait until we receive a 1054 - * card insertion event. 1049 + * The dev_link structure is initialized, but we don't actually 1050 + * configure the card at this point -- we wait until we receive a 1051 + * card insertion event. 1055 1052 */ 1056 1053 static int ines_gpib_probe(struct pcmcia_device *link) 1057 1054 { ··· 1082 1079 } 1083 1080 1084 1081 /* 1085 - * This deletes a driver "instance". The device is de-registered 1086 - * with Card Services. If it has been released, all local data 1087 - * structures are freed. Otherwise, the structures will be freed 1088 - * when the device is released. 1082 + * This deletes a driver "instance". The device is de-registered 1083 + * with Card Services. If it has been released, all local data 1084 + * structures are freed. Otherwise, the structures will be freed 1085 + * when the device is released. 1089 1086 */ 1090 1087 static void ines_gpib_remove(struct pcmcia_device *link) 1091 1088 { ··· 1106 1103 } 1107 1104 1108 1105 /* 1109 - * gpib_config() is scheduled to run after a CARD_INSERTION event 1110 - * is received, to configure the PCMCIA socket, and to make the 1111 - * device available to the system. 1106 + * gpib_config() is scheduled to run after a CARD_INSERTION event 1107 + * is received, to configure the PCMCIA socket, and to make the 1108 + * device available to the system. 1112 1109 */ 1113 1110 static int ines_gpib_config(struct pcmcia_device *link) 1114 1111 { 1115 - struct local_info *dev; 1116 1112 int retval; 1117 1113 void __iomem *virt; 1118 - 1119 - dev = link->priv; 1120 1114 1121 1115 retval = pcmcia_loop_config(link, &ines_gpib_config_iteration, NULL); 1122 1116 if (retval) { ··· 1125 1125 dev_dbg(&link->dev, "ines_cs: manufacturer: 0x%x card: 0x%x\n", 1126 1126 link->manf_id, link->card_id); 1127 1127 1128 - /* for the ines card we have to setup the configuration registers in 1129 - * attribute memory here 1128 + /* 1129 + * for the ines card we have to setup the configuration registers in 1130 + * attribute memory here 1130 1131 */ 1131 1132 link->resource[2]->flags |= WIN_MEMORY_TYPE_AM | WIN_DATA_WIDTH_8 | WIN_ENABLE; 1132 1133 link->resource[2]->end = 0x1000; ··· 1160 1159 } /* gpib_config */ 1161 1160 1162 1161 /* 1163 - * After a card is removed, gpib_release() will unregister the net 1164 - * device, and release the PCMCIA configuration. If the device is 1165 - * still open, this will be postponed until it is closed. 1162 + * After a card is removed, gpib_release() will unregister the net 1163 + * device, and release the PCMCIA configuration. If the device is 1164 + * still open, this will be postponed until it is closed. 1166 1165 */ 1167 1166 1168 1167 static void ines_gpib_release(struct pcmcia_device *link) ··· 1211 1210 .resume = ines_gpib_resume, 1212 1211 }; 1213 1212 1214 - void ines_pcmcia_cleanup_module(void) 1213 + static void ines_pcmcia_cleanup_module(void) 1215 1214 { 1216 1215 pcmcia_unregister_driver(&ines_gpib_cs_driver); 1217 1216 } 1218 1217 1219 - static gpib_interface_t ines_pcmcia_unaccel_interface = { 1218 + static struct gpib_interface ines_pcmcia_unaccel_interface = { 1220 1219 .name = "ines_pcmcia_unaccel", 1221 1220 .attach = ines_pcmcia_attach, 1222 1221 .detach = ines_pcmcia_detach, ··· 1244 1243 .return_to_local = ines_return_to_local, 1245 1244 }; 1246 1245 1247 - static gpib_interface_t ines_pcmcia_accel_interface = { 1246 + static struct gpib_interface ines_pcmcia_accel_interface = { 1248 1247 .name = "ines_pcmcia_accel", 1249 1248 .attach = ines_pcmcia_accel_attach, 1250 1249 .detach = ines_pcmcia_detach, ··· 1272 1271 .return_to_local = ines_return_to_local, 1273 1272 }; 1274 1273 1275 - static gpib_interface_t ines_pcmcia_interface = { 1274 + static struct gpib_interface ines_pcmcia_interface = { 1276 1275 .name = "ines_pcmcia", 1277 1276 .attach = ines_pcmcia_accel_attach, 1278 1277 .detach = ines_pcmcia_detach, ··· 1300 1299 .return_to_local = ines_return_to_local, 1301 1300 }; 1302 1301 1303 - irqreturn_t ines_pcmcia_interrupt(int irq, void *arg) 1302 + static irqreturn_t ines_pcmcia_interrupt(int irq, void *arg) 1304 1303 { 1305 1304 struct gpib_board *board = arg; 1306 1305 1307 1306 return ines_interrupt(board); 1308 1307 } 1309 1308 1310 - int ines_common_pcmcia_attach(struct gpib_board *board) 1309 + static int ines_common_pcmcia_attach(struct gpib_board *board) 1311 1310 { 1312 1311 struct ines_priv *ines_priv; 1313 1312 struct nec7210_priv *nec_priv; ··· 1346 1345 return 0; 1347 1346 } 1348 1347 1349 - int ines_pcmcia_attach(struct gpib_board *board, const gpib_board_config_t *config) 1348 + static int ines_pcmcia_attach(struct gpib_board *board, const struct gpib_board_config *config) 1350 1349 { 1351 1350 struct ines_priv *ines_priv; 1352 1351 int retval; ··· 1361 1360 return 0; 1362 1361 } 1363 1362 1364 - int ines_pcmcia_accel_attach(struct gpib_board *board, const gpib_board_config_t *config) 1363 + static int ines_pcmcia_accel_attach(struct gpib_board *board, 1364 + const struct gpib_board_config *config) 1365 1365 { 1366 1366 struct ines_priv *ines_priv; 1367 1367 int retval; ··· 1377 1375 return 0; 1378 1376 } 1379 1377 1380 - void ines_pcmcia_detach(struct gpib_board *board) 1378 + static void ines_pcmcia_detach(struct gpib_board *board) 1381 1379 { 1382 1380 struct ines_priv *ines_priv = board->private_data; 1383 1381 struct nec7210_priv *nec_priv; ··· 1486 1484 gpib_unregister_driver(&ines_pci_unaccel_interface); 1487 1485 gpib_unregister_driver(&ines_pci_accel_interface); 1488 1486 gpib_unregister_driver(&ines_isa_interface); 1489 - #ifdef GPIB__PCMCIA 1487 + #ifdef CONFIG_GPIB_PCMCIA 1490 1488 gpib_unregister_driver(&ines_pcmcia_interface); 1491 1489 gpib_unregister_driver(&ines_pcmcia_unaccel_interface); 1492 1490 gpib_unregister_driver(&ines_pcmcia_accel_interface);
+74 -71
drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
··· 36 36 MODULE_DESCRIPTION("GPIB driver for LPVO usb devices"); 37 37 38 38 /* 39 - * Table of devices that work with this driver. 39 + * Table of devices that work with this driver. 40 40 * 41 - * Currently, only one device is known to be used in the 42 - * lpvo_usb_gpib adapter (FTDI 0403:6001). 43 - * If your adapter uses a different chip, insert a line 44 - * in the following table with proper <Vendor-id>, <Product-id>. 41 + * Currently, only one device is known to be used in the 42 + * lpvo_usb_gpib adapter (FTDI 0403:6001). 43 + * If your adapter uses a different chip, insert a line 44 + * in the following table with proper <Vendor-id>, <Product-id>. 45 45 * 46 - * To have your chip automatically handled by the driver, 47 - * update files "/usr/local/etc/modprobe.d/lpvo_usb_gpib.conf" 48 - * and /usr/local/etc/udev/rules.d/99-lpvo_usb_gpib.rules. 46 + * To have your chip automatically handled by the driver, 47 + * update files "/usr/local/etc/modprobe.d/lpvo_usb_gpib.conf" 48 + * and /usr/local/etc/udev/rules.d/99-lpvo_usb_gpib.rules. 49 49 * 50 50 */ 51 51 ··· 56 56 MODULE_DEVICE_TABLE(usb, skel_table); 57 57 58 58 /* 59 - * *** Diagnostics and Debug *** 60 - * To enable the diagnostic and debug messages either compile with DEBUG set 61 - * or control via the dynamic debug mechanisms. 62 - * The module parameter "debug" controls the sending of debug messages to 63 - * syslog. By default it is set to 0 64 - * debug = 0: only attach/detach messages are sent 65 - * 1: every action is logged 66 - * 2: extended logging; each single exchanged byte is documented 67 - * (about twice the log volume of [1]) 68 - * To switch debug level: 69 - * At module loading: modprobe lpvo_usb_gpib debug={0,1,2} 70 - * On the fly: echo {0,1,2} > /sys/modules/lpvo_usb_gpib/parameters/debug 59 + * *** Diagnostics and Debug *** 60 + * To enable the diagnostic and debug messages either compile with DEBUG set 61 + * or control via the dynamic debug mechanisms. 62 + * The module parameter "debug" controls the sending of debug messages to 63 + * syslog. By default it is set to 0 64 + * debug = 0: only attach/detach messages are sent 65 + * 1: every action is logged 66 + * 2: extended logging; each single exchanged byte is documented 67 + * (about twice the log volume of [1]) 68 + * To switch debug level: 69 + * At module loading: modprobe lpvo_usb_gpib debug={0,1,2} 70 + * On the fly: echo {0,1,2} > /sys/modules/lpvo_usb_gpib/parameters/debug 71 71 */ 72 72 73 73 static int debug; ··· 169 169 } 170 170 171 171 /* 172 - * GLOBAL VARIABLES: required for 173 - * pairing among gpib minor and usb minor. 174 - * MAX_DEV is the max number of usb-gpib adapters; free 175 - * to change as you like, but no more than 32 172 + * GLOBAL VARIABLES: required for 173 + * pairing among gpib minor and usb minor. 174 + * MAX_DEV is the max number of usb-gpib adapters; free 175 + * to change as you like, but no more than 32 176 176 */ 177 177 178 178 #define MAX_DEV 8 ··· 182 182 static struct mutex minors_lock; /* operations on usb_minors are to be protected */ 183 183 184 184 /* 185 - * usb-skeleton prototypes 185 + * usb-skeleton prototypes 186 186 */ 187 187 188 188 struct usb_skel; ··· 192 192 static int skel_do_release(struct gpib_board *); 193 193 194 194 /* 195 - * usec_diff : take difference in MICROsec between two 'timespec' 195 + * usec_diff : take difference in MICROsec between two 'timespec' 196 196 * (unix time in sec and NANOsec) 197 197 */ 198 198 ··· 203 203 } 204 204 205 205 /* 206 - * *** these routines are specific to the usb-gpib adapter *** 206 + * *** these routines are specific to the usb-gpib adapter *** 207 207 */ 208 208 209 209 /** ··· 262 262 } 263 263 264 264 /* 265 - * 266 265 * set_control_line() - Set the value of a single gpib control line 267 266 * 268 267 * @board: the gpib_board_struct data area for this gpib interface 269 268 * @line: line mask 270 269 * @value: line new value (0/1) 271 - * 272 270 */ 273 271 274 272 static int set_control_line(struct gpib_board *board, int line, int value) ··· 366 368 } 367 369 368 370 /* 369 - * now the standard interface functions - attach and detach 371 + * now the standard interface functions - attach and detach 370 372 */ 371 373 372 374 /** ··· 382 384 * detach() will be called. Always. 383 385 */ 384 386 385 - static int usb_gpib_attach(struct gpib_board *board, const gpib_board_config_t *config) 387 + static int usb_gpib_attach(struct gpib_board *board, const struct gpib_board_config *config) 386 388 { 387 389 int retval, j; 388 390 u32 base = config->ibbase; ··· 462 464 if (retval != ACK) 463 465 return -EIO; 464 466 465 - /* We must setup debug mode because we need the extended instruction 467 + /* 468 + * We must setup debug mode because we need the extended instruction 466 469 * set to cope with the Core (gpib_common) point of view 467 470 */ 468 471 ··· 472 473 if (retval != ACK) 473 474 return -EIO; 474 475 475 - /* We must keep REN off after an IFC because so it is 476 + /* 477 + * We must keep REN off after an IFC because so it is 476 478 * assumed by the Core 477 479 */ 478 480 ··· 654 654 655 655 DIA_LOG(1, "%s\n", "request"); 656 656 657 - /* if we are on the wait queue (board->wait), do not hurry 657 + /* 658 + * if we are on the wait queue (board->wait), do not hurry 658 659 * reading status line; instead, pause a little 659 660 */ 660 661 ··· 706 705 707 706 /* parallel_poll */ 708 707 709 - static int usb_gpib_parallel_poll(struct gpib_board *board, uint8_t *result) 708 + static int usb_gpib_parallel_poll(struct gpib_board *board, u8 *result) 710 709 { 711 - /* request parallel poll asserting ATN | EOI; 710 + /* 711 + * request parallel poll asserting ATN | EOI; 712 712 * we suppose ATN already asserted 713 713 */ 714 714 ··· 911 909 912 910 /* request_system_control */ 913 911 914 - static void usb_gpib_request_system_control(struct gpib_board *board, 915 - int request_control) 912 + static int usb_gpib_request_system_control(struct gpib_board *board, int request_control) 916 913 { 917 - if (request_control) 918 - set_bit(CIC_NUM, &board->status); 919 - else 920 - clear_bit(CIC_NUM, &board->status); 914 + if (!request_control) 915 + return -EINVAL; 921 916 922 917 DIA_LOG(1, "done with %d -> %lx\n", request_control, board->status); 918 + return 0; 923 919 } 924 920 925 921 /* take_control */ ··· 997 997 /* parallel_poll configure */ 998 998 999 999 static void usb_gpib_parallel_poll_configure(struct gpib_board *board, 1000 - uint8_t configuration) 1000 + u8 configuration) 1001 1001 { 1002 1002 } 1003 1003 ··· 1031 1031 1032 1032 /* serial_poll_response */ 1033 1033 1034 - static void usb_gpib_serial_poll_response(struct gpib_board *board, uint8_t status) 1034 + static void usb_gpib_serial_poll_response(struct gpib_board *board, u8 status) 1035 1035 { 1036 1036 } 1037 1037 1038 1038 /* serial_poll_status */ 1039 1039 1040 - static uint8_t usb_gpib_serial_poll_status(struct gpib_board *board) 1040 + static u8 usb_gpib_serial_poll_status(struct gpib_board *board) 1041 1041 { 1042 1042 return 0; 1043 1043 } ··· 1053 1053 * *** module dispatch table and init/exit functions *** 1054 1054 */ 1055 1055 1056 - static gpib_interface_t usb_gpib_interface = { 1056 + static struct gpib_interface usb_gpib_interface = { 1057 1057 .name = NAME, 1058 1058 .attach = usb_gpib_attach, 1059 1059 .detach = usb_gpib_detach, ··· 1083 1083 }; 1084 1084 1085 1085 /* 1086 - * usb_gpib_init_module(), usb_gpib_exit_module() 1086 + * usb_gpib_init_module(), usb_gpib_exit_module() 1087 1087 * 1088 - * This functions are called every time a new device is detected 1089 - * and registered or is removed and unregistered. 1090 - * We must take note of created and destroyed usb minors to be used 1091 - * when usb_gpib_attach() and usb_gpib_detach() will be called on 1092 - * request by gpib_config. 1088 + * This functions are called every time a new device is detected 1089 + * and registered or is removed and unregistered. 1090 + * We must take note of created and destroyed usb minors to be used 1091 + * when usb_gpib_attach() and usb_gpib_detach() will be called on 1092 + * request by gpib_config. 1093 1093 */ 1094 1094 1095 1095 static int usb_gpib_init_module(struct usb_interface *interface) ··· 1107 1107 goto exit; 1108 1108 } 1109 1109 } else { 1110 - /* check if minor is already registered - maybe useless, but if 1111 - * it happens the code is inconsistent somewhere 1110 + /* 1111 + * check if minor is already registered - maybe useless, but if 1112 + * it happens the code is inconsistent somewhere 1112 1113 */ 1113 1114 1114 1115 for (j = 0 ; j < MAX_DEV ; j++) { ··· 1163 1162 } 1164 1163 1165 1164 /* 1166 - * Default latency time (16 msec) is too long. 1167 - * We must use 1 msec (best); anyhow, no more than 5 msec. 1165 + * Default latency time (16 msec) is too long. 1166 + * We must use 1 msec (best); anyhow, no more than 5 msec. 1168 1167 * 1169 - * Defines and function taken and modified from the kernel tree 1170 - * (see ftdi_sio.h and ftdi_sio.c). 1171 - * 1168 + * Defines and function taken and modified from the kernel tree 1169 + * (see ftdi_sio.h and ftdi_sio.c). 1172 1170 */ 1173 1171 1174 1172 #define FTDI_SIO_SET_LATENCY_TIMER 9 /* Set the latency timer */ ··· 1235 1235 /* private defines */ 1236 1236 1237 1237 #define MAX_TRANSFER (PAGE_SIZE - 512) 1238 - /* MAX_TRANSFER is chosen so that the VM is not stressed by 1238 + /* 1239 + * MAX_TRANSFER is chosen so that the VM is not stressed by 1239 1240 * allocations > PAGE_SIZE and the number of packets in a page 1240 1241 * is an integer 512 is the largest possible packet on EHCI 1241 1242 */ ··· 1281 1280 } 1282 1281 1283 1282 /* 1284 - * skel_do_open() - to be called by usb_gpib_attach 1283 + * skel_do_open() - to be called by usb_gpib_attach 1285 1284 */ 1286 1285 1287 1286 static int skel_do_open(struct gpib_board *board, int subminor) ··· 1318 1317 } 1319 1318 1320 1319 /* 1321 - * skel_do_release() - to be called by usb_gpib_detach 1320 + * skel_do_release() - to be called by usb_gpib_detach 1322 1321 */ 1323 1322 1324 1323 static int skel_do_release(struct gpib_board *board) ··· 1341 1340 } 1342 1341 1343 1342 /* 1344 - * read functions 1343 + * read functions 1345 1344 */ 1346 1345 1347 1346 static void skel_read_bulk_callback(struct urb *urb) ··· 1406 1405 } 1407 1406 1408 1407 /* 1409 - * skel_do_read() - read operations from lpvo_usb_gpib 1408 + * skel_do_read() - read operations from lpvo_usb_gpib 1410 1409 */ 1411 1410 1412 1411 static ssize_t skel_do_read(struct usb_skel *dev, char *buffer, size_t count) ··· 1483 1482 * all data has been used 1484 1483 * actual IO needs to be done 1485 1484 */ 1486 - /* it seems that requests for less than dev->bulk_in_size 1485 + /* 1486 + * it seems that requests for less than dev->bulk_in_size 1487 1487 * are not accepted 1488 1488 */ 1489 1489 rv = skel_do_read_io(dev, dev->bulk_in_size); ··· 1498 1496 * data is available - chunk tells us how much shall be copied 1499 1497 */ 1500 1498 1501 - /* Condition dev->bulk_in_copied > 0 maybe will never happen. In case, 1499 + /* 1500 + * Condition dev->bulk_in_copied > 0 maybe will never happen. In case, 1502 1501 * signal the event and copy using the original procedure, i.e., copy 1503 1502 * first two bytes also 1504 1503 */ ··· 1554 1551 } 1555 1552 1556 1553 /* 1557 - * write functions 1554 + * write functions 1558 1555 */ 1559 1556 1560 1557 static void skel_write_bulk_callback(struct urb *urb) ··· 1584 1581 } 1585 1582 1586 1583 /* 1587 - * skel_do_write() - write operations from lpvo_usb_gpib 1584 + * skel_do_write() - write operations from lpvo_usb_gpib 1588 1585 */ 1589 1586 1590 1587 static ssize_t skel_do_write(struct usb_skel *dev, const char *buffer, size_t count) ··· 1689 1686 } 1690 1687 1691 1688 /* 1692 - * services for the user space devices 1689 + * services for the user space devices 1693 1690 */ 1694 1691 1695 1692 #if USER_DEVICE /* conditional compilation of user space device */ ··· 1774 1771 } 1775 1772 1776 1773 /* 1777 - * user space access to read function 1774 + * user space access to read function 1778 1775 */ 1779 1776 1780 1777 static ssize_t skel_read(struct file *file, char __user *buffer, size_t count, ··· 1803 1800 } 1804 1801 1805 1802 /* 1806 - * user space access to write function 1803 + * user space access to write function 1807 1804 */ 1808 1805 1809 1806 static ssize_t skel_write(struct file *file, const char __user *user_buffer,
+40 -32
drivers/staging/gpib/nec7210/nec7210.c
··· 23 23 MODULE_LICENSE("GPL"); 24 24 MODULE_DESCRIPTION("GPIB library code for NEC uPD7210"); 25 25 26 - int nec7210_enable_eos(struct gpib_board *board, struct nec7210_priv *priv, uint8_t eos_byte, 26 + int nec7210_enable_eos(struct gpib_board *board, struct nec7210_priv *priv, u8 eos_byte, 27 27 int compare_8_bits) 28 28 { 29 29 write_byte(priv, eos_byte, EOSR); ··· 44 44 } 45 45 EXPORT_SYMBOL(nec7210_disable_eos); 46 46 47 - int nec7210_parallel_poll(struct gpib_board *board, struct nec7210_priv *priv, uint8_t *result) 47 + int nec7210_parallel_poll(struct gpib_board *board, struct nec7210_priv *priv, u8 *result) 48 48 { 49 49 int ret; 50 50 ··· 79 79 write_byte(priv, AUX_CPPF, AUXMR); 80 80 } 81 81 EXPORT_SYMBOL(nec7210_parallel_poll_response); 82 - /* This is really only adequate for chips that do a 488.2 style reqt/reqf 82 + /* 83 + * This is really only adequate for chips that do a 488.2 style reqt/reqf 83 84 * based on bit 6 of the SPMR (see chapter 11.3.3 of 488.2). For simpler chips that simply 84 85 * set rsv directly based on bit 6, we either need to do more hardware setup to expose 85 86 * the 488.2 capability (for example with NI chips), or we need to implement the 86 87 * 488.2 set srv state machine in the driver (if that is even viable). 87 88 */ 88 89 void nec7210_serial_poll_response(struct gpib_board *board, 89 - struct nec7210_priv *priv, uint8_t status) 90 + struct nec7210_priv *priv, u8 status) 90 91 { 91 92 unsigned long flags; 92 93 ··· 104 103 } 105 104 EXPORT_SYMBOL(nec7210_serial_poll_response); 106 105 107 - uint8_t nec7210_serial_poll_status(struct gpib_board *board, struct nec7210_priv *priv) 106 + u8 nec7210_serial_poll_status(struct gpib_board *board, struct nec7210_priv *priv) 108 107 { 109 108 return read_byte(priv, SPSR); 110 109 } ··· 203 202 set_bit(SPOLL_NUM, &board->status); 204 203 } 205 204 206 - /* we rely on the interrupt handler to set the 205 + /* 206 + * we rely on the interrupt handler to set the 207 207 * rest of the status bits 208 208 */ 209 209 ··· 253 251 } 254 252 EXPORT_SYMBOL(nec7210_set_handshake_mode); 255 253 256 - uint8_t nec7210_read_data_in(struct gpib_board *board, struct nec7210_priv *priv, int *end) 254 + u8 nec7210_read_data_in(struct gpib_board *board, struct nec7210_priv *priv, int *end) 257 255 { 258 256 unsigned long flags; 259 257 u8 data; ··· 332 330 } 333 331 EXPORT_SYMBOL(nec7210_go_to_standby); 334 332 335 - void nec7210_request_system_control(struct gpib_board *board, struct nec7210_priv *priv, 336 - int request_control) 333 + int nec7210_request_system_control(struct gpib_board *board, struct nec7210_priv *priv, 334 + int request_control) 337 335 { 338 336 if (request_control == 0) { 339 337 write_byte(priv, AUX_CREN, AUXMR); 340 338 write_byte(priv, AUX_CIFC, AUXMR); 341 339 write_byte(priv, AUX_DSC, AUXMR); 342 340 } 341 + return 0; 343 342 } 344 343 EXPORT_SYMBOL(nec7210_request_system_control); 345 344 ··· 418 415 return -1; 419 416 } 420 417 421 - int nec7210_command(struct gpib_board *board, struct nec7210_priv *priv, uint8_t 418 + int nec7210_command(struct gpib_board *board, struct nec7210_priv *priv, u8 422 419 *buffer, size_t length, size_t *bytes_written) 423 420 { 424 421 int retval = 0; ··· 467 464 } 468 465 EXPORT_SYMBOL(nec7210_command); 469 466 470 - static int pio_read(struct gpib_board *board, struct nec7210_priv *priv, uint8_t *buffer, 467 + static int pio_read(struct gpib_board *board, struct nec7210_priv *priv, u8 *buffer, 471 468 size_t length, int *end, size_t *bytes_read) 472 469 { 473 470 ssize_t retval = 0; ··· 485 482 } 486 483 if (test_bit(READ_READY_BN, &priv->state)) { 487 484 if (*bytes_read == 0) { 488 - /* We set the handshake mode here because we know 485 + /* 486 + * We set the handshake mode here because we know 489 487 * no new bytes will arrive (it has already arrived 490 488 * and is awaiting being read out of the chip) while we are changing 491 489 * modes. This ensures we can reliably keep track ··· 572 568 return retval ? retval : count; 573 569 } 574 570 575 - static ssize_t dma_read(struct gpib_board *board, struct nec7210_priv *priv, uint8_t *buffer, 571 + static ssize_t dma_read(struct gpib_board *board, struct nec7210_priv *priv, u8 *buffer, 576 572 size_t length) 577 573 { 578 574 size_t remain = length; ··· 599 595 } 600 596 #endif 601 597 602 - int nec7210_read(struct gpib_board *board, struct nec7210_priv *priv, uint8_t *buffer, 598 + int nec7210_read(struct gpib_board *board, struct nec7210_priv *priv, u8 *buffer, 603 599 size_t length, int *end, size_t *bytes_read) 604 600 { 605 601 ssize_t retval = 0; ··· 646 642 return 0; 647 643 } 648 644 649 - static int pio_write(struct gpib_board *board, struct nec7210_priv *priv, uint8_t *buffer, 645 + static int pio_write(struct gpib_board *board, struct nec7210_priv *priv, u8 *buffer, 650 646 size_t length, size_t *bytes_written) 651 647 { 652 648 size_t last_count = 0; ··· 666 662 if (retval == -EIO) { 667 663 /* resend last byte on bus error */ 668 664 *bytes_written = last_count; 669 - /* we can get unrecoverable bus errors, 665 + /* 666 + * we can get unrecoverable bus errors, 670 667 * so give up after a while 671 668 */ 672 669 bus_error_count++; ··· 747 742 return retval ? retval : length; 748 743 } 749 744 750 - static ssize_t dma_write(struct gpib_board *board, struct nec7210_priv *priv, uint8_t *buffer, 745 + static ssize_t dma_write(struct gpib_board *board, struct nec7210_priv *priv, u8 *buffer, 751 746 size_t length) 752 747 { 753 748 size_t remain = length; ··· 772 767 } 773 768 #endif 774 769 int nec7210_write(struct gpib_board *board, struct nec7210_priv *priv, 775 - uint8_t *buffer, size_t length, int send_eoi, 770 + u8 *buffer, size_t length, int send_eoi, 776 771 size_t *bytes_written) 777 772 { 778 773 int retval = 0; ··· 810 805 if (send_eoi) { 811 806 size_t num_bytes; 812 807 813 - /* We need to wait to make sure we will immediately be able to write the data byte 808 + /* 809 + * We need to wait to make sure we will immediately be able to write the data byte 814 810 * into the chip before sending the associated AUX_SEOI command. This is really 815 811 * only needed for length==1 since otherwise the earlier calls to pio_write 816 812 * will have dont the wait already. ··· 833 827 EXPORT_SYMBOL(nec7210_write); 834 828 835 829 /* 836 - * interrupt service routine 830 + * interrupt service routine 837 831 */ 838 832 irqreturn_t nec7210_interrupt(struct gpib_board *board, struct nec7210_priv *priv) 839 833 { ··· 938 932 939 933 // ignore device clear events if we are controller in charge 940 934 if ((address_status_bits & HR_CIC) == 0) { 941 - push_gpib_event(board, EventDevClr); 935 + push_gpib_event(board, EVENT_DEV_CLR); 942 936 set_bit(DEV_CLEAR_BN, &priv->state); 943 937 } 944 938 } 945 939 946 940 if (status1 & HR_DET) 947 - push_gpib_event(board, EventDevTrg); 941 + push_gpib_event(board, EVENT_DEV_TRG); 948 942 949 943 // Addressing status has changed 950 944 if (status2 & HR_ADSC) ··· 1018 1012 1019 1013 #ifdef CONFIG_HAS_IOPORT 1020 1014 /* wrappers for io */ 1021 - uint8_t nec7210_ioport_read_byte(struct nec7210_priv *priv, unsigned int register_num) 1015 + u8 nec7210_ioport_read_byte(struct nec7210_priv *priv, unsigned int register_num) 1022 1016 { 1023 1017 return inb(priv->iobase + register_num * priv->offset); 1024 1018 } 1025 1019 EXPORT_SYMBOL(nec7210_ioport_read_byte); 1026 1020 1027 - void nec7210_ioport_write_byte(struct nec7210_priv *priv, uint8_t data, unsigned int register_num) 1021 + void nec7210_ioport_write_byte(struct nec7210_priv *priv, u8 data, unsigned int register_num) 1028 1022 { 1029 1023 if (register_num == AUXMR) 1030 - /* locking makes absolutely sure noone accesses the 1024 + /* 1025 + * locking makes absolutely sure noone accesses the 1031 1026 * AUXMR register faster than once per microsecond 1032 1027 */ 1033 1028 nec7210_locking_ioport_write_byte(priv, data, register_num); ··· 1038 1031 EXPORT_SYMBOL(nec7210_ioport_write_byte); 1039 1032 1040 1033 /* locking variants of io wrappers, for chips that page-in registers */ 1041 - uint8_t nec7210_locking_ioport_read_byte(struct nec7210_priv *priv, unsigned int register_num) 1034 + u8 nec7210_locking_ioport_read_byte(struct nec7210_priv *priv, unsigned int register_num) 1042 1035 { 1043 1036 u8 retval; 1044 1037 unsigned long flags; ··· 1050 1043 } 1051 1044 EXPORT_SYMBOL(nec7210_locking_ioport_read_byte); 1052 1045 1053 - void nec7210_locking_ioport_write_byte(struct nec7210_priv *priv, uint8_t data, 1046 + void nec7210_locking_ioport_write_byte(struct nec7210_priv *priv, u8 data, 1054 1047 unsigned int register_num) 1055 1048 { 1056 1049 unsigned long flags; ··· 1064 1057 EXPORT_SYMBOL(nec7210_locking_ioport_write_byte); 1065 1058 #endif 1066 1059 1067 - uint8_t nec7210_iomem_read_byte(struct nec7210_priv *priv, unsigned int register_num) 1060 + u8 nec7210_iomem_read_byte(struct nec7210_priv *priv, unsigned int register_num) 1068 1061 { 1069 1062 return readb(priv->mmiobase + register_num * priv->offset); 1070 1063 } 1071 1064 EXPORT_SYMBOL(nec7210_iomem_read_byte); 1072 1065 1073 - void nec7210_iomem_write_byte(struct nec7210_priv *priv, uint8_t data, unsigned int register_num) 1066 + void nec7210_iomem_write_byte(struct nec7210_priv *priv, u8 data, unsigned int register_num) 1074 1067 { 1075 1068 if (register_num == AUXMR) 1076 - /* locking makes absolutely sure noone accesses the 1069 + /* 1070 + * locking makes absolutely sure noone accesses the 1077 1071 * AUXMR register faster than once per microsecond 1078 1072 */ 1079 1073 nec7210_locking_iomem_write_byte(priv, data, register_num); ··· 1083 1075 } 1084 1076 EXPORT_SYMBOL(nec7210_iomem_write_byte); 1085 1077 1086 - uint8_t nec7210_locking_iomem_read_byte(struct nec7210_priv *priv, unsigned int register_num) 1078 + u8 nec7210_locking_iomem_read_byte(struct nec7210_priv *priv, unsigned int register_num) 1087 1079 { 1088 1080 u8 retval; 1089 1081 unsigned long flags; ··· 1095 1087 } 1096 1088 EXPORT_SYMBOL(nec7210_locking_iomem_read_byte); 1097 1089 1098 - void nec7210_locking_iomem_write_byte(struct nec7210_priv *priv, uint8_t data, 1090 + void nec7210_locking_iomem_write_byte(struct nec7210_priv *priv, u8 data, 1099 1091 unsigned int register_num) 1100 1092 { 1101 1093 unsigned long flags;
+41 -29
drivers/staging/gpib/ni_usb/ni_usb_gpib.c
··· 74 74 return 0xff; 75 75 else if (usec <= 300000000) 76 76 return 0x01; 77 - /* NI driver actually uses 0xff for timeout T1000s, which is a bug in their code. 77 + /* 78 + * NI driver actually uses 0xff for timeout T1000s, which is a bug in their code. 78 79 * I've verified on a usb-b that a code of 0x2 is correct for a 1000 sec timeout 79 80 */ 80 81 else if (usec <= 1000000000) ··· 233 232 mutex_unlock(&ni_priv->bulk_transfer_lock); 234 233 if (interruptible) { 235 234 if (wait_for_completion_interruptible(&context->complete)) { 236 - /* If we got interrupted by a signal while 235 + /* 236 + * If we got interrupted by a signal while 237 237 * waiting for the usb gpib to respond, we 238 238 * should send a stop command so it will 239 239 * finish up with whatever it was doing and ··· 242 240 */ 243 241 ni_usb_stop(ni_priv); 244 242 retval = -ERESTARTSYS; 245 - /* now do an uninterruptible wait, it shouldn't take long 246 - * for the board to respond now. 243 + /* 244 + * now do an uninterruptible wait, it shouldn't take long 245 + * for the board to respond now. 247 246 */ 248 247 wait_for_completion(&context->complete); 249 248 } ··· 589 586 } 590 587 591 588 // interface functions 592 - static int ni_usb_read(struct gpib_board *board, uint8_t *buffer, size_t length, 589 + static int ni_usb_read(struct gpib_board *board, u8 *buffer, size_t length, 593 590 int *end, size_t *bytes_read) 594 591 { 595 592 int retval, parse_retval; ··· 687 684 retval = 0; 688 685 break; 689 686 case NIUSB_ABORTED_ERROR: 690 - /* this is expected if ni_usb_receive_bulk_msg got 687 + /* 688 + * this is expected if ni_usb_receive_bulk_msg got 691 689 * interrupted by a signal and returned -ERESTARTSYS 692 690 */ 693 691 break; ··· 720 716 return retval; 721 717 } 722 718 723 - static int ni_usb_write(struct gpib_board *board, uint8_t *buffer, size_t length, 719 + static int ni_usb_write(struct gpib_board *board, u8 *buffer, size_t length, 724 720 int send_eoi, size_t *bytes_written) 725 721 { 726 722 int retval; ··· 798 794 retval = 0; 799 795 break; 800 796 case NIUSB_ABORTED_ERROR: 801 - /* this is expected if ni_usb_receive_bulk_msg got 797 + /* 798 + * this is expected if ni_usb_receive_bulk_msg got 802 799 * interrupted by a signal and returned -ERESTARTSYS 803 800 */ 804 801 break; ··· 824 819 return retval; 825 820 } 826 821 827 - static int ni_usb_command_chunk(struct gpib_board *board, uint8_t *buffer, size_t length, 822 + static int ni_usb_command_chunk(struct gpib_board *board, u8 *buffer, size_t length, 828 823 size_t *command_bytes_written) 829 824 { 830 825 int retval; ··· 898 893 case NIUSB_NO_ERROR: 899 894 break; 900 895 case NIUSB_ABORTED_ERROR: 901 - /* this is expected if ni_usb_receive_bulk_msg got 896 + /* 897 + * this is expected if ni_usb_receive_bulk_msg got 902 898 * interrupted by a signal and returned -ERESTARTSYS 903 899 */ 904 900 break; ··· 918 912 return 0; 919 913 } 920 914 921 - static int ni_usb_command(struct gpib_board *board, uint8_t *buffer, size_t length, 915 + static int ni_usb_command(struct gpib_board *board, u8 *buffer, size_t length, 922 916 size_t *bytes_written) 923 917 { 924 918 size_t count; ··· 1055 1049 return 0; 1056 1050 } 1057 1051 1058 - static void ni_usb_request_system_control(struct gpib_board *board, int request_control) 1052 + static int ni_usb_request_system_control(struct gpib_board *board, int request_control) 1059 1053 { 1060 1054 int retval; 1061 1055 struct ni_usb_priv *ni_priv = board->private_data; ··· 1065 1059 unsigned int ibsta; 1066 1060 1067 1061 if (!ni_priv->bus_interface) 1068 - return; // -ENODEV; 1062 + return -ENODEV; 1069 1063 usb_dev = interface_to_usbdev(ni_priv->bus_interface); 1070 1064 if (request_control) { 1071 1065 writes[i].device = NIUSB_SUBDEV_TNT4882; ··· 1097 1091 retval = ni_usb_write_registers(ni_priv, writes, i, &ibsta); 1098 1092 if (retval < 0) { 1099 1093 dev_err(&usb_dev->dev, "register write failed, retval=%i\n", retval); 1100 - return; // retval; 1094 + return retval; 1101 1095 } 1102 1096 if (!request_control) 1103 1097 ni_priv->ren_state = 0; 1104 1098 ni_usb_soft_update_status(board, ibsta, 0); 1105 - return; // 0; 1099 + return 0; 1106 1100 } 1107 1101 1108 1102 //FIXME maybe the interface should have a "pulse interface clear" function that can return an error? ··· 1182 1176 return;// 0; 1183 1177 } 1184 1178 1185 - static int ni_usb_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits) 1179 + static int ni_usb_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits) 1186 1180 { 1187 1181 struct ni_usb_priv *ni_priv = board->private_data; 1188 1182 ··· 1198 1192 static void ni_usb_disable_eos(struct gpib_board *board) 1199 1193 { 1200 1194 struct ni_usb_priv *ni_priv = board->private_data; 1201 - /* adapter gets unhappy if you don't zero all the bits 1202 - * for the eos mode and eos char (returns error 4 on reads). 1195 + /* 1196 + * adapter gets unhappy if you don't zero all the bits 1197 + * for the eos mode and eos char (returns error 4 on reads). 1203 1198 */ 1204 1199 ni_priv->eos_mode = 0; 1205 1200 ni_priv->eos_char = 0; ··· 1341 1334 return 0; 1342 1335 } 1343 1336 1344 - static int ni_usb_parallel_poll(struct gpib_board *board, uint8_t *result) 1337 + static int ni_usb_parallel_poll(struct gpib_board *board, u8 *result) 1345 1338 { 1346 1339 int retval; 1347 1340 struct ni_usb_priv *ni_priv = board->private_data; ··· 1396 1389 return retval; 1397 1390 } 1398 1391 1399 - static void ni_usb_parallel_poll_configure(struct gpib_board *board, uint8_t config) 1392 + static void ni_usb_parallel_poll_configure(struct gpib_board *board, u8 config) 1400 1393 { 1401 1394 int retval; 1402 1395 struct ni_usb_priv *ni_priv = board->private_data; ··· 1474 1467 return;// 0; 1475 1468 } 1476 1469 1477 - static uint8_t ni_usb_serial_poll_status(struct gpib_board *board) 1470 + static u8 ni_usb_serial_poll_status(struct gpib_board *board) 1478 1471 { 1479 1472 return 0; 1480 1473 } ··· 2052 2045 unexpected = 1; 2053 2046 } 2054 2047 ++j; 2055 - // MC usb-488 (and sometimes NI-USB-HS?) sends 0x8 here; MC usb-488A sends 0x7 here 2056 - // NI-USB-HS+ sends 0x0 2048 + /* 2049 + * MC usb-488 (and sometimes NI-USB-HS?) sends 0x8 here; MC usb-488A sends 0x7 here 2050 + * NI-USB-HS+ sends 0x0 2051 + */ 2057 2052 if (buffer[j] != 0x1 && buffer[j] != 0x8 && buffer[j] != 0x7 && buffer[j] != 0x0) { 2058 2053 // [3] 2059 2054 dev_err(&usb_dev->dev, "unexpected data: buffer[%i]=0x%x, expected 0x0, 0x1, 0x7 or 0x8\n", ··· 2136 2127 return retval; 2137 2128 } 2138 2129 2139 - /* This does some extra init for HS+ models, as observed on Windows. One of the 2130 + /* 2131 + * This does some extra init for HS+ models, as observed on Windows. One of the 2140 2132 * control requests causes the LED to stop blinking. 2141 2133 * I'm not sure what the other 2 requests do. None of these requests are actually required 2142 2134 * for the adapter to work, maybe they do some init for the analyzer interface ··· 2208 2198 } 2209 2199 2210 2200 static inline int ni_usb_device_match(struct usb_interface *interface, 2211 - const gpib_board_config_t *config) 2201 + const struct gpib_board_config *config) 2212 2202 { 2213 2203 if (gpib_match_device_path(&interface->dev, config->device_path) == 0) 2214 2204 return 0; 2215 2205 return 1; 2216 2206 } 2217 2207 2218 - static int ni_usb_attach(struct gpib_board *board, const gpib_board_config_t *config) 2208 + static int ni_usb_attach(struct gpib_board *board, const struct gpib_board_config *config) 2219 2209 { 2220 2210 int retval; 2221 2211 int i, index; ··· 2353 2343 struct ni_usb_priv *ni_priv; 2354 2344 2355 2345 mutex_lock(&ni_usb_hotplug_lock); 2356 - // under windows, software unplug does chip_reset nec7210 aux command, 2357 - // then writes 0x0 to address 0x10 of device 3 2346 + /* 2347 + * under windows, software unplug does chip_reset nec7210 aux command, 2348 + * then writes 0x0 to address 0x10 of device 3 2349 + */ 2358 2350 ni_priv = board->private_data; 2359 2351 if (ni_priv) { 2360 2352 if (ni_priv->bus_interface) { ··· 2373 2361 mutex_unlock(&ni_usb_hotplug_lock); 2374 2362 } 2375 2363 2376 - static gpib_interface_t ni_usb_gpib_interface = { 2364 + static struct gpib_interface ni_usb_gpib_interface = { 2377 2365 .name = "ni_usb_b", 2378 2366 .attach = ni_usb_attach, 2379 2367 .detach = ni_usb_detach,
+21 -11
drivers/staging/gpib/ni_usb/ni_usb_gpib.h
··· 113 113 114 114 enum ni_usb_error_codes { 115 115 NIUSB_NO_ERROR = 0, 116 - /* NIUSB_ABORTED_ERROR occurs when I/O is interrupted early by 117 - * doing a NI_USB_STOP_REQUEST on the control endpoint. 116 + /* 117 + * NIUSB_ABORTED_ERROR occurs when I/O is interrupted early by 118 + * doing a NI_USB_STOP_REQUEST on the control endpoint. 118 119 */ 119 120 NIUSB_ABORTED_ERROR = 1, 120 - // NIUSB_READ_ATN_ERROR occurs when you do a board read while 121 - // ATN is set 121 + /* 122 + * NIUSB_READ_ATN_ERROR occurs when you do a board read while 123 + * ATN is set 124 + */ 122 125 NIUSB_ATN_STATE_ERROR = 2, 123 - // NIUSB_ADDRESSING_ERROR occurs when you do a board 124 - // read/write as CIC but are not in LACS/TACS 126 + /* 127 + * NIUSB_ADDRESSING_ERROR occurs when you do a board 128 + * read/write as CIC but are not in LACS/TACS 129 + */ 125 130 NIUSB_ADDRESSING_ERROR = 3, 126 - /* NIUSB_EOSMODE_ERROR occurs on reads if any eos mode or char 131 + /* 132 + * NIUSB_EOSMODE_ERROR occurs on reads if any eos mode or char 127 133 * bits are set when REOS is not set. 128 134 * Have also seen error 4 if you try to send more than 16 129 135 * command bytes at once on a usb-b. 130 136 */ 131 137 NIUSB_EOSMODE_ERROR = 4, 132 - // NIUSB_NO_BUS_ERROR occurs when you try to write a command 133 - // byte but there are no devices connected to the gpib bus 138 + /* 139 + * NIUSB_NO_BUS_ERROR occurs when you try to write a command 140 + * byte but there are no devices connected to the gpib bus 141 + */ 134 142 NIUSB_NO_BUS_ERROR = 5, 135 - // NIUSB_NO_LISTENER_ERROR occurs when you do a board write as 136 - // CIC with no listener 143 + /* 144 + * NIUSB_NO_LISTENER_ERROR occurs when you do a board write as 145 + * CIC with no listener 146 + */ 137 147 NIUSB_NO_LISTENER_ERROR = 8, 138 148 // get NIUSB_TIMEOUT_ERROR on board read/write timeout 139 149 NIUSB_TIMEOUT_ERROR = 10,
+24 -22
drivers/staging/gpib/pc2/pc2_gpib.c
··· 90 90 } 91 91 92 92 // wrappers for interface functions 93 - static int pc2_read(struct gpib_board *board, uint8_t *buffer, size_t length, int *end, 93 + static int pc2_read(struct gpib_board *board, u8 *buffer, size_t length, int *end, 94 94 size_t *bytes_read) 95 95 { 96 96 struct pc2_priv *priv = board->private_data; ··· 98 98 return nec7210_read(board, &priv->nec7210_priv, buffer, length, end, bytes_read); 99 99 } 100 100 101 - static int pc2_write(struct gpib_board *board, uint8_t *buffer, size_t length, int send_eoi, 101 + static int pc2_write(struct gpib_board *board, u8 *buffer, size_t length, int send_eoi, 102 102 size_t *bytes_written) 103 103 { 104 104 struct pc2_priv *priv = board->private_data; ··· 106 106 return nec7210_write(board, &priv->nec7210_priv, buffer, length, send_eoi, bytes_written); 107 107 } 108 108 109 - static int pc2_command(struct gpib_board *board, uint8_t *buffer, size_t length, size_t *bytes_written) 109 + static int pc2_command(struct gpib_board *board, u8 *buffer, 110 + size_t length, size_t *bytes_written) 110 111 { 111 112 struct pc2_priv *priv = board->private_data; 112 113 ··· 128 127 return nec7210_go_to_standby(board, &priv->nec7210_priv); 129 128 } 130 129 131 - static void pc2_request_system_control(struct gpib_board *board, int request_control) 130 + static int pc2_request_system_control(struct gpib_board *board, int request_control) 132 131 { 133 132 struct pc2_priv *priv = board->private_data; 134 133 135 - nec7210_request_system_control(board, &priv->nec7210_priv, request_control); 134 + return nec7210_request_system_control(board, &priv->nec7210_priv, request_control); 136 135 } 137 136 138 137 static void pc2_interface_clear(struct gpib_board *board, int assert) ··· 149 148 nec7210_remote_enable(board, &priv->nec7210_priv, enable); 150 149 } 151 150 152 - static int pc2_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits) 151 + static int pc2_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits) 153 152 { 154 153 struct pc2_priv *priv = board->private_data; 155 154 ··· 184 183 return nec7210_secondary_address(board, &priv->nec7210_priv, address, enable); 185 184 } 186 185 187 - static int pc2_parallel_poll(struct gpib_board *board, uint8_t *result) 186 + static int pc2_parallel_poll(struct gpib_board *board, u8 *result) 188 187 { 189 188 struct pc2_priv *priv = board->private_data; 190 189 191 190 return nec7210_parallel_poll(board, &priv->nec7210_priv, result); 192 191 } 193 192 194 - static void pc2_parallel_poll_configure(struct gpib_board *board, uint8_t config) 193 + static void pc2_parallel_poll_configure(struct gpib_board *board, u8 config) 195 194 { 196 195 struct pc2_priv *priv = board->private_data; 197 196 ··· 205 204 nec7210_parallel_poll_response(board, &priv->nec7210_priv, ist); 206 205 } 207 206 208 - static void pc2_serial_poll_response(struct gpib_board *board, uint8_t status) 207 + static void pc2_serial_poll_response(struct gpib_board *board, u8 status) 209 208 { 210 209 struct pc2_priv *priv = board->private_data; 211 210 212 211 nec7210_serial_poll_response(board, &priv->nec7210_priv, status); 213 212 } 214 213 215 - static uint8_t pc2_serial_poll_status(struct gpib_board *board) 214 + static u8 pc2_serial_poll_status(struct gpib_board *board) 216 215 { 217 216 struct pc2_priv *priv = board->private_data; 218 217 ··· 252 251 board->private_data = NULL; 253 252 } 254 253 255 - static int pc2_generic_attach(struct gpib_board *board, const gpib_board_config_t *config, 254 + static int pc2_generic_attach(struct gpib_board *board, const struct gpib_board_config *config, 256 255 enum nec7210_chipset chipset) 257 256 { 258 257 struct pc2_priv *pc2_priv; ··· 268 267 nec_priv->type = chipset; 269 268 270 269 #ifndef PC2_DMA 271 - /* board->dev hasn't been initialized, so forget about DMA until this driver 272 - * is adapted to use isa_register_driver. 270 + /* 271 + * board->dev hasn't been initialized, so forget about DMA until this driver 272 + * is adapted to use isa_register_driver. 273 273 */ 274 274 if (config->ibdma) 275 275 // driver needs to be adapted to use isa_register_driver to get a struct device* ··· 296 294 return 0; 297 295 } 298 296 299 - static int pc2_attach(struct gpib_board *board, const gpib_board_config_t *config) 297 + static int pc2_attach(struct gpib_board *board, const struct gpib_board_config *config) 300 298 { 301 299 int isr_flags = 0; 302 300 struct pc2_priv *pc2_priv; ··· 367 365 free_private(board); 368 366 } 369 367 370 - static int pc2a_common_attach(struct gpib_board *board, const gpib_board_config_t *config, 368 + static int pc2a_common_attach(struct gpib_board *board, const struct gpib_board_config *config, 371 369 unsigned int num_registers, enum nec7210_chipset chipset) 372 370 { 373 371 unsigned int i, j; ··· 461 459 return 0; 462 460 } 463 461 464 - static int pc2a_attach(struct gpib_board *board, const gpib_board_config_t *config) 462 + static int pc2a_attach(struct gpib_board *board, const struct gpib_board_config *config) 465 463 { 466 464 return pc2a_common_attach(board, config, pc2a_iosize, NEC7210); 467 465 } 468 466 469 - static int pc2a_cb7210_attach(struct gpib_board *board, const gpib_board_config_t *config) 467 + static int pc2a_cb7210_attach(struct gpib_board *board, const struct gpib_board_config *config) 470 468 { 471 469 return pc2a_common_attach(board, config, pc2a_iosize, CB7210); 472 470 } 473 471 474 - static int pc2_2a_attach(struct gpib_board *board, const gpib_board_config_t *config) 472 + static int pc2_2a_attach(struct gpib_board *board, const struct gpib_board_config *config) 475 473 { 476 474 return pc2a_common_attach(board, config, pc2_2a_iosize, NAT4882); 477 475 } ··· 519 517 pc2a_common_detach(board, pc2_2a_iosize); 520 518 } 521 519 522 - static gpib_interface_t pc2_interface = { 520 + static struct gpib_interface pc2_interface = { 523 521 .name = "pcII", 524 522 .attach = pc2_attach, 525 523 .detach = pc2_detach, ··· 547 545 .return_to_local = pc2_return_to_local, 548 546 }; 549 547 550 - static gpib_interface_t pc2a_interface = { 548 + static struct gpib_interface pc2a_interface = { 551 549 .name = "pcIIa", 552 550 .attach = pc2a_attach, 553 551 .detach = pc2a_detach, ··· 575 573 .return_to_local = pc2_return_to_local, 576 574 }; 577 575 578 - static gpib_interface_t pc2a_cb7210_interface = { 576 + static struct gpib_interface pc2a_cb7210_interface = { 579 577 .name = "pcIIa_cb7210", 580 578 .attach = pc2a_cb7210_attach, 581 579 .detach = pc2a_detach, ··· 603 601 .return_to_local = pc2_return_to_local, 604 602 }; 605 603 606 - static gpib_interface_t pc2_2a_interface = { 604 + static struct gpib_interface pc2_2a_interface = { 607 605 .name = "pcII_IIa", 608 606 .attach = pc2_2a_attach, 609 607 .detach = pc2_2a_detach,
+39 -30
drivers/staging/gpib/tms9914/tms9914.c
··· 53 53 } 54 54 EXPORT_SYMBOL_GPL(tms9914_take_control); 55 55 56 - /* The agilent 82350B has a buggy implementation of tcs which interferes with the 56 + /* 57 + * The agilent 82350B has a buggy implementation of tcs which interferes with the 57 58 * operation of tca. It appears to be based on the controller state machine 58 59 * described in the TI 9900 TMS9914A data manual published in 1982. This 59 60 * manual describes tcs as putting the controller into a CWAS ··· 67 66 * The rest of the tms9914 based drivers still use tms9914_take_control 68 67 * directly (which does issue tcs). 69 68 */ 70 - int tms9914_take_control_workaround(struct gpib_board *board, struct tms9914_priv *priv, int synchronous) 69 + int tms9914_take_control_workaround(struct gpib_board *board, 70 + struct tms9914_priv *priv, int synchronous) 71 71 { 72 72 if (synchronous) 73 73 return -ETIMEDOUT; ··· 118 116 } 119 117 EXPORT_SYMBOL_GPL(tms9914_remote_enable); 120 118 121 - void tms9914_request_system_control(struct gpib_board *board, struct tms9914_priv *priv, 122 - int request_control) 119 + int tms9914_request_system_control(struct gpib_board *board, struct tms9914_priv *priv, 120 + int request_control) 123 121 { 124 122 if (request_control) { 125 123 write_byte(priv, AUX_RQC, AUXCR); ··· 127 125 clear_bit(CIC_NUM, &board->status); 128 126 write_byte(priv, AUX_RLC, AUXCR); 129 127 } 128 + return 0; 130 129 } 131 130 EXPORT_SYMBOL_GPL(tms9914_request_system_control); 132 131 ··· 195 192 } 196 193 EXPORT_SYMBOL_GPL(tms9914_release_holdoff); 197 194 198 - int tms9914_enable_eos(struct gpib_board *board, struct tms9914_priv *priv, uint8_t eos_byte, 195 + int tms9914_enable_eos(struct gpib_board *board, struct tms9914_priv *priv, u8 eos_byte, 199 196 int compare_8_bits) 200 197 { 201 198 priv->eos = eos_byte; ··· 212 209 } 213 210 EXPORT_SYMBOL(tms9914_disable_eos); 214 211 215 - int tms9914_parallel_poll(struct gpib_board *board, struct tms9914_priv *priv, uint8_t *result) 212 + int tms9914_parallel_poll(struct gpib_board *board, struct tms9914_priv *priv, u8 *result) 216 213 { 217 214 // execute parallel poll 218 215 write_byte(priv, AUX_CS | AUX_RPP, AUXCR); ··· 238 235 } 239 236 240 237 void tms9914_parallel_poll_configure(struct gpib_board *board, 241 - struct tms9914_priv *priv, uint8_t config) 238 + struct tms9914_priv *priv, u8 config) 242 239 { 243 240 priv->ppoll_enable = (config & PPC_DISABLE) == 0; 244 241 priv->ppoll_line = (config & PPC_DIO_MASK) + 1; ··· 254 251 } 255 252 EXPORT_SYMBOL(tms9914_parallel_poll_response); 256 253 257 - void tms9914_serial_poll_response(struct gpib_board *board, struct tms9914_priv *priv, uint8_t status) 254 + void tms9914_serial_poll_response(struct gpib_board *board, 255 + struct tms9914_priv *priv, u8 status) 258 256 { 259 257 unsigned long flags; 260 258 ··· 270 266 } 271 267 EXPORT_SYMBOL(tms9914_serial_poll_response); 272 268 273 - uint8_t tms9914_serial_poll_status(struct gpib_board *board, struct tms9914_priv *priv) 269 + u8 tms9914_serial_poll_status(struct gpib_board *board, struct tms9914_priv *priv) 274 270 { 275 271 u8 status; 276 272 unsigned long flags; ··· 283 279 } 284 280 EXPORT_SYMBOL(tms9914_serial_poll_status); 285 281 286 - int tms9914_primary_address(struct gpib_board *board, struct tms9914_priv *priv, unsigned int address) 282 + int tms9914_primary_address(struct gpib_board *board, 283 + struct tms9914_priv *priv, unsigned int address) 287 284 { 288 285 // put primary address in address0 289 286 write_byte(priv, address & ADDRESS_MASK, ADR); ··· 326 321 if (address_status_bits & HR_ATN) 327 322 priv->talker_state = talker_addressed; 328 323 else 329 - /* this could also be serial_poll_active, but the tms9914 provides no 324 + /* 325 + * this could also be serial_poll_active, but the tms9914 provides no 330 326 * way to distinguish, so we'll assume talker_active 331 327 */ 332 328 priv->talker_state = talker_active; ··· 422 416 } 423 417 EXPORT_SYMBOL(tms9914_line_status); 424 418 425 - static int check_for_eos(struct tms9914_priv *priv, uint8_t byte) 419 + static int check_for_eos(struct tms9914_priv *priv, u8 byte) 426 420 { 427 421 static const u8 seven_bit_compare_mask = 0x7f; 428 422 ··· 455 449 return 0; 456 450 } 457 451 458 - static inline uint8_t tms9914_read_data_in(struct gpib_board *board, struct tms9914_priv *priv, int *end) 452 + static inline u8 tms9914_read_data_in(struct gpib_board *board, 453 + struct tms9914_priv *priv, int *end) 459 454 { 460 455 unsigned long flags; 461 456 u8 data; ··· 487 480 return data; 488 481 } 489 482 490 - static int pio_read(struct gpib_board *board, struct tms9914_priv *priv, uint8_t *buffer, 483 + static int pio_read(struct gpib_board *board, struct tms9914_priv *priv, u8 *buffer, 491 484 size_t length, int *end, size_t *bytes_read) 492 485 { 493 486 ssize_t retval = 0; ··· 508 501 return retval; 509 502 } 510 503 511 - int tms9914_read(struct gpib_board *board, struct tms9914_priv *priv, uint8_t *buffer, 504 + int tms9914_read(struct gpib_board *board, struct tms9914_priv *priv, u8 *buffer, 512 505 size_t length, int *end, size_t *bytes_read) 513 506 { 514 507 ssize_t retval = 0; ··· 568 561 return 0; 569 562 } 570 563 571 - static int pio_write(struct gpib_board *board, struct tms9914_priv *priv, uint8_t *buffer, 564 + static int pio_write(struct gpib_board *board, struct tms9914_priv *priv, u8 *buffer, 572 565 size_t length, size_t *bytes_written) 573 566 { 574 567 ssize_t retval = 0; ··· 592 585 return length; 593 586 } 594 587 595 - int tms9914_write(struct gpib_board *board, struct tms9914_priv *priv, uint8_t *buffer, size_t length, 596 - int send_eoi, size_t *bytes_written) 588 + int tms9914_write(struct gpib_board *board, struct tms9914_priv *priv, 589 + u8 *buffer, size_t length, int send_eoi, size_t *bytes_written) 597 590 { 598 591 ssize_t retval = 0; 599 592 ··· 627 620 } 628 621 EXPORT_SYMBOL(tms9914_write); 629 622 630 - static void check_my_address_state(struct gpib_board *board, struct tms9914_priv *priv, int cmd_byte) 623 + static void check_my_address_state(struct gpib_board *board, 624 + struct tms9914_priv *priv, int cmd_byte) 631 625 { 632 626 if (cmd_byte == MLA(board->pad)) { 633 627 priv->primary_listen_addressed = 1; ··· 663 655 } 664 656 } 665 657 666 - int tms9914_command(struct gpib_board *board, struct tms9914_priv *priv, uint8_t *buffer, 658 + int tms9914_command(struct gpib_board *board, struct tms9914_priv *priv, u8 *buffer, 667 659 size_t length, size_t *bytes_written) 668 660 { 669 661 int retval = 0; ··· 744 736 unsigned short command_byte = read_byte(priv, CPTR) & gpib_command_mask; 745 737 746 738 switch (command_byte) { 747 - case PPConfig: 739 + case PP_CONFIG: 748 740 priv->ppoll_configure_state = 1; 749 - /* AUX_PTS generates another UNC interrupt on the next command byte 741 + /* 742 + * AUX_PTS generates another UNC interrupt on the next command byte 750 743 * if it is in the secondary address group (such as PPE and PPD). 751 744 */ 752 745 write_byte(priv, AUX_PTS, AUXCR); ··· 773 764 break; 774 765 } 775 766 776 - if (in_primary_command_group(command_byte) && command_byte != PPConfig) 767 + if (in_primary_command_group(command_byte) && command_byte != PP_CONFIG) 777 768 priv->ppoll_configure_state = 0; 778 769 } 779 770 ··· 783 774 } 784 775 785 776 if (status1 & HR_IFC) { 786 - push_gpib_event(board, EventIFC); 777 + push_gpib_event(board, EVENT_IFC); 787 778 clear_bit(CIC_NUM, &board->status); 788 779 } 789 780 790 781 if (status1 & HR_GET) { 791 - push_gpib_event(board, EventDevTrg); 782 + push_gpib_event(board, EVENT_DEV_TRG); 792 783 // clear dac holdoff 793 784 write_byte(priv, AUX_VAL, AUXCR); 794 785 } 795 786 796 787 if (status1 & HR_DCAS) { 797 - push_gpib_event(board, EventDevClr); 788 + push_gpib_event(board, EVENT_DEV_CLR); 798 789 // clear dac holdoff 799 790 write_byte(priv, AUX_VAL, AUXCR); 800 791 set_bit(DEV_CLEAR_BN, &priv->state); ··· 868 859 869 860 #ifdef CONFIG_HAS_IOPORT 870 861 // wrapper for inb 871 - uint8_t tms9914_ioport_read_byte(struct tms9914_priv *priv, unsigned int register_num) 862 + u8 tms9914_ioport_read_byte(struct tms9914_priv *priv, unsigned int register_num) 872 863 { 873 864 return inb(priv->iobase + register_num * priv->offset); 874 865 } 875 866 EXPORT_SYMBOL_GPL(tms9914_ioport_read_byte); 876 867 877 868 // wrapper for outb 878 - void tms9914_ioport_write_byte(struct tms9914_priv *priv, uint8_t data, unsigned int register_num) 869 + void tms9914_ioport_write_byte(struct tms9914_priv *priv, u8 data, unsigned int register_num) 879 870 { 880 871 outb(data, priv->iobase + register_num * priv->offset); 881 872 if (register_num == AUXCR) ··· 885 876 #endif 886 877 887 878 // wrapper for readb 888 - uint8_t tms9914_iomem_read_byte(struct tms9914_priv *priv, unsigned int register_num) 879 + u8 tms9914_iomem_read_byte(struct tms9914_priv *priv, unsigned int register_num) 889 880 { 890 881 return readb(priv->mmiobase + register_num * priv->offset); 891 882 } 892 883 EXPORT_SYMBOL_GPL(tms9914_iomem_read_byte); 893 884 894 885 // wrapper for writeb 895 - void tms9914_iomem_write_byte(struct tms9914_priv *priv, uint8_t data, unsigned int register_num) 886 + void tms9914_iomem_write_byte(struct tms9914_priv *priv, u8 data, unsigned int register_num) 896 887 { 897 888 writeb(data, priv->mmiobase + register_num * priv->offset); 898 889 if (register_num == AUXCR)
+57 -49
drivers/staging/gpib/tnt4882/tnt4882_gpib.c
··· 236 236 return retval; 237 237 } 238 238 239 - static int drain_fifo_words(struct tnt4882_priv *tnt_priv, uint8_t *buffer, int num_bytes) 239 + static int drain_fifo_words(struct tnt4882_priv *tnt_priv, u8 *buffer, int num_bytes) 240 240 { 241 241 int count = 0; 242 242 struct nec7210_priv *nec_priv = &tnt_priv->nec7210_priv; ··· 258 258 259 259 sasr_bits = tnt_readb(tnt_priv, SASR); 260 260 261 - /*tnt4882 not in one-chip mode won't always release holdoff unless we 261 + /* 262 + * tnt4882 not in one-chip mode won't always release holdoff unless we 262 263 * are in the right mode when release handshake command is given 263 264 */ 264 265 if (sasr_bits & AEHS_BIT) /* holding off due to holdoff on end mode*/ { ··· 275 274 } 276 275 } 277 276 278 - static int tnt4882_accel_read(struct gpib_board *board, uint8_t *buffer, size_t length, int *end, 277 + static int tnt4882_accel_read(struct gpib_board *board, u8 *buffer, size_t length, int *end, 279 278 size_t *bytes_read) 280 279 { 281 280 size_t count = 0; ··· 385 384 386 385 nec7210_set_reg_bits(nec_priv, IMR1, HR_ENDIE, 0); 387 386 nec7210_set_reg_bits(nec_priv, IMR2, HR_DMAI, 0); 388 - /* force handling of any pending interrupts (seems to be needed 387 + /* 388 + * force handling of any pending interrupts (seems to be needed 389 389 * to keep interrupts from getting hosed, plus for syncing 390 390 * with RECEIVED_END below) 391 391 */ ··· 450 448 return 0; 451 449 } 452 450 453 - static int generic_write(struct gpib_board *board, uint8_t *buffer, size_t length, 451 + static int generic_write(struct gpib_board *board, u8 *buffer, size_t length, 454 452 int send_eoi, int send_commands, size_t *bytes_written) 455 453 { 456 454 size_t count = 0; ··· 533 531 534 532 nec7210_set_reg_bits(nec_priv, IMR1, HR_ERR, 0x0); 535 533 nec7210_set_reg_bits(nec_priv, IMR2, HR_DMAO, 0x0); 536 - /* force handling of any interrupts that happened 534 + /* 535 + * force handling of any interrupts that happened 537 536 * while they were masked (this appears to be needed) 538 537 */ 539 538 tnt4882_internal_interrupt(board); ··· 542 539 return retval; 543 540 } 544 541 545 - static int tnt4882_accel_write(struct gpib_board *board, uint8_t *buffer, size_t length, int send_eoi, 546 - size_t *bytes_written) 542 + static int tnt4882_accel_write(struct gpib_board *board, u8 *buffer, 543 + size_t length, int send_eoi, size_t *bytes_written) 547 544 { 548 545 return generic_write(board, buffer, length, send_eoi, 0, bytes_written); 549 546 } 550 547 551 - static int tnt4882_command(struct gpib_board *board, uint8_t *buffer, size_t length, 548 + static int tnt4882_command(struct gpib_board *board, u8 *buffer, size_t length, 552 549 size_t *bytes_written) 553 550 { 554 551 return generic_write(board, buffer, length, 0, 1, bytes_written); ··· 569 566 imr3_bits = priv->imr3_bits; 570 567 571 568 if (isr0_bits & TNT_IFCI_BIT) 572 - push_gpib_event(board, EventIFC); 569 + push_gpib_event(board, EVENT_IFC); 573 570 //XXX don't need this wakeup, one below should do? 574 571 // wake_up_interruptible(&board->wait); 575 572 ··· 595 592 } 596 593 597 594 // wrappers for interface functions 598 - static int tnt4882_read(struct gpib_board *board, uint8_t *buffer, size_t length, int *end, 595 + static int tnt4882_read(struct gpib_board *board, u8 *buffer, size_t length, int *end, 599 596 size_t *bytes_read) 600 597 { 601 598 struct tnt4882_priv *priv = board->private_data; ··· 615 612 return retval; 616 613 } 617 614 618 - static int tnt4882_write(struct gpib_board *board, uint8_t *buffer, size_t length, int send_eoi, 615 + static int tnt4882_write(struct gpib_board *board, u8 *buffer, size_t length, int send_eoi, 619 616 size_t *bytes_written) 620 617 { 621 618 struct tnt4882_priv *priv = board->private_data; ··· 623 620 return nec7210_write(board, &priv->nec7210_priv, buffer, length, send_eoi, bytes_written); 624 621 } 625 622 626 - static int tnt4882_command_unaccel(struct gpib_board *board, uint8_t *buffer, 623 + static int tnt4882_command_unaccel(struct gpib_board *board, u8 *buffer, 627 624 size_t length, size_t *bytes_written) 628 625 { 629 626 struct tnt4882_priv *priv = board->private_data; ··· 645 642 return nec7210_go_to_standby(board, &priv->nec7210_priv); 646 643 } 647 644 648 - static void tnt4882_request_system_control(struct gpib_board *board, int request_control) 645 + static int tnt4882_request_system_control(struct gpib_board *board, int request_control) 649 646 { 650 647 struct tnt4882_priv *priv = board->private_data; 648 + int retval; 651 649 652 650 if (request_control) { 653 651 tnt_writeb(priv, SETSC, CMDR); 654 652 udelay(1); 655 653 } 656 - nec7210_request_system_control(board, &priv->nec7210_priv, request_control); 654 + retval = nec7210_request_system_control(board, &priv->nec7210_priv, request_control); 657 655 if (!request_control) { 658 656 tnt_writeb(priv, CLRSC, CMDR); 659 657 udelay(1); 660 658 } 659 + return retval; 661 660 } 662 661 663 662 static void tnt4882_interface_clear(struct gpib_board *board, int assert) ··· 676 671 nec7210_remote_enable(board, &priv->nec7210_priv, enable); 677 672 } 678 673 679 - static int tnt4882_enable_eos(struct gpib_board *board, uint8_t eos_byte, int compare_8_bits) 674 + static int tnt4882_enable_eos(struct gpib_board *board, u8 eos_byte, int compare_8_bits) 680 675 { 681 676 struct tnt4882_priv *priv = board->private_data; 682 677 ··· 723 718 return nec7210_secondary_address(board, &priv->nec7210_priv, address, enable); 724 719 } 725 720 726 - static int tnt4882_parallel_poll(struct gpib_board *board, uint8_t *result) 721 + static int tnt4882_parallel_poll(struct gpib_board *board, u8 *result) 727 722 { 728 723 struct tnt4882_priv *tnt_priv = board->private_data; 729 724 ··· 740 735 } 741 736 } 742 737 743 - static void tnt4882_parallel_poll_configure(struct gpib_board *board, uint8_t config) 738 + static void tnt4882_parallel_poll_configure(struct gpib_board *board, u8 config) 744 739 { 745 740 struct tnt4882_priv *priv = board->private_data; 746 741 ··· 765 760 nec7210_parallel_poll_response(board, &priv->nec7210_priv, ist); 766 761 } 767 762 768 - /* this is just used by the old nec7210 isa interfaces, the newer 763 + /* 764 + * this is just used by the old nec7210 isa interfaces, the newer 769 765 * boards use tnt4882_serial_poll_response2 770 766 */ 771 - static void tnt4882_serial_poll_response(struct gpib_board *board, uint8_t status) 767 + static void tnt4882_serial_poll_response(struct gpib_board *board, u8 status) 772 768 { 773 769 struct tnt4882_priv *priv = board->private_data; 774 770 775 771 nec7210_serial_poll_response(board, &priv->nec7210_priv, status); 776 772 } 777 773 778 - static void tnt4882_serial_poll_response2(struct gpib_board *board, uint8_t status, 774 + static void tnt4882_serial_poll_response2(struct gpib_board *board, u8 status, 779 775 int new_reason_for_service) 780 776 { 781 777 struct tnt4882_priv *priv = board->private_data; ··· 794 788 priv->nec7210_priv.srq_pending = 0; 795 789 } 796 790 if (reqt) 797 - /* It may seem like a race to issue reqt before updating 791 + /* 792 + * It may seem like a race to issue reqt before updating 798 793 * the status byte, but it is not. The chip does not 799 794 * issue the reqt until the SPMR is written to at 800 795 * a later time. ··· 803 796 write_byte(&priv->nec7210_priv, AUX_REQT, AUXMR); 804 797 else if (reqf) 805 798 write_byte(&priv->nec7210_priv, AUX_REQF, AUXMR); 806 - /* We need to always zero bit 6 of the status byte before writing it to 799 + /* 800 + * We need to always zero bit 6 of the status byte before writing it to 807 801 * the SPMR to insure we are using 808 802 * serial poll mode SP1, and not accidentally triggering mode SP3. 809 803 */ ··· 812 804 spin_unlock_irqrestore(&board->spinlock, flags); 813 805 } 814 806 815 - static uint8_t tnt4882_serial_poll_status(struct gpib_board *board) 807 + static u8 tnt4882_serial_poll_status(struct gpib_board *board) 816 808 { 817 809 struct tnt4882_priv *priv = board->private_data; 818 810 ··· 906 898 tnt_writeb(tnt_priv, tnt_priv->imr0_bits, IMR0); 907 899 } 908 900 909 - static int ni_pci_attach(struct gpib_board *board, const gpib_board_config_t *config) 901 + static int ni_pci_attach(struct gpib_board *board, const struct gpib_board_config *config) 910 902 { 911 903 struct tnt4882_priv *tnt_priv; 912 904 struct nec7210_priv *nec_priv; ··· 1027 1019 return 0; 1028 1020 } 1029 1021 1030 - static int ni_isa_attach_common(struct gpib_board *board, const gpib_board_config_t *config, 1022 + static int ni_isa_attach_common(struct gpib_board *board, const struct gpib_board_config *config, 1031 1023 enum nec7210_chipset chipset) 1032 1024 { 1033 1025 struct tnt4882_priv *tnt_priv; ··· 1083 1075 return 0; 1084 1076 } 1085 1077 1086 - static int ni_tnt_isa_attach(struct gpib_board *board, const gpib_board_config_t *config) 1078 + static int ni_tnt_isa_attach(struct gpib_board *board, const struct gpib_board_config *config) 1087 1079 { 1088 1080 return ni_isa_attach_common(board, config, TNT4882); 1089 1081 } 1090 1082 1091 - static int ni_nat4882_isa_attach(struct gpib_board *board, const gpib_board_config_t *config) 1083 + static int ni_nat4882_isa_attach(struct gpib_board *board, const struct gpib_board_config *config) 1092 1084 { 1093 1085 return ni_isa_attach_common(board, config, NAT4882); 1094 1086 } 1095 1087 1096 - static int ni_nec_isa_attach(struct gpib_board *board, const gpib_board_config_t *config) 1088 + static int ni_nec_isa_attach(struct gpib_board *board, const struct gpib_board_config *config) 1097 1089 { 1098 1090 return ni_isa_attach_common(board, config, NEC7210); 1099 1091 } ··· 1124 1116 return 0; 1125 1117 } 1126 1118 1127 - static gpib_interface_t ni_pci_interface = { 1119 + static struct gpib_interface ni_pci_interface = { 1128 1120 .name = "ni_pci", 1129 1121 .attach = ni_pci_attach, 1130 1122 .detach = ni_pci_detach, ··· 1152 1144 .return_to_local = tnt4882_return_to_local, 1153 1145 }; 1154 1146 1155 - static gpib_interface_t ni_pci_accel_interface = { 1147 + static struct gpib_interface ni_pci_accel_interface = { 1156 1148 .name = "ni_pci_accel", 1157 1149 .attach = ni_pci_attach, 1158 1150 .detach = ni_pci_detach, ··· 1180 1172 .return_to_local = tnt4882_return_to_local, 1181 1173 }; 1182 1174 1183 - static gpib_interface_t ni_isa_interface = { 1175 + static struct gpib_interface ni_isa_interface = { 1184 1176 .name = "ni_isa", 1185 1177 .attach = ni_tnt_isa_attach, 1186 1178 .detach = ni_isa_detach, ··· 1208 1200 .return_to_local = tnt4882_return_to_local, 1209 1201 }; 1210 1202 1211 - static gpib_interface_t ni_nat4882_isa_interface = { 1203 + static struct gpib_interface ni_nat4882_isa_interface = { 1212 1204 .name = "ni_nat4882_isa", 1213 1205 .attach = ni_nat4882_isa_attach, 1214 1206 .detach = ni_isa_detach, ··· 1236 1228 .return_to_local = tnt4882_return_to_local, 1237 1229 }; 1238 1230 1239 - static gpib_interface_t ni_nec_isa_interface = { 1231 + static struct gpib_interface ni_nec_isa_interface = { 1240 1232 .name = "ni_nec_isa", 1241 1233 .attach = ni_nec_isa_attach, 1242 1234 .detach = ni_isa_detach, ··· 1264 1256 .return_to_local = tnt4882_return_to_local, 1265 1257 }; 1266 1258 1267 - static gpib_interface_t ni_isa_accel_interface = { 1259 + static struct gpib_interface ni_isa_accel_interface = { 1268 1260 .name = "ni_isa_accel", 1269 1261 .attach = ni_tnt_isa_attach, 1270 1262 .detach = ni_isa_detach, ··· 1292 1284 .return_to_local = tnt4882_return_to_local, 1293 1285 }; 1294 1286 1295 - static gpib_interface_t ni_nat4882_isa_accel_interface = { 1287 + static struct gpib_interface ni_nat4882_isa_accel_interface = { 1296 1288 .name = "ni_nat4882_isa_accel", 1297 1289 .attach = ni_nat4882_isa_attach, 1298 1290 .detach = ni_isa_detach, ··· 1320 1312 .return_to_local = tnt4882_return_to_local, 1321 1313 }; 1322 1314 1323 - static gpib_interface_t ni_nec_isa_accel_interface = { 1315 + static struct gpib_interface ni_nec_isa_accel_interface = { 1324 1316 .name = "ni_nec_isa_accel", 1325 1317 .attach = ni_nec_isa_attach, 1326 1318 .detach = ni_isa_detach, ··· 1379 1371 #endif 1380 1372 1381 1373 #ifdef CONFIG_GPIB_PCMCIA 1382 - static gpib_interface_t ni_pcmcia_interface; 1383 - static gpib_interface_t ni_pcmcia_accel_interface; 1374 + static struct gpib_interface ni_pcmcia_interface; 1375 + static struct gpib_interface ni_pcmcia_accel_interface; 1384 1376 static int __init init_ni_gpib_cs(void); 1385 1377 static void __exit exit_ni_gpib_cs(void); 1386 1378 #endif ··· 1589 1581 } 1590 1582 1591 1583 /* 1592 - * This deletes a driver "instance". The device is de-registered 1593 - * with Card Services. If it has been released, all local data 1594 - * structures are freed. Otherwise, the structures will be freed 1595 - * when the device is released. 1584 + * This deletes a driver "instance". The device is de-registered 1585 + * with Card Services. If it has been released, all local data 1586 + * structures are freed. Otherwise, the structures will be freed 1587 + * when the device is released. 1596 1588 */ 1597 1589 static void ni_gpib_remove(struct pcmcia_device *link) 1598 1590 { ··· 1619 1611 } 1620 1612 1621 1613 /* 1622 - * ni_gpib_config() is scheduled to run after a CARD_INSERTION event 1623 - * is received, to configure the PCMCIA socket, and to make the 1624 - * device available to the system. 1614 + * ni_gpib_config() is scheduled to run after a CARD_INSERTION event 1615 + * is received, to configure the PCMCIA socket, and to make the 1616 + * device available to the system. 1625 1617 */ 1626 1618 static int ni_gpib_config(struct pcmcia_device *link) 1627 1619 { ··· 1710 1702 1711 1703 static const int pcmcia_gpib_iosize = 32; 1712 1704 1713 - static int ni_pcmcia_attach(struct gpib_board *board, const gpib_board_config_t *config) 1705 + static int ni_pcmcia_attach(struct gpib_board *board, const struct gpib_board_config *config) 1714 1706 { 1715 1707 struct local_info_t *info; 1716 1708 struct tnt4882_priv *tnt_priv; ··· 1777 1769 tnt4882_free_private(board); 1778 1770 } 1779 1771 1780 - static gpib_interface_t ni_pcmcia_interface = { 1772 + static struct gpib_interface ni_pcmcia_interface = { 1781 1773 .name = "ni_pcmcia", 1782 1774 .attach = ni_pcmcia_attach, 1783 1775 .detach = ni_pcmcia_detach, ··· 1805 1797 .return_to_local = tnt4882_return_to_local, 1806 1798 }; 1807 1799 1808 - static gpib_interface_t ni_pcmcia_accel_interface = { 1800 + static struct gpib_interface ni_pcmcia_accel_interface = { 1809 1801 .name = "ni_pcmcia_accel", 1810 1802 .attach = ni_pcmcia_attach, 1811 1803 .detach = ni_pcmcia_detach,
+64 -70
drivers/staging/gpib/uapi/gpib_ioctl.h
··· 12 12 13 13 #define GPIB_CODE 160 14 14 15 - typedef struct { 15 + struct gpib_board_type_ioctl { 16 16 char name[100]; 17 - } board_type_ioctl_t; 17 + }; 18 18 19 19 /* argument for read/write/command ioctls */ 20 - typedef struct { 21 - uint64_t buffer_ptr; 20 + struct gpib_read_write_ioctl { 21 + __u64 buffer_ptr; 22 22 unsigned int requested_transfer_count; 23 23 unsigned int completed_transfer_count; 24 24 int end; /* end flag return for reads, end io suppression request for cmd*/ 25 25 int handle; 26 - } read_write_ioctl_t; 26 + }; 27 27 28 - typedef struct { 28 + struct gpib_open_dev_ioctl { 29 29 unsigned int handle; 30 30 unsigned int pad; 31 31 int sad; 32 32 unsigned is_board : 1; 33 - } open_dev_ioctl_t; 33 + }; 34 34 35 - typedef struct { 35 + struct gpib_close_dev_ioctl { 36 36 unsigned int handle; 37 - } close_dev_ioctl_t; 37 + }; 38 38 39 - typedef struct { 39 + struct gpib_serial_poll_ioctl { 40 40 unsigned int pad; 41 41 int sad; 42 - uint8_t status_byte; 43 - } serial_poll_ioctl_t; 42 + __u8 status_byte; 43 + }; 44 44 45 - typedef struct { 45 + struct gpib_eos_ioctl { 46 46 int eos; 47 47 int eos_flags; 48 - } eos_ioctl_t; 48 + }; 49 49 50 - typedef struct { 50 + struct gpib_wait_ioctl { 51 51 int handle; 52 52 int wait_mask; 53 53 int clear_mask; ··· 56 56 int pad; 57 57 int sad; 58 58 unsigned int usec_timeout; 59 - } wait_ioctl_t; 59 + }; 60 60 61 - typedef struct { 62 - uint64_t init_data_ptr; 61 + struct gpib_online_ioctl { 62 + __u64 init_data_ptr; 63 63 int init_data_length; 64 64 int online; 65 - } online_ioctl_t; 65 + }; 66 66 67 - typedef struct { 67 + struct gpib_spoll_bytes_ioctl { 68 68 unsigned int num_bytes; 69 69 unsigned int pad; 70 70 int sad; 71 - } spoll_bytes_ioctl_t; 71 + }; 72 72 73 - typedef struct { 73 + struct gpib_board_info_ioctl { 74 74 unsigned int pad; 75 75 int sad; 76 76 int parallel_poll_configuration; ··· 79 79 unsigned int t1_delay; 80 80 unsigned ist : 1; 81 81 unsigned no_7_bit_eos : 1; 82 - } board_info_ioctl_t; 82 + }; 83 83 84 - typedef struct { 84 + struct gpib_select_pci_ioctl { 85 85 int pci_bus; 86 86 int pci_slot; 87 - } select_pci_ioctl_t; 87 + }; 88 88 89 - typedef struct { 90 - uint8_t config; 89 + struct gpib_ppoll_config_ioctl { 90 + __u8 config; 91 91 unsigned set_ist : 1; 92 92 unsigned clear_ist : 1; 93 - } ppoll_config_ioctl_t; 93 + }; 94 94 95 - typedef struct { 95 + struct gpib_pad_ioctl { 96 96 unsigned int handle; 97 97 unsigned int pad; 98 - } pad_ioctl_t; 98 + }; 99 99 100 - typedef struct { 100 + struct gpib_sad_ioctl { 101 101 unsigned int handle; 102 102 int sad; 103 - } sad_ioctl_t; 103 + }; 104 104 105 105 // select a piece of hardware to attach by its sysfs device path 106 - typedef struct { 106 + struct gpib_select_device_path_ioctl { 107 107 char device_path[0x1000]; 108 - } select_device_path_ioctl_t; 109 - 110 - typedef short event_ioctl_t; 111 - typedef int rsc_ioctl_t; 112 - typedef unsigned int t1_delay_ioctl_t; 113 - typedef short autospoll_ioctl_t; 114 - typedef short local_ppoll_mode_ioctl_t; 108 + }; 115 109 116 110 // update status byte and request service 117 - typedef struct { 118 - uint8_t status_byte; 111 + struct gpib_request_service2 { 112 + __u8 status_byte; 119 113 int new_reason_for_service; 120 - } request_service2_t; 114 + }; 121 115 122 116 /* Standard functions. */ 123 117 enum gpib_ioctl { 124 - IBRD = _IOWR(GPIB_CODE, 100, read_write_ioctl_t), 125 - IBWRT = _IOWR(GPIB_CODE, 101, read_write_ioctl_t), 126 - IBCMD = _IOWR(GPIB_CODE, 102, read_write_ioctl_t), 127 - IBOPENDEV = _IOWR(GPIB_CODE, 3, open_dev_ioctl_t), 128 - IBCLOSEDEV = _IOW(GPIB_CODE, 4, close_dev_ioctl_t), 129 - IBWAIT = _IOWR(GPIB_CODE, 5, wait_ioctl_t), 130 - IBRPP = _IOWR(GPIB_CODE, 6, uint8_t), 118 + IBRD = _IOWR(GPIB_CODE, 100, struct gpib_read_write_ioctl), 119 + IBWRT = _IOWR(GPIB_CODE, 101, struct gpib_read_write_ioctl), 120 + IBCMD = _IOWR(GPIB_CODE, 102, struct gpib_read_write_ioctl), 121 + IBOPENDEV = _IOWR(GPIB_CODE, 3, struct gpib_open_dev_ioctl), 122 + IBCLOSEDEV = _IOW(GPIB_CODE, 4, struct gpib_close_dev_ioctl), 123 + IBWAIT = _IOWR(GPIB_CODE, 5, struct gpib_wait_ioctl), 124 + IBRPP = _IOWR(GPIB_CODE, 6, __u8), 131 125 132 126 IBSIC = _IOW(GPIB_CODE, 9, unsigned int), 133 127 IBSRE = _IOW(GPIB_CODE, 10, int), 134 128 IBGTS = _IO(GPIB_CODE, 11), 135 129 IBCAC = _IOW(GPIB_CODE, 12, int), 136 130 IBLINES = _IOR(GPIB_CODE, 14, short), 137 - IBPAD = _IOW(GPIB_CODE, 15, pad_ioctl_t), 138 - IBSAD = _IOW(GPIB_CODE, 16, sad_ioctl_t), 131 + IBPAD = _IOW(GPIB_CODE, 15, struct gpib_pad_ioctl), 132 + IBSAD = _IOW(GPIB_CODE, 16, struct gpib_sad_ioctl), 139 133 IBTMO = _IOW(GPIB_CODE, 17, unsigned int), 140 - IBRSP = _IOWR(GPIB_CODE, 18, serial_poll_ioctl_t), 141 - IBEOS = _IOW(GPIB_CODE, 19, eos_ioctl_t), 142 - IBRSV = _IOW(GPIB_CODE, 20, uint8_t), 143 - CFCBASE = _IOW(GPIB_CODE, 21, uint64_t), 134 + IBRSP = _IOWR(GPIB_CODE, 18, struct gpib_serial_poll_ioctl), 135 + IBEOS = _IOW(GPIB_CODE, 19, struct gpib_eos_ioctl), 136 + IBRSV = _IOW(GPIB_CODE, 20, __u8), 137 + CFCBASE = _IOW(GPIB_CODE, 21, __u64), 144 138 CFCIRQ = _IOW(GPIB_CODE, 22, unsigned int), 145 139 CFCDMA = _IOW(GPIB_CODE, 23, unsigned int), 146 - CFCBOARDTYPE = _IOW(GPIB_CODE, 24, board_type_ioctl_t), 140 + CFCBOARDTYPE = _IOW(GPIB_CODE, 24, struct gpib_board_type_ioctl), 147 141 148 142 IBMUTEX = _IOW(GPIB_CODE, 26, int), 149 - IBSPOLL_BYTES = _IOWR(GPIB_CODE, 27, spoll_bytes_ioctl_t), 150 - IBPPC = _IOW(GPIB_CODE, 28, ppoll_config_ioctl_t), 151 - IBBOARD_INFO = _IOR(GPIB_CODE, 29, board_info_ioctl_t), 143 + IBSPOLL_BYTES = _IOWR(GPIB_CODE, 27, struct gpib_spoll_bytes_ioctl), 144 + IBPPC = _IOW(GPIB_CODE, 28, struct gpib_ppoll_config_ioctl), 145 + IBBOARD_INFO = _IOR(GPIB_CODE, 29, struct gpib_board_info_ioctl), 152 146 153 147 IBQUERY_BOARD_RSV = _IOR(GPIB_CODE, 31, int), 154 - IBSELECT_PCI = _IOWR(GPIB_CODE, 32, select_pci_ioctl_t), 155 - IBEVENT = _IOR(GPIB_CODE, 33, event_ioctl_t), 156 - IBRSC = _IOW(GPIB_CODE, 34, rsc_ioctl_t), 157 - IB_T1_DELAY = _IOW(GPIB_CODE, 35, t1_delay_ioctl_t), 148 + IBSELECT_PCI = _IOWR(GPIB_CODE, 32, struct gpib_select_pci_ioctl), 149 + IBEVENT = _IOR(GPIB_CODE, 33, short), 150 + IBRSC = _IOW(GPIB_CODE, 34, int), 151 + IB_T1_DELAY = _IOW(GPIB_CODE, 35, unsigned int), 158 152 IBLOC = _IO(GPIB_CODE, 36), 159 153 160 - IBAUTOSPOLL = _IOW(GPIB_CODE, 38, autospoll_ioctl_t), 161 - IBONL = _IOW(GPIB_CODE, 39, online_ioctl_t), 162 - IBPP2_SET = _IOW(GPIB_CODE, 40, local_ppoll_mode_ioctl_t), 163 - IBPP2_GET = _IOR(GPIB_CODE, 41, local_ppoll_mode_ioctl_t), 164 - IBSELECT_DEVICE_PATH = _IOW(GPIB_CODE, 43, select_device_path_ioctl_t), 154 + IBAUTOSPOLL = _IOW(GPIB_CODE, 38, short), 155 + IBONL = _IOW(GPIB_CODE, 39, struct gpib_online_ioctl), 156 + IBPP2_SET = _IOW(GPIB_CODE, 40, short), 157 + IBPP2_GET = _IOR(GPIB_CODE, 41, short), 158 + IBSELECT_DEVICE_PATH = _IOW(GPIB_CODE, 43, struct gpib_select_device_path_ioctl), 165 159 // 44 was IBSELECT_SERIAL_NUMBER 166 - IBRSV2 = _IOW(GPIB_CODE, 45, request_service2_t) 160 + IBRSV2 = _IOW(GPIB_CODE, 45, struct gpib_request_service2) 167 161 }; 168 162 169 163 #endif /* _GPIB_IOCTL_H */
+88 -138
drivers/staging/gpib/uapi/gpib_user.h drivers/staging/gpib/uapi/gpib.h
··· 4 4 * copyright : (C) 2002 by Frank Mori Hess 5 5 ***************************************************************************/ 6 6 7 - #ifndef _GPIB_USER_H 8 - #define _GPIB_USER_H 7 + #ifndef _GPIB_H 8 + #define _GPIB_H 9 9 10 10 #define GPIB_MAX_NUM_BOARDS 16 11 11 #define GPIB_MAX_NUM_DESCRIPTORS 0x1000 ··· 53 53 EVENT | LOK | REM | CIC | ATN | TACS | LACS | DTAS | DCAS | SRQI, 54 54 }; 55 55 56 - /* IBERR error codes */ 57 - enum iberr_code { 58 - EDVR = 0, /* system error */ 59 - ECIC = 1, /* not CIC */ 60 - ENOL = 2, /* no listeners */ 61 - EADR = 3, /* CIC and not addressed before I/O */ 62 - EARG = 4, /* bad argument to function call */ 63 - ESAC = 5, /* not SAC */ 64 - EABO = 6, /* I/O operation was aborted */ 65 - ENEB = 7, /* non-existent board (GPIB interface offline) */ 66 - EDMA = 8, /* DMA hardware error detected */ 67 - EOIP = 10, /* new I/O attempted with old I/O in progress */ 68 - ECAP = 11, /* no capability for intended opeation */ 69 - EFSO = 12, /* file system operation error */ 70 - EBUS = 14, /* bus error */ 71 - ESTB = 15, /* lost serial poll bytes */ 72 - ESRQ = 16, /* SRQ stuck on */ 73 - ETAB = 20 /* Table Overflow */ 74 - }; 75 - 76 - /* Timeout values and meanings */ 77 - enum gpib_timeout { 78 - TNONE = 0, /* Infinite timeout (disabled) */ 79 - T10us = 1, /* Timeout of 10 usec (ideal) */ 80 - T30us = 2, /* Timeout of 30 usec (ideal) */ 81 - T100us = 3, /* Timeout of 100 usec (ideal) */ 82 - T300us = 4, /* Timeout of 300 usec (ideal) */ 83 - T1ms = 5, /* Timeout of 1 msec (ideal) */ 84 - T3ms = 6, /* Timeout of 3 msec (ideal) */ 85 - T10ms = 7, /* Timeout of 10 msec (ideal) */ 86 - T30ms = 8, /* Timeout of 30 msec (ideal) */ 87 - T100ms = 9, /* Timeout of 100 msec (ideal) */ 88 - T300ms = 10, /* Timeout of 300 msec (ideal) */ 89 - T1s = 11, /* Timeout of 1 sec (ideal) */ 90 - T3s = 12, /* Timeout of 3 sec (ideal) */ 91 - T10s = 13, /* Timeout of 10 sec (ideal) */ 92 - T30s = 14, /* Timeout of 30 sec (ideal) */ 93 - T100s = 15, /* Timeout of 100 sec (ideal) */ 94 - T300s = 16, /* Timeout of 300 sec (ideal) */ 95 - T1000s = 17 /* Timeout of 1000 sec (maximum) */ 96 - }; 97 - 98 56 /* End-of-string (EOS) modes for use with ibeos */ 99 57 100 58 enum eos_flags { ··· 88 130 enum cmd_byte { 89 131 GTL = 0x1, /* go to local */ 90 132 SDC = 0x4, /* selected device clear */ 91 - PPConfig = 0x5, 133 + PP_CONFIG = 0x5, 92 134 #ifndef PPC 93 - PPC = PPConfig, /* parallel poll configure */ 135 + PPC = PP_CONFIG, /* parallel poll configure */ 94 136 #endif 95 137 GET = 0x8, /* group execute trigger */ 96 138 TCT = 0x9, /* take control */ ··· 124 166 return addr; 125 167 } 126 168 127 - static inline uint8_t MLA(unsigned int addr) 169 + static inline __u8 MLA(unsigned int addr) 128 170 { 129 171 return gpib_address_restrict(addr) | LAD; 130 172 } 131 173 132 - static inline uint8_t MTA(unsigned int addr) 174 + static inline __u8 MTA(unsigned int addr) 133 175 { 134 176 return gpib_address_restrict(addr) | TAD; 135 177 } 136 178 137 - static inline uint8_t MSA(unsigned int addr) 179 + static inline __u8 MSA(unsigned int addr) 138 180 { 139 - return gpib_address_restrict(addr) | SAD; 181 + return (addr & 0x1f) | SAD; 140 182 } 141 183 142 - static inline uint8_t PPE_byte(unsigned int dio_line, int sense) 184 + static inline __u8 PPE_byte(unsigned int dio_line, int sense) 143 185 { 144 - uint8_t cmd; 186 + __u8 cmd; 145 187 146 188 cmd = PPE; 147 189 if (sense) ··· 150 192 return cmd; 151 193 } 152 194 153 - static inline uint8_t CFGn(unsigned int meters) 154 - { 155 - return 0x6 | (meters & 0xf); 156 - } 157 - 158 195 /* mask of bits that actually matter in a command byte */ 159 196 enum { 160 197 gpib_command_mask = 0x7f, 161 198 }; 162 199 163 - static inline int is_PPE(uint8_t command) 200 + static inline int is_PPE(__u8 command) 164 201 { 165 202 return (command & 0x70) == 0x60; 166 203 } 167 204 168 - static inline int is_PPD(uint8_t command) 205 + static inline int is_PPD(__u8 command) 169 206 { 170 207 return (command & 0x70) == 0x70; 171 208 } 172 209 173 - static inline int in_addressed_command_group(uint8_t command) 210 + static inline int in_addressed_command_group(__u8 command) 174 211 { 175 212 return (command & 0x70) == 0x0; 176 213 } 177 214 178 - static inline int in_universal_command_group(uint8_t command) 215 + static inline int in_universal_command_group(__u8 command) 179 216 { 180 217 return (command & 0x70) == 0x10; 181 218 } 182 219 183 - static inline int in_listen_address_group(uint8_t command) 220 + static inline int in_listen_address_group(__u8 command) 184 221 { 185 222 return (command & 0x60) == 0x20; 186 223 } 187 224 188 - static inline int in_talk_address_group(uint8_t command) 225 + static inline int in_talk_address_group(__u8 command) 189 226 { 190 227 return (command & 0x60) == 0x40; 191 228 } 192 229 193 - static inline int in_primary_command_group(uint8_t command) 230 + static inline int in_primary_command_group(__u8 command) 194 231 { 195 232 return in_addressed_command_group(command) || 196 233 in_universal_command_group(command) || ··· 206 253 } 207 254 208 255 enum ibask_option { 209 - IbaPAD = 0x1, 210 - IbaSAD = 0x2, 211 - IbaTMO = 0x3, 212 - IbaEOT = 0x4, 213 - IbaPPC = 0x5, /* board only */ 214 - IbaREADDR = 0x6, /* device only */ 215 - IbaAUTOPOLL = 0x7, /* board only */ 216 - IbaCICPROT = 0x8, /* board only */ 217 - IbaIRQ = 0x9, /* board only */ 218 - IbaSC = 0xa, /* board only */ 219 - IbaSRE = 0xb, /* board only */ 220 - IbaEOSrd = 0xc, 221 - IbaEOSwrt = 0xd, 222 - IbaEOScmp = 0xe, 223 - IbaEOSchar = 0xf, 224 - IbaPP2 = 0x10, /* board only */ 225 - IbaTIMING = 0x11, /* board only */ 226 - IbaDMA = 0x12, /* board only */ 227 - IbaReadAdjust = 0x13, 228 - IbaWriteAdjust = 0x14, 229 - IbaEventQueue = 0x15, /* board only */ 230 - IbaSPollBit = 0x16, /* board only */ 231 - IbaSpollBit = 0x16, /* board only */ 232 - IbaSendLLO = 0x17, /* board only */ 233 - IbaSPollTime = 0x18, /* device only */ 234 - IbaPPollTime = 0x19, /* board only */ 235 - IbaEndBitIsNormal = 0x1a, 236 - IbaUnAddr = 0x1b, /* device only */ 237 - IbaHSCableLength = 0x1f, /* board only */ 238 - IbaIst = 0x20, /* board only */ 239 - IbaRsv = 0x21, /* board only */ 240 - IbaBNA = 0x200, /* device only */ 256 + IBA_PAD = 0x1, 257 + IBA_SAD = 0x2, 258 + IBA_TMO = 0x3, 259 + IBA_EOT = 0x4, 260 + IBA_PPC = 0x5, /* board only */ 261 + IBA_READ_DR = 0x6, /* device only */ 262 + IBA_AUTOPOLL = 0x7, /* board only */ 263 + IBA_CICPROT = 0x8, /* board only */ 264 + IBA_IRQ = 0x9, /* board only */ 265 + IBA_SC = 0xa, /* board only */ 266 + IBA_SRE = 0xb, /* board only */ 267 + IBA_EOS_RD = 0xc, 268 + IBA_EOS_WRT = 0xd, 269 + IBA_EOS_CMP = 0xe, 270 + IBA_EOS_CHAR = 0xf, 271 + IBA_PP2 = 0x10, /* board only */ 272 + IBA_TIMING = 0x11, /* board only */ 273 + IBA_DMA = 0x12, /* board only */ 274 + IBA_READ_ADJUST = 0x13, 275 + IBA_WRITE_ADJUST = 0x14, 276 + IBA_EVENT_QUEUE = 0x15, /* board only */ 277 + IBA_SPOLL_BIT = 0x16, /* board only */ 278 + IBA_SEND_LLO = 0x17, /* board only */ 279 + IBA_SPOLL_TIME = 0x18, /* device only */ 280 + IBA_PPOLL_TIME = 0x19, /* board only */ 281 + IBA_END_BIT_IS_NORMAL = 0x1a, 282 + IBA_UN_ADDR = 0x1b, /* device only */ 283 + IBA_HS_CABLE_LENGTH = 0x1f, /* board only */ 284 + IBA_IST = 0x20, /* board only */ 285 + IBA_RSV = 0x21, /* board only */ 286 + IBA_BNA = 0x200, /* device only */ 241 287 /* linux-gpib extensions */ 242 - Iba7BitEOS = 0x1000 /* board only. Returns 1 if board supports 7 bit eos compares*/ 288 + IBA_7_BIT_EOS = 0x1000 /* board only. Returns 1 if board supports 7 bit eos compares*/ 243 289 }; 244 290 245 291 enum ibconfig_option { 246 - IbcPAD = 0x1, 247 - IbcSAD = 0x2, 248 - IbcTMO = 0x3, 249 - IbcEOT = 0x4, 250 - IbcPPC = 0x5, /* board only */ 251 - IbcREADDR = 0x6, /* device only */ 252 - IbcAUTOPOLL = 0x7, /* board only */ 253 - IbcCICPROT = 0x8, /* board only */ 254 - IbcIRQ = 0x9, /* board only */ 255 - IbcSC = 0xa, /* board only */ 256 - IbcSRE = 0xb, /* board only */ 257 - IbcEOSrd = 0xc, 258 - IbcEOSwrt = 0xd, 259 - IbcEOScmp = 0xe, 260 - IbcEOSchar = 0xf, 261 - IbcPP2 = 0x10, /* board only */ 262 - IbcTIMING = 0x11, /* board only */ 263 - IbcDMA = 0x12, /* board only */ 264 - IbcReadAdjust = 0x13, 265 - IbcWriteAdjust = 0x14, 266 - IbcEventQueue = 0x15, /* board only */ 267 - IbcSPollBit = 0x16, /* board only */ 268 - IbcSpollBit = 0x16, /* board only */ 269 - IbcSendLLO = 0x17, /* board only */ 270 - IbcSPollTime = 0x18, /* device only */ 271 - IbcPPollTime = 0x19, /* board only */ 272 - IbcEndBitIsNormal = 0x1a, 273 - IbcUnAddr = 0x1b, /* device only */ 274 - IbcHSCableLength = 0x1f, /* board only */ 275 - IbcIst = 0x20, /* board only */ 276 - IbcRsv = 0x21, /* board only */ 277 - IbcBNA = 0x200 /* device only */ 292 + IBC_PAD = 0x1, 293 + IBC_SAD = 0x2, 294 + IBC_TMO = 0x3, 295 + IBC_EOT = 0x4, 296 + IBC_PPC = 0x5, /* board only */ 297 + IBC_READDR = 0x6, /* device only */ 298 + IBC_AUTOPOLL = 0x7, /* board only */ 299 + IBC_CICPROT = 0x8, /* board only */ 300 + IBC_IRQ = 0x9, /* board only */ 301 + IBC_SC = 0xa, /* board only */ 302 + IBC_SRE = 0xb, /* board only */ 303 + IBC_EOS_RD = 0xc, 304 + IBC_EOS_WRT = 0xd, 305 + IBC_EOS_CMP = 0xe, 306 + IBC_EOS_CHAR = 0xf, 307 + IBC_PP2 = 0x10, /* board only */ 308 + IBC_TIMING = 0x11, /* board only */ 309 + IBC_DMA = 0x12, /* board only */ 310 + IBC_READ_ADJUST = 0x13, 311 + IBC_WRITE_ADJUST = 0x14, 312 + IBC_EVENT_QUEUE = 0x15, /* board only */ 313 + IBC_SPOLL_BIT = 0x16, /* board only */ 314 + IBC_SEND_LLO = 0x17, /* board only */ 315 + IBC_SPOLL_TIME = 0x18, /* device only */ 316 + IBC_PPOLL_TIME = 0x19, /* board only */ 317 + IBC_END_BIT_IS_NORMAL = 0x1a, 318 + IBC_UN_ADDR = 0x1b, /* device only */ 319 + IBC_HS_CABLE_LENGTH = 0x1f, /* board only */ 320 + IBC_IST = 0x20, /* board only */ 321 + IBC_RSV = 0x21, /* board only */ 322 + IBC_BNA = 0x200 /* device only */ 278 323 }; 279 324 280 325 enum t1_delays { ··· 286 335 }; 287 336 288 337 enum gpib_events { 289 - EventNone = 0, 290 - EventDevTrg = 1, 291 - EventDevClr = 2, 292 - EventIFC = 3 338 + EVENT_NONE = 0, 339 + EVENT_DEV_TRG = 1, 340 + EVENT_DEV_CLR = 2, 341 + EVENT_IFC = 3 293 342 }; 294 343 295 344 enum gpib_stb { 296 - IbStbRQS = 0x40, /* IEEE 488.1 & 2 */ 297 - IbStbESB = 0x20, /* IEEE 488.2 only */ 298 - IbStbMAV = 0x10 /* IEEE 488.2 only */ 345 + IB_STB_RQS = 0x40, /* IEEE 488.1 & 2 */ 346 + IB_STB_ESB = 0x20, /* IEEE 488.2 only */ 347 + IB_STB_MAV = 0x10 /* IEEE 488.2 only */ 299 348 }; 300 349 301 - #endif /* _GPIB_USER_H */ 350 + #endif /* _GPIB_H */ 302 351 303 - /* Check for errors */
+2 -2
drivers/staging/greybus/camera.c
··· 1165 1165 gcam->debugfs.buffers[i].length = 0; 1166 1166 1167 1167 debugfs_create_file_aux(entry->name, entry->mask, 1168 - gcam->debugfs.root, gcam, entry, 1169 - &gb_camera_debugfs_ops); 1168 + gcam->debugfs.root, gcam, entry, 1169 + &gb_camera_debugfs_ops); 1170 1170 } 1171 1171 1172 1172 return 0;
+17 -31
drivers/staging/greybus/fw-management.c
··· 123 123 fw_info->major = le16_to_cpu(response.major); 124 124 fw_info->minor = le16_to_cpu(response.minor); 125 125 126 - strscpy_pad(fw_info->firmware_tag, response.firmware_tag); 127 - 128 - /* 129 - * The firmware-tag should be NULL terminated, otherwise throw error but 130 - * don't fail. 131 - */ 132 - if (fw_info->firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] != '\0') { 126 + ret = strscpy_pad(fw_info->firmware_tag, response.firmware_tag); 127 + if (ret == -E2BIG) 133 128 dev_err(fw_mgmt->parent, 134 - "fw-version: firmware-tag is not NULL terminated\n"); 135 - fw_info->firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] = '\0'; 136 - } 129 + "fw-version: truncated firmware tag: %s\n", 130 + fw_info->firmware_tag); 137 131 138 132 return 0; 139 133 } ··· 146 152 } 147 153 148 154 request.load_method = load_method; 149 - strscpy_pad(request.firmware_tag, tag); 150 155 151 - /* 152 - * The firmware-tag should be NULL terminated, otherwise throw error and 153 - * fail. 154 - */ 155 - if (request.firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] != '\0') { 156 - dev_err(fw_mgmt->parent, "load-and-validate: firmware-tag is not NULL terminated\n"); 156 + ret = strscpy_pad(request.firmware_tag, tag); 157 + if (ret == -E2BIG) { 158 + dev_err(fw_mgmt->parent, 159 + "load-and-validate: truncated firmware tag: %s\n", 160 + request.firmware_tag); 157 161 return -EINVAL; 158 162 } 159 163 ··· 240 248 struct gb_fw_mgmt_backend_fw_version_response response; 241 249 int ret; 242 250 243 - strscpy_pad(request.firmware_tag, fw_info->firmware_tag); 244 - 245 - /* 246 - * The firmware-tag should be NULL terminated, otherwise throw error and 247 - * fail. 248 - */ 249 - if (request.firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] != '\0') { 250 - dev_err(fw_mgmt->parent, "backend-version: firmware-tag is not NULL terminated\n"); 251 + ret = strscpy_pad(request.firmware_tag, fw_info->firmware_tag); 252 + if (ret == -E2BIG) { 253 + dev_err(fw_mgmt->parent, 254 + "backend-fw-version: truncated firmware tag: %s\n", 255 + request.firmware_tag); 251 256 return -EINVAL; 252 257 } 253 258 ··· 291 302 int ret; 292 303 293 304 ret = strscpy_pad(request.firmware_tag, tag); 294 - 295 - /* 296 - * The firmware-tag should be NULL terminated, otherwise throw error and 297 - * fail. 298 - */ 299 305 if (ret == -E2BIG) { 300 - dev_err(fw_mgmt->parent, "backend-update: firmware-tag is not NULL terminated\n"); 306 + dev_err(fw_mgmt->parent, 307 + "backend-fw-update: truncated firmware tag: %s\n", 308 + request.firmware_tag); 301 309 return -EINVAL; 302 310 } 303 311
+9 -7
drivers/staging/greybus/gpio.c
··· 185 185 return 0; 186 186 } 187 187 188 - static void gb_gpio_set_value_operation(struct gb_gpio_controller *ggc, 189 - u8 which, bool value_high) 188 + static int gb_gpio_set_value_operation(struct gb_gpio_controller *ggc, 189 + u8 which, bool value_high) 190 190 { 191 191 struct device *dev = &ggc->gbphy_dev->dev; 192 192 struct gb_gpio_set_value_request request; ··· 195 195 if (ggc->lines[which].direction == 1) { 196 196 dev_warn(dev, "refusing to set value of input gpio %u\n", 197 197 which); 198 - return; 198 + return -EPERM; 199 199 } 200 200 201 201 request.which = which; ··· 204 204 &request, sizeof(request), NULL, 0); 205 205 if (ret) { 206 206 dev_err(dev, "failed to set value of gpio %u\n", which); 207 - return; 207 + return ret; 208 208 } 209 209 210 210 ggc->lines[which].value = request.value; 211 + 212 + return 0; 211 213 } 212 214 213 215 static int gb_gpio_set_debounce_operation(struct gb_gpio_controller *ggc, ··· 459 457 return ggc->lines[which].value; 460 458 } 461 459 462 - static void gb_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) 460 + static int gb_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) 463 461 { 464 462 struct gb_gpio_controller *ggc = gpiochip_get_data(chip); 465 463 466 - gb_gpio_set_value_operation(ggc, (u8)offset, !!value); 464 + return gb_gpio_set_value_operation(ggc, (u8)offset, !!value); 467 465 } 468 466 469 467 static int gb_gpio_set_config(struct gpio_chip *chip, unsigned int offset, ··· 557 555 gpio->direction_input = gb_gpio_direction_input; 558 556 gpio->direction_output = gb_gpio_direction_output; 559 557 gpio->get = gb_gpio_get; 560 - gpio->set = gb_gpio_set; 558 + gpio->set_rv = gb_gpio_set; 561 559 gpio->set_config = gb_gpio_set_config; 562 560 gpio->base = -1; /* Allocate base dynamically */ 563 561 gpio->ngpio = ggc->line_max + 1;
+1 -1
drivers/staging/rtl8723bs/core/rtw_ap.c
··· 389 389 psta->qos_option = 0; 390 390 psta->htpriv.ht_option = false; 391 391 392 - psta->ieee8021x_blocked = 0; 392 + psta->ieee8021x_blocked = false; 393 393 394 394 memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats)); 395 395
+6 -6
drivers/staging/rtl8723bs/core/rtw_btcoex.c
··· 8 8 #include <rtw_btcoex.h> 9 9 #include <hal_btcoex.h> 10 10 11 - void rtw_btcoex_MediaStatusNotify(struct adapter *padapter, u8 mediaStatus) 11 + void rtw_btcoex_MediaStatusNotify(struct adapter *padapter, u8 media_status) 12 12 { 13 - if ((mediaStatus == RT_MEDIA_CONNECT) 13 + if ((media_status == RT_MEDIA_CONNECT) 14 14 && (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true)) { 15 15 rtw_hal_set_hwreg(padapter, HW_VAR_DL_RSVD_PAGE, NULL); 16 16 } 17 17 18 - hal_btcoex_MediaStatusNotify(padapter, mediaStatus); 18 + hal_btcoex_MediaStatusNotify(padapter, media_status); 19 19 } 20 20 21 21 void rtw_btcoex_HaltNotify(struct adapter *padapter) ··· 52 52 void rtw_btcoex_LPS_Enter(struct adapter *padapter) 53 53 { 54 54 struct pwrctrl_priv *pwrpriv; 55 - u8 lpsVal; 55 + u8 lps_val; 56 56 57 57 58 58 pwrpriv = adapter_to_pwrctl(padapter); 59 59 60 60 pwrpriv->bpower_saving = true; 61 - lpsVal = hal_btcoex_LpsVal(padapter); 62 - rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, lpsVal, "BTCOEX"); 61 + lps_val = hal_btcoex_LpsVal(padapter); 62 + rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, lps_val, "BTCOEX"); 63 63 } 64 64 65 65 void rtw_btcoex_LPS_Leave(struct adapter *padapter)
+2 -9
drivers/staging/rtl8723bs/core/rtw_cmd.c
··· 273 273 274 274 /* spin_lock_bh(&(queue->lock)); */ 275 275 spin_lock_irqsave(&queue->lock, irqL); 276 - if (list_empty(&queue->queue)) 276 + if (list_empty(&queue->queue)) { 277 277 obj = NULL; 278 - else { 278 + } else { 279 279 obj = container_of(get_next(&queue->queue), struct cmd_obj, list); 280 280 list_del_init(&obj->list); 281 281 } ··· 695 695 /* for ies is fix buf size */ 696 696 t_len = sizeof(struct wlan_bssid_ex); 697 697 698 - 699 698 /* for hidden ap to set fw_state here */ 700 699 if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) != true) { 701 700 switch (ndis_network_mode) { ··· 736 737 memcpy(&pmlmepriv->assoc_bssid[0], &pnetwork->network.mac_address[0], ETH_ALEN); 737 738 738 739 psecnetwork->ie_length = rtw_restruct_sec_ie(padapter, &pnetwork->network.ies[0], &psecnetwork->ies[0], pnetwork->network.ie_length); 739 - 740 740 741 741 pqospriv->qos_option = 0; 742 742 ··· 1030 1032 1031 1033 init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); 1032 1034 1033 - 1034 1035 /* rtw_enqueue_cmd(pcmdpriv, ph2c); */ 1035 1036 res = rtw_enqueue_cmd(pcmdpriv, ph2c); 1036 1037 exit: ··· 1095 1098 pdrvextra_cmd_parm->size = 0; 1096 1099 pdrvextra_cmd_parm->pbuf = NULL; 1097 1100 init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); 1098 - 1099 1101 1100 1102 /* rtw_enqueue_cmd(pcmdpriv, ph2c); */ 1101 1103 res = rtw_enqueue_cmd(pcmdpriv, ph2c); ··· 1252 1256 /* */ 1253 1257 hal_btcoex_Handler(padapter); 1254 1258 1255 - 1256 1259 /* always call rtw_ps_processor() at last one. */ 1257 1260 rtw_ps_processor(padapter); 1258 1261 } ··· 1361 1366 struct drvextra_cmd_parm *pdrvextra_cmd_parm; 1362 1367 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 1363 1368 u8 res = _SUCCESS; 1364 - 1365 1369 1366 1370 ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 1367 1371 if (!ph2c) { ··· 1843 1849 timer_delete_sync(&pmlmepriv->assoc_timer); 1844 1850 1845 1851 spin_lock_bh(&pmlmepriv->lock); 1846 - 1847 1852 1848 1853 if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { 1849 1854 psta = rtw_get_stainfo(&padapter->stapriv, pnetwork->mac_address);
+2 -3
drivers/staging/rtl8723bs/core/rtw_ieee80211.c
··· 988 988 if (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac)) { 989 989 addr = of_get_property(np, "local-mac-address", &len); 990 990 991 - if (addr && len == ETH_ALEN) { 991 + if (addr && len == ETH_ALEN) 992 992 ether_addr_copy(mac_addr, addr); 993 - } else { 993 + else 994 994 eth_random_addr(mac_addr); 995 - } 996 995 } 997 996 } 998 997
+5 -5
drivers/staging/rtl8723bs/core/rtw_mlme.c
··· 2022 2022 } 2023 2023 2024 2024 iEntry = SecIsInPMKIDList(adapter, pmlmepriv->assoc_bssid); 2025 - if (iEntry < 0) { 2025 + if (iEntry < 0) 2026 2026 return ielength; 2027 - } else { 2028 - if (authmode == WLAN_EID_RSN) 2029 - ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength); 2030 - } 2027 + 2028 + if (authmode == WLAN_EID_RSN) 2029 + ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength); 2030 + 2031 2031 return ielength; 2032 2032 } 2033 2033
+1 -1
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
··· 3511 3511 /* if ((psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.mac_address)) != NULL) */ 3512 3512 psta = rtw_get_stainfo(pstapriv, raddr); 3513 3513 if (psta) { 3514 - start_seq = (psta->sta_xmitpriv.txseq_tid[status & 0x07]&0xfff) + 1; 3514 + start_seq = (psta->sta_xmitpriv.txseq_tid[status & 0x07] % 4096u) + 1; 3515 3515 3516 3516 psta->BA_starting_seqctrl[status & 0x07] = start_seq; 3517 3517
+2 -6
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
··· 8 8 #include <hal_data.h> 9 9 #include <linux/jiffies.h> 10 10 11 - 12 11 void _ips_enter(struct adapter *padapter) 13 12 { 14 13 struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); ··· 55 56 pwrpriv->ips_leave_cnts++; 56 57 57 58 result = rtw_ips_pwr_up(padapter); 58 - if (result == _SUCCESS) { 59 + if (result == _SUCCESS) 59 60 pwrpriv->rf_pwrstate = rf_on; 60 - } 61 61 pwrpriv->bips_processing = false; 62 62 63 63 pwrpriv->bkeepfwalive = false; ··· 547 549 548 550 LPS_Leave_check(Adapter); 549 551 } else { 550 - if (adapter_to_pwrctl(Adapter)->rf_pwrstate == rf_off) { 552 + if (adapter_to_pwrctl(Adapter)->rf_pwrstate == rf_off) 551 553 ips_leave(Adapter); 552 - } 553 554 } 554 555 } 555 556 ··· 992 995 pwrctrlpriv->wowlan_mode = false; 993 996 pwrctrlpriv->wowlan_ap_mode = false; 994 997 } 995 - 996 998 997 999 void rtw_free_pwrctrl_priv(struct adapter *adapter) 998 1000 {
+3 -3
drivers/staging/rtl8723bs/core/rtw_recv.c
··· 1641 1641 struct dvobj_priv *psdpriv = padapter->dvobj; 1642 1642 struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 1643 1643 u8 wsize = preorder_ctrl->wsize_b; 1644 - u16 wend = (preorder_ctrl->indicate_seq + wsize - 1) & 0xFFF;/* 4096; */ 1644 + u16 wend = (preorder_ctrl->indicate_seq + wsize - 1) % 4096u; 1645 1645 1646 1646 /* Rx Reorder initialize condition. */ 1647 1647 if (preorder_ctrl->indicate_seq == 0xFFFF) ··· 1657 1657 /* 2. Incoming SeqNum is larger than the WinEnd => Window shift N */ 1658 1658 /* */ 1659 1659 if (SN_EQUAL(seq_num, preorder_ctrl->indicate_seq)) { 1660 - preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) & 0xFFF; 1660 + preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) % 4096u; 1661 1661 1662 1662 } else if (SN_LESS(wend, seq_num)) { 1663 1663 /* boundary situation, when seq_num cross 0xFFF */ ··· 1772 1772 list_del_init(&(prframe->u.hdr.list)); 1773 1773 1774 1774 if (SN_EQUAL(preorder_ctrl->indicate_seq, pattrib->seq_num)) 1775 - preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) & 0xFFF; 1775 + preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1) % 4096u; 1776 1776 1777 1777 /* Set this as a lock to make sure that only one thread is indicating packet. */ 1778 1778 /* pTS->RxIndicateState = RXTS_INDICATE_PROCESSING; */
+8 -10
drivers/staging/rtl8723bs/core/rtw_xmit.c
··· 943 943 944 944 if (psta) { 945 945 psta->sta_xmitpriv.txseq_tid[pattrib->priority]++; 946 - psta->sta_xmitpriv.txseq_tid[pattrib->priority] &= 0xFFF; 946 + psta->sta_xmitpriv.txseq_tid[pattrib->priority] %= 4096u; 947 947 pattrib->seqnum = psta->sta_xmitpriv.txseq_tid[pattrib->priority]; 948 948 949 949 SetSeqNum(hdr, pattrib->seqnum); ··· 963 963 if (SN_LESS(pattrib->seqnum, tx_seq)) { 964 964 pattrib->ampdu_en = false;/* AGG BK */ 965 965 } else if (SN_EQUAL(pattrib->seqnum, tx_seq)) { 966 - psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (tx_seq+1)&0xfff; 966 + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = 967 + (tx_seq + 1) % 4096u; 967 968 968 969 pattrib->ampdu_en = true;/* AGG EN */ 969 970 } else { 970 - psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = (pattrib->seqnum+1)&0xfff; 971 + psta->BA_starting_seqctrl[pattrib->priority & 0x0f] = 972 + (pattrib->seqnum + 1) % 4096u; 973 + 971 974 pattrib->ampdu_en = true;/* AGG EN */ 972 975 } 973 976 } ··· 1939 1936 s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt) 1940 1937 { 1941 1938 static unsigned long start; 1942 - static u32 drop_cnt; 1943 1939 1944 1940 struct xmit_priv *pxmitpriv = &padapter->xmitpriv; 1945 1941 struct xmit_frame *pxmitframe = NULL; ··· 1950 1948 1951 1949 pxmitframe = rtw_alloc_xmitframe(pxmitpriv); 1952 1950 1953 - if (jiffies_to_msecs(jiffies - start) > 2000) { 1951 + if (jiffies_to_msecs(jiffies - start) > 2000) 1954 1952 start = jiffies; 1955 - drop_cnt = 0; 1956 - } 1957 1953 1958 - if (!pxmitframe) { 1959 - drop_cnt++; 1954 + if (!pxmitframe) 1960 1955 return -1; 1961 - } 1962 1956 1963 1957 res = update_attrib(padapter, *ppkt, &pxmitframe->attrib); 1964 1958
+34 -34
drivers/staging/rtl8723bs/hal/HalBtc8723b2Ant.c
··· 1100 1100 1101 1101 bCommon = true; 1102 1102 } else { 1103 - if (BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) { 1103 + if (pCoexDm->btStatus == BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE) { 1104 1104 bLowPwrDisable = false; 1105 1105 pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); 1106 1106 halbtc8723b2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, false, false, 0x8); ··· 1115 1115 halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); 1116 1116 1117 1117 bCommon = true; 1118 - } else if (BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) { 1118 + } else if (pCoexDm->btStatus == BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE) { 1119 1119 bLowPwrDisable = true; 1120 1120 pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); 1121 1121 ··· 1605 1605 1606 1606 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); 1607 1607 1608 - if (BTC_WIFI_BW_LEGACY == wifiBw) /* for SCO quality at 11b/g mode */ 1608 + if (wifiBw == BTC_WIFI_BW_LEGACY) /* for SCO quality at 11b/g mode */ 1609 1609 halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); 1610 1610 else /* for SCO quality & wifi performance balance at 11n mode */ 1611 1611 halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 8); ··· 1613 1613 halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, false, 0); /* for voice quality */ 1614 1614 1615 1615 /* sw mechanism */ 1616 - if (BTC_WIFI_BW_HT40 == wifiBw) { 1616 + if (wifiBw == BTC_WIFI_BW_HT40) { 1617 1617 if ( 1618 1618 (wifiRssiState == BTC_RSSI_STATE_HIGH) || 1619 1619 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ··· 1660 1660 1661 1661 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); 1662 1662 1663 - if (BTC_WIFI_BW_LEGACY == wifiBw) /* for HID at 11b/g mode */ 1663 + if (wifiBw == BTC_WIFI_BW_LEGACY) /* for HID at 11b/g mode */ 1664 1664 halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); 1665 1665 else /* for HID quality & wifi performance balance at 11n mode */ 1666 1666 halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 9); ··· 1674 1674 halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13); 1675 1675 1676 1676 /* sw mechanism */ 1677 - if (BTC_WIFI_BW_HT40 == wifiBw) { 1677 + if (wifiBw == BTC_WIFI_BW_HT40) { 1678 1678 if ( 1679 1679 (wifiRssiState == BTC_RSSI_STATE_HIGH) || 1680 1680 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ··· 1723 1723 1724 1724 /* sw mechanism */ 1725 1725 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); 1726 - if (BTC_WIFI_BW_HT40 == wifiBw) { 1726 + if (wifiBw == BTC_WIFI_BW_HT40) { 1727 1727 halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); 1728 1728 halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, true, 0x18); 1729 1729 } else { ··· 1755 1755 1756 1756 /* sw mechanism */ 1757 1757 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); 1758 - if (BTC_WIFI_BW_HT40 == wifiBw) { 1758 + if (wifiBw == BTC_WIFI_BW_HT40) { 1759 1759 if ( 1760 1760 (wifiRssiState == BTC_RSSI_STATE_HIGH) || 1761 1761 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ··· 1805 1805 1806 1806 /* sw mechanism */ 1807 1807 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); 1808 - if (BTC_WIFI_BW_HT40 == wifiBw) { 1808 + if (wifiBw == BTC_WIFI_BW_HT40) { 1809 1809 if ( 1810 1810 (wifiRssiState == BTC_RSSI_STATE_HIGH) || 1811 1811 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ··· 1861 1861 1862 1862 /* sw mechanism */ 1863 1863 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); 1864 - if (BTC_WIFI_BW_HT40 == wifiBw) { 1864 + if (wifiBw == BTC_WIFI_BW_HT40) { 1865 1865 if ( 1866 1866 (wifiRssiState == BTC_RSSI_STATE_HIGH) || 1867 1867 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ··· 1912 1912 halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, false, 1); 1913 1913 1914 1914 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); 1915 - if (BTC_WIFI_BW_HT40 == wifiBw) { 1915 + if (wifiBw == BTC_WIFI_BW_HT40) { 1916 1916 if ( 1917 1917 (wifiRssiState == BTC_RSSI_STATE_HIGH) || 1918 1918 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ··· 1964 1964 (btRssiState == BTC_RSSI_STATE_STAY_HIGH) 1965 1965 ) { 1966 1966 halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 12); 1967 - if (BTC_WIFI_BW_HT40 == wifiBw) 1967 + if (wifiBw == BTC_WIFI_BW_HT40) 1968 1968 halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, false, true, 3); 1969 1969 else 1970 1970 halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, false, false, 3); ··· 1974 1974 } 1975 1975 1976 1976 /* sw mechanism */ 1977 - if (BTC_WIFI_BW_HT40 == wifiBw) { 1977 + if (wifiBw == BTC_WIFI_BW_HT40) { 1978 1978 if ( 1979 1979 (wifiRssiState == BTC_RSSI_STATE_HIGH) || 1980 1980 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ··· 2019 2019 (btRssiState == BTC_RSSI_STATE_HIGH) || 2020 2020 (btRssiState == BTC_RSSI_STATE_STAY_HIGH) 2021 2021 ) { 2022 - if (BTC_WIFI_BW_HT40 == wifiBw) { 2022 + if (wifiBw == BTC_WIFI_BW_HT40) { 2023 2023 halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 3); 2024 2024 halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 11); 2025 2025 pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x780); ··· 2037 2037 } 2038 2038 2039 2039 /* sw mechanism */ 2040 - if (BTC_WIFI_BW_HT40 == wifiBw) { 2040 + if (wifiBw == BTC_WIFI_BW_HT40) { 2041 2041 if ( 2042 2042 (wifiRssiState == BTC_RSSI_STATE_HIGH) || 2043 2043 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ··· 2090 2090 (btRssiState == BTC_RSSI_STATE_HIGH) || 2091 2091 (btRssiState == BTC_RSSI_STATE_STAY_HIGH) 2092 2092 ) { 2093 - if (BTC_WIFI_BW_HT40 == wifiBw) 2093 + if (wifiBw == BTC_WIFI_BW_HT40) 2094 2094 halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, true, true, 2); 2095 2095 else 2096 2096 halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, true, false, 3); ··· 2098 2098 halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, true, true, 3); 2099 2099 2100 2100 /* sw mechanism */ 2101 - if (BTC_WIFI_BW_HT40 == wifiBw) { 2101 + if (wifiBw == BTC_WIFI_BW_HT40) { 2102 2102 if ( 2103 2103 (wifiRssiState == BTC_RSSI_STATE_HIGH) || 2104 2104 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ··· 2140 2140 halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); 2141 2141 2142 2142 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); 2143 - if (BTC_WIFI_BW_LEGACY == wifiBw) { 2143 + if (wifiBw == BTC_WIFI_BW_LEGACY) { 2144 2144 if (BTC_RSSI_HIGH(btRssiState)) 2145 2145 halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2); 2146 2146 else if (BTC_RSSI_MEDIUM(btRssiState)) ··· 2173 2173 halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, true, true, 2); 2174 2174 2175 2175 /* sw mechanism */ 2176 - if (BTC_WIFI_BW_HT40 == wifiBw) { 2176 + if (wifiBw == BTC_WIFI_BW_HT40) { 2177 2177 if ( 2178 2178 (wifiRssiState == BTC_RSSI_STATE_HIGH) || 2179 2179 (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ··· 2391 2391 2392 2392 void EXhalbtc8723b2ant_IpsNotify(struct btc_coexist *pBtCoexist, u8 type) 2393 2393 { 2394 - if (BTC_IPS_ENTER == type) { 2394 + if (type == BTC_IPS_ENTER) { 2395 2395 pCoexSta->bUnderIps = true; 2396 2396 halbtc8723b2ant_WifiOffHwCfg(pBtCoexist); 2397 2397 halbtc8723b2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, true); 2398 2398 halbtc8723b2ant_CoexAllOff(pBtCoexist); 2399 - } else if (BTC_IPS_LEAVE == type) { 2399 + } else if (type == BTC_IPS_LEAVE) { 2400 2400 pCoexSta->bUnderIps = false; 2401 2401 halbtc8723b2ant_InitHwConfig(pBtCoexist, false); 2402 2402 halbtc8723b2ant_InitCoexDm(pBtCoexist); ··· 2406 2406 2407 2407 void EXhalbtc8723b2ant_LpsNotify(struct btc_coexist *pBtCoexist, u8 type) 2408 2408 { 2409 - if (BTC_LPS_ENABLE == type) { 2409 + if (type == BTC_LPS_ENABLE) { 2410 2410 pCoexSta->bUnderLps = true; 2411 - } else if (BTC_LPS_DISABLE == type) { 2411 + } else if (type == BTC_LPS_DISABLE) { 2412 2412 pCoexSta->bUnderLps = false; 2413 2413 } 2414 2414 } 2415 2415 2416 2416 void EXhalbtc8723b2ant_ScanNotify(struct btc_coexist *pBtCoexist, u8 type) 2417 2417 { 2418 - if (BTC_SCAN_START == type) { 2419 - } else if (BTC_SCAN_FINISH == type) { 2418 + if (type == BTC_SCAN_START) { 2419 + } else if (type == BTC_SCAN_FINISH) { 2420 2420 } 2421 2421 } 2422 2422 2423 2423 void EXhalbtc8723b2ant_ConnectNotify(struct btc_coexist *pBtCoexist, u8 type) 2424 2424 { 2425 - if (BTC_ASSOCIATE_START == type) { 2426 - } else if (BTC_ASSOCIATE_FINISH == type) { 2425 + if (type == BTC_ASSOCIATE_START) { 2426 + } else if (type == BTC_ASSOCIATE_FINISH) { 2427 2427 } 2428 2428 } 2429 2429 ··· 2436 2436 2437 2437 /* only 2.4G we need to inform bt the chnl mask */ 2438 2438 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_CENTRAL_CHNL, &wifiCentralChnl); 2439 - if ((BTC_MEDIA_CONNECT == type) && (wifiCentralChnl <= 14)) { 2439 + if ((type == BTC_MEDIA_CONNECT) && (wifiCentralChnl <= 14)) { 2440 2440 H2C_Parameter[0] = 0x1; 2441 2441 H2C_Parameter[1] = wifiCentralChnl; 2442 2442 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); 2443 - if (BTC_WIFI_BW_HT40 == wifiBw) 2443 + if (wifiBw == BTC_WIFI_BW_HT40) 2444 2444 H2C_Parameter[2] = 0x30; 2445 2445 else { 2446 2446 pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &apNum); ··· 2573 2573 } 2574 2574 2575 2575 if ( 2576 - (BT_8723B_2ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) || 2577 - (BT_8723B_2ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) || 2578 - (BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) 2576 + (pCoexDm->btStatus == BT_8723B_2ANT_BT_STATUS_ACL_BUSY) || 2577 + (pCoexDm->btStatus == BT_8723B_2ANT_BT_STATUS_SCO_BUSY) || 2578 + (pCoexDm->btStatus == BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY) 2579 2579 ) { 2580 2580 bBtBusy = true; 2581 2581 bLimitedDig = true; ··· 2603 2603 2604 2604 void EXhalbtc8723b2ant_PnpNotify(struct btc_coexist *pBtCoexist, u8 pnpState) 2605 2605 { 2606 - if (BTC_WIFI_PNP_SLEEP == pnpState) { 2607 - } else if (BTC_WIFI_PNP_WAKE_UP == pnpState) { 2606 + if (pnpState == BTC_WIFI_PNP_SLEEP) { 2607 + } else if (pnpState == BTC_WIFI_PNP_WAKE_UP) { 2608 2608 halbtc8723b2ant_InitHwConfig(pBtCoexist, false); 2609 2609 halbtc8723b2ant_InitCoexDm(pBtCoexist); 2610 2610 halbtc8723b2ant_QueryBtInfo(pBtCoexist);
+11 -11
drivers/staging/rtl8723bs/hal/hal_btcoex.c
··· 91 91 stime = jiffies; 92 92 do { 93 93 ready = rtw_register_task_alive(padapter, BTCOEX_ALIVE); 94 - if (_SUCCESS == ready) 94 + if (ready == _SUCCESS) 95 95 break; 96 96 97 97 utime = jiffies_to_msecs(jiffies - stime); ··· 668 668 struct btc_coexist *pBtCoexist = (struct btc_coexist *)pBtcContext; 669 669 struct adapter *Adapter = pBtCoexist->Adapter; 670 670 671 - if (BTC_INTF_SDIO == pBtCoexist->chipInterface) 671 + if (pBtCoexist->chipInterface == BTC_INTF_SDIO) 672 672 rtw_write8(Adapter, SDIO_LOCAL_BASE | RegAddr, Data); 673 673 else 674 674 rtw_write8(Adapter, RegAddr, Data); ··· 894 894 if (pBtCoexist->bManualControl) 895 895 return; 896 896 897 - if (IPS_NONE == type) 897 + if (type == IPS_NONE) 898 898 ipsType = BTC_IPS_LEAVE; 899 899 else 900 900 ipsType = BTC_IPS_ENTER; ··· 922 922 if (pBtCoexist->bManualControl) 923 923 return; 924 924 925 - if (PS_MODE_ACTIVE == type) 925 + if (type == PS_MODE_ACTIVE) 926 926 lpsType = BTC_LPS_DISABLE; 927 927 else 928 928 lpsType = BTC_LPS_ENABLE; ··· 1000 1000 if (pBtCoexist->bManualControl) 1001 1001 return; 1002 1002 1003 - if (RT_MEDIA_CONNECT == mediaStatus) 1003 + if (mediaStatus == RT_MEDIA_CONNECT) 1004 1004 mStatus = BTC_MEDIA_CONNECT; 1005 1005 else 1006 1006 mStatus = BTC_MEDIA_DISCONNECT; ··· 1026 1026 if (pBtCoexist->bManualControl) 1027 1027 return; 1028 1028 1029 - if (PACKET_DHCP == pktType) { 1029 + if (pktType == PACKET_DHCP) { 1030 1030 packetType = BTC_PACKET_DHCP; 1031 - } else if (PACKET_EAPOL == pktType) { 1031 + } else if (pktType == PACKET_EAPOL) { 1032 1032 packetType = BTC_PACKET_EAPOL; 1033 - } else if (PACKET_ARP == pktType) { 1033 + } else if (pktType == PACKET_ARP) { 1034 1034 packetType = BTC_PACKET_ARP; 1035 1035 } else { 1036 1036 return; ··· 1114 1114 1115 1115 void EXhalbtcoutsrc_SetAntNum(u8 type, u8 antNum) 1116 1116 { 1117 - if (BT_COEX_ANT_TYPE_PG == type) { 1117 + if (type == BT_COEX_ANT_TYPE_PG) { 1118 1118 GLBtCoexist.boardInfo.pgAntNum = antNum; 1119 1119 GLBtCoexist.boardInfo.btdmAntNum = antNum; 1120 - } else if (BT_COEX_ANT_TYPE_ANTDIV == type) { 1120 + } else if (type == BT_COEX_ANT_TYPE_ANTDIV) { 1121 1121 GLBtCoexist.boardInfo.btdmAntNum = antNum; 1122 1122 /* GLBtCoexist.boardInfo.btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; */ 1123 - } else if (BT_COEX_ANT_TYPE_DETECTED == type) { 1123 + } else if (type == BT_COEX_ANT_TYPE_DETECTED) { 1124 1124 GLBtCoexist.boardInfo.btdmAntNum = antNum; 1125 1125 /* GLBtCoexist.boardInfo.btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; */ 1126 1126 }
+4 -7
drivers/staging/rtl8723bs/hal/hal_com.c
··· 890 890 void rtw_bb_rf_gain_offset(struct adapter *padapter) 891 891 { 892 892 u8 value = padapter->eeprompriv.EEPROMRFGainOffset; 893 - u32 res, i = 0; 894 893 u32 *Array = Array_kfreemap; 895 894 u32 v1 = 0, v2 = 0, target = 0; 895 + u32 i = 0; 896 896 897 897 if (value & BIT4) { 898 898 if (padapter->eeprompriv.EEPROMRFGainVal != 0xff) { 899 - res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff); 900 - res &= 0xfff87fff; 901 - /* res &= 0xfff87fff; */ 899 + rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff); 900 + 902 901 for (i = 0; i < ARRAY_SIZE(Array_kfreemap); i += 2) { 903 902 v1 = Array[i]; 904 903 v2 = Array[i+1]; ··· 908 909 } 909 910 PHY_SetRFReg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, BIT18|BIT17|BIT16|BIT15, target); 910 911 911 - /* res |= (padapter->eeprompriv.EEPROMRFGainVal & 0x0f)<< 15; */ 912 - /* rtw_hal_write_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, RF_GAIN_OFFSET_MASK, res); */ 913 - res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff); 912 + rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff); 914 913 } 915 914 } 916 915 }
+2 -2
drivers/staging/rtl8723bs/hal/odm_CfoTracking.c
··· 155 155 /* 4 1.6 Big jump */ 156 156 if (pCfoTrack->bAdjust) { 157 157 if (CFO_ave > CFO_TH_XTAL_LOW) 158 - Adjust_Xtal = Adjust_Xtal+((CFO_ave-CFO_TH_XTAL_LOW)>>2); 158 + Adjust_Xtal = Adjust_Xtal + ((CFO_ave - CFO_TH_XTAL_LOW) >> 2); 159 159 else if (CFO_ave < (-CFO_TH_XTAL_LOW)) 160 - Adjust_Xtal = Adjust_Xtal+((CFO_TH_XTAL_LOW-CFO_ave)>>2); 160 + Adjust_Xtal = Adjust_Xtal + ((CFO_TH_XTAL_LOW - CFO_ave) >> 2); 161 161 } 162 162 163 163 /* 4 1.7 Adjust Crystal Cap. */
+1 -1
drivers/staging/rtl8723bs/hal/odm_DIG.c
··· 56 56 { 57 57 struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; 58 58 59 - pDM_Odm->adaptivity_flag = 0; 59 + pDM_Odm->adaptivity_flag = false; 60 60 pDM_Odm->tolerance_cnt = 3; 61 61 pDM_Odm->NHMLastTxOkcnt = 0; 62 62 pDM_Odm->NHMLastRxOkcnt = 0;
+24 -57
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
··· 501 501 switch (type) { 502 502 case TYPE_EFUSE_MAX_SECTION: 503 503 { 504 - u8 *pMax_section; 505 - pMax_section = pOut; 504 + u8 *pMax_section = pOut; 506 505 507 506 if (efuseType == EFUSE_WIFI) 508 507 *pMax_section = EFUSE_MAX_SECTION_8723B; ··· 512 513 513 514 case TYPE_EFUSE_REAL_CONTENT_LEN: 514 515 { 515 - u16 *pu2Tmp; 516 - pu2Tmp = pOut; 516 + u16 *pu2Tmp = pOut; 517 517 518 518 if (efuseType == EFUSE_WIFI) 519 519 *pu2Tmp = EFUSE_REAL_CONTENT_LEN_8723B; ··· 523 525 524 526 case TYPE_AVAILABLE_EFUSE_BYTES_BANK: 525 527 { 526 - u16 *pu2Tmp; 527 - pu2Tmp = pOut; 528 + u16 *pu2Tmp = pOut; 528 529 529 530 if (efuseType == EFUSE_WIFI) 530 531 *pu2Tmp = (EFUSE_REAL_CONTENT_LEN_8723B-EFUSE_OOB_PROTECT_BYTES); ··· 534 537 535 538 case TYPE_AVAILABLE_EFUSE_BYTES_TOTAL: 536 539 { 537 - u16 *pu2Tmp; 538 - pu2Tmp = pOut; 540 + u16 *pu2Tmp = pOut; 539 541 540 542 if (efuseType == EFUSE_WIFI) 541 543 *pu2Tmp = (EFUSE_REAL_CONTENT_LEN_8723B-EFUSE_OOB_PROTECT_BYTES); ··· 545 549 546 550 case TYPE_EFUSE_MAP_LEN: 547 551 { 548 - u16 *pu2Tmp; 549 - pu2Tmp = pOut; 552 + u16 *pu2Tmp = pOut; 550 553 551 554 if (efuseType == EFUSE_WIFI) 552 555 *pu2Tmp = EFUSE_MAX_MAP_LEN; ··· 556 561 557 562 case TYPE_EFUSE_PROTECT_BYTES_BANK: 558 563 { 559 - u8 *pu1Tmp; 560 - pu1Tmp = pOut; 564 + u8 *pu1Tmp = pOut; 561 565 562 566 if (efuseType == EFUSE_WIFI) 563 567 *pu1Tmp = EFUSE_OOB_PROTECT_BYTES; ··· 567 573 568 574 case TYPE_EFUSE_CONTENT_LEN_BANK: 569 575 { 570 - u16 *pu2Tmp; 571 - pu2Tmp = pOut; 576 + u16 *pu2Tmp = pOut; 572 577 573 578 if (efuseType == EFUSE_WIFI) 574 579 *pu2Tmp = EFUSE_REAL_CONTENT_LEN_8723B; ··· 578 585 579 586 default: 580 587 { 581 - u8 *pu1Tmp; 582 - pu1Tmp = pOut; 588 + u8 *pu1Tmp = pOut; 583 589 *pu1Tmp = 0; 584 590 } 585 591 break; ··· 827 835 } 828 836 829 837 if (offset < EFUSE_BT_MAX_SECTION) { 830 - u16 addr; 838 + u16 addr = offset * PGPKT_DATA_SIZE; 831 839 832 - addr = offset * PGPKT_DATA_SIZE; 833 840 for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { 834 841 /* Check word enable condition in the section */ 835 842 if (!(wden & (0x01<<i))) { ··· 1187 1196 { 1188 1197 struct hal_com_data *pHalData = GET_HAL_DATA(padapter); 1189 1198 u16 val16; 1190 - u8 val8; 1199 + u8 val8 = DIS_TSF_UDT; 1191 1200 1192 1201 1193 - val8 = DIS_TSF_UDT; 1194 1202 val16 = val8 | (val8 << 8); /* port0 and port1 */ 1195 1203 1196 1204 /* Enable prot0 beacon function for PSTDMA */ ··· 1486 1496 { 1487 1497 unsigned long start, passing_time; 1488 1498 u32 val32; 1489 - s32 ret; 1490 - 1491 - 1492 - ret = _FAIL; 1499 + s32 ret = _FAIL; 1493 1500 1494 1501 val32 = rtw_read32(padapter, REG_AUTO_LLT); 1495 1502 val32 |= BIT_AUTO_INIT_LLT; ··· 2260 2273 /* Encrypt the data frame if under security mode excepct null data. Suggested by CCW. */ 2261 2274 /* */ 2262 2275 if (bDataFrame) { 2263 - u32 EncAlg; 2276 + u32 EncAlg = padapter->securitypriv.dot11PrivacyAlgrthm; 2264 2277 2265 - EncAlg = padapter->securitypriv.dot11PrivacyAlgrthm; 2266 2278 switch (EncAlg) { 2267 2279 case _NO_PRIVACY_: 2268 2280 SET_TX_DESC_SEC_TYPE_8723B(pDesc, 0x0); ··· 2364 2378 static void hw_var_set_macaddr(struct adapter *padapter, u8 variable, u8 *val) 2365 2379 { 2366 2380 u8 idx = 0; 2367 - u32 reg_macid; 2368 - 2369 - reg_macid = REG_MACID; 2381 + u32 reg_macid = REG_MACID; 2370 2382 2371 2383 for (idx = 0 ; idx < 6; idx++) 2372 2384 rtw_write8(GET_PRIMARY_ADAPTER(padapter), (reg_macid+idx), val[idx]); ··· 2373 2389 static void hw_var_set_bssid(struct adapter *padapter, u8 variable, u8 *val) 2374 2390 { 2375 2391 u8 idx = 0; 2376 - u32 reg_bssid; 2377 - 2378 - reg_bssid = REG_BSSID; 2392 + u32 reg_bssid = REG_BSSID; 2379 2393 2380 2394 for (idx = 0 ; idx < 6; idx++) 2381 2395 rtw_write8(padapter, (reg_bssid+idx), val[idx]); ··· 2381 2399 2382 2400 static void hw_var_set_bcn_func(struct adapter *padapter, u8 variable, u8 *val) 2383 2401 { 2384 - u32 bcn_ctrl_reg; 2385 - 2386 - bcn_ctrl_reg = REG_BCN_CTRL; 2402 + u32 bcn_ctrl_reg = REG_BCN_CTRL; 2387 2403 2388 2404 if (*(u8 *)val) 2389 2405 rtw_write8(padapter, bcn_ctrl_reg, (EN_BCN_FUNCTION | EN_TXBCN_RPT)); ··· 2402 2422 { 2403 2423 u8 val8; 2404 2424 u64 tsf; 2405 - struct mlme_ext_priv *pmlmeext; 2406 - struct mlme_ext_info *pmlmeinfo; 2407 - 2408 - 2409 - pmlmeext = &padapter->mlmeextpriv; 2410 - pmlmeinfo = &pmlmeext->mlmext_info; 2425 + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 2426 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 2411 2427 2412 2428 tsf = pmlmeext->TSFValue-do_div(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024))-1024; /* us */ 2413 2429 ··· 2519 2543 u8 val8; 2520 2544 u16 val16; 2521 2545 u32 val32; 2522 - u8 RetryLimit; 2523 - u8 type; 2524 - struct mlme_priv *pmlmepriv; 2546 + u8 RetryLimit = 0x30; 2547 + u8 type = *(u8 *)val; 2548 + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 2525 2549 struct eeprom_priv *pEEPROM; 2526 2550 2527 2551 2528 - RetryLimit = 0x30; 2529 - type = *(u8 *)val; 2530 - pmlmepriv = &padapter->mlmepriv; 2531 2552 pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); 2532 2553 2533 2554 if (type == 0) { /* prepare to join */ ··· 2823 2850 2824 2851 case HW_VAR_ACK_PREAMBLE: 2825 2852 { 2826 - u8 regTmp; 2853 + u8 regTmp = 0; 2827 2854 u8 bShortPreamble = *val; 2828 2855 2829 2856 /* Joseph marked out for Netgear 3500 TKIP channel 7 issue.(Temporarily) */ 2830 2857 /* regTmp = (pHalData->nCur40MhzPrimeSC)<<5; */ 2831 - regTmp = 0; 2832 2858 if (bShortPreamble) 2833 2859 regTmp |= 0x80; 2834 2860 rtw_write8(padapter, REG_RRSR+2, regTmp); ··· 3198 3226 */ 3199 3227 u8 SetHalDefVar8723B(struct adapter *padapter, enum hal_def_variable variable, void *pval) 3200 3228 { 3201 - u8 bResult; 3202 - 3203 - bResult = _SUCCESS; 3229 + u8 bResult = _SUCCESS; 3204 3230 3205 3231 switch (variable) { 3206 3232 default: ··· 3214 3244 */ 3215 3245 u8 GetHalDefVar8723B(struct adapter *padapter, enum hal_def_variable variable, void *pval) 3216 3246 { 3217 - u8 bResult; 3218 - 3219 - bResult = _SUCCESS; 3247 + u8 bResult = _SUCCESS; 3220 3248 3221 3249 switch (variable) { 3222 3250 case HAL_DEF_MAX_RECVBUF_SZ: ··· 3249 3281 case HW_DEF_RA_INFO_DUMP: 3250 3282 { 3251 3283 u8 mac_id = *(u8 *)pval; 3252 - u32 cmd; 3284 + u32 cmd = 0x40000100 | mac_id; 3253 3285 3254 - cmd = 0x40000100 | mac_id; 3255 3286 rtw_write32(padapter, REG_HMEBOX_DBG_2_8723B, cmd); 3256 3287 msleep(10); 3257 3288 rtw_read32(padapter, 0x2F0); // info 1
+9 -24
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
··· 120 120 */ 121 121 s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter) 122 122 { 123 - struct xmit_priv *pxmitpriv; 123 + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; 124 124 u8 queue_empty, queue_pending; 125 125 s32 ret; 126 - 127 - 128 - pxmitpriv = &padapter->xmitpriv; 129 126 130 127 if (wait_for_completion_interruptible(&pxmitpriv->xmit_comp)) { 131 128 netdev_emerg(padapter->pnetdev, ··· 354 357 */ 355 358 static s32 rtl8723bs_xmit_handler(struct adapter *padapter) 356 359 { 357 - struct xmit_priv *pxmitpriv; 360 + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; 358 361 s32 ret; 359 - 360 - 361 - pxmitpriv = &padapter->xmitpriv; 362 362 363 363 if (wait_for_completion_interruptible(&pxmitpriv->SdioXmitStart)) { 364 364 netdev_emerg(padapter->pnetdev, "%s: SdioXmitStart fail!\n", ··· 402 408 403 409 int rtl8723bs_xmit_thread(void *context) 404 410 { 405 - s32 ret; 406 - struct adapter *padapter; 407 - struct xmit_priv *pxmitpriv; 408 - 409 - ret = _SUCCESS; 410 - padapter = context; 411 - pxmitpriv = &padapter->xmitpriv; 411 + s32 ret = _SUCCESS; 412 + struct adapter *padapter = context; 413 + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; 412 414 413 415 allow_signal(SIGTERM); 414 416 ··· 425 435 ) 426 436 { 427 437 s32 ret = _SUCCESS; 428 - struct pkt_attrib *pattrib; 429 - struct xmit_buf *pxmitbuf; 438 + struct pkt_attrib *pattrib = &pmgntframe->attrib; 439 + struct xmit_buf *pxmitbuf = pmgntframe->pxmitbuf; 430 440 struct xmit_priv *pxmitpriv = &padapter->xmitpriv; 431 441 struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); 432 442 u8 *pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; 433 443 u8 txdesc_size = TXDESC_SIZE; 434 - 435 - pattrib = &pmgntframe->attrib; 436 - pxmitbuf = pmgntframe->pxmitbuf; 437 444 438 445 rtl8723b_update_txdesc(pmgntframe, pmgntframe->buf_addr); 439 446 ··· 544 557 545 558 void rtl8723bs_free_xmit_priv(struct adapter *padapter) 546 559 { 547 - struct xmit_priv *pxmitpriv; 560 + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; 548 561 struct xmit_buf *pxmitbuf; 549 - struct __queue *pqueue; 562 + struct __queue *pqueue = &pxmitpriv->pending_xmitbuf_queue; 550 563 struct list_head *plist, *phead; 551 564 struct list_head tmplist; 552 565 553 566 554 - pxmitpriv = &padapter->xmitpriv; 555 - pqueue = &pxmitpriv->pending_xmitbuf_queue; 556 567 phead = get_list_head(pqueue); 557 568 INIT_LIST_HEAD(&tmplist); 558 569
+1 -1
drivers/staging/rtl8723bs/include/hal_pwr_seq.h
··· 209 209 #define RTL8723B_TRANS_END \ 210 210 /* format */ \ 211 211 /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, comments here*/ \ 212 - {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, 0, PWR_CMD_END, 0, 0}, 212 + {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, 0, PWR_CMD_END, 0, 0}, 213 213 214 214 215 215 extern struct wlan_pwr_cfg rtl8723B_power_on_flow[RTL8723B_TRANS_CARDEMU_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS];
+1 -1
drivers/staging/rtl8723bs/include/sta_info.h
··· 86 86 uint qos_option; 87 87 u8 hwaddr[ETH_ALEN]; 88 88 89 - uint ieee8021x_blocked; /* 0: allowed, 1:blocked */ 89 + bool ieee8021x_blocked; 90 90 uint dot118021XPrivacy; /* aes, tkip... */ 91 91 union Keytype dot11tkiptxmickey; 92 92 union Keytype dot11tkiprxmickey;
+5 -8
drivers/staging/rtl8723bs/os_dep/recv_linux.c
··· 45 45 /* free os related resource in struct recv_buf */ 46 46 void rtw_os_recvbuf_resource_free(struct adapter *padapter, struct recv_buf *precvbuf) 47 47 { 48 - if (precvbuf->pskb) { 48 + if (precvbuf->pskb) 49 49 dev_kfree_skb_any(precvbuf->pskb); 50 - } 51 50 } 52 51 53 52 struct sk_buff *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 *pdata) ··· 159 160 } 160 161 } 161 162 162 - if (bgroup) { 163 + if (bgroup) 163 164 key_type |= NL80211_KEYTYPE_GROUP; 164 - } else { 165 + else 165 166 key_type |= NL80211_KEYTYPE_PAIRWISE; 166 - } 167 167 168 168 cfg80211_michael_mic_failure(padapter->pnetdev, (u8 *)&pmlmepriv->assoc_bssid[0], key_type, -1, 169 169 NULL, GFP_ATOMIC); 170 170 171 171 memset(&ev, 0x00, sizeof(ev)); 172 - if (bgroup) { 172 + if (bgroup) 173 173 ev.flags |= IW_MICFAILURE_GROUP; 174 - } else { 174 + else 175 175 ev.flags |= IW_MICFAILURE_PAIRWISE; 176 - } 177 176 178 177 ev.src_addr.sa_family = ARPHRD_ETHER; 179 178 memcpy(ev.src_addr.sa_data, &pmlmepriv->assoc_bssid[0], ETH_ALEN);
+1 -2
drivers/staging/sm750fb/Makefile
··· 3 3 4 4 sm750fb-objs := sm750.o sm750_hw.o sm750_accel.o sm750_cursor.o \ 5 5 ddk750_chip.o ddk750_power.o ddk750_mode.o \ 6 - ddk750_display.o ddk750_swi2c.o ddk750_sii164.o \ 7 - ddk750_dvi.o ddk750_hwi2c.o 6 + ddk750_display.o ddk750_swi2c.o
-3
drivers/staging/sm750fb/TODO
··· 3 3 - use kernel coding style 4 4 - refine the code and remove unused code 5 5 - Implement hardware acceleration for imageblit if image->depth > 1 6 - - check on hardware effects of removal of USE_HW_I2C and USE_DVICHIP (these two 7 - are supposed to be sample code which is given here if someone wants to 8 - use those functionalities) 9 6 - must be ported to the atomic kms framework in the drm subsystem (which will 10 7 give you a basic fbdev driver for free) 11 8
-3
drivers/staging/sm750fb/ddk750.h
··· 14 14 #include "ddk750_chip.h" 15 15 #include "ddk750_display.h" 16 16 #include "ddk750_power.h" 17 - #ifdef USE_HW_I2C 18 - #include "ddk750_hwi2c.h" 19 - #endif 20 17 #include "ddk750_swi2c.h" 21 18 #endif
-1
drivers/staging/sm750fb/ddk750_display.c
··· 3 3 #include "ddk750_chip.h" 4 4 #include "ddk750_display.h" 5 5 #include "ddk750_power.h" 6 - #include "ddk750_dvi.h" 7 6 8 7 static void set_display_control(int ctrl, int disp_state) 9 8 {
-62
drivers/staging/sm750fb/ddk750_dvi.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #define USE_DVICHIP 3 - #ifdef USE_DVICHIP 4 - #include "ddk750_chip.h" 5 - #include "ddk750_reg.h" 6 - #include "ddk750_dvi.h" 7 - #include "ddk750_sii164.h" 8 - 9 - /* 10 - * This global variable contains all the supported driver and its corresponding 11 - * function API. Please set the function pointer to NULL whenever the function 12 - * is not supported. 13 - */ 14 - static struct dvi_ctrl_device dcft_supported_dvi_controller[] = { 15 - #ifdef DVI_CTRL_SII164 16 - { 17 - .init = sii164_init_chip, 18 - .get_vendor_id = sii164_get_vendor_id, 19 - .get_device_id = sii164GetDeviceID, 20 - #ifdef SII164_FULL_FUNCTIONS 21 - .reset_chip = sii164ResetChip, 22 - .get_chip_string = sii164GetChipString, 23 - .set_power = sii164SetPower, 24 - .enable_hot_plug_detection = sii164EnableHotPlugDetection, 25 - .is_connected = sii164IsConnected, 26 - .check_interrupt = sii164CheckInterrupt, 27 - .clear_interrupt = sii164ClearInterrupt, 28 - #endif 29 - }, 30 - #endif 31 - }; 32 - 33 - int dvi_init(unsigned char edge_select, 34 - unsigned char bus_select, 35 - unsigned char dual_edge_clk_select, 36 - unsigned char hsync_enable, 37 - unsigned char vsync_enable, 38 - unsigned char deskew_enable, 39 - unsigned char deskew_setting, 40 - unsigned char continuous_sync_enable, 41 - unsigned char pll_filter_enable, 42 - unsigned char pll_filter_value) 43 - { 44 - struct dvi_ctrl_device *current_dvi_ctrl; 45 - 46 - current_dvi_ctrl = dcft_supported_dvi_controller; 47 - if (current_dvi_ctrl->init) { 48 - return current_dvi_ctrl->init(edge_select, 49 - bus_select, 50 - dual_edge_clk_select, 51 - hsync_enable, 52 - vsync_enable, 53 - deskew_enable, 54 - deskew_setting, 55 - continuous_sync_enable, 56 - pll_filter_enable, 57 - pll_filter_value); 58 - } 59 - return -1; /* error */ 60 - } 61 - 62 - #endif
-57
drivers/staging/sm750fb/ddk750_dvi.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef DDK750_DVI_H__ 3 - #define DDK750_DVI_H__ 4 - 5 - /* dvi chip stuffs structros */ 6 - 7 - typedef long (*PFN_DVICTRL_INIT)(unsigned char edge_select, 8 - unsigned char bus_select, 9 - unsigned char dual_edge_clk_select, 10 - unsigned char hsync_enable, 11 - unsigned char vsync_enable, 12 - unsigned char deskew_enable, 13 - unsigned char deskew_setting, 14 - unsigned char continuous_sync_enable, 15 - unsigned char pll_filter_enable, 16 - unsigned char pll_filter_value); 17 - 18 - typedef void (*PFN_DVICTRL_RESETCHIP)(void); 19 - typedef char* (*PFN_DVICTRL_GETCHIPSTRING)(void); 20 - typedef unsigned short (*PFN_DVICTRL_GETVENDORID)(void); 21 - typedef unsigned short (*PFN_DVICTRL_GETDEVICEID)(void); 22 - typedef void (*PFN_DVICTRL_SETPOWER)(unsigned char power_up); 23 - typedef void (*PFN_DVICTRL_HOTPLUGDETECTION)(unsigned char enable_hot_plug); 24 - typedef unsigned char (*PFN_DVICTRL_ISCONNECTED)(void); 25 - typedef unsigned char (*PFN_DVICTRL_CHECKINTERRUPT)(void); 26 - typedef void (*PFN_DVICTRL_CLEARINTERRUPT)(void); 27 - 28 - /* Structure to hold all the function pointer to the DVI Controller. */ 29 - struct dvi_ctrl_device { 30 - PFN_DVICTRL_INIT init; 31 - PFN_DVICTRL_RESETCHIP reset_chip; 32 - PFN_DVICTRL_GETCHIPSTRING get_chip_string; 33 - PFN_DVICTRL_GETVENDORID get_vendor_id; 34 - PFN_DVICTRL_GETDEVICEID get_device_id; 35 - PFN_DVICTRL_SETPOWER set_power; 36 - PFN_DVICTRL_HOTPLUGDETECTION enable_hot_plug_detection; 37 - PFN_DVICTRL_ISCONNECTED is_connected; 38 - PFN_DVICTRL_CHECKINTERRUPT check_interrupt; 39 - PFN_DVICTRL_CLEARINTERRUPT clear_interrupt; 40 - }; 41 - 42 - #define DVI_CTRL_SII164 43 - 44 - /* dvi functions prototype */ 45 - int dvi_init(unsigned char edge_select, 46 - unsigned char bus_select, 47 - unsigned char dual_edge_clk_select, 48 - unsigned char hsync_enable, 49 - unsigned char vsync_enable, 50 - unsigned char deskew_enable, 51 - unsigned char deskew_setting, 52 - unsigned char continuous_sync_enable, 53 - unsigned char pll_filter_enable, 54 - unsigned char pll_filter_value); 55 - 56 - #endif 57 -
-247
drivers/staging/sm750fb/ddk750_hwi2c.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #define USE_HW_I2C 3 - #ifdef USE_HW_I2C 4 - #include "ddk750_chip.h" 5 - #include "ddk750_reg.h" 6 - #include "ddk750_hwi2c.h" 7 - #include "ddk750_power.h" 8 - 9 - #define MAX_HWI2C_FIFO 16 10 - #define HWI2C_WAIT_TIMEOUT 0xF0000 11 - 12 - int sm750_hw_i2c_init(unsigned char bus_speed_mode) 13 - { 14 - unsigned int value; 15 - 16 - /* Enable GPIO 30 & 31 as IIC clock & data */ 17 - value = peek32(GPIO_MUX); 18 - 19 - value |= (GPIO_MUX_30 | GPIO_MUX_31); 20 - poke32(GPIO_MUX, value); 21 - 22 - /* 23 - * Enable Hardware I2C power. 24 - * TODO: Check if we need to enable GPIO power? 25 - */ 26 - sm750_enable_i2c(1); 27 - 28 - /* Enable the I2C Controller and set the bus speed mode */ 29 - value = peek32(I2C_CTRL) & ~(I2C_CTRL_MODE | I2C_CTRL_EN); 30 - if (bus_speed_mode) 31 - value |= I2C_CTRL_MODE; 32 - value |= I2C_CTRL_EN; 33 - poke32(I2C_CTRL, value); 34 - 35 - return 0; 36 - } 37 - 38 - void sm750_hw_i2c_close(void) 39 - { 40 - unsigned int value; 41 - 42 - /* Disable I2C controller */ 43 - value = peek32(I2C_CTRL) & ~I2C_CTRL_EN; 44 - poke32(I2C_CTRL, value); 45 - 46 - /* Disable I2C Power */ 47 - sm750_enable_i2c(0); 48 - 49 - /* Set GPIO 30 & 31 back as GPIO pins */ 50 - value = peek32(GPIO_MUX); 51 - value &= ~GPIO_MUX_30; 52 - value &= ~GPIO_MUX_31; 53 - poke32(GPIO_MUX, value); 54 - } 55 - 56 - static long hw_i2c_wait_tx_done(void) 57 - { 58 - unsigned int timeout; 59 - 60 - /* Wait until the transfer is completed. */ 61 - timeout = HWI2C_WAIT_TIMEOUT; 62 - while (!(peek32(I2C_STATUS) & I2C_STATUS_TX) && (timeout != 0)) 63 - timeout--; 64 - 65 - if (timeout == 0) 66 - return -1; 67 - 68 - return 0; 69 - } 70 - 71 - /* 72 - * This function writes data to the i2c slave device registers. 73 - * 74 - * Parameters: 75 - * addr - i2c Slave device address 76 - * length - Total number of bytes to be written to the device 77 - * buf - The buffer that contains the data to be written to the 78 - * i2c device. 79 - * 80 - * Return Value: 81 - * Total number of bytes those are actually written. 82 - */ 83 - static unsigned int hw_i2c_write_data(unsigned char addr, 84 - unsigned int length, 85 - unsigned char *buf) 86 - { 87 - unsigned char count, i; 88 - unsigned int total_bytes = 0; 89 - 90 - /* Set the Device Address */ 91 - poke32(I2C_SLAVE_ADDRESS, addr & ~0x01); 92 - 93 - /* 94 - * Write data. 95 - * Note: 96 - * Only 16 byte can be accessed per i2c start instruction. 97 - */ 98 - do { 99 - /* 100 - * Reset I2C by writing 0 to I2C_RESET register to 101 - * clear the previous status. 102 - */ 103 - poke32(I2C_RESET, 0); 104 - 105 - /* Set the number of bytes to be written */ 106 - if (length < MAX_HWI2C_FIFO) 107 - count = length - 1; 108 - else 109 - count = MAX_HWI2C_FIFO - 1; 110 - poke32(I2C_BYTE_COUNT, count); 111 - 112 - /* Move the data to the I2C data register */ 113 - for (i = 0; i <= count; i++) 114 - poke32(I2C_DATA0 + i, *buf++); 115 - 116 - /* Start the I2C */ 117 - poke32(I2C_CTRL, peek32(I2C_CTRL) | I2C_CTRL_CTRL); 118 - 119 - /* Wait until the transfer is completed. */ 120 - if (hw_i2c_wait_tx_done() != 0) 121 - break; 122 - 123 - /* Subtract length */ 124 - length -= (count + 1); 125 - 126 - /* Total byte written */ 127 - total_bytes += (count + 1); 128 - 129 - } while (length > 0); 130 - 131 - return total_bytes; 132 - } 133 - 134 - /* 135 - * This function reads data from the slave device and stores them 136 - * in the given buffer 137 - * 138 - * Parameters: 139 - * addr - i2c Slave device address 140 - * length - Total number of bytes to be read 141 - * buf - Pointer to a buffer to be filled with the data read 142 - * from the slave device. It has to be the same size as the 143 - * length to make sure that it can keep all the data read. 144 - * 145 - * Return Value: 146 - * Total number of actual bytes read from the slave device 147 - */ 148 - static unsigned int hw_i2c_read_data(unsigned char addr, 149 - unsigned int length, 150 - unsigned char *buf) 151 - { 152 - unsigned char count, i; 153 - unsigned int total_bytes = 0; 154 - 155 - /* Set the Device Address */ 156 - poke32(I2C_SLAVE_ADDRESS, addr | 0x01); 157 - 158 - /* 159 - * Read data and save them to the buffer. 160 - * Note: 161 - * Only 16 byte can be accessed per i2c start instruction. 162 - */ 163 - do { 164 - /* 165 - * Reset I2C by writing 0 to I2C_RESET register to 166 - * clear all the status. 167 - */ 168 - poke32(I2C_RESET, 0); 169 - 170 - /* Set the number of bytes to be read */ 171 - if (length <= MAX_HWI2C_FIFO) 172 - count = length - 1; 173 - else 174 - count = MAX_HWI2C_FIFO - 1; 175 - poke32(I2C_BYTE_COUNT, count); 176 - 177 - /* Start the I2C */ 178 - poke32(I2C_CTRL, peek32(I2C_CTRL) | I2C_CTRL_CTRL); 179 - 180 - /* Wait until transaction done. */ 181 - if (hw_i2c_wait_tx_done() != 0) 182 - break; 183 - 184 - /* Save the data to the given buffer */ 185 - for (i = 0; i <= count; i++) 186 - *buf++ = peek32(I2C_DATA0 + i); 187 - 188 - /* Subtract length by 16 */ 189 - length -= (count + 1); 190 - 191 - /* Number of bytes read. */ 192 - total_bytes += (count + 1); 193 - 194 - } while (length > 0); 195 - 196 - return total_bytes; 197 - } 198 - 199 - /* 200 - * This function reads the slave device's register 201 - * 202 - * Parameters: 203 - * deviceAddress - i2c Slave device address which register 204 - * to be read from 205 - * registerIndex - Slave device's register to be read 206 - * 207 - * Return Value: 208 - * Register value 209 - */ 210 - unsigned char sm750_hw_i2c_read_reg(unsigned char addr, unsigned char reg) 211 - { 212 - unsigned char value = 0xFF; 213 - 214 - if (hw_i2c_write_data(addr, 1, &reg) == 1) 215 - hw_i2c_read_data(addr, 1, &value); 216 - 217 - return value; 218 - } 219 - 220 - /* 221 - * This function writes a value to the slave device's register 222 - * 223 - * Parameters: 224 - * deviceAddress - i2c Slave device address which register 225 - * to be written 226 - * registerIndex - Slave device's register to be written 227 - * data - Data to be written to the register 228 - * 229 - * Result: 230 - * 0 - Success 231 - * -1 - Fail 232 - */ 233 - int sm750_hw_i2c_write_reg(unsigned char addr, 234 - unsigned char reg, 235 - unsigned char data) 236 - { 237 - unsigned char value[2]; 238 - 239 - value[0] = reg; 240 - value[1] = data; 241 - if (hw_i2c_write_data(addr, 2, value) == 2) 242 - return 0; 243 - 244 - return -1; 245 - } 246 - 247 - #endif
-12
drivers/staging/sm750fb/ddk750_hwi2c.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef DDK750_HWI2C_H__ 3 - #define DDK750_HWI2C_H__ 4 - 5 - /* hwi2c functions */ 6 - int sm750_hw_i2c_init(unsigned char bus_speed_mode); 7 - void sm750_hw_i2c_close(void); 8 - 9 - unsigned char sm750_hw_i2c_read_reg(unsigned char addr, unsigned char reg); 10 - int sm750_hw_i2c_write_reg(unsigned char addr, unsigned char reg, 11 - unsigned char data); 12 - #endif
+4 -4
drivers/staging/sm750fb/ddk750_power.h
··· 3 3 #define DDK750_POWER_H__ 4 4 5 5 enum dpms { 6 - crtDPMS_ON = 0x0, 7 - crtDPMS_STANDBY = 0x1, 8 - crtDPMS_SUSPEND = 0x2, 9 - crtDPMS_OFF = 0x3, 6 + CRT_DPMS_ON = 0x0, 7 + CRT_DPMS_STANDBY = 0x1, 8 + CRT_DPMS_SUSPEND = 0x2, 9 + CRT_DPMS_OFF = 0x3, 10 10 }; 11 11 12 12 #define set_DAC(off) { \
-408
drivers/staging/sm750fb/ddk750_sii164.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #define USE_DVICHIP 3 - #ifdef USE_DVICHIP 4 - 5 - #include "ddk750_sii164.h" 6 - #include "ddk750_hwi2c.h" 7 - 8 - /* I2C Address of each SII164 chip */ 9 - #define SII164_I2C_ADDRESS 0x70 10 - 11 - /* Define this definition to use hardware i2c. */ 12 - #define USE_HW_I2C 13 - 14 - #ifdef USE_HW_I2C 15 - #define i2cWriteReg sm750_hw_i2c_write_reg 16 - #define i2cReadReg sm750_hw_i2c_read_reg 17 - #else 18 - #define i2cWriteReg sm750_sw_i2c_write_reg 19 - #define i2cReadReg sm750_sw_i2c_read_reg 20 - #endif 21 - 22 - /* SII164 Vendor and Device ID */ 23 - #define SII164_VENDOR_ID 0x0001 24 - #define SII164_DEVICE_ID 0x0006 25 - 26 - #ifdef SII164_FULL_FUNCTIONS 27 - /* Name of the DVI Controller chip */ 28 - static char *gDviCtrlChipName = "Silicon Image SiI 164"; 29 - #endif 30 - 31 - /* 32 - * sii164_get_vendor_id 33 - * This function gets the vendor ID of the DVI controller chip. 34 - * 35 - * Output: 36 - * Vendor ID 37 - */ 38 - unsigned short sii164_get_vendor_id(void) 39 - { 40 - unsigned short vendorID; 41 - 42 - vendorID = ((unsigned short)i2cReadReg(SII164_I2C_ADDRESS, 43 - SII164_VENDOR_ID_HIGH) << 8) | 44 - (unsigned short)i2cReadReg(SII164_I2C_ADDRESS, 45 - SII164_VENDOR_ID_LOW); 46 - 47 - return vendorID; 48 - } 49 - 50 - /* 51 - * sii164GetDeviceID 52 - * This function gets the device ID of the DVI controller chip. 53 - * 54 - * Output: 55 - * Device ID 56 - */ 57 - unsigned short sii164GetDeviceID(void) 58 - { 59 - unsigned short deviceID; 60 - 61 - deviceID = ((unsigned short)i2cReadReg(SII164_I2C_ADDRESS, 62 - SII164_DEVICE_ID_HIGH) << 8) | 63 - (unsigned short)i2cReadReg(SII164_I2C_ADDRESS, 64 - SII164_DEVICE_ID_LOW); 65 - 66 - return deviceID; 67 - } 68 - 69 - /* 70 - * DVI.C will handle all SiI164 chip stuffs and try its best to make code 71 - * minimal and useful 72 - */ 73 - 74 - /* 75 - * sii164_init_chip 76 - * This function initialize and detect the DVI controller chip. 77 - * 78 - * Input: 79 - * edge_select - Edge Select: 80 - * 0 = Input data is falling edge latched (falling 81 - * edge latched first in dual edge mode) 82 - * 1 = Input data is rising edge latched (rising 83 - * edge latched first in dual edge mode) 84 - * bus_select - Input Bus Select: 85 - * 0 = Input data bus is 12-bits wide 86 - * 1 = Input data bus is 24-bits wide 87 - * dual_edge_clk_select - Dual Edge Clock Select 88 - * 0 = Input data is single edge latched 89 - * 1 = Input data is dual edge latched 90 - * hsync_enable - Horizontal Sync Enable: 91 - * 0 = HSYNC input is transmitted as fixed LOW 92 - * 1 = HSYNC input is transmitted as is 93 - * vsync_enable - Vertical Sync Enable: 94 - * 0 = VSYNC input is transmitted as fixed LOW 95 - * 1 = VSYNC input is transmitted as is 96 - * deskew_enable - De-skewing Enable: 97 - * 0 = De-skew disabled 98 - * 1 = De-skew enabled 99 - * deskew_setting - De-skewing Setting (increment of 260psec) 100 - * 0 = 1 step --> minimum setup / maximum hold 101 - * 1 = 2 step 102 - * 2 = 3 step 103 - * 3 = 4 step 104 - * 4 = 5 step 105 - * 5 = 6 step 106 - * 6 = 7 step 107 - * 7 = 8 step --> maximum setup / minimum hold 108 - * continuous_sync_enable- SYNC Continuous: 109 - * 0 = Disable 110 - * 1 = Enable 111 - * pll_filter_enable - PLL Filter Enable 112 - * 0 = Disable PLL Filter 113 - * 1 = Enable PLL Filter 114 - * pll_filter_value - PLL Filter characteristics: 115 - * 0~7 (recommended value is 4) 116 - * 117 - * Output: 118 - * 0 - Success 119 - * -1 - Fail. 120 - */ 121 - long sii164_init_chip(unsigned char edge_select, 122 - unsigned char bus_select, 123 - unsigned char dual_edge_clk_select, 124 - unsigned char hsync_enable, 125 - unsigned char vsync_enable, 126 - unsigned char deskew_enable, 127 - unsigned char deskew_setting, 128 - unsigned char continuous_sync_enable, 129 - unsigned char pll_filter_enable, 130 - unsigned char pll_filter_value) 131 - { 132 - unsigned char config; 133 - 134 - /* Initialize the i2c bus */ 135 - #ifdef USE_HW_I2C 136 - /* Use fast mode. */ 137 - sm750_hw_i2c_init(1); 138 - #else 139 - sm750_sw_i2c_init(DEFAULT_I2C_SCL, DEFAULT_I2C_SDA); 140 - #endif 141 - 142 - /* Check if SII164 Chip exists */ 143 - if ((sii164_get_vendor_id() == SII164_VENDOR_ID) && 144 - (sii164GetDeviceID() == SII164_DEVICE_ID)) { 145 - /* 146 - * Initialize SII164 controller chip. 147 - */ 148 - 149 - /* Select the edge */ 150 - if (edge_select == 0) 151 - config = SII164_CONFIGURATION_LATCH_FALLING; 152 - else 153 - config = SII164_CONFIGURATION_LATCH_RISING; 154 - 155 - /* Select bus wide */ 156 - if (bus_select == 0) 157 - config |= SII164_CONFIGURATION_BUS_12BITS; 158 - else 159 - config |= SII164_CONFIGURATION_BUS_24BITS; 160 - 161 - /* Select Dual/Single Edge Clock */ 162 - if (dual_edge_clk_select == 0) 163 - config |= SII164_CONFIGURATION_CLOCK_SINGLE; 164 - else 165 - config |= SII164_CONFIGURATION_CLOCK_DUAL; 166 - 167 - /* Select HSync Enable */ 168 - if (hsync_enable == 0) 169 - config |= SII164_CONFIGURATION_HSYNC_FORCE_LOW; 170 - else 171 - config |= SII164_CONFIGURATION_HSYNC_AS_IS; 172 - 173 - /* Select VSync Enable */ 174 - if (vsync_enable == 0) 175 - config |= SII164_CONFIGURATION_VSYNC_FORCE_LOW; 176 - else 177 - config |= SII164_CONFIGURATION_VSYNC_AS_IS; 178 - 179 - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); 180 - 181 - /* 182 - * De-skew enabled with default 111b value. 183 - * This fixes some artifacts problem in some mode on board 2.2. 184 - * Somehow this fix does not affect board 2.1. 185 - */ 186 - if (deskew_enable == 0) 187 - config = SII164_DESKEW_DISABLE; 188 - else 189 - config = SII164_DESKEW_ENABLE; 190 - 191 - switch (deskew_setting) { 192 - case 0: 193 - config |= SII164_DESKEW_1_STEP; 194 - break; 195 - case 1: 196 - config |= SII164_DESKEW_2_STEP; 197 - break; 198 - case 2: 199 - config |= SII164_DESKEW_3_STEP; 200 - break; 201 - case 3: 202 - config |= SII164_DESKEW_4_STEP; 203 - break; 204 - case 4: 205 - config |= SII164_DESKEW_5_STEP; 206 - break; 207 - case 5: 208 - config |= SII164_DESKEW_6_STEP; 209 - break; 210 - case 6: 211 - config |= SII164_DESKEW_7_STEP; 212 - break; 213 - case 7: 214 - config |= SII164_DESKEW_8_STEP; 215 - break; 216 - } 217 - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config); 218 - 219 - /* Enable/Disable Continuous Sync. */ 220 - if (continuous_sync_enable == 0) 221 - config = SII164_PLL_FILTER_SYNC_CONTINUOUS_DISABLE; 222 - else 223 - config = SII164_PLL_FILTER_SYNC_CONTINUOUS_ENABLE; 224 - 225 - /* Enable/Disable PLL Filter */ 226 - if (pll_filter_enable == 0) 227 - config |= SII164_PLL_FILTER_DISABLE; 228 - else 229 - config |= SII164_PLL_FILTER_ENABLE; 230 - 231 - /* Set the PLL Filter value */ 232 - config |= ((pll_filter_value & 0x07) << 1); 233 - 234 - i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config); 235 - 236 - /* Recover from Power Down and enable output. */ 237 - config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); 238 - config |= SII164_CONFIGURATION_POWER_NORMAL; 239 - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); 240 - 241 - return 0; 242 - } 243 - 244 - /* Return -1 if initialization fails. */ 245 - return -1; 246 - } 247 - 248 - /* below sii164 function is not necessary */ 249 - 250 - #ifdef SII164_FULL_FUNCTIONS 251 - 252 - /* 253 - * sii164ResetChip 254 - * This function resets the DVI Controller Chip. 255 - */ 256 - void sii164ResetChip(void) 257 - { 258 - /* Power down */ 259 - sii164SetPower(0); 260 - sii164SetPower(1); 261 - } 262 - 263 - /* 264 - * sii164GetChipString 265 - * This function returns a char string name of the current DVI Controller 266 - * chip. 267 - * 268 - * It's convenient for application need to display the chip name. 269 - */ 270 - char *sii164GetChipString(void) 271 - { 272 - return gDviCtrlChipName; 273 - } 274 - 275 - /* 276 - * sii164SetPower 277 - * This function sets the power configuration of the DVI Controller Chip. 278 - * 279 - * Input: 280 - * powerUp - Flag to set the power down or up 281 - */ 282 - void sii164SetPower(unsigned char powerUp) 283 - { 284 - unsigned char config; 285 - 286 - config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION); 287 - if (powerUp == 1) { 288 - /* Power up the chip */ 289 - config &= ~SII164_CONFIGURATION_POWER_MASK; 290 - config |= SII164_CONFIGURATION_POWER_NORMAL; 291 - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); 292 - } else { 293 - /* Power down the chip */ 294 - config &= ~SII164_CONFIGURATION_POWER_MASK; 295 - config |= SII164_CONFIGURATION_POWER_DOWN; 296 - i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config); 297 - } 298 - } 299 - 300 - /* 301 - * sii164SelectHotPlugDetectionMode 302 - * This function selects the mode of the hot plug detection. 303 - */ 304 - static 305 - void sii164SelectHotPlugDetectionMode(enum sii164_hot_plug_mode hotPlugMode) 306 - { 307 - unsigned char detectReg; 308 - 309 - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & 310 - ~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG; 311 - switch (hotPlugMode) { 312 - case SII164_HOTPLUG_DISABLE: 313 - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH; 314 - break; 315 - case SII164_HOTPLUG_USE_MDI: 316 - detectReg &= ~SII164_DETECT_INTERRUPT_MASK; 317 - detectReg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN; 318 - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI; 319 - break; 320 - case SII164_HOTPLUG_USE_RSEN: 321 - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN; 322 - break; 323 - case SII164_HOTPLUG_USE_HTPLG: 324 - detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG; 325 - break; 326 - } 327 - 328 - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg); 329 - } 330 - 331 - /* 332 - * sii164EnableHotPlugDetection 333 - * This function enables the Hot Plug detection. 334 - * 335 - * enableHotPlug - Enable (=1) / disable (=0) Hot Plug detection 336 - */ 337 - void sii164EnableHotPlugDetection(unsigned char enableHotPlug) 338 - { 339 - unsigned char detectReg; 340 - 341 - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); 342 - 343 - /* Depending on each DVI controller, need to enable the hot plug based 344 - * on each individual chip design. 345 - */ 346 - if (enableHotPlug != 0) 347 - sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI); 348 - else 349 - sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_DISABLE); 350 - } 351 - 352 - /* 353 - * sii164IsConnected 354 - * Check if the DVI Monitor is connected. 355 - * 356 - * Output: 357 - * 0 - Not Connected 358 - * 1 - Connected 359 - */ 360 - unsigned char sii164IsConnected(void) 361 - { 362 - unsigned char hotPlugValue; 363 - 364 - hotPlugValue = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & 365 - SII164_DETECT_HOT_PLUG_STATUS_MASK; 366 - if (hotPlugValue == SII164_DETECT_HOT_PLUG_STATUS_ON) 367 - return 1; 368 - else 369 - return 0; 370 - } 371 - 372 - /* 373 - * sii164CheckInterrupt 374 - * Checks if interrupt has occurred. 375 - * 376 - * Output: 377 - * 0 - No interrupt 378 - * 1 - Interrupt occurs 379 - */ 380 - unsigned char sii164CheckInterrupt(void) 381 - { 382 - unsigned char detectReg; 383 - 384 - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) & 385 - SII164_DETECT_MONITOR_STATE_MASK; 386 - if (detectReg == SII164_DETECT_MONITOR_STATE_CHANGE) 387 - return 1; 388 - else 389 - return 0; 390 - } 391 - 392 - /* 393 - * sii164ClearInterrupt 394 - * Clear the hot plug interrupt. 395 - */ 396 - void sii164ClearInterrupt(void) 397 - { 398 - unsigned char detectReg; 399 - 400 - /* Clear the MDI interrupt */ 401 - detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT); 402 - i2cWriteReg(SII164_I2C_ADDRESS, SII164_DETECT, 403 - detectReg | SII164_DETECT_MONITOR_STATE_CLEAR); 404 - } 405 - 406 - #endif 407 - 408 - #endif
-174
drivers/staging/sm750fb/ddk750_sii164.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef DDK750_SII164_H__ 3 - #define DDK750_SII164_H__ 4 - 5 - #define USE_DVICHIP 6 - 7 - /* Hot Plug detection mode structure */ 8 - enum sii164_hot_plug_mode { 9 - SII164_HOTPLUG_DISABLE = 0, /* Disable Hot Plug output bit 10 - * (always high). 11 - */ 12 - 13 - SII164_HOTPLUG_USE_MDI, /* Use Monitor Detect Interrupt bit. */ 14 - SII164_HOTPLUG_USE_RSEN, /* Use Receiver Sense detect bit. */ 15 - SII164_HOTPLUG_USE_HTPLG /* Use Hot Plug detect bit. */ 16 - }; 17 - 18 - /* Silicon Image SiI164 chip prototype */ 19 - long sii164_init_chip(unsigned char edgeSelect, 20 - unsigned char busSelect, 21 - unsigned char dualEdgeClkSelect, 22 - unsigned char hsyncEnable, 23 - unsigned char vsyncEnable, 24 - unsigned char deskewEnable, 25 - unsigned char deskewSetting, 26 - unsigned char continuousSyncEnable, 27 - unsigned char pllFilterEnable, 28 - unsigned char pllFilterValue); 29 - 30 - unsigned short sii164_get_vendor_id(void); 31 - unsigned short sii164GetDeviceID(void); 32 - 33 - #ifdef SII164_FULL_FUNCTIONS 34 - void sii164ResetChip(void); 35 - char *sii164GetChipString(void); 36 - void sii164SetPower(unsigned char powerUp); 37 - void sii164EnableHotPlugDetection(unsigned char enableHotPlug); 38 - unsigned char sii164IsConnected(void); 39 - unsigned char sii164CheckInterrupt(void); 40 - void sii164ClearInterrupt(void); 41 - #endif 42 - /* 43 - * below register definition is used for 44 - * Silicon Image SiI164 DVI controller chip 45 - */ 46 - /* 47 - * Vendor ID registers 48 - */ 49 - #define SII164_VENDOR_ID_LOW 0x00 50 - #define SII164_VENDOR_ID_HIGH 0x01 51 - 52 - /* 53 - * Device ID registers 54 - */ 55 - #define SII164_DEVICE_ID_LOW 0x02 56 - #define SII164_DEVICE_ID_HIGH 0x03 57 - 58 - /* 59 - * Device Revision 60 - */ 61 - #define SII164_DEVICE_REVISION 0x04 62 - 63 - /* 64 - * Frequency Limitation registers 65 - */ 66 - #define SII164_FREQUENCY_LIMIT_LOW 0x06 67 - #define SII164_FREQUENCY_LIMIT_HIGH 0x07 68 - 69 - /* 70 - * Power Down and Input Signal Configuration registers 71 - */ 72 - #define SII164_CONFIGURATION 0x08 73 - 74 - /* Power down (PD) */ 75 - #define SII164_CONFIGURATION_POWER_DOWN 0x00 76 - #define SII164_CONFIGURATION_POWER_NORMAL 0x01 77 - #define SII164_CONFIGURATION_POWER_MASK 0x01 78 - 79 - /* Input Edge Latch Select (EDGE) */ 80 - #define SII164_CONFIGURATION_LATCH_FALLING 0x00 81 - #define SII164_CONFIGURATION_LATCH_RISING 0x02 82 - 83 - /* Bus Select (BSEL) */ 84 - #define SII164_CONFIGURATION_BUS_12BITS 0x00 85 - #define SII164_CONFIGURATION_BUS_24BITS 0x04 86 - 87 - /* Dual Edge Clock Select (DSEL) */ 88 - #define SII164_CONFIGURATION_CLOCK_SINGLE 0x00 89 - #define SII164_CONFIGURATION_CLOCK_DUAL 0x08 90 - 91 - /* Horizontal Sync Enable (HEN) */ 92 - #define SII164_CONFIGURATION_HSYNC_FORCE_LOW 0x00 93 - #define SII164_CONFIGURATION_HSYNC_AS_IS 0x10 94 - 95 - /* Vertical Sync Enable (VEN) */ 96 - #define SII164_CONFIGURATION_VSYNC_FORCE_LOW 0x00 97 - #define SII164_CONFIGURATION_VSYNC_AS_IS 0x20 98 - 99 - /* 100 - * Detection registers 101 - */ 102 - #define SII164_DETECT 0x09 103 - 104 - /* Monitor Detect Interrupt (MDI) */ 105 - #define SII164_DETECT_MONITOR_STATE_CHANGE 0x00 106 - #define SII164_DETECT_MONITOR_STATE_NO_CHANGE 0x01 107 - #define SII164_DETECT_MONITOR_STATE_CLEAR 0x01 108 - #define SII164_DETECT_MONITOR_STATE_MASK 0x01 109 - 110 - /* Hot Plug detect Input (HTPLG) */ 111 - #define SII164_DETECT_HOT_PLUG_STATUS_OFF 0x00 112 - #define SII164_DETECT_HOT_PLUG_STATUS_ON 0x02 113 - #define SII164_DETECT_HOT_PLUG_STATUS_MASK 0x02 114 - 115 - /* Receiver Sense (RSEN) */ 116 - #define SII164_DETECT_RECEIVER_SENSE_NOT_DETECTED 0x00 117 - #define SII164_DETECT_RECEIVER_SENSE_DETECTED 0x04 118 - 119 - /* Interrupt Generation Method (TSEL) */ 120 - #define SII164_DETECT_INTERRUPT_BY_RSEN_PIN 0x00 121 - #define SII164_DETECT_INTERRUPT_BY_HTPLG_PIN 0x08 122 - #define SII164_DETECT_INTERRUPT_MASK 0x08 123 - 124 - /* Monitor Sense Output (MSEN) */ 125 - #define SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH 0x00 126 - #define SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI 0x10 127 - #define SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN 0x20 128 - #define SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG 0x30 129 - #define SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG 0x30 130 - 131 - /* 132 - * Skewing registers 133 - */ 134 - #define SII164_DESKEW 0x0A 135 - 136 - /* General Purpose Input (CTL[3:1]) */ 137 - #define SII164_DESKEW_GENERAL_PURPOSE_INPUT_MASK 0x0E 138 - 139 - /* De-skewing Enable bit (DKEN) */ 140 - #define SII164_DESKEW_DISABLE 0x00 141 - #define SII164_DESKEW_ENABLE 0x10 142 - 143 - /* De-skewing Setting (DK[3:1])*/ 144 - #define SII164_DESKEW_1_STEP 0x00 145 - #define SII164_DESKEW_2_STEP 0x20 146 - #define SII164_DESKEW_3_STEP 0x40 147 - #define SII164_DESKEW_4_STEP 0x60 148 - #define SII164_DESKEW_5_STEP 0x80 149 - #define SII164_DESKEW_6_STEP 0xA0 150 - #define SII164_DESKEW_7_STEP 0xC0 151 - #define SII164_DESKEW_8_STEP 0xE0 152 - 153 - /* 154 - * User Configuration Data registers (CFG 7:0) 155 - */ 156 - #define SII164_USER_CONFIGURATION 0x0B 157 - 158 - /* 159 - * PLL registers 160 - */ 161 - #define SII164_PLL 0x0C 162 - 163 - /* PLL Filter Value (PLLF) */ 164 - #define SII164_PLL_FILTER_VALUE_MASK 0x0E 165 - 166 - /* PLL Filter Enable (PFEN) */ 167 - #define SII164_PLL_FILTER_DISABLE 0x00 168 - #define SII164_PLL_FILTER_ENABLE 0x01 169 - 170 - /* Sync Continuous (SCNT) */ 171 - #define SII164_PLL_FILTER_SYNC_CONTINUOUS_DISABLE 0x00 172 - #define SII164_PLL_FILTER_SYNC_CONTINUOUS_ENABLE 0x80 173 - 174 - #endif
+11 -13
drivers/staging/sm750fb/sm750.c
··· 120 120 121 121 sm750_hw_cursor_disable(cursor); 122 122 if (fbcursor->set & FB_CUR_SETSIZE) 123 - sm750_hw_cursor_setSize(cursor, 123 + sm750_hw_cursor_set_size(cursor, 124 124 fbcursor->image.width, 125 125 fbcursor->image.height); 126 126 127 127 if (fbcursor->set & FB_CUR_SETPOS) 128 - sm750_hw_cursor_setPos(cursor, 128 + sm750_hw_cursor_set_pos(cursor, 129 129 fbcursor->image.dx - info->var.xoffset, 130 130 fbcursor->image.dy - info->var.yoffset); 131 131 ··· 141 141 ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 5) | 142 142 ((info->cmap.blue[fbcursor->image.bg_color] & 0xf800) >> 11); 143 143 144 - sm750_hw_cursor_setColor(cursor, fg, bg); 144 + sm750_hw_cursor_set_color(cursor, fg, bg); 145 145 } 146 146 147 147 if (fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) { 148 - sm750_hw_cursor_setData(cursor, 149 - fbcursor->rop, 150 - fbcursor->image.data, 151 - fbcursor->mask); 148 + sm750_hw_cursor_set_data(cursor, fbcursor->rop, fbcursor->image.data, 149 + fbcursor->mask); 152 150 } 153 151 154 152 if (fbcursor->enable) ··· 392 394 pr_err("bpp %d not supported\n", var->bits_per_pixel); 393 395 return ret; 394 396 } 395 - ret = hw_sm750_crtc_setMode(crtc, var, fix); 397 + ret = hw_sm750_crtc_set_mode(crtc, var, fix); 396 398 if (!ret) 397 - ret = hw_sm750_output_setMode(output, var, fix); 399 + ret = hw_sm750_output_set_mode(output, var, fix); 398 400 return ret; 399 401 } 400 402 ··· 512 514 return -ENOMEM; 513 515 } 514 516 515 - return hw_sm750_crtc_checkMode(crtc, var); 517 + return hw_sm750_crtc_check_mode(crtc, var); 516 518 } 517 519 518 520 static int lynxfb_ops_setcolreg(unsigned int regno, ··· 545 547 red >>= 8; 546 548 green >>= 8; 547 549 blue >>= 8; 548 - ret = hw_sm750_setColReg(crtc, regno, red, green, blue); 550 + ret = hw_sm750_set_col_reg(crtc, regno, red, green, blue); 549 551 goto exit; 550 552 } 551 553 ··· 606 608 crtc->ywrapstep = 0; 607 609 608 610 output->proc_setBLANK = (sm750_dev->revid == SM750LE_REVISION_ID) ? 609 - hw_sm750le_setBLANK : hw_sm750_setBLANK; 611 + hw_sm750le_set_blank : hw_sm750_set_blank; 610 612 /* chip specific phase */ 611 613 sm750_dev->accel.de_wait = (sm750_dev->revid == SM750LE_REVISION_ID) ? 612 - hw_sm750le_deWait : hw_sm750_deWait; 614 + hw_sm750le_de_wait : hw_sm750_de_wait; 613 615 switch (sm750_dev->dataflow) { 614 616 case sm750_simul_pri: 615 617 output->paths = sm750_pnc;
+15 -15
drivers/staging/sm750fb/sm750.h
··· 193 193 194 194 int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev); 195 195 int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev); 196 - void hw_sm750_initAccel(struct sm750_dev *sm750_dev); 197 - int hw_sm750_deWait(void); 198 - int hw_sm750le_deWait(void); 196 + void hw_sm750_init_accel(struct sm750_dev *sm750_dev); 197 + int hw_sm750_de_wait(void); 198 + int hw_sm750le_de_wait(void); 199 199 200 - int hw_sm750_output_setMode(struct lynxfb_output *output, 201 - struct fb_var_screeninfo *var, 202 - struct fb_fix_screeninfo *fix); 200 + int hw_sm750_output_set_mode(struct lynxfb_output *output, 201 + struct fb_var_screeninfo *var, 202 + struct fb_fix_screeninfo *fix); 203 203 204 - int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc, 205 - struct fb_var_screeninfo *var); 204 + int hw_sm750_crtc_check_mode(struct lynxfb_crtc *crtc, 205 + struct fb_var_screeninfo *var); 206 206 207 - int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc, 208 - struct fb_var_screeninfo *var, 209 - struct fb_fix_screeninfo *fix); 207 + int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc, 208 + struct fb_var_screeninfo *var, 209 + struct fb_fix_screeninfo *fix); 210 210 211 - int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index, 212 - ushort red, ushort green, ushort blue); 211 + int hw_sm750_set_col_reg(struct lynxfb_crtc *crtc, ushort index, 212 + ushort red, ushort green, ushort blue); 213 213 214 - int hw_sm750_setBLANK(struct lynxfb_output *output, int blank); 215 - int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank); 214 + int hw_sm750_set_blank(struct lynxfb_output *output, int blank); 215 + int hw_sm750le_set_blank(struct lynxfb_output *output, int blank); 216 216 int hw_sm750_pan_display(struct lynxfb_crtc *crtc, 217 217 const struct fb_var_screeninfo *var, 218 218 const struct fb_info *info);
+7 -7
drivers/staging/sm750fb/sm750_cursor.c
··· 57 57 poke32(HWC_ADDRESS, 0); 58 58 } 59 59 60 - void sm750_hw_cursor_setSize(struct lynx_cursor *cursor, int w, int h) 60 + void sm750_hw_cursor_set_size(struct lynx_cursor *cursor, int w, int h) 61 61 { 62 62 cursor->w = w; 63 63 cursor->h = h; 64 64 } 65 65 66 - void sm750_hw_cursor_setPos(struct lynx_cursor *cursor, int x, int y) 66 + void sm750_hw_cursor_set_pos(struct lynx_cursor *cursor, int x, int y) 67 67 { 68 68 u32 reg; 69 69 ··· 72 72 poke32(HWC_LOCATION, reg); 73 73 } 74 74 75 - void sm750_hw_cursor_setColor(struct lynx_cursor *cursor, u32 fg, u32 bg) 75 + void sm750_hw_cursor_set_color(struct lynx_cursor *cursor, u32 fg, u32 bg) 76 76 { 77 77 u32 reg = (fg << HWC_COLOR_12_2_RGB565_SHIFT) & 78 78 HWC_COLOR_12_2_RGB565_MASK; ··· 81 81 poke32(HWC_COLOR_3, 0xffe0); 82 82 } 83 83 84 - void sm750_hw_cursor_setData(struct lynx_cursor *cursor, u16 rop, 85 - const u8 *pcol, const u8 *pmsk) 84 + void sm750_hw_cursor_set_data(struct lynx_cursor *cursor, u16 rop, 85 + const u8 *pcol, const u8 *pmsk) 86 86 { 87 87 int i, j, count, pitch, offset; 88 88 u8 color, mask, opr; ··· 131 131 } 132 132 } 133 133 134 - void sm750_hw_cursor_setData2(struct lynx_cursor *cursor, u16 rop, 135 - const u8 *pcol, const u8 *pmsk) 134 + void sm750_hw_cursor_set_data2(struct lynx_cursor *cursor, u16 rop, 135 + const u8 *pcol, const u8 *pmsk) 136 136 { 137 137 int i, j, count, pitch, offset; 138 138 u8 color, mask;
+6 -6
drivers/staging/sm750fb/sm750_cursor.h
··· 5 5 /* hw_cursor_xxx works for voyager,718 and 750 */ 6 6 void sm750_hw_cursor_enable(struct lynx_cursor *cursor); 7 7 void sm750_hw_cursor_disable(struct lynx_cursor *cursor); 8 - void sm750_hw_cursor_setSize(struct lynx_cursor *cursor, int w, int h); 9 - void sm750_hw_cursor_setPos(struct lynx_cursor *cursor, int x, int y); 10 - void sm750_hw_cursor_setColor(struct lynx_cursor *cursor, u32 fg, u32 bg); 11 - void sm750_hw_cursor_setData(struct lynx_cursor *cursor, u16 rop, 12 - const u8 *data, const u8 *mask); 13 - void sm750_hw_cursor_setData2(struct lynx_cursor *cursor, u16 rop, 8 + void sm750_hw_cursor_set_size(struct lynx_cursor *cursor, int w, int h); 9 + void sm750_hw_cursor_set_pos(struct lynx_cursor *cursor, int x, int y); 10 + void sm750_hw_cursor_set_color(struct lynx_cursor *cursor, u32 fg, u32 bg); 11 + void sm750_hw_cursor_set_data(struct lynx_cursor *cursor, u16 rop, 14 12 const u8 *data, const u8 *mask); 13 + void sm750_hw_cursor_set_data2(struct lynx_cursor *cursor, u16 rop, 14 + const u8 *data, const u8 *mask); 15 15 #endif
+18 -20
drivers/staging/sm750fb/sm750_hw.c
··· 55 55 pr_err("mmio failed\n"); 56 56 ret = -EFAULT; 57 57 goto exit; 58 - } else { 59 - pr_info("mmio virtual addr = %p\n", sm750_dev->pvReg); 60 58 } 59 + pr_info("mmio virtual addr = %p\n", sm750_dev->pvReg); 61 60 62 61 sm750_dev->accel.dprBase = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1; 63 62 sm750_dev->accel.dpPortBase = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1; ··· 83 84 pr_err("Map video memory failed\n"); 84 85 ret = -EFAULT; 85 86 goto exit; 86 - } else { 87 - pr_info("video memory vaddr = %p\n", sm750_dev->pvMem); 88 87 } 88 + pr_info("video memory vaddr = %p\n", sm750_dev->pvMem); 89 89 exit: 90 90 return ret; 91 91 } ··· 173 175 174 176 /* init 2d engine */ 175 177 if (!sm750_dev->accel_off) 176 - hw_sm750_initAccel(sm750_dev); 178 + hw_sm750_init_accel(sm750_dev); 177 179 178 180 return 0; 179 181 } 180 182 181 - int hw_sm750_output_setMode(struct lynxfb_output *output, 182 - struct fb_var_screeninfo *var, 183 - struct fb_fix_screeninfo *fix) 183 + int hw_sm750_output_set_mode(struct lynxfb_output *output, 184 + struct fb_var_screeninfo *var, 185 + struct fb_fix_screeninfo *fix) 184 186 { 185 187 int ret; 186 188 enum disp_output disp_set; ··· 219 221 return ret; 220 222 } 221 223 222 - int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc, 223 - struct fb_var_screeninfo *var) 224 + int hw_sm750_crtc_check_mode(struct lynxfb_crtc *crtc, 225 + struct fb_var_screeninfo *var) 224 226 { 225 227 struct sm750_dev *sm750_dev; 226 228 struct lynxfb_par *par = container_of(crtc, struct lynxfb_par, crtc); ··· 245 247 } 246 248 247 249 /* set the controller's mode for @crtc charged with @var and @fix parameters */ 248 - int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc, 249 - struct fb_var_screeninfo *var, 250 - struct fb_fix_screeninfo *fix) 250 + int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc, 251 + struct fb_var_screeninfo *var, 252 + struct fb_fix_screeninfo *fix) 251 253 { 252 254 int ret, fmt; 253 255 u32 reg; ··· 370 372 return ret; 371 373 } 372 374 373 - int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index, ushort red, 374 - ushort green, ushort blue) 375 + int hw_sm750_set_col_reg(struct lynxfb_crtc *crtc, ushort index, ushort red, 376 + ushort green, ushort blue) 375 377 { 376 378 static unsigned int add[] = { PANEL_PALETTE_RAM, CRT_PALETTE_RAM }; 377 379 ··· 380 382 return 0; 381 383 } 382 384 383 - int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank) 385 + int hw_sm750le_set_blank(struct lynxfb_output *output, int blank) 384 386 { 385 387 int dpms, crtdb; 386 388 ··· 421 423 return 0; 422 424 } 423 425 424 - int hw_sm750_setBLANK(struct lynxfb_output *output, int blank) 426 + int hw_sm750_set_blank(struct lynxfb_output *output, int blank) 425 427 { 426 428 unsigned int dpms, pps, crtdb; 427 429 ··· 474 476 return 0; 475 477 } 476 478 477 - void hw_sm750_initAccel(struct sm750_dev *sm750_dev) 479 + void hw_sm750_init_accel(struct sm750_dev *sm750_dev) 478 480 { 479 481 u32 reg; 480 482 ··· 504 506 sm750_dev->accel.de_init(&sm750_dev->accel); 505 507 } 506 508 507 - int hw_sm750le_deWait(void) 509 + int hw_sm750le_de_wait(void) 508 510 { 509 511 int i = 0x10000000; 510 512 unsigned int mask = DE_STATE2_DE_STATUS_BUSY | DE_STATE2_DE_FIFO_EMPTY | ··· 521 523 return -1; 522 524 } 523 525 524 - int hw_sm750_deWait(void) 526 + int hw_sm750_de_wait(void) 525 527 { 526 528 int i = 0x10000000; 527 529 unsigned int mask = SYSTEM_CTRL_DE_STATUS_BUSY |
+6
drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
··· 71 71 struct snd_ctl_elem_value *ucontrol) 72 72 { 73 73 struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); 74 + struct snd_ctl_elem_info info; 74 75 int val, *valp; 75 76 int changed = 0; 76 77 ··· 85 84 return -EINVAL; 86 85 87 86 val = ucontrol->value.integer.value[0]; 87 + 88 + snd_bcm2835_ctl_info(kcontrol, &info); 89 + if (val < info.value.integer.min || val > info.value.integer.max) 90 + return -EINVAL; 91 + 88 92 mutex_lock(&chip->audio_mutex); 89 93 if (val != *valp) { 90 94 *valp = val;
+6 -8
drivers/staging/vc04_services/bcm2835-camera/controls.c
··· 533 533 534 534 control = &dev->component[COMP_CAMERA]->control; 535 535 536 - ret = vchiq_mmal_port_parameter_set( 537 - dev->instance, control, 538 - MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, 539 - &imagefx, sizeof(imagefx)); 536 + ret = vchiq_mmal_port_parameter_set(dev->instance, control, 537 + MMAL_PARAMETER_IMAGE_EFFECT_PARAMETERS, 538 + &imagefx, sizeof(imagefx)); 540 539 if (ret) 541 540 goto exit; 542 541 543 - ret = vchiq_mmal_port_parameter_set( 544 - dev->instance, control, 545 - MMAL_PARAMETER_COLOUR_EFFECT, 546 - &dev->colourfx, sizeof(dev->colourfx)); 542 + ret = vchiq_mmal_port_parameter_set(dev->instance, control, 543 + MMAL_PARAMETER_COLOUR_EFFECT, 544 + &dev->colourfx, sizeof(dev->colourfx)); 547 545 } 548 546 549 547 exit: