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-7.0-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 updates for 7.0-rc1. Well, not
that big, just lots of tiny coding style cleanups primarily in one
driver as everyone seems to have glomed onto it for some reason that
escapes me (is there a tutorial out there somewhere pointing people at
this?)

Not much overall, the changes can be summarized as:

- cleanups for the rtl8723bs driver, so many cleanups...

- vme_user driver cleanups

- sm750fb driver cleanups

- tiny greybus driver cleanups

- other really small staging driver cleanups

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

* tag 'staging-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (119 commits)
staging: rtl8723bs: refactor ODM_SetIQCbyRFpath to reduce duplication
staging: rtl8723bs: rename CamelCase function Set_MSR to set_msr
staging: rtl8723bs: remove unnecessary blank lines in rtw_io.c
staging: rtl8723bs: remove stale TODO item regarding %pM
staging: rtl8723bs: remove unused allocation wrapper functions
staging: rtl8723bs: use standard skb allocation APIs
staging: rtl8723bs: replace rtw_zmalloc() with kzalloc()
staging: rtl8723bs: replace rtw_malloc() with kmalloc()
staging: rtl8723bs: introduce kmemdup() where applicable
staging: sm750fb: Clean up variable names
staging: rtl8723bs: fix null dereference in find_network
staging: rtl8723bs: use unaligned access macros in rtw_security.c
staging: rtl8723bs: fix potential race in expire_timeout_chk
staging: rtl8723bs: remove dead debugging code in rtw_mlme_ext.c
staging: rtl8723bs: modernize hex output in rtw_report_sec_ie
staging: rtl8723bs: fix spacing around operators
staging: rtl8723bs: rename u1bTmp to val
staging: rtl8723bs: remove unused private debug counters
staging: rtl8723bs: remove thread wraper functions and add IS_ERR() check
staging: rtl8723bs: fix firmware memory leak on error
...

+1133 -1531
+75 -215
drivers/staging/axis-fifo/axis-fifo.c
··· 9 9 * See Xilinx PG080 document for IP details 10 10 */ 11 11 12 - /* ---------------------------- 13 - * includes 14 - * ---------------------------- 15 - */ 16 - 17 12 #include <linux/kernel.h> 18 13 #include <linux/of.h> 19 14 #include <linux/platform_device.h> ··· 20 25 #include <linux/module.h> 21 26 #include <linux/slab.h> 22 27 #include <linux/io.h> 23 - #include <linux/moduleparam.h> 24 28 #include <linux/interrupt.h> 25 - #include <linux/param.h> 26 29 #include <linux/fs.h> 27 30 #include <linux/types.h> 28 31 #include <linux/uaccess.h> 29 32 #include <linux/jiffies.h> 30 33 #include <linux/miscdevice.h> 31 34 #include <linux/debugfs.h> 32 - 33 - /* ---------------------------- 34 - * driver parameters 35 - * ---------------------------- 36 - */ 35 + #include <linux/poll.h> 37 36 38 37 #define DRIVER_NAME "axis_fifo" 39 38 ··· 35 46 36 47 #define AXIS_FIFO_DEBUG_REG_NAME_MAX_LEN 4 37 48 38 - /* ---------------------------- 39 - * IP register offsets 40 - * ---------------------------- 41 - */ 49 + #define XLLF_ISR_OFFSET 0x00 /* Interrupt Status */ 50 + #define XLLF_IER_OFFSET 0x04 /* Interrupt Enable */ 51 + #define XLLF_TDFR_OFFSET 0x08 /* Transmit Reset */ 52 + #define XLLF_TDFV_OFFSET 0x0c /* Transmit Vacancy */ 53 + #define XLLF_TDFD_OFFSET 0x10 /* Transmit Data */ 54 + #define XLLF_TLR_OFFSET 0x14 /* Transmit Length */ 55 + #define XLLF_RDFR_OFFSET 0x18 /* Receive Reset */ 56 + #define XLLF_RDFO_OFFSET 0x1c /* Receive Occupancy */ 57 + #define XLLF_RDFD_OFFSET 0x20 /* Receive Data */ 58 + #define XLLF_RLR_OFFSET 0x24 /* Receive Length */ 59 + #define XLLF_SRR_OFFSET 0x28 /* Local Link Reset */ 60 + #define XLLF_TDR_OFFSET 0x2C /* Transmit Destination */ 61 + #define XLLF_RDR_OFFSET 0x30 /* Receive Destination */ 42 62 43 - #define XLLF_ISR_OFFSET 0x00000000 /* Interrupt Status */ 44 - #define XLLF_IER_OFFSET 0x00000004 /* Interrupt Enable */ 63 + #define XLLF_RDFR_RESET_MASK 0xa5 /* Receive reset value */ 64 + #define XLLF_TDFR_RESET_MASK 0xa5 /* Transmit reset value */ 65 + #define XLLF_SRR_RESET_MASK 0xa5 /* Local Link reset value */ 45 66 46 - #define XLLF_TDFR_OFFSET 0x00000008 /* Transmit Reset */ 47 - #define XLLF_TDFV_OFFSET 0x0000000c /* Transmit Vacancy */ 48 - #define XLLF_TDFD_OFFSET 0x00000010 /* Transmit Data */ 49 - #define XLLF_TLR_OFFSET 0x00000014 /* Transmit Length */ 50 - 51 - #define XLLF_RDFR_OFFSET 0x00000018 /* Receive Reset */ 52 - #define XLLF_RDFO_OFFSET 0x0000001c /* Receive Occupancy */ 53 - #define XLLF_RDFD_OFFSET 0x00000020 /* Receive Data */ 54 - #define XLLF_RLR_OFFSET 0x00000024 /* Receive Length */ 55 - #define XLLF_SRR_OFFSET 0x00000028 /* Local Link Reset */ 56 - #define XLLF_TDR_OFFSET 0x0000002C /* Transmit Destination */ 57 - #define XLLF_RDR_OFFSET 0x00000030 /* Receive Destination */ 58 - 59 - /* ---------------------------- 60 - * reset register masks 61 - * ---------------------------- 62 - */ 63 - 64 - #define XLLF_RDFR_RESET_MASK 0x000000a5 /* receive reset value */ 65 - #define XLLF_TDFR_RESET_MASK 0x000000a5 /* Transmit reset value */ 66 - #define XLLF_SRR_RESET_MASK 0x000000a5 /* Local Link reset value */ 67 - 68 - /* ---------------------------- 69 - * interrupt masks 70 - * ---------------------------- 71 - */ 72 - 73 - #define XLLF_INT_RPURE_MASK 0x80000000 /* Receive under-read */ 74 - #define XLLF_INT_RPORE_MASK 0x40000000 /* Receive over-read */ 75 - #define XLLF_INT_RPUE_MASK 0x20000000 /* Receive underrun (empty) */ 76 - #define XLLF_INT_TPOE_MASK 0x10000000 /* Transmit overrun */ 77 - #define XLLF_INT_TC_MASK 0x08000000 /* Transmit complete */ 78 - #define XLLF_INT_RC_MASK 0x04000000 /* Receive complete */ 79 - #define XLLF_INT_TSE_MASK 0x02000000 /* Transmit length mismatch */ 67 + #define XLLF_INT_RPURE_MASK BIT(31) /* Receive under-read */ 68 + #define XLLF_INT_RPORE_MASK BIT(30) /* Receive over-read */ 69 + #define XLLF_INT_RPUE_MASK BIT(29) /* Receive underrun (empty) */ 70 + #define XLLF_INT_TPOE_MASK BIT(28) /* Transmit overrun */ 71 + #define XLLF_INT_TC_MASK BIT(27) /* Transmit complete */ 72 + #define XLLF_INT_RC_MASK BIT(26) /* Receive complete */ 73 + #define XLLF_INT_TSE_MASK BIT(25) /* Transmit length mismatch */ 80 74 81 75 #define XLLF_INT_CLEAR_ALL GENMASK(31, 0) 82 76 83 - /* ---------------------------- 84 - * globals 85 - * ---------------------------- 86 - */ 87 - static long read_timeout = 1000; /* ms to wait before read() times out */ 88 - static long write_timeout = 1000; /* ms to wait before write() times out */ 89 - 90 77 static DEFINE_IDA(axis_fifo_ida); 91 - 92 - /* ---------------------------- 93 - * module command-line arguments 94 - * ---------------------------- 95 - */ 96 - 97 - module_param(read_timeout, long, 0444); 98 - MODULE_PARM_DESC(read_timeout, "ms to wait before blocking read() timing out; set to -1 for no timeout"); 99 - module_param(write_timeout, long, 0444); 100 - MODULE_PARM_DESC(write_timeout, "ms to wait before blocking write() timing out; set to -1 for no timeout"); 101 - 102 - /* ---------------------------- 103 - * types 104 - * ---------------------------- 105 - */ 106 78 107 79 struct axis_fifo { 108 80 int id; 109 - void __iomem *base_addr; /* kernel space memory */ 81 + void __iomem *base_addr; 110 82 111 - unsigned int rx_fifo_depth; /* max words in the receive fifo */ 112 - unsigned int tx_fifo_depth; /* max words in the transmit fifo */ 113 - int has_rx_fifo; /* whether the IP has the rx fifo enabled */ 114 - int has_tx_fifo; /* whether the IP has the tx fifo enabled */ 83 + unsigned int rx_fifo_depth; 84 + unsigned int tx_fifo_depth; 85 + int has_rx_fifo; 86 + int has_tx_fifo; 115 87 116 - wait_queue_head_t read_queue; /* wait queue for asynchronos read */ 88 + wait_queue_head_t read_queue; 117 89 struct mutex read_lock; /* lock for reading */ 118 - wait_queue_head_t write_queue; /* wait queue for asynchronos write */ 90 + wait_queue_head_t write_queue; 119 91 struct mutex write_lock; /* lock for writing */ 120 92 121 - struct device *dt_device; /* device created from the device tree */ 93 + struct device *dt_device; 122 94 struct miscdevice miscdev; 123 95 124 96 struct dentry *debugfs_dir; ··· 89 139 const char * const name; 90 140 unsigned int offset; 91 141 }; 92 - 93 - /* ---------------------------- 94 - * implementation 95 - * ---------------------------- 96 - */ 97 142 98 143 static void reset_ip_core(struct axis_fifo *fifo) 99 144 { ··· 120 175 static ssize_t axis_fifo_read(struct file *f, char __user *buf, 121 176 size_t len, loff_t *off) 122 177 { 123 - struct axis_fifo *fifo = (struct axis_fifo *)f->private_data; 178 + struct axis_fifo *fifo = f->private_data; 124 179 size_t bytes_available; 125 180 unsigned int words_available; 126 181 unsigned int copied; ··· 130 185 u32 tmp_buf[READ_BUF_SIZE]; 131 186 132 187 if (f->f_flags & O_NONBLOCK) { 133 - /* 134 - * Device opened in non-blocking mode. Try to lock it and then 135 - * check if any packet is available. 136 - */ 137 188 if (!mutex_trylock(&fifo->read_lock)) 138 189 return -EAGAIN; 139 190 ··· 138 197 goto end_unlock; 139 198 } 140 199 } else { 141 - /* opened in blocking mode 142 - * wait for a packet available interrupt (or timeout) 143 - * if nothing is currently available 144 - */ 145 200 mutex_lock(&fifo->read_lock); 146 - ret = wait_event_interruptible_timeout(fifo->read_queue, 147 - ioread32(fifo->base_addr + XLLF_RDFO_OFFSET), 148 - read_timeout); 149 201 150 - if (ret <= 0) { 151 - if (ret == 0) { 152 - ret = -EAGAIN; 153 - } else if (ret != -ERESTARTSYS) { 154 - dev_err(fifo->dt_device, "wait_event_interruptible_timeout() error in read (ret=%i)\n", 155 - ret); 156 - } 157 - 202 + ret = wait_event_interruptible(fifo->read_queue, 203 + ioread32(fifo->base_addr + XLLF_RDFO_OFFSET)); 204 + if (ret) 158 205 goto end_unlock; 159 - } 160 206 } 161 207 162 208 bytes_available = ioread32(fifo->base_addr + XLLF_RLR_OFFSET); 163 209 words_available = bytes_available / sizeof(u32); 164 - if (!bytes_available) { 165 - dev_err(fifo->dt_device, "received a packet of length 0\n"); 166 - ret = -EIO; 167 - goto end_unlock; 168 - } 169 210 170 211 if (bytes_available > len) { 171 - dev_err(fifo->dt_device, "user read buffer too small (available bytes=%zu user buffer bytes=%zu)\n", 172 - bytes_available, len); 173 212 ret = -EINVAL; 174 213 goto err_flush_rx; 175 214 } ··· 163 242 goto err_flush_rx; 164 243 } 165 244 166 - /* read data into an intermediate buffer, copying the contents 167 - * to userspace when the buffer is full 168 - */ 169 245 copied = 0; 170 246 while (words_available > 0) { 171 247 copy = min(words_available, READ_BUF_SIZE); ··· 213 295 static ssize_t axis_fifo_write(struct file *f, const char __user *buf, 214 296 size_t len, loff_t *off) 215 297 { 216 - struct axis_fifo *fifo = (struct axis_fifo *)f->private_data; 298 + struct axis_fifo *fifo = f->private_data; 217 299 unsigned int words_to_write; 218 300 u32 *txbuf; 219 301 int ret; 220 302 221 - if (len % sizeof(u32)) { 222 - dev_err(fifo->dt_device, 223 - "tried to send a packet that isn't word-aligned\n"); 224 - return -EINVAL; 225 - } 226 - 227 303 words_to_write = len / sizeof(u32); 228 - 229 - if (!words_to_write) { 230 - dev_err(fifo->dt_device, 231 - "tried to send a packet of length 0\n"); 232 - return -EINVAL; 233 - } 234 304 235 305 /* 236 306 * In 'Store-and-Forward' mode, the maximum packet that can be ··· 229 323 * otherwise a 'Transmit Packet Overrun Error' interrupt will be 230 324 * raised, which requires a reset of the TX circuit to recover. 231 325 */ 232 - if (words_to_write > (fifo->tx_fifo_depth - 4)) 326 + if (!words_to_write || (len % sizeof(u32)) || 327 + (words_to_write > (fifo->tx_fifo_depth - 4))) 233 328 return -EINVAL; 234 329 235 330 if (f->f_flags & O_NONBLOCK) { 236 - /* 237 - * Device opened in non-blocking mode. Try to lock it and then 238 - * check if there is any room to write the given buffer. 239 - */ 240 331 if (!mutex_trylock(&fifo->write_lock)) 241 332 return -EAGAIN; 242 333 ··· 243 340 goto end_unlock; 244 341 } 245 342 } else { 246 - /* opened in blocking mode */ 247 - 248 - /* wait for an interrupt (or timeout) if there isn't 249 - * currently enough room in the fifo 250 - */ 251 343 mutex_lock(&fifo->write_lock); 252 - ret = wait_event_interruptible_timeout(fifo->write_queue, 253 - ioread32(fifo->base_addr + XLLF_TDFV_OFFSET) 254 - >= words_to_write, 255 - write_timeout); 256 344 257 - if (ret <= 0) { 258 - if (ret == 0) { 259 - ret = -EAGAIN; 260 - } else if (ret != -ERESTARTSYS) { 261 - dev_err(fifo->dt_device, "wait_event_interruptible_timeout() error in write (ret=%i)\n", 262 - ret); 263 - } 264 - 345 + ret = wait_event_interruptible(fifo->write_queue, 346 + ioread32(fifo->base_addr + XLLF_TDFV_OFFSET) >= words_to_write); 347 + if (ret) 265 348 goto end_unlock; 266 - } 267 349 } 268 350 269 351 txbuf = vmemdup_user(buf, len); ··· 260 372 for (int i = 0; i < words_to_write; ++i) 261 373 iowrite32(txbuf[i], fifo->base_addr + XLLF_TDFD_OFFSET); 262 374 263 - /* write packet size to fifo */ 264 375 iowrite32(len, fifo->base_addr + XLLF_TLR_OFFSET); 265 376 266 377 ret = len; ··· 268 381 mutex_unlock(&fifo->write_lock); 269 382 270 383 return ret; 384 + } 385 + 386 + static __poll_t axis_fifo_poll(struct file *f, poll_table *wait) 387 + { 388 + struct axis_fifo *fifo = f->private_data; 389 + __poll_t mask = 0; 390 + 391 + if (fifo->has_rx_fifo) { 392 + poll_wait(f, &fifo->read_queue, wait); 393 + 394 + if (ioread32(fifo->base_addr + XLLF_RDFO_OFFSET)) 395 + mask |= EPOLLIN | EPOLLRDNORM; 396 + } 397 + 398 + if (fifo->has_tx_fifo) { 399 + poll_wait(f, &fifo->write_queue, wait); 400 + 401 + if (ioread32(fifo->base_addr + XLLF_TDFV_OFFSET)) 402 + mask |= EPOLLOUT | EPOLLWRNORM; 403 + } 404 + 405 + return mask; 271 406 } 272 407 273 408 static irqreturn_t axis_fifo_irq(int irq, void *dw) ··· 345 436 return 0; 346 437 } 347 438 348 - static int axis_fifo_close(struct inode *inod, struct file *f) 349 - { 350 - f->private_data = NULL; 351 - 352 - return 0; 353 - } 354 - 355 439 static const struct file_operations fops = { 356 440 .owner = THIS_MODULE, 357 441 .open = axis_fifo_open, 358 - .release = axis_fifo_close, 359 442 .read = axis_fifo_read, 360 - .write = axis_fifo_write 443 + .write = axis_fifo_write, 444 + .poll = axis_fifo_poll, 361 445 }; 362 446 363 447 static int axis_fifo_debugfs_regs_show(struct seq_file *m, void *p) ··· 450 548 451 549 static int axis_fifo_probe(struct platform_device *pdev) 452 550 { 453 - struct resource *r_mem; /* IO mem resources */ 454 - struct device *dev = &pdev->dev; /* OS device (from device tree) */ 551 + struct resource *r_mem; 552 + struct device *dev = &pdev->dev; 455 553 struct axis_fifo *fifo = NULL; 456 - char *device_name; 457 554 int rc = 0; /* error return value */ 458 555 int irq; 459 556 460 - /* ---------------------------- 461 - * init wrapper device 462 - * ---------------------------- 463 - */ 464 - 465 - device_name = devm_kzalloc(dev, 32, GFP_KERNEL); 466 - if (!device_name) 467 - return -ENOMEM; 468 - 469 - /* allocate device wrapper memory */ 470 557 fifo = devm_kzalloc(dev, sizeof(*fifo), GFP_KERNEL); 471 558 if (!fifo) 472 559 return -ENOMEM; ··· 469 578 mutex_init(&fifo->read_lock); 470 579 mutex_init(&fifo->write_lock); 471 580 472 - /* ---------------------------- 473 - * init device memory space 474 - * ---------------------------- 475 - */ 476 - 477 - /* get iospace for the device and request physical memory */ 478 581 fifo->base_addr = devm_platform_get_and_ioremap_resource(pdev, 0, &r_mem); 479 582 if (IS_ERR(fifo->base_addr)) 480 583 return PTR_ERR(fifo->base_addr); 481 - 482 - /* ---------------------------- 483 - * init IP 484 - * ---------------------------- 485 - */ 486 584 487 585 rc = axis_fifo_parse_dt(fifo); 488 586 if (rc) ··· 479 599 480 600 reset_ip_core(fifo); 481 601 482 - /* ---------------------------- 483 - * init device interrupts 484 - * ---------------------------- 485 - */ 486 - 487 - /* get IRQ resource */ 488 602 irq = platform_get_irq(pdev, 0); 489 603 if (irq < 0) 490 604 return irq; 491 605 492 - /* request IRQ */ 493 606 rc = devm_request_irq(fifo->dt_device, irq, &axis_fifo_irq, 0, 494 607 DRIVER_NAME, fifo); 495 608 if (rc) { ··· 491 618 return rc; 492 619 } 493 620 494 - /* ---------------------------- 495 - * init char device 496 - * ---------------------------- 497 - */ 498 621 fifo->id = ida_alloc(&axis_fifo_ida, GFP_KERNEL); 499 622 if (fifo->id < 0) 500 623 return fifo->id; 501 624 502 - snprintf(device_name, 32, "%s%d", DRIVER_NAME, fifo->id); 503 - 504 - /* create character device */ 505 625 fifo->miscdev.fops = &fops; 506 626 fifo->miscdev.minor = MISC_DYNAMIC_MINOR; 507 - fifo->miscdev.name = device_name; 508 627 fifo->miscdev.parent = dev; 628 + fifo->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", 629 + DRIVER_NAME, fifo->id); 630 + if (!fifo->miscdev.name) { 631 + ida_free(&axis_fifo_ida, fifo->id); 632 + return -ENOMEM; 633 + } 634 + 509 635 rc = misc_register(&fifo->miscdev); 510 636 if (rc < 0) { 511 637 ida_free(&axis_fifo_ida, fifo->id); ··· 545 673 546 674 static int __init axis_fifo_init(void) 547 675 { 548 - if (read_timeout >= 0) 549 - read_timeout = msecs_to_jiffies(read_timeout); 550 - else 551 - read_timeout = MAX_SCHEDULE_TIMEOUT; 552 - 553 - if (write_timeout >= 0) 554 - write_timeout = msecs_to_jiffies(write_timeout); 555 - else 556 - write_timeout = MAX_SCHEDULE_TIMEOUT; 557 - 558 - pr_info("axis-fifo driver loaded with parameters read_timeout = %li, write_timeout = %li\n", 559 - read_timeout, write_timeout); 560 676 return platform_driver_register(&axis_fifo_driver); 561 677 } 562 678
-5
drivers/staging/greybus/TODO
··· 1 - * Convert all uses of the old GPIO API from <linux/gpio.h> to the 2 - GPIO descriptor API in <linux/gpio/consumer.h> and look up GPIO 3 - lines from device tree or ACPI. 4 - * Make pwm.c use the struct pwm_ops::apply instead of ::config, ::set_polarity, 5 - ::enable and ::disable.
+7 -6
drivers/staging/greybus/arche-apb-ctrl.c
··· 10 10 #include <linux/delay.h> 11 11 #include <linux/gpio/consumer.h> 12 12 #include <linux/interrupt.h> 13 - #include <linux/of_irq.h> 14 13 #include <linux/module.h> 15 14 #include <linux/pinctrl/consumer.h> 16 15 #include <linux/platform_device.h> 17 16 #include <linux/pm.h> 17 + #include <linux/property.h> 18 18 #include <linux/regulator/consumer.h> 19 19 #include <linux/spinlock.h> 20 + #include <linux/mod_devicetable.h> 20 21 #include "arche_platform.h" 21 22 22 23 static void apb_bootret_deassert(struct device *dev); ··· 315 314 316 315 static DEVICE_ATTR_RW(state); 317 316 318 - static int apb_ctrl_get_devtree_data(struct platform_device *pdev, 319 - struct arche_apb_ctrl_drvdata *apb) 317 + static int apb_ctrl_get_fw_data(struct platform_device *pdev, 318 + struct arche_apb_ctrl_drvdata *apb) 320 319 { 321 320 struct device *dev = &pdev->dev; 322 321 int ret; ··· 379 378 } 380 379 381 380 /* Only applicable for platform >= V2 */ 382 - if (of_property_read_bool(pdev->dev.of_node, "gb,spi-en-active-high")) 381 + if (device_property_read_bool(&pdev->dev, "gb,spi-en-active-high")) 383 382 apb->spi_en_polarity_high = true; 384 383 385 384 return 0; ··· 395 394 if (!apb) 396 395 return -ENOMEM; 397 396 398 - ret = apb_ctrl_get_devtree_data(pdev, apb); 397 + ret = apb_ctrl_get_fw_data(pdev, apb); 399 398 if (ret) { 400 399 dev_err(dev, "failed to get apb devicetree data %d\n", ret); 401 400 return ret; ··· 404 403 /* Initially set APB to OFF state */ 405 404 apb->state = ARCHE_PLATFORM_STATE_OFF; 406 405 /* Check whether device needs to be enabled on boot */ 407 - if (of_property_read_bool(pdev->dev.of_node, "arche,init-disable")) 406 + if (device_property_read_bool(&pdev->dev, "arche,init-disable")) 408 407 apb->init_disabled = true; 409 408 410 409 platform_set_drvdata(pdev, apb);
+10 -17
drivers/staging/greybus/arche-platform.c
··· 523 523 524 524 arche_pdata->pm_notifier.notifier_call = arche_platform_pm_notifier; 525 525 ret = register_pm_notifier(&arche_pdata->pm_notifier); 526 - 527 526 if (ret) { 528 527 dev_err(dev, "failed to register pm notifier %d\n", ret); 529 - goto err_device_remove; 528 + goto err_depopulate; 530 529 } 531 530 532 531 /* Explicitly power off if requested */ ··· 533 534 mutex_lock(&arche_pdata->platform_state_mutex); 534 535 ret = arche_platform_coldboot_seq(arche_pdata); 535 536 if (ret) { 537 + mutex_unlock(&arche_pdata->platform_state_mutex); 536 538 dev_err(dev, "Failed to cold boot svc %d\n", ret); 537 - goto err_coldboot; 539 + goto err_unregister_pm_notifier; 538 540 } 539 541 arche_platform_wd_irq_en(arche_pdata); 540 542 mutex_unlock(&arche_pdata->platform_state_mutex); ··· 544 544 dev_info(dev, "Device registered successfully\n"); 545 545 return 0; 546 546 547 - err_coldboot: 548 - mutex_unlock(&arche_pdata->platform_state_mutex); 547 + err_unregister_pm_notifier: 548 + unregister_pm_notifier(&arche_pdata->pm_notifier); 549 + err_depopulate: 550 + of_platform_depopulate(dev); 549 551 err_device_remove: 550 552 device_remove_file(&pdev->dev, &dev_attr_state); 551 553 return ret; 552 - } 553 - 554 - static int arche_remove_child(struct device *dev, void *unused) 555 - { 556 - struct platform_device *pdev = to_platform_device(dev); 557 - 558 - platform_device_unregister(pdev); 559 - 560 - return 0; 561 554 } 562 555 563 556 static void arche_platform_remove(struct platform_device *pdev) ··· 559 566 560 567 unregister_pm_notifier(&arche_pdata->pm_notifier); 561 568 device_remove_file(&pdev->dev, &dev_attr_state); 562 - device_for_each_child(&pdev->dev, NULL, arche_remove_child); 569 + of_platform_depopulate(&pdev->dev); 563 570 arche_platform_poweroff_seq(arche_pdata); 564 571 565 572 if (usb3613_hub_mode_ctrl(false)) ··· 569 576 static __maybe_unused int arche_platform_suspend(struct device *dev) 570 577 { 571 578 /* 572 - * If timing profile premits, we may shutdown bridge 579 + * If timing profile permits, we may shutdown bridge 573 580 * completely 574 581 * 575 - * TODO: sequence ?? 582 + * TODO: define shutdown sequence 576 583 * 577 584 * Also, need to make sure we meet precondition for unipro suspend 578 585 * Precondition: Definition ???
+5 -4
drivers/staging/greybus/gb-camera.h
··· 10 10 #include <linux/v4l2-mediabus.h> 11 11 12 12 /* Input flags need to be set from the caller */ 13 - #define GB_CAMERA_IN_FLAG_TEST (1 << 0) 13 + #define GB_CAMERA_IN_FLAG_TEST BIT(0) 14 14 /* Output flags returned */ 15 - #define GB_CAMERA_OUT_FLAG_ADJUSTED (1 << 0) 15 + #define GB_CAMERA_OUT_FLAG_ADJUSTED BIT(0) 16 16 17 17 /** 18 18 * struct gb_camera_stream - Represents greybus camera stream. ··· 89 89 struct gb_camera_ops { 90 90 ssize_t (*capabilities)(void *priv, char *buf, size_t len); 91 91 int (*configure_streams)(void *priv, unsigned int *nstreams, 92 - unsigned int *flags, struct gb_camera_stream *streams, 93 - struct gb_camera_csi_params *csi_params); 92 + unsigned int *flags, 93 + struct gb_camera_stream *streams, 94 + struct gb_camera_csi_params *csi_params); 94 95 int (*capture)(void *priv, u32 request_id, 95 96 unsigned int streams, unsigned int num_frames, 96 97 size_t settings_size, const void *settings);
+6 -2
drivers/staging/greybus/light.c
··· 1008 1008 if (!strlen(conf.name)) 1009 1009 return -EINVAL; 1010 1010 1011 - light->channels_count = conf.channel_count; 1012 1011 light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL); 1013 1012 if (!light->name) 1014 1013 return -ENOMEM; 1015 - light->channels = kcalloc(light->channels_count, 1014 + light->channels = kcalloc(conf.channel_count, 1016 1015 sizeof(struct gb_channel), GFP_KERNEL); 1017 1016 if (!light->channels) 1018 1017 return -ENOMEM; 1018 + /* 1019 + * Publish channels_count only after channels allocation so cleanup 1020 + * doesn't walk a NULL channels pointer on allocation failure. 1021 + */ 1022 + light->channels_count = conf.channel_count; 1019 1023 1020 1024 /* First we collect all the configurations for all channels */ 1021 1025 for (i = 0; i < light->channels_count; i++) {
+1 -1
drivers/staging/greybus/sdio.c
··· 806 806 807 807 mutex_init(&host->lock); 808 808 spin_lock_init(&host->xfer); 809 - host->mrq_workqueue = alloc_workqueue("mmc-%s", 0, 1, 809 + host->mrq_workqueue = alloc_workqueue("mmc-%s", WQ_PERCPU, 1, 810 810 dev_name(&gbphy_dev->dev)); 811 811 if (!host->mrq_workqueue) { 812 812 ret = -ENOMEM;
+7 -5
drivers/staging/most/dim2/dim2.c
··· 113 113 return container_of(iface, struct dim2_hdm, most_iface); 114 114 } 115 115 116 - /* Macro to identify a network status message */ 117 - #define PACKET_IS_NET_INFO(p) \ 118 - (((p)[1] == 0x18) && ((p)[2] == 0x05) && ((p)[3] == 0x0C) && \ 119 - ((p)[13] == 0x3C) && ((p)[14] == 0x00) && ((p)[15] == 0x0A)) 116 + /* Identify a network status message */ 117 + static bool packet_is_net_info(const u8 *p) 118 + { 119 + return p[1] == 0x18 && p[2] == 0x05 && p[3] == 0x0C && 120 + p[13] == 0x3C && p[14] == 0x00 && p[15] == 0x0A; 121 + } 120 122 121 123 static ssize_t state_show(struct device *dev, struct device_attribute *attr, 122 124 char *buf) ··· 306 304 307 305 if (hdm_ch->data_type == MOST_CH_ASYNC && 308 306 hdm_ch->direction == MOST_CH_RX && 309 - PACKET_IS_NET_INFO(data)) { 307 + packet_is_net_info(data)) { 310 308 retrieve_netinfo(dev, mbo); 311 309 312 310 spin_lock_irqsave(&dim_lock, flags);
+13 -11
drivers/staging/most/video/video.c
··· 121 121 struct comp_fh *fh = to_comp_fh(filp); 122 122 struct most_video_dev *mdev = fh->mdev; 123 123 struct mbo *mbo, *tmp; 124 + LIST_HEAD(free_list); 124 125 125 126 /* 126 127 * We need to put MBOs back before we call most_stop_channel() ··· 134 133 135 134 spin_lock_irq(&mdev->list_lock); 136 135 mdev->mute = true; 137 - list_for_each_entry_safe(mbo, tmp, &mdev->pending_mbos, list) { 138 - list_del(&mbo->list); 139 - spin_unlock_irq(&mdev->list_lock); 140 - most_put_mbo(mbo); 141 - spin_lock_irq(&mdev->list_lock); 142 - } 136 + list_replace_init(&mdev->pending_mbos, &free_list); 143 137 spin_unlock_irq(&mdev->list_lock); 138 + 139 + list_for_each_entry_safe(mbo, tmp, &free_list, list) { 140 + list_del_init(&mbo->list); 141 + most_put_mbo(mbo); 142 + } 143 + 144 144 most_stop_channel(mdev->iface, mdev->ch_idx, &comp); 145 145 mdev->mute = false; 146 146 ··· 556 554 static void __exit comp_exit(void) 557 555 { 558 556 struct most_video_dev *mdev, *tmp; 557 + LIST_HEAD(free_list); 559 558 560 559 /* 561 560 * As the mostcore currently doesn't call disconnect_channel() ··· 565 562 * This must be fixed in core. 566 563 */ 567 564 spin_lock_irq(&list_lock); 568 - list_for_each_entry_safe(mdev, tmp, &video_devices, list) { 569 - list_del(&mdev->list); 570 - spin_unlock_irq(&list_lock); 565 + list_replace_init(&video_devices, &free_list); 566 + spin_unlock_irq(&list_lock); 571 567 568 + list_for_each_entry_safe(mdev, tmp, &free_list, list) { 569 + list_del_init(&mdev->list); 572 570 comp_unregister_videodev(mdev); 573 571 v4l2_device_disconnect(&mdev->v4l2_dev); 574 572 v4l2_device_put(&mdev->v4l2_dev); 575 - spin_lock_irq(&list_lock); 576 573 } 577 - spin_unlock_irq(&list_lock); 578 574 579 575 most_deregister_configfs_subsys(&comp); 580 576 most_deregister_component(&comp);
+3 -1
drivers/staging/nvec/nvec.c
··· 648 648 break; 649 649 case 2: /* first byte after command */ 650 650 if (status == (I2C_SL_IRQ | RNW | RCVD)) { 651 - udelay(33); 652 651 if (nvec->rx->data[0] != 0x01) { 653 652 dev_err(nvec->dev, 654 653 "Read without prior read command\n"); ··· 659 660 nvec_tx_set(nvec); 660 661 to_send = nvec->tx->data[0]; 661 662 nvec->tx->pos = 1; 663 + /* delay ACK due to AP20 HW Bug 664 + do not replace by usleep_range */ 665 + udelay(33); 662 666 } else if (status == (I2C_SL_IRQ)) { 663 667 nvec->rx->data[1] = received; 664 668 nvec->rx->pos = 2;
+1 -1
drivers/staging/rtl8723bs/Kconfig
··· 3 3 tristate "Realtek RTL8723BS SDIO Wireless LAN NIC driver" 4 4 depends on WLAN && MMC && CFG80211 5 5 depends on m 6 - select CRYPTO 7 6 select CRYPTO_LIB_AES 8 7 select CRYPTO_LIB_ARC4 8 + select CRYPTO_LIB_UTILS 9 9 help 10 10 This option enables support for RTL8723BS SDIO drivers, such as 11 11 the wifi found on the 1st gen Intel Compute Stick, the CHIP
-1
drivers/staging/rtl8723bs/TODO
··· 1 1 TODO: 2 2 - find and remove any code for other chips that is left over 3 3 - convert any remaining unusual variable types 4 - - find codes that can use %pM and %Nph formatting 5 4 - checkpatch.pl fixes - most of the remaining ones are lines too long. Many 6 5 of them will require refactoring 7 6 - merge Realtek's bugfixes and new features into the driver
+36 -40
drivers/staging/rtl8723bs/core/rtw_ap.c
··· 114 114 dst_ie = pie + offset; 115 115 } 116 116 117 - if (remainder_ielen > 0) { 118 - pbackup_remainder_ie = rtw_malloc(remainder_ielen); 119 - if (pbackup_remainder_ie && premainder_ie) 120 - memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); 121 - } 117 + if (premainder_ie && remainder_ielen) 118 + pbackup_remainder_ie = kmemdup(premainder_ie, remainder_ielen, GFP_ATOMIC); 122 119 123 120 *dst_ie++ = WLAN_EID_TIM; 124 121 ··· 175 178 struct sta_priv *pstapriv = &padapter->stapriv; 176 179 u8 chk_alive_num = 0; 177 180 char chk_alive_list[NUM_STA]; 181 + struct sta_info *psta_tmp; 182 + LIST_HEAD(free_list); 178 183 int i; 179 184 180 185 spin_lock_bh(&pstapriv->auth_list_lock); ··· 189 190 if (psta->expire_to > 0) { 190 191 psta->expire_to--; 191 192 if (psta->expire_to == 0) { 192 - list_del_init(&psta->auth_list); 193 + list_move(&psta->auth_list, &free_list); 193 194 pstapriv->auth_list_cnt--; 194 - 195 - spin_unlock_bh(&pstapriv->auth_list_lock); 196 - 197 - rtw_free_stainfo(padapter, psta); 198 - 199 - spin_lock_bh(&pstapriv->auth_list_lock); 200 195 } 201 196 } 202 197 } 203 198 204 199 spin_unlock_bh(&pstapriv->auth_list_lock); 200 + 201 + list_for_each_entry_safe(psta, psta_tmp, &free_list, auth_list) { 202 + list_del_init(&psta->auth_list); 203 + rtw_free_stainfo(padapter, psta); 204 + } 205 + 205 206 psta = NULL; 206 207 207 208 spin_lock_bh(&pstapriv->asoc_list_lock); ··· 317 318 associated_clients_update(padapter, updated); 318 319 } 319 320 320 - void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) 321 + void add_ratid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) 321 322 { 322 - unsigned char sta_band = 0, shortGIrate = false; 323 + unsigned char sta_band = 0, short_gi_rate = false; 323 324 unsigned int tx_ra_bitmap = 0; 324 325 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 325 326 struct wlan_bssid_ex ··· 334 335 rtw_hal_update_sta_rate_mask(padapter, psta); 335 336 tx_ra_bitmap = psta->ra_mask; 336 337 337 - shortGIrate = query_ra_short_GI(psta); 338 + short_gi_rate = query_ra_short_GI(psta); 338 339 339 340 if (pcur_network->configuration.ds_config > 14) { 340 341 sta_band |= WIRELESS_INVALID; ··· 357 358 358 359 arg[0] = psta->mac_id; 359 360 arg[1] = psta->raid; 360 - arg[2] = shortGIrate; 361 + arg[2] = short_gi_rate; 361 362 arg[3] = psta->init_rate; 362 363 363 364 rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, rssi_level); ··· 367 368 void update_bmc_sta(struct adapter *padapter) 368 369 { 369 370 unsigned char network_type; 370 - int supportRateNum = 0; 371 + int support_rate_num = 0; 371 372 unsigned int tx_ra_bitmap = 0; 372 373 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 373 374 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; ··· 390 391 391 392 memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats)); 392 393 393 - /* prepare for add_RATid */ 394 - supportRateNum = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates); 394 + /* prepare for add_ratid */ 395 + support_rate_num = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates); 395 396 network_type = rtw_check_network_type((u8 *)&pcur_network->supported_rates, 396 - supportRateNum, 397 + support_rate_num, 397 398 pcur_network->configuration.ds_config 398 399 ); 399 400 if (is_supported_tx_cck(network_type)) { ··· 548 549 memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats)); 549 550 550 551 /* add ratid */ 551 - /* add_RATid(padapter, psta);//move to ap_sta_info_defer_update() */ 552 + /* add_ratid(padapter, psta); move to ap_sta_info_defer_update() */ 552 553 553 554 spin_lock_bh(&psta->lock); 554 555 psta->state |= _FW_LINKED; ··· 687 688 } 688 689 689 690 /* set MSR to AP_Mode */ 690 - Set_MSR(padapter, _HW_STATE_AP_); 691 + set_msr(padapter, _HW_STATE_AP_); 691 692 692 693 /* Set BSSID REG */ 693 694 rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pnetwork->mac_address); ··· 806 807 u16 cap, ht_cap = false; 807 808 uint ie_len = 0; 808 809 int group_cipher, pairwise_cipher; 809 - u8 channel, network_type, supportRate[NDIS_802_11_LENGTH_RATES_EX]; 810 - int supportRateNum = 0; 810 + u8 channel, network_type, support_rate[NDIS_802_11_LENGTH_RATES_EX]; 811 + int support_rate_num = 0; 811 812 u8 OUI1[] = {0x00, 0x50, 0xf2, 0x01}; 812 813 u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; 813 814 struct registry_priv *pregistrypriv = &padapter->registrypriv; ··· 869 870 870 871 pbss_network->configuration.ds_config = channel; 871 872 872 - memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX); 873 + memset(support_rate, 0, NDIS_802_11_LENGTH_RATES_EX); 873 874 /* get supported rates */ 874 875 p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, 875 876 WLAN_EID_SUPP_RATES, 876 877 &ie_len, 877 878 (pbss_network->ie_length - _BEACON_IE_OFFSET_)); 878 879 if (p) { 879 - memcpy(supportRate, p + 2, ie_len); 880 - supportRateNum = ie_len; 880 + memcpy(support_rate, p + 2, ie_len); 881 + support_rate_num = ie_len; 881 882 } 882 883 883 884 /* get ext_supported rates */ ··· 886 887 &ie_len, 887 888 pbss_network->ie_length - _BEACON_IE_OFFSET_); 888 889 if (p) { 889 - memcpy(supportRate + supportRateNum, p + 2, ie_len); 890 - supportRateNum += ie_len; 890 + memcpy(support_rate + support_rate_num, p + 2, ie_len); 891 + support_rate_num += ie_len; 891 892 } 892 893 893 - network_type = rtw_check_network_type(supportRate, supportRateNum, channel); 894 + network_type = rtw_check_network_type(support_rate, support_rate_num, channel); 894 895 895 896 rtw_set_supported_rate(pbss_network->supported_rates, network_type); 896 897 ··· 1229 1230 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 1230 1231 u8 res = _SUCCESS; 1231 1232 1232 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 1233 + ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL); 1233 1234 if (!ph2c) { 1234 1235 res = _FAIL; 1235 1236 goto exit; 1236 1237 } 1237 1238 1238 - psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm)); 1239 + psetstakey_para = kzalloc(sizeof(*psetstakey_para), GFP_KERNEL); 1239 1240 if (!psetstakey_para) { 1240 1241 kfree(ph2c); 1241 1242 res = _FAIL; ··· 1269 1270 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 1270 1271 int res = _SUCCESS; 1271 1272 1272 - pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); 1273 + pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL); 1273 1274 if (!pcmd) { 1274 1275 res = _FAIL; 1275 1276 goto exit; 1276 1277 } 1277 - psetkeyparm = rtw_zmalloc(sizeof(struct setkey_parm)); 1278 + psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_KERNEL); 1278 1279 if (!psetkeyparm) { 1279 1280 kfree(pcmd); 1280 1281 res = _FAIL; ··· 1439 1440 1440 1441 remainder_ielen = ielen - wps_offset - wps_ielen; 1441 1442 1442 - if (remainder_ielen > 0) { 1443 - pbackup_remainder_ie = rtw_malloc(remainder_ielen); 1444 - if (pbackup_remainder_ie) 1445 - memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen); 1446 - } 1443 + if (premainder_ie && remainder_ielen) 1444 + pbackup_remainder_ie = kmemdup(premainder_ie, remainder_ielen, GFP_ATOMIC); 1447 1445 1448 1446 wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */ 1449 1447 if ((wps_offset + wps_ielen + 2 + remainder_ielen) <= MAX_IE_SZ) { ··· 1943 1947 pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta; 1944 1948 1945 1949 /* add ratid */ 1946 - add_RATid(padapter, psta, 0);/* DM_RATR_STA_INIT */ 1950 + add_ratid(padapter, psta, 0);/* DM_RATR_STA_INIT */ 1947 1951 } 1948 1952 } 1949 1953
+68 -74
drivers/staging/rtl8723bs/core/rtw_cmd.c
··· 7 7 #include <drv_types.h> 8 8 #include <hal_btcoex.h> 9 9 #include <linux/jiffies.h> 10 + #include <linux/align.h> 10 11 11 12 static struct _cmd_callback rtw_cmd_callback[] = { 12 13 {GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/ ··· 171 170 172 171 pcmdpriv->cmd_seq = 1; 173 172 174 - pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ); 175 - 173 + pcmdpriv->cmd_allocated_buf = kzalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ, GFP_ATOMIC); 176 174 if (!pcmdpriv->cmd_allocated_buf) 177 175 return -ENOMEM; 178 176 179 - pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ((SIZE_PTR)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1)); 177 + pcmdpriv->cmd_buf = PTR_ALIGN(pcmdpriv->cmd_allocated_buf, CMDBUFF_ALIGN_SZ); 180 178 181 - pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4); 182 - 179 + pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_ATOMIC); 183 180 if (!pcmdpriv->rsp_allocated_buf) { 184 181 kfree(pcmdpriv->cmd_allocated_buf); 185 182 return -ENOMEM; 186 183 } 187 184 188 - pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3); 185 + pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3); 189 186 190 187 pcmdpriv->cmd_issued_cnt = 0; 191 188 pcmdpriv->cmd_done_cnt = 0; ··· 203 204 204 205 _init_workitem(&pevtpriv->c2h_wk, c2h_wk_callback, NULL); 205 206 pevtpriv->c2h_wk_alive = false; 206 - pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN+1); 207 + pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN + 1); 207 208 if (!pevtpriv->c2h_queue) 208 209 return -ENOMEM; 209 210 ··· 304 305 bAllow = true; 305 306 306 307 if ((!pcmdpriv->padapter->hw_init_completed && !bAllow) || 307 - !atomic_read(&pcmdpriv->cmdthd_running)) /* com_thread not running */ 308 + !atomic_read(&pcmdpriv->cmdthd_running)) /* com_thread not running */ 308 309 return _FAIL; 309 310 310 311 return _SUCCESS; ··· 362 363 void rtw_stop_cmd_thread(struct adapter *adapter) 363 364 { 364 365 if (adapter->cmdThread && 365 - atomic_read(&adapter->cmdpriv.cmdthd_running) && 366 + atomic_read(&adapter->cmdpriv.cmdthd_running) && 366 367 adapter->cmdpriv.stop_req == 0) { 367 368 adapter->cmdpriv.stop_req = 1; 368 369 complete(&adapter->cmdpriv.cmd_queue_comp); ··· 522 523 */ 523 524 524 525 u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, int ssid_num, 525 - struct rtw_ieee80211_channel *ch, int ch_num) 526 + struct rtw_ieee80211_channel *ch, int ch_num) 526 527 { 527 528 u8 res = _FAIL; 528 529 struct cmd_obj *ph2c; ··· 533 534 if (check_fwstate(pmlmepriv, _FW_LINKED)) 534 535 rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1); 535 536 536 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 537 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 537 538 if (!ph2c) 538 539 return _FAIL; 539 540 540 - psurveyPara = rtw_zmalloc(sizeof(struct sitesurvey_parm)); 541 + psurveyPara = kzalloc(sizeof(*psurveyPara), GFP_ATOMIC); 541 542 if (!psurveyPara) { 542 543 kfree(ph2c); 543 544 return _FAIL; ··· 601 602 struct wlan_bssid_ex *pdev_network = &padapter->registrypriv.dev_network; 602 603 u8 res = _SUCCESS; 603 604 604 - pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); 605 + pcmd = kzalloc(sizeof(*pcmd), GFP_ATOMIC); 605 606 if (!pcmd) { 606 607 res = _FAIL; 607 608 goto exit; ··· 634 635 start_bss_network(padapter); 635 636 } else { 636 637 /* need enqueue, prepare cmd_obj and enqueue */ 637 - pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); 638 + pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL); 638 639 if (!pcmd) { 639 640 res = _FAIL; 640 641 goto exit; ··· 686 687 u32 tmp_len; 687 688 u8 *ptmp = NULL; 688 689 689 - pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); 690 + pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL); 690 691 if (!pcmd) { 691 692 res = _FAIL; 692 693 goto exit; ··· 695 696 t_len = sizeof(struct wlan_bssid_ex); 696 697 697 698 /* for hidden ap to set fw_state here */ 698 - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) != true) { 699 + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE) != true) { 699 700 switch (ndis_network_mode) { 700 701 case Ndis802_11IBSS: 701 702 set_fwstate(pmlmepriv, WIFI_ADHOC_STATE); ··· 720 721 721 722 psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->ie_length; 722 723 723 - if ((psecnetwork->ie_length-12) < (256-1)) 724 - memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->ies[12], psecnetwork->ie_length-12); 724 + if ((psecnetwork->ie_length - 12) < (256 - 1)) 725 + memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->ies[12], psecnetwork->ie_length - 12); 725 726 else 726 - memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->ies[12], (256-1)); 727 + memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->ies[12], (256 - 1)); 727 728 728 729 psecnetwork->ie_length = 0; 729 730 /* Added by Albert 2009/02/18 */ ··· 750 751 } 751 752 752 753 phtpriv->ht_option = false; 753 - ptmp = rtw_get_ie(&pnetwork->network.ies[12], WLAN_EID_HT_CAPABILITY, &tmp_len, pnetwork->network.ie_length-12); 754 + ptmp = rtw_get_ie(&pnetwork->network.ies[12], WLAN_EID_HT_CAPABILITY, &tmp_len, pnetwork->network.ie_length - 12); 754 755 if (pregistrypriv->ht_enable && ptmp && tmp_len > 0) { 755 756 /* Added by Albert 2010/06/23 */ 756 757 /* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */ 757 758 /* Especially for Realtek 8192u SoftAP. */ 758 759 if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) && 759 - (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) && 760 - (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) { 760 + (padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) && 761 + (padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) { 761 762 rtw_ht_use_default_setting(padapter); 762 763 763 764 rtw_build_wmm_ie_ht(padapter, &psecnetwork->ies[12], &psecnetwork->ie_length); 764 765 765 766 /* rtw_restructure_ht_ie */ 766 767 rtw_restructure_ht_ie(padapter, &pnetwork->network.ies[12], &psecnetwork->ies[0], 767 - pnetwork->network.ie_length-12, &psecnetwork->ie_length, 768 - pnetwork->network.configuration.ds_config); 768 + pnetwork->network.ie_length - 12, &psecnetwork->ie_length, 769 + pnetwork->network.configuration.ds_config); 769 770 } 770 771 } 771 772 ··· 795 796 u8 res = _SUCCESS; 796 797 797 798 /* prepare cmd parameter */ 798 - param = rtw_zmalloc(sizeof(*param)); 799 + param = kzalloc(sizeof(*param), GFP_KERNEL); 799 800 if (!param) { 800 801 res = _FAIL; 801 802 goto exit; ··· 804 805 805 806 if (enqueue) { 806 807 /* need enqueue, prepare cmd_obj and enqueue */ 807 - cmdobj = rtw_zmalloc(sizeof(*cmdobj)); 808 + cmdobj = kzalloc(sizeof(*cmdobj), GFP_KERNEL); 808 809 if (!cmdobj) { 809 810 res = _FAIL; 810 811 kfree(param); ··· 831 832 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 832 833 u8 res = _SUCCESS; 833 834 834 - psetop = rtw_zmalloc(sizeof(struct setopmode_parm)); 835 - 835 + psetop = kzalloc(sizeof(*psetop), GFP_KERNEL); 836 836 if (!psetop) { 837 837 res = _FAIL; 838 838 goto exit; ··· 839 841 psetop->mode = (u8)networktype; 840 842 841 843 if (enqueue) { 842 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 844 + ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL); 843 845 if (!ph2c) { 844 846 kfree(psetop); 845 847 res = _FAIL; ··· 866 868 struct security_priv *psecuritypriv = &padapter->securitypriv; 867 869 u8 res = _SUCCESS; 868 870 869 - psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm)); 871 + psetstakey_para = kzalloc(sizeof(*psetstakey_para), GFP_KERNEL); 870 872 if (!psetstakey_para) { 871 873 res = _FAIL; 872 874 goto exit; ··· 888 890 padapter->securitypriv.busetkipkey = true; 889 891 890 892 if (enqueue) { 891 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 893 + ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL); 892 894 if (!ph2c) { 893 895 kfree(psetstakey_para); 894 896 res = _FAIL; 895 897 goto exit; 896 898 } 897 899 898 - psetstakey_rsp = rtw_zmalloc(sizeof(struct set_stakey_rsp)); 900 + psetstakey_rsp = kzalloc(sizeof(*psetstakey_rsp), GFP_KERNEL); 899 901 if (!psetstakey_rsp) { 900 902 kfree(ph2c); 901 903 kfree(psetstakey_para); ··· 928 930 while ((cam_id = rtw_camid_search(padapter, sta->hwaddr, -1)) >= 0) { 929 931 netdev_dbg(padapter->pnetdev, 930 932 "clear key for addr:%pM, camid:%d\n", 931 - MAC_ARG(sta->hwaddr), cam_id); 933 + sta->hwaddr, cam_id); 932 934 clear_cam_entry(padapter, cam_id); 933 935 rtw_camid_free(padapter, cam_id); 934 936 } 935 937 } else { 936 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 938 + ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL); 937 939 if (!ph2c) { 938 940 res = _FAIL; 939 941 goto exit; 940 942 } 941 943 942 - psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm)); 944 + psetstakey_para = kzalloc(sizeof(*psetstakey_para), GFP_KERNEL); 943 945 if (!psetstakey_para) { 944 946 kfree(ph2c); 945 947 res = _FAIL; 946 948 goto exit; 947 949 } 948 950 949 - psetstakey_rsp = rtw_zmalloc(sizeof(struct set_stakey_rsp)); 951 + psetstakey_rsp = kzalloc(sizeof(*psetstakey_rsp), GFP_KERNEL); 950 952 if (!psetstakey_rsp) { 951 953 kfree(ph2c); 952 954 kfree(psetstakey_para); ··· 976 978 977 979 u8 res = _SUCCESS; 978 980 979 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 981 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 980 982 if (!ph2c) { 981 983 res = _FAIL; 982 984 goto exit; 983 985 } 984 986 985 - paddbareq_parm = rtw_zmalloc(sizeof(struct addBaReq_parm)); 987 + paddbareq_parm = kzalloc(sizeof(*paddbareq_parm), GFP_ATOMIC); 986 988 if (!paddbareq_parm) { 987 989 kfree(ph2c); 988 990 res = _FAIL; ··· 1000 1002 exit: 1001 1003 return res; 1002 1004 } 1005 + 1003 1006 /* add for CONFIG_IEEE80211W, none 11w can use it */ 1004 1007 u8 rtw_reset_securitypriv_cmd(struct adapter *padapter) 1005 1008 { ··· 1009 1010 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 1010 1011 u8 res = _SUCCESS; 1011 1012 1012 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 1013 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 1013 1014 if (!ph2c) { 1014 1015 res = _FAIL; 1015 1016 goto exit; 1016 1017 } 1017 1018 1018 - pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); 1019 + pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC); 1019 1020 if (!pdrvextra_cmd_parm) { 1020 1021 kfree(ph2c); 1021 1022 res = _FAIL; ··· 1042 1043 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 1043 1044 u8 res = _SUCCESS; 1044 1045 1045 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 1046 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 1046 1047 if (!ph2c) { 1047 1048 res = _FAIL; 1048 1049 goto exit; 1049 1050 } 1050 1051 1051 - pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); 1052 + pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC); 1052 1053 if (!pdrvextra_cmd_parm) { 1053 1054 kfree(ph2c); 1054 1055 res = _FAIL; ··· 1076 1077 u8 res = _SUCCESS; 1077 1078 1078 1079 /* only primary padapter does this cmd */ 1079 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 1080 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 1080 1081 if (!ph2c) { 1081 1082 res = _FAIL; 1082 1083 goto exit; 1083 1084 } 1084 1085 1085 - pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); 1086 + pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC); 1086 1087 if (!pdrvextra_cmd_parm) { 1087 1088 kfree(ph2c); 1088 1089 res = _FAIL; ··· 1121 1122 pdvobjpriv->traffic_stat.last_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes; 1122 1123 pdvobjpriv->traffic_stat.last_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes; 1123 1124 1124 - pdvobjpriv->traffic_stat.cur_tx_tp = (u32)(pdvobjpriv->traffic_stat.cur_tx_bytes * 8/2/1024/1024); 1125 - pdvobjpriv->traffic_stat.cur_rx_tp = (u32)(pdvobjpriv->traffic_stat.cur_rx_bytes * 8/2/1024/1024); 1125 + pdvobjpriv->traffic_stat.cur_tx_tp = (u32)(pdvobjpriv->traffic_stat.cur_tx_bytes * 8 / 2 / 1024 / 1024); 1126 + pdvobjpriv->traffic_stat.cur_rx_tp = (u32)(pdvobjpriv->traffic_stat.cur_rx_bytes * 8 / 2 / 1024 / 1024); 1126 1127 } 1127 1128 1128 1129 u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer) ··· 1147 1148 BusyThreshold = BusyThresholdLow; 1148 1149 1149 1150 if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold || 1150 - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold) { 1151 + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold) { 1151 1152 bBusyTraffic = true; 1152 1153 1153 1154 if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) ··· 1158 1159 1159 1160 /* Higher Tx/Rx data. */ 1160 1161 if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 4000 || 1161 - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000) { 1162 + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000) { 1162 1163 bHigherBusyTraffic = true; 1163 1164 1164 1165 if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) ··· 1169 1170 1170 1171 /* check traffic for powersaving. */ 1171 1172 if (((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8) || 1172 - (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) { 1173 + (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) { 1173 1174 bEnterPS = false; 1174 1175 1175 1176 if (bBusyTraffic) { ··· 1223 1224 pmlmepriv->LinkDetectInfo.bHigherBusyTxTraffic = bHigherBusyTxTraffic; 1224 1225 1225 1226 return bEnterPS; 1226 - 1227 1227 } 1228 1228 1229 1229 static void dynamic_chk_wk_hdl(struct adapter *padapter) ··· 1262 1264 u8 mstatus; 1263 1265 1264 1266 if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) || 1265 - check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { 1267 + check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { 1266 1268 return; 1267 1269 } 1268 1270 ··· 1316 1318 u8 res = _SUCCESS; 1317 1319 1318 1320 if (enqueue) { 1319 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 1321 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 1320 1322 if (!ph2c) { 1321 1323 res = _FAIL; 1322 1324 goto exit; 1323 1325 } 1324 1326 1325 - pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); 1327 + pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC); 1326 1328 if (!pdrvextra_cmd_parm) { 1327 1329 kfree(ph2c); 1328 1330 res = _FAIL; ··· 1357 1359 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 1358 1360 u8 res = _SUCCESS; 1359 1361 1360 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 1362 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 1361 1363 if (!ph2c) { 1362 1364 res = _FAIL; 1363 1365 goto exit; 1364 1366 } 1365 1367 1366 - pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); 1368 + pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC); 1367 1369 if (!pdrvextra_cmd_parm) { 1368 1370 kfree(ph2c); 1369 1371 res = _FAIL; ··· 1419 1421 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 1420 1422 u8 res = _SUCCESS; 1421 1423 1422 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 1424 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 1423 1425 if (!ph2c) { 1424 1426 res = _FAIL; 1425 1427 goto exit; 1426 1428 } 1427 1429 1428 - pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); 1430 + pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC); 1429 1431 if (!pdrvextra_cmd_parm) { 1430 1432 kfree(ph2c); 1431 1433 res = _FAIL; ··· 1444 1446 exit: 1445 1447 1446 1448 return res; 1447 - 1448 1449 } 1449 1450 1450 1451 u8 rtw_ps_cmd(struct adapter *padapter) ··· 1453 1456 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 1454 1457 u8 res = _SUCCESS; 1455 1458 1456 - ppscmd = rtw_zmalloc(sizeof(struct cmd_obj)); 1459 + ppscmd = kzalloc(sizeof(*ppscmd), GFP_ATOMIC); 1457 1460 if (!ppscmd) { 1458 1461 res = _FAIL; 1459 1462 goto exit; 1460 1463 } 1461 1464 1462 - pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); 1465 + pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC); 1463 1466 if (!pdrvextra_cmd_parm) { 1464 1467 kfree(ppscmd); 1465 1468 res = _FAIL; ··· 1513 1516 } else {/* re check again */ 1514 1517 rtw_chk_hi_queue_cmd(padapter); 1515 1518 } 1516 - 1517 1519 } 1518 - 1519 1520 } 1520 1521 1521 1522 u8 rtw_chk_hi_queue_cmd(struct adapter *padapter) ··· 1523 1528 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 1524 1529 u8 res = _SUCCESS; 1525 1530 1526 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 1531 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 1527 1532 if (!ph2c) { 1528 1533 res = _FAIL; 1529 1534 goto exit; 1530 1535 } 1531 1536 1532 - pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); 1537 + pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC); 1533 1538 if (!pdrvextra_cmd_parm) { 1534 1539 kfree(ph2c); 1535 1540 res = _FAIL; ··· 1593 1598 1594 1599 cmd_idx = info->cid; 1595 1600 1596 - if (info->len > buf_len-2) { 1601 + if (info->len > buf_len - 2) { 1597 1602 rtw_warn_on(1); 1598 - len = buf_len-2; 1603 + len = buf_len - 2; 1599 1604 } else { 1600 1605 len = info->len; 1601 1606 } ··· 1605 1610 buf[1] = 0; 1606 1611 else if (cmd_idx == BTINFO_BT_AUTO_RPT) 1607 1612 buf[1] = 2; 1608 - hal_btcoex_BtInfoNotify(adapter, len+1, &buf[1]); 1613 + hal_btcoex_BtInfoNotify(adapter, len + 1, &buf[1]); 1609 1614 } 1610 1615 1611 1616 u8 rtw_c2h_packet_wk_cmd(struct adapter *padapter, u8 *pbuf, u16 length) ··· 1615 1620 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 1616 1621 u8 res = _SUCCESS; 1617 1622 1618 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 1623 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 1619 1624 if (!ph2c) { 1620 1625 res = _FAIL; 1621 1626 goto exit; 1622 1627 } 1623 1628 1624 - pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); 1629 + pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC); 1625 1630 if (!pdrvextra_cmd_parm) { 1626 1631 kfree(ph2c); 1627 1632 res = _FAIL; ··· 1650 1655 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 1651 1656 u8 res = _SUCCESS; 1652 1657 1653 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 1658 + ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL); 1654 1659 if (!ph2c) { 1655 1660 res = _FAIL; 1656 1661 goto exit; 1657 1662 } 1658 1663 1659 - pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm)); 1664 + pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_KERNEL); 1660 1665 if (!pdrvextra_cmd_parm) { 1661 1666 kfree(ph2c); 1662 1667 res = _FAIL; ··· 1665 1670 1666 1671 pdrvextra_cmd_parm->ec_id = C2H_WK_CID; 1667 1672 pdrvextra_cmd_parm->type = 0; 1668 - pdrvextra_cmd_parm->size = c2h_evt?16:0; 1673 + pdrvextra_cmd_parm->size = c2h_evt ? 16 : 0; 1669 1674 pdrvextra_cmd_parm->pbuf = c2h_evt; 1670 1675 1671 1676 init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra)); ··· 1692 1697 /* This C2H event is read, clear it */ 1693 1698 c2h_evt_clear(adapter); 1694 1699 } else { 1695 - c2h_evt = rtw_malloc(16); 1700 + c2h_evt = kmalloc(16, GFP_ATOMIC); 1696 1701 if (c2h_evt) { 1697 1702 /* This C2H event is not read, read & clear now */ 1698 1703 if (c2h_evt_read_88xx(adapter, c2h_evt) != _SUCCESS) { ··· 1872 1877 1873 1878 spin_unlock_bh(&pmlmepriv->scanned_queue.lock); 1874 1879 /* we will set _FW_LINKED when there is one more sat to join us (rtw_stassoc_event_callback) */ 1875 - 1876 1880 } 1877 1881 1878 1882 createbss_cmd_fail:
+3 -3
drivers/staging/rtl8723bs/core/rtw_ieee80211.c
··· 1010 1010 pbuf = rtw_get_wpa_ie(&pnetwork->network.ies[12], &wpa_ielen, pnetwork->network.ie_length-12); 1011 1011 1012 1012 if (pbuf && (wpa_ielen > 0)) { 1013 - if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) { 1013 + if (rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) { 1014 1014 pnetwork->bcn_info.pairwise_cipher = pairwise_cipher; 1015 1015 pnetwork->bcn_info.group_cipher = group_cipher; 1016 1016 pnetwork->bcn_info.is_8021x = is8021x; ··· 1020 1020 pbuf = rtw_get_wpa2_ie(&pnetwork->network.ies[12], &wpa_ielen, pnetwork->network.ie_length-12); 1021 1021 1022 1022 if (pbuf && (wpa_ielen > 0)) { 1023 - if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) { 1023 + if (rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) { 1024 1024 pnetwork->bcn_info.pairwise_cipher = pairwise_cipher; 1025 1025 pnetwork->bcn_info.group_cipher = group_cipher; 1026 1026 pnetwork->bcn_info.is_8021x = is8021x; ··· 1140 1140 return true; 1141 1141 } 1142 1142 1143 - static const char *_action_public_str[] = { 1143 + static const char * const _action_public_str[] = { 1144 1144 "ACT_PUB_BSSCOEXIST", 1145 1145 "ACT_PUB_DSE_ENABLE", 1146 1146 "ACT_PUB_DSE_DEENABLE",
+7 -8
drivers/staging/rtl8723bs/core/rtw_io.c
··· 29 29 { 30 30 /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ 31 31 struct io_priv *pio_priv = &adapter->iopriv; 32 - struct intf_hdl *pintfhdl = &(pio_priv->intf); 32 + struct intf_hdl *pintfhdl = &pio_priv->intf; 33 33 u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr); 34 34 35 35 _read8 = pintfhdl->io_ops._read8; ··· 41 41 { 42 42 /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ 43 43 struct io_priv *pio_priv = &adapter->iopriv; 44 - struct intf_hdl *pintfhdl = &(pio_priv->intf); 44 + struct intf_hdl *pintfhdl = &pio_priv->intf; 45 45 u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr); 46 46 47 47 _read16 = pintfhdl->io_ops._read16; ··· 53 53 { 54 54 /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ 55 55 struct io_priv *pio_priv = &adapter->iopriv; 56 - struct intf_hdl *pintfhdl = &(pio_priv->intf); 56 + struct intf_hdl *pintfhdl = &pio_priv->intf; 57 57 u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr); 58 58 59 59 _read32 = pintfhdl->io_ops._read32; 60 60 61 61 return _read32(pintfhdl, addr); 62 - 63 62 } 64 63 65 64 int rtw_write8(struct adapter *adapter, u32 addr, u8 val) 66 65 { 67 66 /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ 68 67 struct io_priv *pio_priv = &adapter->iopriv; 69 - struct intf_hdl *pintfhdl = &(pio_priv->intf); 68 + struct intf_hdl *pintfhdl = &pio_priv->intf; 70 69 int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val); 71 70 int ret; 72 71 ··· 79 80 { 80 81 /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ 81 82 struct io_priv *pio_priv = &adapter->iopriv; 82 - struct intf_hdl *pintfhdl = &(pio_priv->intf); 83 + struct intf_hdl *pintfhdl = &pio_priv->intf; 83 84 int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val); 84 85 int ret; 85 86 ··· 92 93 { 93 94 /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ 94 95 struct io_priv *pio_priv = &adapter->iopriv; 95 - struct intf_hdl *pintfhdl = &(pio_priv->intf); 96 + struct intf_hdl *pintfhdl = &pio_priv->intf; 96 97 int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val); 97 98 int ret; 98 99 ··· 107 108 { 108 109 u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); 109 110 struct io_priv *pio_priv = &adapter->iopriv; 110 - struct intf_hdl *pintfhdl = &(pio_priv->intf); 111 + struct intf_hdl *pintfhdl = &pio_priv->intf; 111 112 112 113 _write_port = pintfhdl->io_ops._write_port; 113 114
+72 -85
drivers/staging/rtl8723bs/core/rtw_mlme.c
··· 179 179 if (pnetwork->fixed) 180 180 return; 181 181 182 - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || 183 - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) 182 + if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) || 183 + check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) 184 184 lifetime = 1; 185 185 186 186 if (!isfreeall) { ··· 267 267 signed int res; 268 268 269 269 if (padapter->bDriverStopped || padapter->bSurpriseRemoved || 270 - (check_fwstate(&padapter->mlmepriv, _FW_LINKED) == false)) 270 + !check_fwstate(&padapter->mlmepriv, _FW_LINKED)) 271 271 res = false; 272 272 else 273 273 res = true; ··· 283 283 pibss[1] = 0x11; 284 284 pibss[2] = 0x87; 285 285 pibss[3] = (u8)(curtime & 0xff) ;/* p[0]; */ 286 - pibss[4] = (u8)((curtime>>8) & 0xff) ;/* p[1]; */ 287 - pibss[5] = (u8)((curtime>>16) & 0xff) ;/* p[2]; */ 286 + pibss[4] = (u8)((curtime >> 8) & 0xff) ;/* p[1]; */ 287 + pibss[5] = (u8)((curtime >> 16) & 0xff) ;/* p[2]; */ 288 288 } 289 289 290 290 u8 *rtw_get_capability_from_ie(u8 *ie) ··· 433 433 sq_final = padapter->recvpriv.signal_qual; 434 434 /* the rssi value here is undecorated, and will be used for antenna diversity */ 435 435 if (sq_smp != 101) /* from the right channel */ 436 - rssi_final = (src->rssi+dst->rssi*4)/5; 436 + rssi_final = (src->rssi + dst->rssi * 4) / 5; 437 437 else 438 438 rssi_final = rssi_ori; 439 439 } else { 440 440 if (sq_smp != 101) { /* from the right channel */ 441 - ss_final = ((u32)(src->phy_info.signal_strength)+(u32)(dst->phy_info.signal_strength)*4)/5; 442 - sq_final = ((u32)(src->phy_info.signal_quality)+(u32)(dst->phy_info.signal_quality)*4)/5; 443 - rssi_final = (src->rssi+dst->rssi*4)/5; 441 + ss_final = ((u32)(src->phy_info.signal_strength) + (u32)(dst->phy_info.signal_strength) * 4) / 5; 442 + sq_final = ((u32)(src->phy_info.signal_quality) + (u32)(dst->phy_info.signal_quality) * 4) / 5; 443 + rssi_final = (src->rssi + dst->rssi * 4) / 5; 444 444 } else { 445 445 /* bss info not receiving from the right channel, use the original RX signal infos */ 446 446 ss_final = dst->phy_info.signal_strength; ··· 469 469 &pmlmepriv->cur_network.network, 470 470 &pmlmepriv->cur_network.network); 471 471 472 - if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) && (is_same_network(&pmlmepriv->cur_network.network, pnetwork, 0))) { 472 + if (check_fwstate(pmlmepriv, _FW_LINKED) && (is_same_network(&pmlmepriv->cur_network.network, pnetwork, 0))) { 473 473 update_network(&pmlmepriv->cur_network.network, pnetwork, adapter, true); 474 474 rtw_update_protection(adapter, (pmlmepriv->cur_network.network.ies) + sizeof(struct ndis_802_11_fix_ie), 475 475 pmlmepriv->cur_network.network.ie_length); ··· 609 609 privacy = pnetwork->network.privacy; 610 610 611 611 if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { 612 - if (rtw_get_wps_ie(pnetwork->network.ies+_FIXED_IE_LENGTH_, pnetwork->network.ie_length-_FIXED_IE_LENGTH_, NULL, &wps_ielen)) 612 + if (rtw_get_wps_ie(pnetwork->network.ies + _FIXED_IE_LENGTH_, pnetwork->network.ie_length - _FIXED_IE_LENGTH_, NULL, &wps_ielen)) 613 613 return true; 614 614 else 615 615 return false; ··· 633 633 if ((desired_encmode != Ndis802_11EncryptionDisabled) && (privacy == 0)) 634 634 bselected = false; 635 635 636 - if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) { 636 + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { 637 637 if (pnetwork->network.infrastructure_mode != pmlmepriv->cur_network.network.infrastructure_mode) 638 638 bselected = false; 639 639 } ··· 661 661 spin_lock_bh(&pmlmepriv->lock); 662 662 663 663 /* update IBSS_network 's timestamp */ 664 - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) == true) { 664 + if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) { 665 665 if (!memcmp(&pmlmepriv->cur_network.network.mac_address, pnetwork->mac_address, ETH_ALEN)) { 666 666 struct wlan_network *ibss_wlan = NULL; 667 667 ··· 678 678 } 679 679 680 680 /* lock pmlmepriv->lock when you accessing network_q */ 681 - if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == false) { 681 + if (!check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { 682 682 if (pnetwork->ssid.ssid[0] == 0) 683 683 pnetwork->ssid.ssid_length = 0; 684 684 rtw_add_network(adapter, pnetwork); ··· 710 710 rtw_set_signal_stat_timer(&adapter->recvpriv); 711 711 712 712 if (pmlmepriv->to_join) { 713 - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) { 714 - if (check_fwstate(pmlmepriv, _FW_LINKED) == false) { 713 + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { 714 + if (!check_fwstate(pmlmepriv, _FW_LINKED)) { 715 715 set_fwstate(pmlmepriv, _FW_UNDER_LINKING); 716 716 717 717 if (rtw_select_and_join_from_scanned_queue(pmlmepriv) == _SUCCESS) { ··· 819 819 spin_unlock_bh(&scan_queue->lock); 820 820 } 821 821 822 - static void rtw_reset_rx_info(struct debug_priv *pdbgpriv) 823 - { 824 - pdbgpriv->dbg_rx_ampdu_drop_count = 0; 825 - pdbgpriv->dbg_rx_ampdu_forced_indicate_count = 0; 826 - pdbgpriv->dbg_rx_ampdu_loss_count = 0; 827 - pdbgpriv->dbg_rx_dup_mgt_frame_drop_count = 0; 828 - pdbgpriv->dbg_rx_ampdu_window_shift_cnt = 0; 829 - } 830 - 831 822 static void find_network(struct adapter *adapter) 832 823 { 833 824 struct wlan_network *pwlan = NULL; ··· 826 835 struct wlan_network *tgt_network = &pmlmepriv->cur_network; 827 836 828 837 pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.mac_address); 829 - if (pwlan) 830 - pwlan->fixed = false; 838 + if (!pwlan) 839 + return; 840 + 841 + pwlan->fixed = false; 831 842 832 843 if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) && 833 844 (adapter->stapriv.asoc_sta_count == 1)) ··· 841 848 { 842 849 struct mlme_priv *pmlmepriv = &adapter->mlmepriv; 843 850 struct wlan_network *tgt_network = &pmlmepriv->cur_network; 844 - struct dvobj_priv *psdpriv = adapter->dvobj; 845 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 846 851 847 - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_AP_STATE)) { 852 + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_AP_STATE)) { 848 853 struct sta_info *psta; 849 854 850 855 psta = rtw_get_stainfo(&adapter->stapriv, tgt_network->network.mac_address); 851 856 rtw_free_stainfo(adapter, psta); 852 857 } 853 858 854 - if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)) { 859 + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE | WIFI_AP_STATE)) { 855 860 struct sta_info *psta; 856 861 857 862 rtw_free_all_stainfo(adapter); ··· 864 873 865 874 if (lock_scanned_queue) 866 875 adapter->securitypriv.key_mask = 0; 867 - 868 - rtw_reset_rx_info(pdbgpriv); 869 876 } 870 877 871 878 /* rtw_indicate_connect: the caller has to lock pmlmepriv->lock */ ··· 898 909 { 899 910 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 900 911 901 - _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING|WIFI_UNDER_WPS); 912 + _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING | WIFI_UNDER_WPS); 902 913 903 914 if (rtw_to_roam(padapter) > 0) 904 915 _clr_fwstate_(pmlmepriv, _FW_LINKED); ··· 929 940 930 941 if ((!adapter_to_pwrctl(padapter)->bInSuspend) && 931 942 (!check_fwstate(&padapter->mlmepriv, 932 - WIFI_ASOC_STATE|WIFI_UNDER_LINKING))) { 943 + WIFI_ASOC_STATE | WIFI_UNDER_LINKING))) { 933 944 rtw_set_ips_deny(padapter, 0); 934 945 _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 1); 935 946 } ··· 1067 1078 switch (pnetwork->network.infrastructure_mode) { 1068 1079 case Ndis802_11Infrastructure: 1069 1080 1070 - if (pmlmepriv->fw_state&WIFI_UNDER_WPS) 1071 - pmlmepriv->fw_state = WIFI_STATION_STATE|WIFI_UNDER_WPS; 1081 + if (pmlmepriv->fw_state & WIFI_UNDER_WPS) 1082 + pmlmepriv->fw_state = WIFI_STATION_STATE | WIFI_UNDER_WPS; 1072 1083 else 1073 1084 pmlmepriv->fw_state = WIFI_STATION_STATE; 1074 1085 ··· 1195 1206 rtw_free_stainfo(adapter, pcur_sta); 1196 1207 1197 1208 ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->network.mac_address); 1198 - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { 1209 + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { 1199 1210 if (ptarget_wlan) 1200 1211 ptarget_wlan->fixed = true; 1201 1212 } ··· 1203 1214 1204 1215 } else { 1205 1216 ptarget_wlan = _rtw_find_same_network(&pmlmepriv->scanned_queue, pnetwork); 1206 - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { 1217 + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { 1207 1218 if (ptarget_wlan) 1208 1219 ptarget_wlan->fixed = true; 1209 1220 } ··· 1220 1231 } 1221 1232 1222 1233 /* s3. find ptarget_sta & update ptarget_sta after update cur_network only for station mode */ 1223 - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { 1234 + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { 1224 1235 ptarget_sta = rtw_joinbss_update_stainfo(adapter, pnetwork); 1225 1236 if (!ptarget_sta) { 1226 1237 spin_unlock_bh(&pmlmepriv->scanned_queue.lock); ··· 1229 1240 } 1230 1241 1231 1242 /* s4. indicate connect */ 1232 - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) { 1243 + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { 1233 1244 pmlmepriv->cur_network_scanned = ptarget_wlan; 1234 1245 rtw_indicate_connect(adapter); 1235 1246 } ··· 1247 1258 rtw_reset_securitypriv(adapter); 1248 1259 _set_timer(&pmlmepriv->assoc_timer, 1); 1249 1260 1250 - if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == true) 1261 + if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) 1251 1262 _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); 1252 1263 1253 1264 } else {/* if join_res < 0 (join fails), then try again */ ··· 1298 1309 if (!psta) 1299 1310 return; 1300 1311 1301 - media_status_rpt = (u16)((psta->mac_id<<8)|mstatus); /* MACID|OPMODE:1 connect */ 1312 + media_status_rpt = (u16)((psta->mac_id << 8) | mstatus); /* MACID|OPMODE:1 connect */ 1302 1313 rtw_hal_set_hwreg(adapter, HW_VAR_H2C_MEDIA_STATUS_RPT, (u8 *)&media_status_rpt); 1303 1314 } 1304 1315 ··· 1326 1337 /* report to upper layer */ 1327 1338 spin_lock_bh(&psta->lock); 1328 1339 if (psta->passoc_req && psta->assoc_req_len > 0) { 1329 - passoc_req = rtw_zmalloc(psta->assoc_req_len); 1340 + passoc_req = kmemdup(psta->passoc_req, psta->assoc_req_len, GFP_ATOMIC); 1330 1341 if (passoc_req) { 1331 1342 assoc_req_len = psta->assoc_req_len; 1332 - memcpy(passoc_req, psta->passoc_req, assoc_req_len); 1333 1343 1334 1344 kfree(psta->passoc_req); 1335 1345 psta->passoc_req = NULL; ··· 1374 1386 1375 1387 spin_lock_bh(&pmlmepriv->lock); 1376 1388 1377 - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || 1378 - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) { 1389 + if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) || 1390 + check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { 1379 1391 if (adapter->stapriv.asoc_sta_count == 2) { 1380 1392 spin_lock_bh(&pmlmepriv->scanned_queue.lock); 1381 1393 ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.mac_address); ··· 1415 1427 if (mac_id >= 0) { 1416 1428 u16 media_status; 1417 1429 1418 - media_status = (mac_id<<8)|0; /* MACID|OPMODE:0 means disconnect */ 1430 + media_status = (mac_id << 8) | 0; /* MACID|OPMODE:0 means disconnect */ 1419 1431 /* for STA, AP, ADHOC mode, report disconnect stauts to FW */ 1420 1432 rtw_hal_set_hwreg(adapter, HW_VAR_H2C_MEDIA_STATUS_RPT, (u8 *)&media_status); 1421 1433 } 1422 1434 1423 1435 /* if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) */ 1424 - if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) 1436 + if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) 1425 1437 return; 1426 1438 1427 1439 mlmeext_sta_del_event_callback(adapter); ··· 1550 1562 continue; 1551 1563 1552 1564 break; 1553 - } else { 1554 - rtw_indicate_disconnect(adapter); 1555 - break; 1556 1565 } 1566 + 1567 + rtw_indicate_disconnect(adapter); 1568 + break; 1557 1569 } 1558 1570 1559 1571 } else { ··· 1595 1607 if (pmlmeinfo->VHT_enable) /* disable auto scan when connect to 11AC AP */ 1596 1608 mlme->auto_scan_int_ms = 0; 1597 1609 else if (adapter->registrypriv.wifi_spec && is_client_associated_to_ap(adapter) == true) 1598 - mlme->auto_scan_int_ms = 60*1000; 1610 + mlme->auto_scan_int_ms = 60 * 1000; 1599 1611 else if (rtw_chk_roam_flags(adapter, RTW_ROAM_ACTIVE)) { 1600 1612 if (check_fwstate(mlme, WIFI_STATION_STATE) && check_fwstate(mlme, _FW_LINKED)) 1601 1613 mlme->auto_scan_int_ms = mlme->roam_scan_int_ms; ··· 1612 1624 if (pmlmepriv->auto_scan_int_ms != 0 1613 1625 && jiffies_to_msecs(jiffies - pmlmepriv->scan_start_time) > pmlmepriv->auto_scan_int_ms) { 1614 1626 if (!padapter->registrypriv.wifi_spec) { 1615 - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING) == true) 1627 + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING)) 1616 1628 goto exit; 1617 1629 1618 1630 if (pmlmepriv->LinkDetectInfo.bBusyTraffic) ··· 1854 1866 candidate_exist: 1855 1867 1856 1868 /* check for situation of _FW_LINKED */ 1857 - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { 1869 + if (check_fwstate(pmlmepriv, _FW_LINKED)) { 1858 1870 rtw_disassoc_cmd(adapter, 0, true); 1859 1871 rtw_indicate_disconnect(adapter); 1860 1872 rtw_free_assoc_resources(adapter, 0); ··· 1875 1887 struct cmd_priv *pcmdpriv = &adapter->cmdpriv; 1876 1888 signed int res = _SUCCESS; 1877 1889 1878 - pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); 1890 + pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL); 1879 1891 if (!pcmd) { 1880 1892 res = _FAIL; /* try again */ 1881 1893 goto exit; 1882 1894 } 1883 1895 1884 - psetauthparm = rtw_zmalloc(sizeof(struct setauth_parm)); 1896 + psetauthparm = kzalloc(sizeof(*psetauthparm), GFP_KERNEL); 1885 1897 if (!psetauthparm) { 1886 1898 kfree(pcmd); 1887 1899 res = _FAIL; ··· 1912 1924 struct cmd_priv *pcmdpriv = &adapter->cmdpriv; 1913 1925 signed int res = _SUCCESS; 1914 1926 1915 - psetkeyparm = rtw_zmalloc(sizeof(struct setkey_parm)); 1927 + psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_KERNEL); 1916 1928 if (!psetkeyparm) { 1917 1929 res = _FAIL; 1918 1930 goto exit; ··· 1954 1966 } 1955 1967 1956 1968 if (enqueue) { 1957 - pcmd = rtw_zmalloc(sizeof(struct cmd_obj)); 1969 + pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL); 1958 1970 if (!pcmd) { 1959 1971 kfree(psetkeyparm); 1960 1972 res = _FAIL; /* try again */ ··· 1988 2000 while (i < in_len) { 1989 2001 ielength = initial_out_len; 1990 2002 1991 - if (in_ie[i] == 0xDD && in_ie[i+2] == 0x00 && in_ie[i+3] == 0x50 && in_ie[i+4] == 0xF2 && in_ie[i+5] == 0x02 && i+5 < in_len) { /* WMM element ID and OUI */ 2003 + if (in_ie[i] == 0xDD && in_ie[i + 2] == 0x00 && in_ie[i + 3] == 0x50 && in_ie[i + 4] == 0xF2 && in_ie[i + 5] == 0x02 && i + 5 < in_len) { /* WMM element ID and OUI */ 1992 2004 for (j = i; j < i + 9; j++) { 1993 2005 out_ie[ielength] = in_ie[j]; 1994 2006 ielength++; ··· 2000 2012 break; 2001 2013 } 2002 2014 2003 - i += (in_ie[i+1]+2); /* to the next IE element */ 2015 + i += (in_ie[i + 1] + 2); /* to the next IE element */ 2004 2016 } 2005 2017 2006 2018 return ielength; 2007 2019 } 2008 2020 2009 - /* Ported from 8185: IsInPreAuthKeyList(). 2021 + /* Ported from 8185: IsInPreAuthKeyList(). 2010 2022 * (Renamed from SecIsInPreAuthKeyList(), 2006-10-13.) 2011 2023 * Added by Annie, 2006-05-07. 2012 2024 * ··· 2056 2068 static void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie) 2057 2069 { 2058 2070 uint len; 2059 - u8 *buff, *p, i; 2071 + u8 *buff, *p; 2060 2072 union iwreq_data wrqu; 2061 2073 2062 2074 buff = NULL; 2063 2075 if (authmode == WLAN_EID_VENDOR_SPECIFIC) { 2064 - buff = rtw_zmalloc(IW_CUSTOM_MAX); 2076 + buff = kzalloc(IW_CUSTOM_MAX, GFP_ATOMIC); 2065 2077 if (!buff) 2066 2078 return; 2067 2079 ··· 2072 2084 len = sec_ie[1] + 2; 2073 2085 len = (len < IW_CUSTOM_MAX) ? len : IW_CUSTOM_MAX; 2074 2086 2075 - for (i = 0; i < len; i++) 2076 - p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), "%02x", sec_ie[i]); 2087 + p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), " %*ph", len, sec_ie); 2077 2088 2078 2089 p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), ")"); 2079 2090 ··· 2105 2118 authmode = WLAN_EID_RSN; 2106 2119 2107 2120 if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) { 2108 - memcpy(out_ie+ielength, psecuritypriv->wps_ie, psecuritypriv->wps_ie_len); 2121 + memcpy(out_ie + ielength, psecuritypriv->wps_ie, psecuritypriv->wps_ie_len); 2109 2122 2110 2123 ielength += psecuritypriv->wps_ie_len; 2111 2124 } else if ((authmode == WLAN_EID_VENDOR_SPECIFIC) || (authmode == WLAN_EID_RSN)) { 2112 2125 /* copy RSN or SSN */ 2113 - memcpy(&out_ie[ielength], &psecuritypriv->supplicant_ie[0], psecuritypriv->supplicant_ie[1]+2); 2114 - ielength += psecuritypriv->supplicant_ie[1]+2; 2126 + memcpy(&out_ie[ielength], &psecuritypriv->supplicant_ie[0], psecuritypriv->supplicant_ie[1] + 2); 2127 + ielength += psecuritypriv->supplicant_ie[1] + 2; 2115 2128 rtw_report_sec_ie(adapter, authmode, psecuritypriv->supplicant_ie); 2116 2129 } 2117 2130 ··· 2279 2292 2280 2293 if (padapter->mlmepriv.qospriv.qos_option == 0) { 2281 2294 out_len = *pout_len; 2282 - rtw_set_ie(out_ie+out_len, WLAN_EID_VENDOR_SPECIFIC, 2295 + rtw_set_ie(out_ie + out_len, WLAN_EID_VENDOR_SPECIFIC, 2283 2296 _WMM_IE_Length_, WMM_IE, pout_len); 2284 2297 2285 2298 padapter->mlmepriv.qospriv.qos_option = 1; ··· 2323 2336 } else { 2324 2337 p = rtw_get_ie(in_ie, WLAN_EID_HT_OPERATION, &ielen, in_len); 2325 2338 if (p && (ielen == sizeof(struct ieee80211_ht_addt_info))) { 2326 - struct HT_info_element *pht_info = (struct HT_info_element *)(p+2); 2339 + struct HT_info_element *pht_info = (struct HT_info_element *)(p + 2); 2327 2340 2328 2341 if (pht_info->infos[0] & BIT(2)) { 2329 2342 switch (pht_info->infos[0] & 0x3) { ··· 2386 2399 rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, 2387 2400 &max_rx_ampdu_factor); 2388 2401 2389 - ht_capie.ampdu_params_info = (max_rx_ampdu_factor&0x03); 2402 + ht_capie.ampdu_params_info = (max_rx_ampdu_factor & 0x03); 2390 2403 2391 2404 if (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_) 2392 - ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2)); 2405 + ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY & (0x07 << 2)); 2393 2406 else 2394 - ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00); 2407 + ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00); 2395 2408 2396 - rtw_set_ie(out_ie+out_len, WLAN_EID_HT_CAPABILITY, 2409 + rtw_set_ie(out_ie + out_len, WLAN_EID_HT_CAPABILITY, 2397 2410 sizeof(struct ieee80211_ht_cap), (unsigned char *)&ht_capie, pout_len); 2398 2411 2399 2412 phtpriv->ht_option = true; ··· 2402 2415 p = rtw_get_ie(in_ie, WLAN_EID_HT_OPERATION, &ielen, in_len); 2403 2416 if (p && (ielen == sizeof(struct ieee80211_ht_addt_info))) { 2404 2417 out_len = *pout_len; 2405 - rtw_set_ie(out_ie+out_len, WLAN_EID_HT_OPERATION, ielen, p+2, pout_len); 2418 + rtw_set_ie(out_ie + out_len, WLAN_EID_HT_OPERATION, ielen, p + 2, pout_len); 2406 2419 } 2407 2420 } 2408 2421 ··· 2434 2447 2435 2448 /* check Max Rx A-MPDU Size */ 2436 2449 len = 0; 2437 - p = rtw_get_ie(pie+sizeof(struct ndis_802_11_fix_ie), WLAN_EID_HT_CAPABILITY, &len, ie_len-sizeof(struct ndis_802_11_fix_ie)); 2450 + p = rtw_get_ie(pie + sizeof(struct ndis_802_11_fix_ie), WLAN_EID_HT_CAPABILITY, &len, ie_len - sizeof(struct ndis_802_11_fix_ie)); 2438 2451 if (p && len > 0) { 2439 - pht_capie = (struct ieee80211_ht_cap *)(p+2); 2452 + pht_capie = (struct ieee80211_ht_cap *)(p + 2); 2440 2453 max_ampdu_sz = (pht_capie->ampdu_params_info & IEEE80211_HT_CAP_AMPDU_FACTOR); 2441 - max_ampdu_sz = 1 << (max_ampdu_sz+3); /* max_ampdu_sz (kbytes); */ 2454 + max_ampdu_sz = 1 << (max_ampdu_sz + 3); /* max_ampdu_sz (kbytes); */ 2442 2455 2443 2456 phtpriv->rx_ampdu_maxlen = max_ampdu_sz; 2444 2457 } 2445 2458 2446 2459 len = 0; 2447 - p = rtw_get_ie(pie+sizeof(struct ndis_802_11_fix_ie), WLAN_EID_HT_OPERATION, &len, ie_len-sizeof(struct ndis_802_11_fix_ie)); 2460 + p = rtw_get_ie(pie + sizeof(struct ndis_802_11_fix_ie), WLAN_EID_HT_OPERATION, &len, ie_len - sizeof(struct ndis_802_11_fix_ie)); 2448 2461 if (p && len > 0) { 2449 2462 /* todo: */ 2450 2463 } ··· 2523 2536 phtpriv = &psta->htpriv; 2524 2537 2525 2538 if (phtpriv->ht_option && phtpriv->ampdu_enable) { 2526 - issued = (phtpriv->agg_enable_bitmap>>priority)&0x1; 2527 - issued |= (phtpriv->candidate_tid_bitmap>>priority)&0x1; 2539 + issued = (phtpriv->agg_enable_bitmap >> priority) & 0x1; 2540 + issued |= (phtpriv->candidate_tid_bitmap >> priority) & 0x1; 2528 2541 2529 2542 if (issued == 0) { 2530 2543 psta->htpriv.candidate_tid_bitmap |= BIT((u8)priority); ··· 2594 2607 2595 2608 signed int rtw_linked_check(struct adapter *padapter) 2596 2609 { 2597 - if ((check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true) || 2598 - (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == true)) { 2610 + if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) || 2611 + check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)) { 2599 2612 if (padapter->stapriv.asoc_sta_count > 2) 2600 2613 return true; 2601 2614 } else { /* Station mode */ 2602 - if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) == true) 2615 + if (check_fwstate(&padapter->mlmepriv, _FW_LINKED)) 2603 2616 return true; 2604 2617 } 2605 2618 return false;
+194 -203
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
··· 438 438 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 439 439 u8 *pframe = precv_frame->u.hdr.rx_data; 440 440 struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(pframe)); 441 - struct dvobj_priv *psdpriv = padapter->dvobj; 442 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 443 441 444 442 if (GetFrameType(pframe) != WIFI_MGT_TYPE) 445 443 return; ··· 461 463 if (GetRetry(pframe)) { 462 464 if (precv_frame->u.hdr.attrib.seq_num == psta->RxMgmtFrameSeqNum) { 463 465 /* drop the duplicate management frame */ 464 - pdbgpriv->dbg_rx_dup_mgt_frame_drop_count++; 465 466 return; 466 467 } 467 468 } ··· 559 562 int cam_idx; 560 563 struct sta_info *psta; 561 564 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 562 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 565 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 563 566 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 564 567 struct sta_priv *pstapriv = &padapter->stapriv; 565 568 u8 *pframe = precv_frame->u.hdr.rx_data; ··· 586 589 if (!memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) { 587 590 if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { 588 591 /* we should update current network before auth, or some IE is wrong */ 589 - pbss = rtw_malloc(sizeof(struct wlan_bssid_ex)); 592 + pbss = kmalloc(sizeof(*pbss), GFP_ATOMIC); 590 593 if (pbss) { 591 594 if (collect_bss_info(padapter, precv_frame, pbss) == _SUCCESS) { 592 595 update_network(&(pmlmepriv->cur_network.network), pbss, padapter, true); ··· 678 681 struct sta_priv *pstapriv = &padapter->stapriv; 679 682 struct security_priv *psecuritypriv = &padapter->securitypriv; 680 683 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 681 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 684 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 682 685 u8 *pframe = precv_frame->u.hdr.rx_data; 683 686 uint len = precv_frame->u.hdr.len; 684 687 u8 offset = 0; ··· 855 858 unsigned char *p; 856 859 unsigned int go2asoc = 0; 857 860 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 858 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 861 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 859 862 u8 *pframe = precv_frame->u.hdr.rx_data; 860 863 uint pkt_len = precv_frame->u.hdr.len; 861 864 ··· 941 944 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 942 945 struct security_priv *psecuritypriv = &padapter->securitypriv; 943 946 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 944 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 947 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 945 948 struct wlan_bssid_ex *cur = &(pmlmeinfo->network); 946 949 struct sta_priv *pstapriv = &padapter->stapriv; 947 950 u8 *pframe = precv_frame->u.hdr.rx_data; ··· 1117 1120 1118 1121 pstat->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS); 1119 1122 if (!wpa_ie) { 1120 - if (elems.wps_ie) { 1123 + if (elems.wps_ie) 1121 1124 pstat->flags |= WLAN_STA_WPS; 1122 - } else { 1125 + else 1123 1126 pstat->flags |= WLAN_STA_MAYBE_WPS; 1124 - } 1125 1127 1126 1128 1127 1129 /* AP support WPA/RSN, and sta is going to do WPS, but AP is not ready */ ··· 1177 1181 p = pframe + WLAN_HDR_A3_LEN + ie_offset; ie_len = 0; 1178 1182 for (;;) { 1179 1183 p = rtw_get_ie(p, WLAN_EID_VENDOR_SPECIFIC, &ie_len, pkt_len - WLAN_HDR_A3_LEN - ie_offset); 1180 - if (p) { 1181 - if (!memcmp(p+2, WMM_IE, 6)) { 1182 - 1183 - pstat->flags |= WLAN_STA_WME; 1184 - 1185 - pstat->qos_option = 1; 1186 - pstat->qos_info = *(p+8); 1187 - 1188 - pstat->max_sp_len = (pstat->qos_info>>5)&0x3; 1189 - 1190 - if ((pstat->qos_info&0xf) != 0xf) 1191 - pstat->has_legacy_ac = true; 1192 - else 1193 - pstat->has_legacy_ac = false; 1194 - 1195 - if (pstat->qos_info&0xf) { 1196 - if (pstat->qos_info&BIT(0)) 1197 - pstat->uapsd_vo = BIT(0)|BIT(1); 1198 - else 1199 - pstat->uapsd_vo = 0; 1200 - 1201 - if (pstat->qos_info&BIT(1)) 1202 - pstat->uapsd_vi = BIT(0)|BIT(1); 1203 - else 1204 - pstat->uapsd_vi = 0; 1205 - 1206 - if (pstat->qos_info&BIT(2)) 1207 - pstat->uapsd_bk = BIT(0)|BIT(1); 1208 - else 1209 - pstat->uapsd_bk = 0; 1210 - 1211 - if (pstat->qos_info&BIT(3)) 1212 - pstat->uapsd_be = BIT(0)|BIT(1); 1213 - else 1214 - pstat->uapsd_be = 0; 1215 - 1216 - } 1217 - 1218 - break; 1219 - } 1220 - } else { 1184 + if (!p) 1221 1185 break; 1186 + 1187 + if (memcmp(p+2, WMM_IE, 6)) { 1188 + p = p + ie_len + 2; 1189 + continue; 1222 1190 } 1223 - p = p + ie_len + 2; 1191 + 1192 + pstat->flags |= WLAN_STA_WME; 1193 + 1194 + pstat->qos_option = 1; 1195 + pstat->qos_info = *(p+8); 1196 + 1197 + pstat->max_sp_len = (pstat->qos_info>>5)&0x3; 1198 + 1199 + if ((pstat->qos_info&0xf) != 0xf) 1200 + pstat->has_legacy_ac = true; 1201 + else 1202 + pstat->has_legacy_ac = false; 1203 + 1204 + if (pstat->qos_info&0xf) { 1205 + if (pstat->qos_info&BIT(0)) 1206 + pstat->uapsd_vo = BIT(0)|BIT(1); 1207 + else 1208 + pstat->uapsd_vo = 0; 1209 + 1210 + if (pstat->qos_info&BIT(1)) 1211 + pstat->uapsd_vi = BIT(0)|BIT(1); 1212 + else 1213 + pstat->uapsd_vi = 0; 1214 + 1215 + if (pstat->qos_info&BIT(2)) 1216 + pstat->uapsd_bk = BIT(0)|BIT(1); 1217 + else 1218 + pstat->uapsd_bk = 0; 1219 + 1220 + if (pstat->qos_info&BIT(3)) 1221 + pstat->uapsd_be = BIT(0)|BIT(1); 1222 + else 1223 + pstat->uapsd_be = 0; 1224 + 1225 + } 1226 + 1227 + break; 1224 1228 } 1225 1229 } 1226 1230 ··· 1262 1266 else 1263 1267 pstat->flags &= ~WLAN_STA_SHORT_PREAMBLE; 1264 1268 1265 - 1266 - 1267 - if (status != WLAN_STATUS_SUCCESS) 1268 - goto OnAssocReqFail; 1269 - 1270 1269 /* TODO: identify_proprietary_vendor_ie(); */ 1271 1270 /* Realtek proprietary IE */ 1272 1271 /* identify if this is Broadcom sta */ 1273 1272 /* identify if this is ralink sta */ 1274 1273 /* Customer proprietary IE */ 1275 - 1276 - 1277 1274 1278 1275 /* get a unique AID */ 1279 1276 if (pstat->aid == 0) { ··· 1323 1334 spin_lock_bh(&pstat->lock); 1324 1335 kfree(pstat->passoc_req); 1325 1336 pstat->assoc_req_len = 0; 1326 - pstat->passoc_req = rtw_zmalloc(pkt_len); 1327 - if (pstat->passoc_req) { 1328 - memcpy(pstat->passoc_req, pframe, pkt_len); 1337 + pstat->passoc_req = kmemdup(pframe, pkt_len, GFP_ATOMIC); 1338 + if (pstat->passoc_req) 1329 1339 pstat->assoc_req_len = pkt_len; 1330 - } 1340 + 1331 1341 spin_unlock_bh(&pstat->lock); 1332 1342 1333 1343 /* 3-(1) report sta add event */ ··· 1360 1372 struct ndis_80211_var_ie *pIE; 1361 1373 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1362 1374 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 1363 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 1375 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 1364 1376 /* struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); */ 1365 1377 u8 *pframe = precv_frame->u.hdr.rx_data; 1366 1378 uint pkt_len = precv_frame->u.hdr.len; ··· 1447 1459 unsigned short reason; 1448 1460 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1449 1461 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 1450 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 1462 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 1451 1463 u8 *pframe = precv_frame->u.hdr.rx_data; 1452 1464 int ignore_received_deauth = 0; 1453 1465 ··· 1520 1532 unsigned short reason; 1521 1533 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1522 1534 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 1523 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 1535 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 1524 1536 u8 *pframe = precv_frame->u.hdr.rx_data; 1525 1537 1526 1538 /* check A3 */ ··· 1616 1628 unsigned char category, action; 1617 1629 unsigned short tid, status; 1618 1630 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 1619 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 1631 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 1620 1632 u8 *pframe = precv_frame->u.hdr.rx_data; 1621 1633 struct sta_priv *pstapriv = &padapter->stapriv; 1622 1634 ··· 1837 1849 unsigned int OnAction_sa_query(struct adapter *padapter, union recv_frame *precv_frame) 1838 1850 { 1839 1851 u8 *pframe = precv_frame->u.hdr.rx_data; 1840 - struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib; 1841 1852 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 1842 1853 unsigned short tid; 1843 1854 ··· 1851 1864 break; 1852 1865 default: 1853 1866 break; 1854 - } 1855 - if (0) { 1856 - int pp; 1857 - 1858 - netdev_dbg(padapter->pnetdev, "pattrib->pktlen = %d =>", pattrib->pkt_len); 1859 - for (pp = 0; pp < pattrib->pkt_len; pp++) 1860 - pr_cont(" %02x ", pframe[pp]); 1861 - pr_cont("\n"); 1862 1867 } 1863 1868 1864 1869 return _SUCCESS; ··· 2094 2115 struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); 2095 2116 struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); 2096 2117 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 2097 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 2118 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 2098 2119 struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); 2099 2120 2100 2121 pmgntframe = alloc_mgtxmitframe(pxmitpriv); ··· 2242 2263 uint wps_ielen; 2243 2264 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 2244 2265 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 2245 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 2266 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 2246 2267 struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); 2247 2268 unsigned int rate_len; 2248 2269 ··· 2327 2348 u8 *buf; 2328 2349 u8 *ies = pmgntframe->buf_addr+TXDESC_OFFSET+sizeof(struct ieee80211_hdr_3addr); 2329 2350 2330 - buf = rtw_zmalloc(MAX_IE_SZ); 2351 + buf = kzalloc(MAX_IE_SZ, GFP_ATOMIC); 2331 2352 if (!buf) 2332 2353 return; 2333 2354 ··· 2565 2586 int use_shared_key = 0; 2566 2587 struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); 2567 2588 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 2568 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 2589 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 2569 2590 __le16 le_tmp; 2570 2591 2571 2592 pmgntframe = alloc_mgtxmitframe(pxmitpriv); ··· 2693 2714 struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); 2694 2715 struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); 2695 2716 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 2696 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 2717 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 2697 2718 struct wlan_bssid_ex *pnetwork = &(pmlmeinfo->network); 2698 2719 u8 *ie = pnetwork->ies; 2699 2720 __le16 lestatus, le_tmp; ··· 2824 2845 struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); 2825 2846 struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); 2826 2847 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 2827 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 2848 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 2828 2849 int bssrate_len = 0, sta_bssrate_len = 0; 2829 2850 u8 vs_ie_length = 0; 2830 2851 ··· 3003 3024 3004 3025 pxmitpriv = &(padapter->xmitpriv); 3005 3026 pmlmeext = &(padapter->mlmeextpriv); 3006 - pmlmeinfo = &(pmlmeext->mlmext_info); 3027 + pmlmeinfo = &pmlmeext->mlmext_info; 3007 3028 3008 3029 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 3009 3030 if (!pmgntframe) ··· 3065 3086 int ret; 3066 3087 int i = 0; 3067 3088 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 3068 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 3089 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 3069 3090 struct sta_info *psta; 3070 3091 3071 3092 ··· 3142 3163 u16 *qc; 3143 3164 struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); 3144 3165 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 3145 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 3166 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 3146 3167 3147 3168 pmgntframe = alloc_mgtxmitframe(pxmitpriv); 3148 3169 if (!pmgntframe) ··· 3210 3231 int ret; 3211 3232 int i = 0; 3212 3233 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 3213 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 3234 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 3214 3235 3215 3236 /* da == NULL, assume it's null data for sta to ap*/ 3216 3237 if (!da) ··· 3250 3271 __le16 *fctrl; 3251 3272 struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); 3252 3273 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 3253 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 3274 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 3254 3275 int ret = _FAIL; 3255 3276 __le16 le_tmp; 3256 3277 ··· 3344 3365 __le16 *fctrl; 3345 3366 struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); 3346 3367 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 3347 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 3368 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 3348 3369 __le16 le_tmp; 3349 3370 3350 3371 pmgntframe = alloc_mgtxmitframe(pxmitpriv); ··· 3417 3438 __le16 *fctrl; 3418 3439 struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); 3419 3440 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 3420 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 3441 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 3421 3442 struct sta_info *psta; 3422 3443 struct sta_priv *pstapriv = &padapter->stapriv; 3423 3444 struct registry_priv *pregpriv = &padapter->registrypriv; ··· 3565 3586 struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); 3566 3587 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 3567 3588 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 3568 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 3589 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 3569 3590 struct __queue *queue = &(pmlmepriv->scanned_queue); 3570 3591 u8 InfoContent[16] = {0}; 3571 3592 u8 ICS[8][15]; ··· 3663 3684 3664 3685 3665 3686 for (i = 0; i < 8; i++) { 3666 - if (ICS[i][0] == 1) { 3667 - int j, k = 0; 3687 + int j, k = 0; 3668 3688 3669 - InfoContent[k] = i; 3670 - /* SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent, i); */ 3671 - k++; 3689 + if (ICS[i][0] != 1) 3690 + continue; 3672 3691 3673 - for (j = 1; j <= 14; j++) { 3674 - if (ICS[i][j] == 1) { 3675 - if (k < 16) { 3676 - InfoContent[k] = j; /* channel number */ 3677 - /* SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); */ 3678 - k++; 3679 - } 3680 - } 3692 + InfoContent[k] = i; 3693 + /* SET_BSS_INTOLERANT_ELE_REG_CLASS(InfoContent, i); */ 3694 + k++; 3695 + 3696 + for (j = 1; j <= 14; j++) { 3697 + if (ICS[i][j] != 1) 3698 + continue; 3699 + 3700 + if (k < 16) { 3701 + InfoContent[k] = j; /* channel number */ 3702 + /* SET_BSS_INTOLERANT_ELE_CHANNEL(InfoContent+k, j); */ 3703 + k++; 3681 3704 } 3682 - 3683 - pframe = rtw_set_ie(pframe, WLAN_EID_BSS_INTOLERANT_CHL_REPORT, k, InfoContent, &(pattrib->pktlen)); 3684 - 3685 3705 } 3686 3706 3687 - } 3707 + pframe = rtw_set_ie(pframe, WLAN_EID_BSS_INTOLERANT_CHL_REPORT, k, InfoContent, &(pattrib->pktlen)); 3688 3708 3709 + } 3689 3710 3690 3711 } 3691 3712 ··· 3701 3722 struct sta_info *psta = NULL; 3702 3723 /* struct recv_reorder_ctrl *preorder_ctrl; */ 3703 3724 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 3704 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 3725 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 3705 3726 u16 tid; 3706 3727 3707 3728 if ((pmlmeinfo->state&0x03) != WIFI_FW_AP_STATE) ··· 3770 3791 unsigned char survey_channel = 0, val8; 3771 3792 enum rt_scan_type ScanType = SCAN_PASSIVE; 3772 3793 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 3773 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 3794 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 3774 3795 u32 initialgain = 0; 3775 3796 u32 channel_scan_time_ms = 0; 3776 3797 ··· 3810 3831 int i; 3811 3832 3812 3833 for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) { 3813 - if (pmlmeext->sitesurvey_res.ssid[i].ssid_length) { 3814 - /* IOT issue, When wifi_spec is not set, send one probe req without WPS IE. */ 3815 - if (padapter->registrypriv.wifi_spec) 3816 - issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL); 3817 - else 3818 - issue_probereq_ex(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL, 0, 0, 0, 0); 3834 + if (!pmlmeext->sitesurvey_res.ssid[i].ssid_length) 3835 + continue; 3836 + 3837 + /* IOT issue, When wifi_spec is not set, send one probe req without WPS IE. */ 3838 + if (padapter->registrypriv.wifi_spec) 3819 3839 issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL); 3820 - } 3840 + else 3841 + issue_probereq_ex(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL, 0, 0, 0, 0); 3842 + 3843 + issue_probereq(padapter, &(pmlmeext->sitesurvey_res.ssid[i]), NULL); 3821 3844 } 3822 3845 3823 3846 if (pmlmeext->sitesurvey_res.scan_mode == SCAN_ACTIVE) { ··· 3853 3872 /* rtw_hal_set_hwreg(padapter, HW_VAR_TXPAUSE, (u8 *)(&val8)); */ 3854 3873 3855 3874 /* config MSR */ 3856 - Set_MSR(padapter, (pmlmeinfo->state & 0x3)); 3875 + set_msr(padapter, (pmlmeinfo->state & 0x3)); 3857 3876 3858 3877 initialgain = 0xff; /* restore RX GAIN */ 3859 3878 rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); ··· 3894 3913 u8 ie_offset; 3895 3914 struct registry_priv *pregistrypriv = &padapter->registrypriv; 3896 3915 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 3897 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 3916 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 3898 3917 __le32 le32_tmp; 3899 3918 3900 3919 len = packet_len - sizeof(struct ieee80211_hdr_3addr); ··· 4044 4063 u8 val8; 4045 4064 u8 join_type; 4046 4065 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4047 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4066 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4048 4067 struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)(&(pmlmeinfo->network)); 4049 4068 4050 4069 pmlmeext->cur_channel = (u8)pnetwork->configuration.ds_config; ··· 4070 4089 4071 4090 /* set msr to WIFI_FW_ADHOC_STATE */ 4072 4091 pmlmeinfo->state = WIFI_FW_ADHOC_STATE; 4073 - Set_MSR(padapter, (pmlmeinfo->state & 0x3)); 4092 + set_msr(padapter, (pmlmeinfo->state & 0x3)); 4074 4093 4075 4094 /* issue beacon */ 4076 4095 if (send_beacon(padapter) == _FAIL) { ··· 4098 4117 unsigned short caps; 4099 4118 u8 val8; 4100 4119 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4101 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4120 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4102 4121 struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)(&(pmlmeinfo->network)); 4103 4122 int beacon_timeout; 4104 4123 ··· 4109 4128 caps = rtw_get_capability((struct wlan_bssid_ex *)pnetwork); 4110 4129 update_capinfo(padapter, caps); 4111 4130 if (caps&WLAN_CAPABILITY_ESS) { 4112 - Set_MSR(padapter, WIFI_FW_STATION_STATE); 4131 + set_msr(padapter, WIFI_FW_STATION_STATE); 4113 4132 4114 4133 val8 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_8021X) ? 0xcc : 0xcf; 4115 4134 ··· 4136 4155 4137 4156 pmlmeinfo->state = WIFI_FW_AUTH_NULL | WIFI_FW_STATION_STATE; 4138 4157 } else if (caps&WLAN_CAPABILITY_IBSS) { /* adhoc client */ 4139 - Set_MSR(padapter, WIFI_FW_ADHOC_STATE); 4158 + set_msr(padapter, WIFI_FW_ADHOC_STATE); 4140 4159 4141 4160 val8 = 0xcf; 4142 4161 rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8)); ··· 4155 4174 void start_clnt_auth(struct adapter *padapter) 4156 4175 { 4157 4176 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4158 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4177 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4159 4178 4160 4179 timer_delete_sync(&pmlmeext->link_timer); 4161 4180 ··· 4180 4199 void start_clnt_assoc(struct adapter *padapter) 4181 4200 { 4182 4201 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4183 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4202 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4184 4203 4185 4204 timer_delete_sync(&pmlmeext->link_timer); 4186 4205 ··· 4195 4214 unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr, unsigned short reason) 4196 4215 { 4197 4216 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4198 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4217 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4199 4218 4200 4219 /* check A3 */ 4201 4220 if (!(!memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN))) ··· 4376 4395 pmlmeext = &padapter->mlmeextpriv; 4377 4396 pcmdpriv = &padapter->cmdpriv; 4378 4397 4379 - pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj)); 4398 + pcmd_obj = kzalloc(sizeof(*pcmd_obj), GFP_ATOMIC); 4380 4399 if (!pcmd_obj) 4381 4400 return; 4382 4401 4383 4402 cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header)); 4384 - pevtcmd = rtw_zmalloc(cmdsz); 4403 + pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); 4385 4404 if (!pevtcmd) { 4386 4405 kfree(pcmd_obj); 4387 4406 return; ··· 4429 4448 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4430 4449 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 4431 4450 4432 - pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj)); 4451 + pcmd_obj = kzalloc(sizeof(*pcmd_obj), GFP_ATOMIC); 4433 4452 if (!pcmd_obj) 4434 4453 return; 4435 4454 4436 4455 cmdsz = (sizeof(struct surveydone_event) + sizeof(struct C2HEvent_Header)); 4437 - pevtcmd = rtw_zmalloc(cmdsz); 4456 + pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); 4438 4457 if (!pevtcmd) { 4439 4458 kfree(pcmd_obj); 4440 4459 return; ··· 4471 4490 struct joinbss_event *pjoinbss_evt; 4472 4491 struct C2HEvent_Header *pc2h_evt_hdr; 4473 4492 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4474 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4493 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4475 4494 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 4476 4495 4477 - pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj)); 4496 + pcmd_obj = kzalloc(sizeof(*pcmd_obj), GFP_ATOMIC); 4478 4497 if (!pcmd_obj) 4479 4498 return; 4480 4499 4481 4500 cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header)); 4482 - pevtcmd = rtw_zmalloc(cmdsz); 4501 + pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); 4483 4502 if (!pevtcmd) { 4484 4503 kfree(pcmd_obj); 4485 4504 return; ··· 4523 4542 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4524 4543 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 4525 4544 4526 - pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj)); 4545 + pcmd_obj = kzalloc(sizeof(*pcmd_obj), GFP_ATOMIC); 4527 4546 if (!pcmd_obj) 4528 4547 return; 4529 4548 4530 4549 cmdsz = (sizeof(struct wmm_event) + sizeof(struct C2HEvent_Header)); 4531 - pevtcmd = rtw_zmalloc(cmdsz); 4550 + pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); 4532 4551 if (!pevtcmd) { 4533 4552 kfree(pcmd_obj); 4534 4553 return; ··· 4569 4588 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4570 4589 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 4571 4590 4572 - pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj)); 4591 + pcmd_obj = kzalloc(sizeof(*pcmd_obj), GFP_ATOMIC); 4573 4592 if (!pcmd_obj) 4574 4593 return; 4575 4594 4576 4595 cmdsz = (sizeof(struct stadel_event) + sizeof(struct C2HEvent_Header)); 4577 - pevtcmd = rtw_zmalloc(cmdsz); 4596 + pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); 4578 4597 if (!pevtcmd) { 4579 4598 kfree(pcmd_obj); 4580 4599 return; ··· 4620 4639 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4621 4640 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 4622 4641 4623 - pcmd_obj = rtw_zmalloc(sizeof(struct cmd_obj)); 4642 + pcmd_obj = kzalloc(sizeof(*pcmd_obj), GFP_ATOMIC); 4624 4643 if (!pcmd_obj) 4625 4644 return; 4626 4645 4627 4646 cmdsz = (sizeof(struct stassoc_event) + sizeof(struct C2HEvent_Header)); 4628 - pevtcmd = rtw_zmalloc(cmdsz); 4647 + pevtcmd = kzalloc(cmdsz, GFP_ATOMIC); 4629 4648 if (!pevtcmd) { 4630 4649 kfree(pcmd_obj); 4631 4650 return; ··· 4659 4678 { 4660 4679 struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); 4661 4680 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4662 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4681 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4663 4682 4664 4683 /* ERP */ 4665 4684 VCS_update(padapter, psta); ··· 4719 4738 { 4720 4739 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 4721 4740 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4722 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4741 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4723 4742 struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)(&(pmlmeinfo->network)); 4724 4743 4725 4744 /* set_opmode_cmd(padapter, infra_client_with_mlme); */ ··· 4742 4761 rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, null_addr); 4743 4762 4744 4763 /* set MSR to no link state -> infra. mode */ 4745 - Set_MSR(padapter, _HW_STATE_STATION_); 4764 + set_msr(padapter, _HW_STATE_STATION_); 4746 4765 4747 4766 pmlmeinfo->state = WIFI_FW_NULL_STATE; 4748 4767 ··· 4765 4784 void mlmeext_joinbss_event_callback(struct adapter *padapter, int join_res) 4766 4785 { 4767 4786 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4768 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4787 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4769 4788 struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); 4770 4789 struct sta_priv *pstapriv = &padapter->stapriv; 4771 4790 u8 join_type; ··· 4843 4862 void mlmeext_sta_add_event_callback(struct adapter *padapter, struct sta_info *psta) 4844 4863 { 4845 4864 struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); 4846 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4865 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4847 4866 u8 join_type; 4848 4867 4849 4868 if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) { ··· 4904 4923 { 4905 4924 int i; 4906 4925 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4907 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4926 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4908 4927 int UndecoratedSmoothedPWDB; 4909 4928 struct dvobj_priv *pdvobj = adapter_to_dvobj(padapter); 4910 4929 4911 4930 if (padapter->bLinkInfoDump) { 4912 4931 4913 4932 if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE) 4914 - rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, &UndecoratedSmoothedPWDB); 4933 + rtw_hal_get_def_var(padapter, 4934 + HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, 4935 + &UndecoratedSmoothedPWDB); 4915 4936 4916 4937 for (i = 0; i < NUM_STA; i++) { 4917 4938 if (pdvobj->macid[i]) { ··· 4949 4966 struct sta_info *psta; 4950 4967 struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); 4951 4968 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 4952 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 4969 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 4953 4970 struct sta_priv *pstapriv = &padapter->stapriv; 4954 - 4955 4971 4956 4972 if (is_client_associated_to_ap(padapter)) { 4957 4973 /* linked infrastructure client mode */ ··· 4967 4985 link_count_limit = 7; /* 16 sec */ 4968 4986 4969 4987 /* Marked by Kurt 20130715 */ 4970 - /* For WiDi 3.5 and latered on, they don't ask WiDi sink to do roaming, so we could not check rx limit that strictly. */ 4988 + /* For WiDi 3.5 and latered on, they don't ask WiDi sink to do roaming, */ 4989 + /* so we could not check rx limit that strictly. */ 4971 4990 /* todo: To check why we under miracast session, rx_chk would be false */ 4972 4991 psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.mac_address); 4973 4992 if (psta) { ··· 4981 4998 { 4982 4999 if (rx_chk != _SUCCESS) { 4983 5000 if (pmlmeext->retry == 0) { 4984 - issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0); 4985 - issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0); 4986 - issue_probereq_ex(padapter, &pmlmeinfo->network.ssid, pmlmeinfo->network.mac_address, 0, 0, 0, 0); 5001 + issue_probereq_ex(padapter, 5002 + &pmlmeinfo->network.ssid, 5003 + pmlmeinfo->network.mac_address, 5004 + 0, 0, 0, 0); 5005 + issue_probereq_ex(padapter, 5006 + &pmlmeinfo->network.ssid, 5007 + pmlmeinfo->network.mac_address, 5008 + 0, 0, 0, 0); 5009 + issue_probereq_ex(padapter, 5010 + &pmlmeinfo->network.ssid, 5011 + pmlmeinfo->network.mac_address, 5012 + 0, 0, 0, 0); 4987 5013 } 4988 5014 } 4989 5015 ··· 5016 5024 } 5017 5025 5018 5026 if (tx_chk == _FAIL) { 5019 - pmlmeinfo->link_count %= (link_count_limit+1); 5027 + pmlmeinfo->link_count %= (link_count_limit + 1); 5020 5028 } else { 5021 5029 pxmitpriv->last_tx_pkts = pxmitpriv->tx_pkts; 5022 5030 pmlmeinfo->link_count = 0; ··· 5034 5042 continue; 5035 5043 5036 5044 if (pmlmeinfo->FW_sta_info[i].rx_pkt == sta_rx_pkts(psta)) { 5037 - 5038 5045 if (pmlmeinfo->FW_sta_info[i].retry < 3) { 5039 5046 pmlmeinfo->FW_sta_info[i].retry++; 5040 5047 } else { ··· 5051 5060 } 5052 5061 5053 5062 /* set_link_timer(pmlmeext, DISCONNECT_TO); */ 5054 - 5055 5063 } 5056 - 5057 5064 } 5058 5065 5059 5066 void survey_timer_hdl(struct timer_list *t) ··· 5074 5085 pmlmeext->scan_abort = false;/* reset */ 5075 5086 } 5076 5087 5077 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 5088 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 5078 5089 if (!ph2c) 5079 5090 return; 5080 5091 5081 - psurveyPara = rtw_zmalloc(sizeof(struct sitesurvey_parm)); 5092 + psurveyPara = kzalloc(sizeof(*psurveyPara), GFP_ATOMIC); 5082 5093 if (!psurveyPara) { 5083 5094 kfree(ph2c); 5084 5095 return; ··· 5094 5105 struct adapter *padapter = 5095 5106 timer_container_of(padapter, t, mlmeextpriv.link_timer); 5096 5107 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 5097 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5108 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 5098 5109 5099 5110 5100 5111 if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { ··· 5167 5178 { 5168 5179 u8 type; 5169 5180 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 5170 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5181 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 5171 5182 struct setopmode_parm *psetop = (struct setopmode_parm *)pbuf; 5172 5183 5173 5184 if (psetop->mode == Ndis802_11APMode) { ··· 5175 5186 type = _HW_STATE_AP_; 5176 5187 /* start_ap_mode(padapter); */ 5177 5188 } else if (psetop->mode == Ndis802_11Infrastructure) { 5178 - pmlmeinfo->state &= ~(BIT(0)|BIT(1));/* clear state */ 5189 + pmlmeinfo->state &= ~(BIT(0) | BIT(1));/* clear state */ 5179 5190 pmlmeinfo->state |= WIFI_FW_STATION_STATE;/* set to STATION_STATE */ 5180 5191 type = _HW_STATE_STATION_; 5181 5192 } else if (psetop->mode == Ndis802_11IBSS) { ··· 5185 5196 } 5186 5197 5187 5198 rtw_hal_set_hwreg(padapter, HW_VAR_SET_OPMODE, (u8 *)(&type)); 5188 - /* Set_MSR(padapter, type); */ 5199 + /* set_msr(padapter, type); */ 5189 5200 5190 5201 if (psetop->mode == Ndis802_11APMode) { 5191 5202 /* Do this after port switch to */ ··· 5194 5205 } 5195 5206 5196 5207 return H2C_SUCCESS; 5197 - 5198 5208 } 5199 5209 5200 5210 u8 createbss_hdl(struct adapter *padapter, u8 *pbuf) 5201 5211 { 5202 5212 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 5203 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5213 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 5204 5214 struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)(&(pmlmeinfo->network)); 5205 5215 struct joinbss_parm *pparm = (struct joinbss_parm *)pbuf; 5206 5216 /* u32 initialgain; */ ··· 5259 5271 struct ndis_80211_var_ie *pIE; 5260 5272 struct registry_priv *pregpriv = &padapter->registrypriv; 5261 5273 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 5262 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5274 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 5263 5275 struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)(&(pmlmeinfo->network)); 5264 5276 u32 i; 5265 5277 u8 cbw40_enable = 0; ··· 5279 5291 timer_delete_sync(&pmlmeext->link_timer); 5280 5292 5281 5293 /* set MSR to nolink -> infra. mode */ 5282 - /* Set_MSR(padapter, _HW_STATE_NOLINK_); */ 5283 - Set_MSR(padapter, _HW_STATE_STATION_); 5294 + /* set_msr(padapter, _HW_STATE_NOLINK_); */ 5295 + set_msr(padapter, _HW_STATE_STATION_); 5284 5296 5285 5297 5286 5298 rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, NULL); ··· 5401 5413 { 5402 5414 struct disconnect_parm *param = (struct disconnect_parm *)pbuf; 5403 5415 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 5404 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5416 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 5405 5417 struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)(&(pmlmeinfo->network)); 5406 5418 u8 val8; 5407 5419 ··· 5497 5509 5498 5510 for (i = 0; i < RTW_SSID_SCAN_AMOUNT; i++) { 5499 5511 if (pparm->ssid[i].ssid_length) { 5500 - memcpy(pmlmeext->sitesurvey_res.ssid[i].ssid, pparm->ssid[i].ssid, IW_ESSID_MAX_SIZE); 5501 - pmlmeext->sitesurvey_res.ssid[i].ssid_length = pparm->ssid[i].ssid_length; 5512 + memcpy(pmlmeext->sitesurvey_res.ssid[i].ssid, 5513 + pparm->ssid[i].ssid, 5514 + IW_ESSID_MAX_SIZE); 5515 + pmlmeext->sitesurvey_res.ssid[i].ssid_length = 5516 + pparm->ssid[i].ssid_length; 5502 5517 } else { 5503 5518 pmlmeext->sitesurvey_res.ssid[i].ssid_length = 0; 5504 5519 } ··· 5529 5538 } 5530 5539 } 5531 5540 5532 - if ((pmlmeext->sitesurvey_res.state == SCAN_START) || (pmlmeext->sitesurvey_res.state == SCAN_TXNULL)) { 5541 + if ((pmlmeext->sitesurvey_res.state == SCAN_START) || 5542 + (pmlmeext->sitesurvey_res.state == SCAN_TXNULL)) { 5533 5543 /* disable dynamic functions, such as high power, DIG */ 5534 5544 Save_DM_Func_Flag(padapter); 5535 5545 Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false); ··· 5543 5551 rtw_hal_set_hwreg(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain)); 5544 5552 5545 5553 /* set MSR to no link state */ 5546 - Set_MSR(padapter, _HW_STATE_NOLINK_); 5554 + set_msr(padapter, _HW_STATE_NOLINK_); 5547 5555 5548 5556 val8 = 1; /* under site survey */ 5549 5557 rtw_hal_set_hwreg(padapter, HW_VAR_MLME_SITESURVEY, (u8 *)(&val8)); ··· 5554 5562 site_survey(padapter); 5555 5563 5556 5564 return H2C_SUCCESS; 5557 - 5558 5565 } 5559 5566 5560 5567 u8 setauth_hdl(struct adapter *padapter, unsigned char *pbuf) 5561 5568 { 5562 5569 struct setauth_parm *pparm = (struct setauth_parm *)pbuf; 5563 5570 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 5564 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5571 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 5565 5572 5566 5573 if (pparm->mode < 4) 5567 5574 pmlmeinfo->auth_algo = pparm->mode; ··· 5574 5583 s16 cam_id = 0; 5575 5584 struct setkey_parm *pparm = (struct setkey_parm *)pbuf; 5576 5585 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 5577 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5586 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 5578 5587 unsigned char null_addr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 5579 5588 u8 *addr; 5580 5589 ··· 5595 5604 write_cam(padapter, cam_id, ctrl, addr, pparm->key); 5596 5605 netdev_dbg(padapter->pnetdev, 5597 5606 "set group key camid:%d, addr:%pM, kid:%d, type:%s\n", 5598 - cam_id, MAC_ARG(addr), pparm->keyid, 5607 + cam_id, addr, pparm->keyid, 5599 5608 security_type_str(pparm->algorithm)); 5600 5609 } 5601 5610 ··· 5614 5623 s16 cam_id = 0; 5615 5624 u8 ret = H2C_SUCCESS; 5616 5625 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 5617 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5626 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 5618 5627 struct set_stakey_parm *pparm = (struct set_stakey_parm *)pbuf; 5619 5628 struct sta_priv *pstapriv = &padapter->stapriv; 5620 5629 struct sta_info *psta; ··· 5625 5634 psta = rtw_get_stainfo(pstapriv, pparm->addr); 5626 5635 if (!psta) { 5627 5636 netdev_dbg(padapter->pnetdev, "%s sta:%pM not found\n", 5628 - __func__, MAC_ARG(pparm->addr)); 5637 + __func__, pparm->addr); 5629 5638 ret = H2C_REJECTED; 5630 5639 goto exit; 5631 5640 } ··· 5640 5649 while ((cam_id = rtw_camid_search(padapter, pparm->addr, -1)) >= 0) { 5641 5650 netdev_dbg(padapter->pnetdev, 5642 5651 "clear key for addr:%pM, camid:%d\n", 5643 - MAC_ARG(pparm->addr), cam_id); 5652 + pparm->addr, cam_id); 5644 5653 clear_cam_entry(padapter, cam_id); 5645 5654 rtw_camid_free(padapter, cam_id); 5646 5655 } 5647 5656 } else { 5648 5657 netdev_dbg(padapter->pnetdev, 5649 5658 "set pairwise key camid:%d, addr:%pM, kid:%d, type:%s\n", 5650 - cam_id, MAC_ARG(pparm->addr), pparm->keyid, 5659 + cam_id, pparm->addr, pparm->keyid, 5651 5660 security_type_str(pparm->algorithm)); 5652 5661 ctrl = BIT(15) | ((pparm->algorithm) << 2) | pparm->keyid; 5653 5662 write_cam(padapter, cam_id, ctrl, pparm->addr, pparm->key); ··· 5662 5671 { 5663 5672 struct addBaReq_parm *pparm = (struct addBaReq_parm *)pbuf; 5664 5673 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 5665 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5674 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 5666 5675 5667 5676 struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, pparm->addr); 5668 5677 ··· 5683 5692 return H2C_SUCCESS; 5684 5693 } 5685 5694 5686 - 5687 5695 u8 chk_bmc_sleepq_cmd(struct adapter *padapter) 5688 5696 { 5689 5697 struct cmd_obj *ph2c; 5690 5698 struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); 5691 5699 u8 res = _SUCCESS; 5692 5700 5693 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 5701 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 5694 5702 if (!ph2c) { 5695 5703 res = _FAIL; 5696 5704 goto exit; ··· 5709 5719 struct Tx_Beacon_param *ptxBeacon_parm; 5710 5720 struct cmd_priv *pcmdpriv = &(padapter->cmdpriv); 5711 5721 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 5712 - struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); 5722 + struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 5713 5723 u8 res = _SUCCESS; 5714 5724 int len_diff = 0; 5715 5725 5716 - ph2c = rtw_zmalloc(sizeof(struct cmd_obj)); 5726 + ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC); 5717 5727 if (!ph2c) { 5718 5728 res = _FAIL; 5719 5729 goto exit; 5720 5730 } 5721 5731 5722 - ptxBeacon_parm = rtw_zmalloc(sizeof(struct Tx_Beacon_param)); 5732 + ptxBeacon_parm = kzalloc(sizeof(*ptxBeacon_parm), GFP_ATOMIC); 5723 5733 if (!ptxBeacon_parm) { 5724 5734 kfree(ph2c); 5725 5735 res = _FAIL; ··· 5728 5738 5729 5739 memcpy(&(ptxBeacon_parm->network), &(pmlmeinfo->network), sizeof(struct wlan_bssid_ex)); 5730 5740 5731 - len_diff = update_hidden_ssid(ptxBeacon_parm->network.ies+_BEACON_IE_OFFSET_, 5732 - ptxBeacon_parm->network.ie_length-_BEACON_IE_OFFSET_, 5741 + len_diff = update_hidden_ssid(ptxBeacon_parm->network.ies + _BEACON_IE_OFFSET_, 5742 + ptxBeacon_parm->network.ie_length - _BEACON_IE_OFFSET_, 5733 5743 pmlmeinfo->hidden_ssid_mode); 5734 5744 ptxBeacon_parm->network.ie_length += len_diff; 5735 5745 ··· 5784 5794 goto _abort_event_; 5785 5795 5786 5796 peventbuf = (uint *)pbuf; 5787 - evt_sz = (u16)(*peventbuf&0xffff); 5788 - evt_code = (u8)((*peventbuf>>16)&0xff); 5797 + evt_sz = (u16)(*peventbuf & 0xffff); 5798 + evt_code = (u8)((*peventbuf >> 16) & 0xff); 5789 5799 5790 5800 /* checking if event code is valid */ 5791 5801 if (evt_code >= MAX_C2HEVT) ··· 5793 5803 5794 5804 /* checking if event size match the event parm size */ 5795 5805 if ((wlanevents[evt_code].parmsize != 0) && 5796 - (wlanevents[evt_code].parmsize != evt_sz)) 5806 + (wlanevents[evt_code].parmsize != evt_sz)) 5797 5807 goto _abort_event_; 5798 5808 5799 5809 atomic_inc(&pevt_priv->event_seq); ··· 5807 5817 pevt_priv->evt_done_cnt++; 5808 5818 } 5809 5819 5810 - 5811 5820 _abort_event_: 5812 - 5813 - 5814 5821 return H2C_SUCCESS; 5815 - 5816 5822 } 5817 5823 5818 5824 u8 h2c_msg_hdl(struct adapter *padapter, unsigned char *pbuf) ··· 5832 5846 if (!psta_bmc) 5833 5847 return H2C_SUCCESS; 5834 5848 5835 - if ((pstapriv->tim_bitmap&BIT(0)) && (psta_bmc->sleepq_len > 0)) { 5849 + if ((pstapriv->tim_bitmap & BIT(0)) && (psta_bmc->sleepq_len > 0)) { 5836 5850 msleep(10);/* 10ms, ATIM(HIQ) Windows */ 5837 5851 5838 5852 /* spin_lock_bh(&psta_bmc->sleep_q.lock); */ ··· 5931 5945 5932 5946 setChannelPlan_param = (struct SetChannelPlan_param *)pbuf; 5933 5947 5934 - pmlmeext->max_chan_nums = init_channel_set(padapter, setChannelPlan_param->channel_plan, pmlmeext->channel_set); 5935 - init_channel_list(padapter, pmlmeext->channel_set, pmlmeext->max_chan_nums, &pmlmeext->channel_list); 5948 + pmlmeext->max_chan_nums = init_channel_set(padapter, 5949 + setChannelPlan_param->channel_plan, 5950 + pmlmeext->channel_set); 5951 + init_channel_list(padapter, 5952 + pmlmeext->channel_set, 5953 + pmlmeext->max_chan_nums, 5954 + &pmlmeext->channel_list); 5936 5955 5937 5956 if (padapter->rtw_wdev && padapter->rtw_wdev->wiphy) { 5938 5957 struct regulatory_request request; ··· 5957 5966 /* TDLS_ESTABLISHED : write RCR DATA BIT */ 5958 5967 /* TDLS_CS_OFF : go back to the channel linked with AP, terminating channel switch procedure */ 5959 5968 /* TDLS_INIT_CH_SEN : init channel sensing, receive all data and mgnt frame */ 5960 - /* TDLS_DONE_CH_SEN: channel sensing and report candidate channel */ 5969 + /* TDLS_DONE_CH_SEN : channel sensing and report candidate channel */ 5961 5970 /* TDLS_OFF_CH : first time set channel to off channel */ 5962 - /* TDLS_BASE_CH : go back tp the channel linked with AP when set base channel as target channel */ 5971 + /* TDLS_BASE_CH : go back tp the channel linked with AP when set */ 5972 + /* base channel as target channel */ 5963 5973 /* TDLS_P_OFF_CH : periodically go to off channel */ 5964 5974 /* TDLS_P_BASE_CH : periodically go back to base channel */ 5965 5975 /* TDLS_RS_RCR : restore RCR */ ··· 5974 5982 { 5975 5983 struct RunInThread_param *p; 5976 5984 5977 - 5978 - if (pbuf == NULL) 5985 + if (!pbuf) 5979 5986 return H2C_PARAMETERS_ERROR; 5980 5987 p = (struct RunInThread_param *)pbuf; 5981 5988
+1 -5
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
··· 139 139 void rtw_ps_processor(struct adapter *padapter) 140 140 { 141 141 struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); 142 - struct dvobj_priv *psdpriv = padapter->dvobj; 143 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 144 142 u32 ps_deny = 0; 145 143 146 144 mutex_lock(&adapter_to_pwrctl(padapter)->lock); ··· 147 149 if (ps_deny != 0) 148 150 goto exit; 149 151 150 - if (pwrpriv->bInSuspend) {/* system suspend or autosuspend */ 151 - pdbgpriv->dbg_ps_insuspend_cnt++; 152 + if (pwrpriv->bInSuspend) /* system suspend or autosuspend */ 152 153 return; 153 - } 154 154 155 155 pwrpriv->ps_processing = true; 156 156
+4 -29
drivers/staging/rtl8723bs/core/rtw_recv.c
··· 501 501 { 502 502 u8 *psta_addr = NULL; 503 503 u8 *ptr; 504 - uint auth_alg; 504 + unsigned int auth_alg; 505 505 struct recv_frame_hdr *pfhdr; 506 506 struct sta_info *psta; 507 507 struct sta_priv *pstapriv; ··· 1425 1425 memcpy(pattrib->ta, GetAddr2Ptr(ptr), ETH_ALEN); 1426 1426 /* actual management data frame body */ 1427 1427 data_len = pattrib->pkt_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; 1428 - mgmt_DATA = rtw_zmalloc(data_len); 1428 + mgmt_DATA = kzalloc(data_len, GFP_ATOMIC); 1429 1429 if (!mgmt_DATA) 1430 1430 goto validate_80211w_fail; 1431 1431 precv_frame = decryptor(adapter, precv_frame); ··· 1630 1630 1631 1631 pattrib = &prframe->u.hdr.attrib; 1632 1632 1633 - sub_skb = rtw_skb_alloc(nSubframe_Length + 12); 1633 + sub_skb = __dev_alloc_skb(nSubframe_Length + 12, GFP_ATOMIC); 1634 1634 if (!sub_skb) 1635 1635 return NULL; 1636 1636 ··· 1782 1782 1783 1783 static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num) 1784 1784 { 1785 - struct adapter *padapter = preorder_ctrl->padapter; 1786 - struct dvobj_priv *psdpriv = padapter->dvobj; 1787 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 1788 1785 u8 wsize = preorder_ctrl->wsize_b; 1789 1786 u16 wend = (preorder_ctrl->indicate_seq + wsize - 1) % 4096u; 1790 1787 ··· 1807 1810 preorder_ctrl->indicate_seq = seq_num + 1 - wsize; 1808 1811 else 1809 1812 preorder_ctrl->indicate_seq = 0xFFF - (wsize - (seq_num + 1)) + 1; 1810 - pdbgpriv->dbg_rx_ampdu_window_shift_cnt++; 1811 1813 } 1812 1814 1813 1815 return true; ··· 1857 1861 1858 1862 } 1859 1863 1860 - static void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u64 current_seq) 1861 - { 1862 - if (current_seq < prev_seq) 1863 - pdbgpriv->dbg_rx_ampdu_loss_count += (4096 + current_seq - prev_seq); 1864 - else 1865 - pdbgpriv->dbg_rx_ampdu_loss_count += (current_seq - prev_seq); 1866 - 1867 - } 1868 - 1869 1864 static int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame) 1870 1865 { 1871 1866 struct recv_priv *precvpriv; ··· 1903 1916 int bPktInBuf = false; 1904 1917 struct recv_priv *precvpriv = &padapter->recvpriv; 1905 1918 struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; 1906 - struct dvobj_priv *psdpriv = padapter->dvobj; 1907 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 1908 1919 1909 1920 /* spin_lock_irqsave(&ppending_recvframe_queue->lock, irql); */ 1910 1921 /* spin_lock(&ppending_recvframe_queue->lock); */ ··· 1912 1927 1913 1928 /* Handling some condition for forced indicate case. */ 1914 1929 if (bforced == true) { 1915 - pdbgpriv->dbg_rx_ampdu_forced_indicate_count++; 1916 1930 if (list_empty(phead)) { 1917 1931 /* spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql); */ 1918 1932 /* spin_unlock(&ppending_recvframe_queue->lock); */ ··· 1921 1937 prframe = (union recv_frame *)plist; 1922 1938 pattrib = &prframe->u.hdr.attrib; 1923 1939 1924 - recv_indicatepkts_pkt_loss_cnt(pdbgpriv, preorder_ctrl->indicate_seq, pattrib->seq_num); 1925 1940 preorder_ctrl->indicate_seq = pattrib->seq_num; 1926 1941 1927 1942 } ··· 1981 1998 struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; 1982 1999 struct recv_reorder_ctrl *preorder_ctrl = prframe->u.hdr.preorder_ctrl; 1983 2000 struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; 1984 - struct dvobj_priv *psdpriv = padapter->dvobj; 1985 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 1986 2001 1987 2002 if (!pattrib->amsdu) { 1988 2003 /* s1. */ ··· 2016 2035 2017 2036 preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1)%4096; 2018 2037 2019 - if (retval != _SUCCESS) { 2020 - } 2021 - 2022 2038 return retval; 2023 2039 } 2024 2040 } ··· 2023 2045 spin_lock_bh(&ppending_recvframe_queue->lock); 2024 2046 2025 2047 /* s2. check if winstart_b(indicate_seq) needs to been updated */ 2026 - if (!check_indicate_seq(preorder_ctrl, pattrib->seq_num)) { 2027 - pdbgpriv->dbg_rx_ampdu_drop_count++; 2048 + if (!check_indicate_seq(preorder_ctrl, pattrib->seq_num)) 2028 2049 goto _err_exit; 2029 - } 2030 - 2031 2050 2032 2051 /* s3. Insert all packet into Reorder Queue to maintain its ordering. */ 2033 2052 if (!enqueue_reorder_recvframe(preorder_ctrl, prframe)) {
+7 -30
drivers/staging/rtl8723bs/core/rtw_security.c
··· 5 5 * 6 6 ******************************************************************************/ 7 7 #include <linux/crc32.h> 8 + #include <linux/unaligned.h> 8 9 #include <drv_types.h> 9 10 #include <crypto/aes.h> 10 11 #include <crypto/utils.h> ··· 129 128 130 129 /* 3 =====TKIP related ===== */ 131 130 132 - static u32 secmicgetuint32(u8 *p) 133 - /* Convert from Byte[] to Us3232 in a portable way */ 134 - { 135 - s32 i; 136 - u32 res = 0; 137 - 138 - for (i = 0; i < 4; i++) 139 - res |= ((u32)(*p++)) << (8 * i); 140 - 141 - return res; 142 - } 143 - 144 - static void secmicputuint32(u8 *p, u32 val) 145 - /* Convert from Us3232 to Byte[] in a portable way */ 146 - { 147 - long i; 148 - 149 - for (i = 0; i < 4; i++) { 150 - *p++ = (u8) (val & 0xff); 151 - val >>= 8; 152 - } 153 - } 154 - 155 131 static void secmicclear(struct mic_data *pmicdata) 156 132 { 157 133 /* Reset the state to the empty message. */ ··· 141 163 void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key) 142 164 { 143 165 /* Set the key */ 144 - pmicdata->K0 = secmicgetuint32(key); 145 - pmicdata->K1 = secmicgetuint32(key + 4); 166 + pmicdata->K0 = get_unaligned_le32(key); 167 + pmicdata->K1 = get_unaligned_le32(key + 4); 146 168 /* and reset the message */ 147 169 secmicclear(pmicdata); 148 170 } ··· 190 212 while (pmicdata->nBytesInM != 0) 191 213 rtw_secmicappendbyte(pmicdata, 0); 192 214 /* The appendByte function has already computed the result. */ 193 - secmicputuint32(dst, pmicdata->L); 194 - secmicputuint32(dst + 4, pmicdata->R); 215 + put_unaligned_le32(pmicdata->L, dst); 216 + put_unaligned_le32(pmicdata->R, dst + 4); 195 217 /* Reset to the empty message. */ 196 218 secmicclear(pmicdata); 197 219 } ··· 1294 1316 __le64 le_tmp64; 1295 1317 1296 1318 ori_len = pattrib->pkt_len - WLAN_HDR_A3_LEN + BIP_AAD_SIZE; 1297 - BIP_AAD = rtw_zmalloc(ori_len); 1298 - 1319 + BIP_AAD = kzalloc(ori_len, GFP_KERNEL); 1299 1320 if (!BIP_AAD) 1300 1321 return _FAIL; 1301 1322 ··· 1465 1488 struct security_priv *securitypriv = &(adapter->securitypriv); 1466 1489 signed int keyid; 1467 1490 1468 - if ((_WEP40_ == securitypriv->dot11PrivacyAlgrthm) || (_WEP104_ == securitypriv->dot11PrivacyAlgrthm)) { 1491 + if ((securitypriv->dot11PrivacyAlgrthm == _WEP40_) || (securitypriv->dot11PrivacyAlgrthm == _WEP104_)) { 1469 1492 for (keyid = 0; keyid < 4; keyid++) { 1470 1493 if (securitypriv->key_mask & BIT(keyid)) { 1471 1494 if (keyid == securitypriv->dot11PrivacyKeyIndex)
+74 -75
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
··· 54 54 struct sta_info *psta; 55 55 s32 i; 56 56 57 - pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA+4); 57 + pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA + 4); 58 58 59 59 if (!pstapriv->pallocated_stainfo_buf) 60 60 return _FAIL; ··· 105 105 106 106 inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta) 107 107 { 108 - int offset = (((u8 *)sta) - stapriv->pstainfo_buf)/sizeof(struct sta_info); 108 + int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info); 109 109 110 110 return offset; 111 111 } ··· 191 191 /* spin_unlock_bh(&(pfree_sta_queue->lock)); */ 192 192 spin_unlock_bh(&(pstapriv->sta_hash_lock)); 193 193 return NULL; 194 - } else { 195 - psta = container_of(get_next(&pfree_sta_queue->queue), struct sta_info, list); 196 - 197 - list_del_init(&(psta->list)); 198 - 199 - /* spin_unlock_bh(&(pfree_sta_queue->lock)); */ 200 - 201 - _rtw_init_stainfo(psta); 202 - 203 - psta->padapter = pstapriv->padapter; 204 - 205 - memcpy(psta->hwaddr, hwaddr, ETH_ALEN); 206 - 207 - index = wifi_mac_hash(hwaddr); 208 - 209 - if (index >= NUM_STA) { 210 - spin_unlock_bh(&(pstapriv->sta_hash_lock)); 211 - psta = NULL; 212 - goto exit; 213 - } 214 - phash_list = &(pstapriv->sta_hash[index]); 215 - 216 - /* spin_lock_bh(&(pstapriv->sta_hash_lock)); */ 217 - 218 - list_add_tail(&psta->hash_list, phash_list); 219 - 220 - pstapriv->asoc_sta_count++; 221 - 222 - /* spin_unlock_bh(&(pstapriv->sta_hash_lock)); */ 223 - 224 - /* Commented by Albert 2009/08/13 */ 225 - /* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */ 226 - /* In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */ 227 - /* So, we initialize the tid_rxseq variable as the 0xffff. */ 228 - 229 - for (i = 0; i < 16; i++) 230 - memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2); 231 - 232 - timer_setup(&psta->addba_retry_timer, addba_timer_hdl, 0); 233 - 234 - /* for A-MPDU Rx reordering buffer control */ 235 - for (i = 0; i < 16 ; i++) { 236 - preorder_ctrl = &psta->recvreorder_ctrl[i]; 237 - 238 - preorder_ctrl->padapter = pstapriv->padapter; 239 - 240 - preorder_ctrl->enable = false; 241 - 242 - preorder_ctrl->indicate_seq = 0xffff; 243 - preorder_ctrl->wend_b = 0xffff; 244 - /* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */ 245 - preorder_ctrl->wsize_b = 64;/* 64; */ 246 - 247 - INIT_LIST_HEAD(&preorder_ctrl->pending_recvframe_queue.queue); 248 - spin_lock_init(&preorder_ctrl->pending_recvframe_queue.lock); 249 - 250 - /* init recv timer */ 251 - timer_setup(&preorder_ctrl->reordering_ctrl_timer, 252 - rtw_reordering_ctrl_timeout_handler, 0); 253 - } 254 - 255 - /* init for DM */ 256 - psta->rssi_stat.UndecoratedSmoothedPWDB = (-1); 257 - psta->rssi_stat.UndecoratedSmoothedCCK = (-1); 258 - 259 - /* init for the sequence number of received management frame */ 260 - psta->RxMgmtFrameSeqNum = 0xffff; 261 - spin_unlock_bh(&(pstapriv->sta_hash_lock)); 262 - /* alloc mac id for non-bc/mc station, */ 263 - rtw_alloc_macid(pstapriv->padapter, psta); 264 194 } 195 + psta = container_of(get_next(&pfree_sta_queue->queue), struct sta_info, list); 196 + 197 + list_del_init(&(psta->list)); 198 + 199 + /* spin_unlock_bh(&(pfree_sta_queue->lock)); */ 200 + 201 + _rtw_init_stainfo(psta); 202 + 203 + psta->padapter = pstapriv->padapter; 204 + 205 + memcpy(psta->hwaddr, hwaddr, ETH_ALEN); 206 + 207 + index = wifi_mac_hash(hwaddr); 208 + 209 + if (index >= NUM_STA) { 210 + spin_unlock_bh(&(pstapriv->sta_hash_lock)); 211 + psta = NULL; 212 + goto exit; 213 + } 214 + phash_list = &(pstapriv->sta_hash[index]); 215 + 216 + /* spin_lock_bh(&(pstapriv->sta_hash_lock)); */ 217 + 218 + list_add_tail(&psta->hash_list, phash_list); 219 + 220 + pstapriv->asoc_sta_count++; 221 + 222 + /* spin_unlock_bh(&(pstapriv->sta_hash_lock)); */ 223 + 224 + /* Commented by Albert 2009/08/13 */ 225 + /* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */ 226 + /* In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */ 227 + /* So, we initialize the tid_rxseq variable as the 0xffff. */ 228 + 229 + for (i = 0; i < 16; i++) 230 + memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2); 231 + 232 + timer_setup(&psta->addba_retry_timer, addba_timer_hdl, 0); 233 + 234 + /* for A-MPDU Rx reordering buffer control */ 235 + for (i = 0; i < 16 ; i++) { 236 + preorder_ctrl = &psta->recvreorder_ctrl[i]; 237 + 238 + preorder_ctrl->padapter = pstapriv->padapter; 239 + 240 + preorder_ctrl->enable = false; 241 + 242 + preorder_ctrl->indicate_seq = 0xffff; 243 + preorder_ctrl->wend_b = 0xffff; 244 + /* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */ 245 + preorder_ctrl->wsize_b = 64;/* 64; */ 246 + 247 + INIT_LIST_HEAD(&preorder_ctrl->pending_recvframe_queue.queue); 248 + spin_lock_init(&preorder_ctrl->pending_recvframe_queue.lock); 249 + 250 + /* init recv timer */ 251 + timer_setup(&preorder_ctrl->reordering_ctrl_timer, 252 + rtw_reordering_ctrl_timeout_handler, 0); 253 + } 254 + 255 + /* init for DM */ 256 + psta->rssi_stat.UndecoratedSmoothedPWDB = (-1); 257 + psta->rssi_stat.UndecoratedSmoothedCCK = (-1); 258 + 259 + /* init for the sequence number of received management frame */ 260 + psta->RxMgmtFrameSeqNum = 0xffff; 261 + spin_unlock_bh(&(pstapriv->sta_hash_lock)); 262 + /* alloc mac id for non-bc/mc station, */ 263 + rtw_alloc_macid(pstapriv->padapter, psta); 265 264 266 265 exit: 267 266 ··· 310 311 /* spin_lock_bh(&(pxmitpriv->vi_pending.lock)); */ 311 312 rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending); 312 313 list_del_init(&(pstaxmitpriv->vi_q.tx_pending)); 313 - phwxmit = pxmitpriv->hwxmits+1; 314 + phwxmit = pxmitpriv->hwxmits + 1; 314 315 phwxmit->accnt -= pstaxmitpriv->vi_q.qcnt; 315 316 pstaxmitpriv->vi_q.qcnt = 0; 316 317 /* spin_unlock_bh(&(pxmitpriv->vi_pending.lock)); */ ··· 319 320 /* spin_lock_bh(&(pxmitpriv->be_pending.lock)); */ 320 321 rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->be_q.sta_pending); 321 322 list_del_init(&(pstaxmitpriv->be_q.tx_pending)); 322 - phwxmit = pxmitpriv->hwxmits+2; 323 + phwxmit = pxmitpriv->hwxmits + 2; 323 324 phwxmit->accnt -= pstaxmitpriv->be_q.qcnt; 324 325 pstaxmitpriv->be_q.qcnt = 0; 325 326 /* spin_unlock_bh(&(pxmitpriv->be_pending.lock)); */ ··· 328 329 /* spin_lock_bh(&(pxmitpriv->bk_pending.lock)); */ 329 330 rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending); 330 331 list_del_init(&(pstaxmitpriv->bk_q.tx_pending)); 331 - phwxmit = pxmitpriv->hwxmits+3; 332 + phwxmit = pxmitpriv->hwxmits + 3; 332 333 phwxmit->accnt -= pstaxmitpriv->bk_q.qcnt; 333 334 pstaxmitpriv->bk_q.qcnt = 0; 334 335 /* spin_unlock_bh(&(pxmitpriv->bk_pending.lock)); */
+8 -11
drivers/staging/rtl8723bs/core/rtw_wlan_util.c
··· 63 63 break; 64 64 case WIRELESS_11B_24N: 65 65 case WIRELESS_11BG_24N: 66 - if (psta->bw_mode == CHANNEL_WIDTH_20) { 66 + if (psta->bw_mode == CHANNEL_WIDTH_20) 67 67 raid = RATEID_IDX_BGN_20M_1SS_BN; 68 - } else { 68 + else 69 69 raid = RATEID_IDX_BGN_40M_1SS; 70 - } 71 70 break; 72 71 default: 73 72 raid = RATEID_IDX_BGN_40M_2SS; ··· 242 243 rtw_hal_set_hwreg(padapter, HW_VAR_DM_FUNC_CLR, (u8 *)(&mode)); 243 244 } 244 245 245 - void Set_MSR(struct adapter *padapter, u8 type) 246 + void set_msr(struct adapter *padapter, u8 type) 246 247 { 247 248 rtw_hal_set_hwreg(padapter, HW_VAR_MEDIA_STATUS, (u8 *)(&type)); 248 249 } ··· 616 617 netdev_dbg(adapter->pnetdev, 617 618 FUNC_ADPT_FMT " pairwise key with %pM id:%u no room\n", 618 619 FUNC_ADPT_ARG(adapter), 619 - MAC_ARG(sta->hwaddr), kid); 620 + sta->hwaddr, kid); 620 621 else 621 622 netdev_dbg(adapter->pnetdev, 622 623 FUNC_ADPT_FMT " group key id:%u no room\n", ··· 693 694 694 695 if (!memcmp(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element))) 695 696 return false; 696 - else 697 - memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element)); 697 + 698 + memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element)); 698 699 699 700 pmlmeinfo->WMM_enable = 1; 700 701 return true; ··· 1131 1132 if (memcmp(cur_network->network.mac_address, pbssid, 6)) 1132 1133 return true; 1133 1134 1134 - bssid = rtw_zmalloc(sizeof(struct wlan_bssid_ex)); 1135 + bssid = kzalloc(sizeof(*bssid), GFP_KERNEL); 1135 1136 if (!bssid) 1136 1137 return true; 1137 1138 ··· 1449 1450 return get_realtek_assoc_AP_vender(pIE); 1450 1451 else if (!memcmp(pIE->data, AIRGOCAP_OUI, 3)) 1451 1452 return HT_IOT_PEER_AIRGO; 1452 - else 1453 - break; 1454 - 1453 + break; 1455 1454 default: 1456 1455 break; 1457 1456 }
+90 -58
drivers/staging/rtl8723bs/core/rtw_xmit.c
··· 78 78 } 79 79 pxmitpriv->pxmit_frame_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitpriv->pallocated_frame_buf), 4); 80 80 81 - pxframe = (struct xmit_frame *) pxmitpriv->pxmit_frame_buf; 81 + pxframe = (struct xmit_frame *)pxmitpriv->pxmit_frame_buf; 82 82 83 83 for (i = 0; i < NR_XMITFRAME; i++) { 84 84 INIT_LIST_HEAD(&pxframe->list); ··· 238 238 pxmitbuf->padapter = padapter; 239 239 pxmitbuf->buf_tag = XMITBUF_CMD; 240 240 241 - res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ, true); 241 + res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, 242 + MAX_CMDBUF_SZ + XMITBUF_ALIGN_SZ, 243 + true); 242 244 if (res == _FAIL) { 243 245 res = _FAIL; 244 246 goto exit; ··· 250 248 pxmitbuf->pend = pxmitbuf->pbuf + MAX_CMDBUF_SZ; 251 249 pxmitbuf->len = 0; 252 250 pxmitbuf->pdata = pxmitbuf->ptail = pxmitbuf->phead; 253 - pxmitbuf->alloc_sz = MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ; 251 + pxmitbuf->alloc_sz = MAX_CMDBUF_SZ + XMITBUF_ALIGN_SZ; 254 252 } 255 253 } 256 254 ··· 276 274 { 277 275 int i; 278 276 struct adapter *padapter = pxmitpriv->adapter; 279 - struct xmit_frame *pxmitframe = (struct xmit_frame *) pxmitpriv->pxmit_frame_buf; 277 + struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitpriv->pxmit_frame_buf; 280 278 struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf; 281 279 282 280 rtw_hal_free_xmit_priv(padapter); ··· 323 321 for (i = 0; i < CMDBUF_MAX; i++) { 324 322 pxmitbuf = &pxmitpriv->pcmd_xmitbuf[i]; 325 323 if (pxmitbuf) 326 - rtw_os_xmit_resource_free(padapter, pxmitbuf, MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ, true); 324 + rtw_os_xmit_resource_free(padapter, pxmitbuf, 325 + MAX_CMDBUF_SZ + XMITBUF_ALIGN_SZ, 326 + true); 327 327 } 328 328 329 329 rtw_free_hwxmits(padapter); ··· 600 596 return priority; 601 597 } 602 598 603 - static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib) 599 + static int set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib) 604 600 { 605 601 struct ethhdr etherhdr; 606 602 struct iphdr ip_hdr; 607 603 s32 UserPriority = 0; 604 + int ret; 608 605 609 606 _rtw_open_pktfile(ppktfile->pkt, ppktfile); 610 - _rtw_pktfile_read(ppktfile, (unsigned char *)&etherhdr, ETH_HLEN); 607 + ret = _rtw_pktfile_read(ppktfile, (unsigned char *)&etherhdr, ETH_HLEN); 608 + if (ret < 0) 609 + return ret; 611 610 612 611 /* get UserPriority from IP hdr */ 613 612 if (pattrib->ether_type == 0x0800) { 614 - _rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr)); 613 + ret = _rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr)); 614 + if (ret < 0) 615 + return ret; 616 + 615 617 UserPriority = ip_hdr.tos >> 5; 616 618 } 617 619 pattrib->priority = UserPriority; 618 620 pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN; 619 621 pattrib->subtype = WIFI_QOS_DATA_TYPE; 622 + 623 + return 0; 620 624 } 621 625 622 626 static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pkt_attrib *pattrib) ··· 638 626 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 639 627 struct qos_priv *pqospriv = &pmlmepriv->qospriv; 640 628 signed int res = _SUCCESS; 629 + int ret; 641 630 642 631 _rtw_open_pktfile(pkt, &pktfile); 643 - _rtw_pktfile_read(&pktfile, (u8 *)&etherhdr, ETH_HLEN); 632 + ret = _rtw_pktfile_read(&pktfile, (u8 *)&etherhdr, ETH_HLEN); 633 + if (ret < 0) 634 + return ret; 644 635 645 636 pattrib->ether_type = ntohs(etherhdr.h_proto); 646 637 ··· 670 655 671 656 u8 tmp[24]; 672 657 673 - _rtw_pktfile_read(&pktfile, &tmp[0], 24); 658 + ret = _rtw_pktfile_read(&pktfile, &tmp[0], 24); 659 + if (ret < 0) 660 + return ret; 674 661 675 662 pattrib->dhcp_pkt = 0; 676 663 if (pktfile.pkt_len > 282) {/* MINIMUM_DHCP_PACKET_SIZE) { */ ··· 732 715 if (!(psta->state & _FW_LINKED)) 733 716 return _FAIL; 734 717 735 - /* TODO:_lock */ 718 + spin_lock_bh(&psta->lock); 736 719 if (update_attrib_sec_info(padapter, pattrib, psta) == _FAIL) { 720 + spin_unlock_bh(&psta->lock); 737 721 res = _FAIL; 738 722 goto exit; 739 723 } ··· 742 724 update_attrib_phy_info(padapter, pattrib, psta); 743 725 744 726 pattrib->psta = psta; 745 - /* TODO:_unlock */ 727 + spin_unlock_bh(&psta->lock); 746 728 747 729 pattrib->pctrl = 0; 748 730 ··· 754 736 pattrib->subtype = WIFI_DATA_TYPE; 755 737 pattrib->priority = 0; 756 738 757 - if (check_fwstate(pmlmepriv, WIFI_AP_STATE|WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) { 758 - if (pattrib->qos_en) 759 - set_qos(&pktfile, pattrib); 739 + if (check_fwstate(pmlmepriv, WIFI_AP_STATE | WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)) { 740 + if (pattrib->qos_en) { 741 + ret = set_qos(&pktfile, pattrib); 742 + if (ret < 0) 743 + return ret; 744 + } 760 745 } else { 761 746 if (pqospriv->qos_option) { 762 - set_qos(&pktfile, pattrib); 747 + ret = set_qos(&pktfile, pattrib); 748 + if (ret < 0) 749 + return ret; 763 750 764 751 if (pmlmepriv->acm_mask != 0) 765 752 pattrib->priority = qos_acm(pmlmepriv->acm_mask, pattrib->priority); ··· 810 787 rtw_secmicsetkey(&micdata, &pattrib->dot11tkiptxmickey.skey[0]); 811 788 } 812 789 813 - if (pframe[1]&1) { /* ToDS == 1 */ 790 + if (pframe[1] & 1) { /* ToDS == 1 */ 814 791 rtw_secmicappend(&micdata, &pframe[16], 6); /* DA */ 815 - if (pframe[1]&2) /* From Ds == 1 */ 792 + if (pframe[1] & 2) /* From Ds == 1 */ 816 793 rtw_secmicappend(&micdata, &pframe[24], 6); 817 794 else 818 795 rtw_secmicappend(&micdata, &pframe[10], 6); 819 796 } else { /* ToDS == 0 */ 820 797 rtw_secmicappend(&micdata, &pframe[4], 6); /* DA */ 821 - if (pframe[1]&2) /* From Ds == 1 */ 798 + if (pframe[1] & 2) /* From Ds == 1 */ 822 799 rtw_secmicappend(&micdata, &pframe[16], 6); 823 800 else 824 801 rtw_secmicappend(&micdata, &pframe[10], 6); ··· 833 810 834 811 for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) { 835 812 payload = (u8 *)round_up((SIZE_PTR)(payload), 4); 836 - payload = payload+pattrib->hdrlen+pattrib->iv_len; 813 + payload = payload + pattrib->hdrlen + pattrib->iv_len; 837 814 838 - if ((curfragnum+1) == pattrib->nr_frags) { 839 - length = pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len-((pattrib->bswenc) ? pattrib->icv_len : 0); 815 + if ((curfragnum + 1) == pattrib->nr_frags) { 816 + length = pattrib->last_txcmdsz - pattrib->hdrlen - 817 + pattrib->iv_len - 818 + ((pattrib->bswenc) ? pattrib->icv_len : 0); 840 819 rtw_secmicappend(&micdata, payload, length); 841 - payload = payload+length; 820 + payload = payload + length; 842 821 } else { 843 - length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-((pattrib->bswenc) ? pattrib->icv_len : 0); 822 + length = pxmitpriv->frag_len - pattrib->hdrlen - 823 + pattrib->iv_len - 824 + ((pattrib->bswenc) ? pattrib->icv_len : 0); 844 825 rtw_secmicappend(&micdata, payload, length); 845 - payload = payload+length+pattrib->icv_len; 826 + payload = payload + length + pattrib->icv_len; 846 827 } 847 828 } 848 829 rtw_secgetmic(&micdata, &mic[0]); ··· 1066 1039 1067 1040 s32 bmcst = is_multicast_ether_addr(pattrib->ra); 1068 1041 s32 res = _SUCCESS; 1042 + int ret; 1069 1043 1070 1044 if (!pxmitframe->buf_addr) 1071 1045 return _FAIL; ··· 1082 1054 } 1083 1055 1084 1056 _rtw_open_pktfile(pkt, &pktfile); 1085 - _rtw_pktfile_read(&pktfile, NULL, pattrib->pkt_hdrlen); 1057 + ret = _rtw_pktfile_read(&pktfile, NULL, pattrib->pkt_hdrlen); 1058 + if (ret < 0) 1059 + return ret; 1086 1060 1087 1061 frg_inx = 0; 1088 1062 frg_len = pxmitpriv->frag_len - 4;/* 2346-4 = 2342 */ ··· 1126 1096 mem_sz = _rtw_pktfile_read(&pktfile, pframe, mpdu_len); 1127 1097 } 1128 1098 1099 + if (mem_sz < 0) 1100 + return mem_sz; 1101 + 1129 1102 pframe += mem_sz; 1130 1103 1131 1104 if ((pattrib->icv_len > 0) && (pattrib->bswenc)) { ··· 1141 1108 if (bmcst || (rtw_endofpktfile(&pktfile) == true)) { 1142 1109 pattrib->nr_frags = frg_inx; 1143 1110 1144 - pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + ((pattrib->nr_frags == 1) ? llc_sz:0) + 1145 - ((pattrib->bswenc) ? pattrib->icv_len : 0) + mem_sz; 1111 + pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + 1112 + ((pattrib->nr_frags == 1) ? llc_sz : 0) + 1113 + ((pattrib->bswenc) ? pattrib->icv_len : 0) + 1114 + mem_sz; 1146 1115 1147 1116 ClearMFrag(mem_start); 1148 1117 ··· 1193 1158 mem_start = pframe = (u8 *)(pxmitframe->buf_addr) + TXDESC_OFFSET; 1194 1159 pwlanhdr = (struct ieee80211_hdr *)pframe; 1195 1160 1196 - ori_len = BIP_AAD_SIZE+pattrib->pktlen; 1197 - tmp_buf = BIP_AAD = rtw_zmalloc(ori_len); 1161 + ori_len = BIP_AAD_SIZE + pattrib->pktlen; 1162 + tmp_buf = BIP_AAD = kzalloc(ori_len, GFP_ATOMIC); 1198 1163 subtype = GetFrameSubType(pframe); /* bit(7)~bit(2) */ 1199 1164 1200 1165 if (!BIP_AAD) ··· 1246 1211 /* conscruct AAD, copy address 1 to address 3 */ 1247 1212 memcpy(BIP_AAD + 2, &pwlanhdr->addrs, sizeof(pwlanhdr->addrs)); 1248 1213 /* copy management fram body */ 1249 - memcpy(BIP_AAD+BIP_AAD_SIZE, MGMT_body, frame_body_len); 1214 + memcpy(BIP_AAD + BIP_AAD_SIZE, MGMT_body, frame_body_len); 1250 1215 /* calculate mic */ 1251 1216 if (omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey 1252 - , BIP_AAD, BIP_AAD_SIZE+frame_body_len, mic)) 1217 + , BIP_AAD, BIP_AAD_SIZE + frame_body_len, mic)) 1253 1218 goto xmitframe_coalesce_fail; 1254 1219 1255 1220 /* copy right BIP mic value, total is 128bits, we use the 0~63 bits */ 1256 - memcpy(pframe-8, mic, 8); 1221 + memcpy(pframe - 8, mic, 8); 1257 1222 } else { /* unicast mgmt frame TX */ 1258 1223 /* start to encrypt mgmt frame */ 1259 1224 if (subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC || ··· 1302 1267 memcpy(pframe, pattrib->iv, pattrib->iv_len); 1303 1268 pframe += pattrib->iv_len; 1304 1269 /* copy mgmt data portion after CCMP header */ 1305 - memcpy(pframe, tmp_buf+pattrib->hdrlen, pattrib->pktlen-pattrib->hdrlen); 1270 + memcpy(pframe, tmp_buf + pattrib->hdrlen, 1271 + pattrib->pktlen - pattrib->hdrlen); 1306 1272 /* move pframe to end of mgmt pkt */ 1307 - pframe += pattrib->pktlen-pattrib->hdrlen; 1273 + pframe += pattrib->pktlen - pattrib->hdrlen; 1308 1274 /* add 8 bytes CCMP IV header to length */ 1309 1275 pattrib->pktlen += pattrib->iv_len; 1310 1276 if ((pattrib->icv_len > 0) && (pattrib->bswenc)) { ··· 1411 1375 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1412 1376 u8 pkt_num = 1; 1413 1377 1414 - if ((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) { 1378 + if ((pxmitframe->frame_tag & 0x0f) == DATA_FRAMETAG) { 1415 1379 pkt_num = pxmitframe->agg_num; 1416 1380 1417 1381 pmlmepriv->LinkDetectInfo.NumTxOkInPeriod += pkt_num; ··· 1698 1662 struct xmit_frame *pxframe = NULL; 1699 1663 u8 *alloc_addr; 1700 1664 1701 - alloc_addr = rtw_zmalloc(sizeof(struct xmit_frame) + 4); 1702 - 1665 + alloc_addr = kzalloc(sizeof(*pxframe) + 4, GFP_ATOMIC); 1703 1666 if (!alloc_addr) 1704 1667 goto exit; 1705 1668 ··· 1742 1707 queue = &pxmitpriv->free_xmit_queue; 1743 1708 else if (pxmitframe->ext_tag == 1) 1744 1709 queue = &pxmitpriv->free_xframe_ext_queue; 1745 - else { 1746 - } 1747 1710 1748 1711 spin_lock_bh(&queue->lock); 1749 1712 ··· 1869 1836 1870 1837 pxmitpriv->hwxmits = NULL; 1871 1838 1872 - pxmitpriv->hwxmits = rtw_zmalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry); 1873 - 1839 + pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry, sizeof(*hwxmits), GFP_ATOMIC); 1874 1840 if (!pxmitpriv->hwxmits) 1875 1841 return _FAIL; 1876 1842 ··· 1990 1958 1991 1959 res = update_attrib(padapter, *ppkt, &pxmitframe->attrib); 1992 1960 1993 - if (res == _FAIL) { 1961 + if (res != _SUCCESS) { 1994 1962 rtw_free_xmitframe(pxmitpriv, pxmitframe); 1995 1963 return -1; 1996 1964 } ··· 2102 2070 2103 2071 spin_lock_bh(&psta->sleep_q.lock); 2104 2072 2105 - if (psta->state&WIFI_SLEEP_STATE) { 2073 + if (psta->state & WIFI_SLEEP_STATE) { 2106 2074 u8 wmmps_ac = 0; 2107 2075 2108 2076 if (pstapriv->sta_dz_bitmap & BIT(psta->aid)) { ··· 2115 2083 switch (pattrib->priority) { 2116 2084 case 1: 2117 2085 case 2: 2118 - wmmps_ac = psta->uapsd_bk&BIT(0); 2086 + wmmps_ac = psta->uapsd_bk & BIT(0); 2119 2087 break; 2120 2088 case 4: 2121 2089 case 5: 2122 - wmmps_ac = psta->uapsd_vi&BIT(0); 2090 + wmmps_ac = psta->uapsd_vi & BIT(0); 2123 2091 break; 2124 2092 case 6: 2125 2093 case 7: 2126 - wmmps_ac = psta->uapsd_vo&BIT(0); 2094 + wmmps_ac = psta->uapsd_vo & BIT(0); 2127 2095 break; 2128 2096 case 0: 2129 2097 case 3: 2130 2098 default: 2131 - wmmps_ac = psta->uapsd_be&BIT(0); 2099 + wmmps_ac = psta->uapsd_be & BIT(0); 2132 2100 break; 2133 2101 } 2134 2102 ··· 2246 2214 switch (pxmitframe->attrib.priority) { 2247 2215 case 1: 2248 2216 case 2: 2249 - wmmps_ac = psta->uapsd_bk&BIT(1); 2217 + wmmps_ac = psta->uapsd_bk & BIT(1); 2250 2218 break; 2251 2219 case 4: 2252 2220 case 5: 2253 - wmmps_ac = psta->uapsd_vi&BIT(1); 2221 + wmmps_ac = psta->uapsd_vi & BIT(1); 2254 2222 break; 2255 2223 case 6: 2256 2224 case 7: 2257 - wmmps_ac = psta->uapsd_vo&BIT(1); 2225 + wmmps_ac = psta->uapsd_vo & BIT(1); 2258 2226 break; 2259 2227 case 0: 2260 2228 case 3: 2261 2229 default: 2262 - wmmps_ac = psta->uapsd_be&BIT(1); 2230 + wmmps_ac = psta->uapsd_be & BIT(1); 2263 2231 break; 2264 2232 } 2265 2233 ··· 2291 2259 2292 2260 pstapriv->tim_bitmap &= ~BIT(psta->aid); 2293 2261 2294 - if (psta->state&WIFI_SLEEP_STATE) 2262 + if (psta->state & WIFI_SLEEP_STATE) 2295 2263 psta->state ^= WIFI_SLEEP_STATE; 2296 2264 2297 2265 if (psta->state & WIFI_STA_ALIVE_CHK_STATE) { ··· 2306 2274 if (!psta_bmc) 2307 2275 goto _exit; 2308 2276 2309 - if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0) { /* no any sta in ps mode */ 2277 + if ((pstapriv->sta_dz_bitmap & 0xfffe) == 0x0) { /* no any sta in ps mode */ 2310 2278 xmitframe_phead = get_list_head(&psta_bmc->sleep_q); 2311 2279 list_for_each_safe(xmitframe_plist, tmp, xmitframe_phead) { 2312 2280 pxmitframe = list_entry(xmitframe_plist, ··· 2359 2327 switch (pxmitframe->attrib.priority) { 2360 2328 case 1: 2361 2329 case 2: 2362 - wmmps_ac = psta->uapsd_bk&BIT(1); 2330 + wmmps_ac = psta->uapsd_bk & BIT(1); 2363 2331 break; 2364 2332 case 4: 2365 2333 case 5: 2366 - wmmps_ac = psta->uapsd_vi&BIT(1); 2334 + wmmps_ac = psta->uapsd_vi & BIT(1); 2367 2335 break; 2368 2336 case 6: 2369 2337 case 7: 2370 - wmmps_ac = psta->uapsd_vo&BIT(1); 2338 + wmmps_ac = psta->uapsd_vo & BIT(1); 2371 2339 break; 2372 2340 case 0: 2373 2341 case 3: 2374 2342 default: 2375 - wmmps_ac = psta->uapsd_be&BIT(1); 2343 + wmmps_ac = psta->uapsd_be & BIT(1); 2376 2344 break; 2377 2345 } 2378 2346
+59 -60
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /****************************************************************************** 3 - * 4 - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 - * 6 - ******************************************************************************/ 3 + * 4 + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 + * 6 + ******************************************************************************/ 7 7 8 8 #include <linux/kernel.h> 9 9 #include "odm_precomp.h" 10 10 11 - static bool CheckPositive( 12 - struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2 13 - ) 11 + static bool CheckPositive(struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2) 14 12 { 15 13 u8 _BoardType = 16 - ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */ 17 - ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */ 18 - ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */ 19 - ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */ 20 - ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */ 14 + ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */ 15 + ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */ 16 + ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */ 17 + ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */ 18 + ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */ 21 19 22 20 u32 cond1 = Condition1, cond2 = Condition2; 23 21 u32 driver1 = ··· 31 33 pDM_Odm->TypeALNA << 16 | 32 34 pDM_Odm->TypeAPA << 24; 33 35 34 - 35 - /* Value Defined Check =============== */ 36 + /* Value Defined Check =============== */ 36 37 /* QFN Type [15:12] and Cut Version [27:24] need to do value check */ 37 38 38 39 if (((cond1 & 0x0000F000) != 0) && ((cond1 & 0x0000F000) != (driver1 & 0x0000F000))) ··· 39 42 if (((cond1 & 0x0F000000) != 0) && ((cond1 & 0x0F000000) != (driver1 & 0x0F000000))) 40 43 return false; 41 44 42 - /* Bit Defined Check ================ */ 43 - /* We don't care [31:28] and [23:20] */ 44 - /* */ 45 + /* Bit Defined Check ================ */ 46 + /* We don't care [31:28] and [23:20] */ 47 + /* */ 45 48 cond1 &= 0x000F0FFF; 46 49 driver1 &= 0x000F0FFF; 47 50 48 51 if ((cond1 & driver1) == cond1) { 49 52 u32 bitMask = 0; 50 53 51 - if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE */ 54 + if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE */ 52 55 return true; 53 56 54 57 if ((cond1 & BIT0) != 0) /* GLNA */ ··· 60 63 if ((cond1 & BIT3) != 0) /* APA */ 61 64 bitMask |= 0xFF000000; 62 65 63 - /* BoardType of each RF path is matched */ 66 + /* BoardType of each RF path is matched */ 64 67 if ((cond2 & bitMask) == (driver2 & bitMask)) 65 68 return true; 66 69 } ··· 68 71 } 69 72 70 73 /****************************************************************************** 71 - * AGC_TAB.TXT 72 - ******************************************************************************/ 74 + * AGC_TAB.TXT 75 + ******************************************************************************/ 73 76 74 77 static u32 Array_MP_8723B_AGC_TAB[] = { 75 78 0xC78, 0xFD000001, ··· 214 217 215 218 for (i = 0; i < ArrayLen; i += 2) { 216 219 u32 v1 = Array[i]; 217 - u32 v2 = Array[i+1]; 220 + u32 v2 = Array[i + 1]; 218 221 219 - /* This (offset, data) pair doesn't care the condition. */ 222 + /* This (offset, data) pair doesn't care the condition. */ 220 223 if (v1 < 0x40000000) { 221 224 odm_ConfigBB_AGC_8723B(pDM_Odm, v1, bMaskDWord, v2); 222 225 continue; 223 226 } else { 224 - /* This line is the beginning of branch. */ 227 + /* This line is the beginning of branch. */ 225 228 bool bMatched = true; 226 - u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); 229 + u8 cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28); 227 230 228 - if (cCond == COND_ELSE) { /* ELSE, ENDIF */ 231 + if (cCond == COND_ELSE) { /* ELSE, ENDIF */ 229 232 bMatched = true; 230 233 READ_NEXT_PAIR(v1, v2, i); 231 234 } else if (!CheckPositive(pDM_Odm, v1, v2)) { ··· 239 242 } 240 243 241 244 if (!bMatched) { 242 - /* Condition isn't matched. 243 - * Discard the following (offset, data) pairs. 244 - */ 245 - while (v1 < 0x40000000 && i < ArrayLen-2) 245 + /* 246 + * Condition isn't matched. 247 + * Discard the following (offset, data) pairs. 248 + */ 249 + while (v1 < 0x40000000 && i < ArrayLen - 2) 246 250 READ_NEXT_PAIR(v1, v2, i); 247 251 248 - i -= 2; /* prevent from for-loop += 2 */ 252 + i -= 2; /* prevent from for-loop += 2 */ 249 253 } else { 250 - /* Configure matched pairs and skip to end of if-else. */ 251 - while (v1 < 0x40000000 && i < ArrayLen-2) { 254 + /* Configure matched pairs and skip to end of if-else. */ 255 + while (v1 < 0x40000000 && i < ArrayLen - 2) { 252 256 odm_ConfigBB_AGC_8723B(pDM_Odm, v1, bMaskDWord, v2); 253 257 READ_NEXT_PAIR(v1, v2, i); 254 258 } 255 259 256 - /* Keeps reading until ENDIF. */ 257 - cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); 258 - while (cCond != COND_ENDIF && i < ArrayLen-2) { 260 + /* Keeps reading until ENDIF. */ 261 + cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28); 262 + while (cCond != COND_ENDIF && i < ArrayLen - 2) { 259 263 READ_NEXT_PAIR(v1, v2, i); 260 - cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); 264 + cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28); 261 265 } 262 266 } 263 267 } ··· 266 268 } 267 269 268 270 /****************************************************************************** 269 - * PHY_REG.TXT 270 - ******************************************************************************/ 271 + * PHY_REG.TXT 272 + ******************************************************************************/ 271 273 272 274 static u32 Array_MP_8723B_PHY_REG[] = { 273 275 0x800, 0x80040000, ··· 474 476 475 477 for (i = 0; i < ArrayLen; i += 2) { 476 478 u32 v1 = Array[i]; 477 - u32 v2 = Array[i+1]; 479 + u32 v2 = Array[i + 1]; 478 480 479 - /* This (offset, data) pair doesn't care the condition. */ 481 + /* This (offset, data) pair doesn't care the condition. */ 480 482 if (v1 < 0x40000000) { 481 483 odm_ConfigBB_PHY_8723B(pDM_Odm, v1, bMaskDWord, v2); 482 484 continue; 483 485 } else { 484 - /* This line is the beginning of branch. */ 486 + /* This line is the beginning of branch. */ 485 487 bool bMatched = true; 486 - u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); 488 + u8 cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28); 487 489 488 - if (cCond == COND_ELSE) { /* ELSE, ENDIF */ 490 + if (cCond == COND_ELSE) { /* ELSE, ENDIF */ 489 491 bMatched = true; 490 492 READ_NEXT_PAIR(v1, v2, i); 491 493 } else if (!CheckPositive(pDM_Odm, v1, v2)) { ··· 499 501 } 500 502 501 503 if (!bMatched) { 502 - /* Condition isn't matched. 503 - * Discard the following (offset, data) pairs. 504 - */ 505 - while (v1 < 0x40000000 && i < ArrayLen-2) 504 + /* 505 + * Condition isn't matched. 506 + * Discard the following (offset, data) pairs. 507 + */ 508 + while (v1 < 0x40000000 && i < ArrayLen - 2) 506 509 READ_NEXT_PAIR(v1, v2, i); 507 510 508 - i -= 2; /* prevent from for-loop += 2 */ 509 - } else { /* Configure matched pairs and skip to end of if-else. */ 510 - while (v1 < 0x40000000 && i < ArrayLen-2) { 511 + i -= 2; /* prevent from for-loop += 2 */ 512 + } else { /* Configure matched pairs and skip to end of if-else. */ 513 + while (v1 < 0x40000000 && i < ArrayLen - 2) { 511 514 odm_ConfigBB_PHY_8723B(pDM_Odm, v1, bMaskDWord, v2); 512 515 READ_NEXT_PAIR(v1, v2, i); 513 516 } 514 517 515 - /* Keeps reading until ENDIF. */ 516 - cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); 517 - while (cCond != COND_ENDIF && i < ArrayLen-2) { 518 + /* Keeps reading until ENDIF. */ 519 + cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28); 520 + while (cCond != COND_ENDIF && i < ArrayLen - 2) { 518 521 READ_NEXT_PAIR(v1, v2, i); 519 - cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); 522 + cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28); 520 523 } 521 524 } 522 525 } ··· 525 526 } 526 527 527 528 /****************************************************************************** 528 - * PHY_REG_PG.TXT 529 - ******************************************************************************/ 529 + * PHY_REG_PG.TXT 530 + ******************************************************************************/ 530 531 531 532 static u32 Array_MP_8723B_PHY_REG_PG[] = { 532 533 0, 0x00000e08, 0x0000ff00, 0x00003800, ··· 547 548 548 549 for (i = 0; i < ARRAY_SIZE(Array_MP_8723B_PHY_REG_PG); i += 4) { 549 550 u32 v1 = Array[i]; 550 - u32 v2 = Array[i+1]; 551 - u32 v3 = Array[i+2]; 552 - u32 v4 = Array[i+3]; 551 + u32 v2 = Array[i + 1]; 552 + u32 v3 = Array[i + 2]; 553 + u32 v4 = Array[i + 3]; 553 554 554 555 odm_ConfigBB_PHY_REG_PG_8723B(pDM_Odm, v1, v2, v3, v4); 555 556 }
+10 -11
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 2 /****************************************************************************** 3 - * 4 - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 - * 6 - ******************************************************************************/ 3 + * 4 + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 + * 6 + ******************************************************************************/ 7 7 8 8 #ifndef __INC_MP_BB_HW_IMG_8723B_H 9 9 #define __INC_MP_BB_HW_IMG_8723B_H 10 10 11 - 12 11 /****************************************************************************** 13 - * AGC_TAB.TXT 14 - ******************************************************************************/ 12 + * AGC_TAB.TXT 13 + ******************************************************************************/ 15 14 16 15 void 17 16 ODM_ReadAndConfig_MP_8723B_AGC_TAB(/* TC: Test Chip, MP: MP Chip */ ··· 18 19 ); 19 20 20 21 /****************************************************************************** 21 - * PHY_REG.TXT 22 - ******************************************************************************/ 22 + * PHY_REG.TXT 23 + ******************************************************************************/ 23 24 24 25 void 25 26 ODM_ReadAndConfig_MP_8723B_PHY_REG(/* TC: Test Chip, MP: MP Chip */ ··· 27 28 ); 28 29 29 30 /****************************************************************************** 30 - * PHY_REG_PG.TXT 31 - ******************************************************************************/ 31 + * PHY_REG_PG.TXT 32 + ******************************************************************************/ 32 33 33 34 void 34 35 ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(/* TC: Test Chip, MP: MP Chip */
+37 -35
drivers/staging/rtl8723bs/hal/HalHWImg8723B_MAC.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /****************************************************************************** 3 - * 4 - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 - * 6 - ******************************************************************************/ 3 + * 4 + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 + * 6 + ******************************************************************************/ 7 7 8 8 #include <linux/kernel.h> 9 9 #include "odm_precomp.h" 10 10 11 - static bool CheckPositive( 12 - struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2 13 - ) 11 + static bool CheckPositive(struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2) 14 12 { 15 13 u8 _BoardType = 16 - ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */ 17 - ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */ 18 - ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */ 19 - ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */ 20 - ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */ 14 + ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */ 15 + ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */ 16 + ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */ 17 + ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */ 18 + ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */ 21 19 22 20 u32 cond1 = Condition1, cond2 = Condition2; 23 21 u32 driver1 = ··· 31 33 pDM_Odm->TypeALNA << 16 | 32 34 pDM_Odm->TypeAPA << 24; 33 35 34 - 35 - /* Value Defined Check =============== */ 36 + /* Value Defined Check =============== */ 36 37 /* QFN Type [15:12] and Cut Version [27:24] need to do value check */ 37 38 38 39 if (((cond1 & 0x0000F000) != 0) && ((cond1 & 0x0000F000) != (driver1 & 0x0000F000))) ··· 39 42 if (((cond1 & 0x0F000000) != 0) && ((cond1 & 0x0F000000) != (driver1 & 0x0F000000))) 40 43 return false; 41 44 42 - /* Bit Defined Check ================ */ 43 - /* We don't care [31:28] and [23:20] */ 44 - /* */ 45 + /* Bit Defined Check ================ */ 46 + /* We don't care [31:28] and [23:20] */ 47 + /* */ 45 48 cond1 &= 0x000F0FFF; 46 49 driver1 &= 0x000F0FFF; 47 50 48 51 if ((cond1 & driver1) == cond1) { 49 52 u32 bitMask = 0; 50 - if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE */ 53 + 54 + if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE */ 51 55 return true; 52 56 53 57 if ((cond1 & BIT0) != 0) /* GLNA */ ··· 60 62 if ((cond1 & BIT3) != 0) /* APA */ 61 63 bitMask |= 0xFF000000; 62 64 63 - if ((cond2 & bitMask) == (driver2 & bitMask)) /* BoardType of each RF path is matched */ 65 + /* BoardType of each RF path is matched */ 66 + if ((cond2 & bitMask) == (driver2 & bitMask)) 64 67 return true; 65 68 } 66 69 return false; 67 70 } 68 71 69 72 /****************************************************************************** 70 - * MAC_REG.TXT 71 - ******************************************************************************/ 73 + * MAC_REG.TXT 74 + ******************************************************************************/ 72 75 73 76 static u32 Array_MP_8723B_MAC_REG[] = { 74 77 0x02F, 0x00000030, ··· 186 187 187 188 for (i = 0; i < ArrayLen; i += 2) { 188 189 u32 v1 = Array[i]; 189 - u32 v2 = Array[i+1]; 190 + u32 v2 = Array[i + 1]; 190 191 191 - /* This (offset, data) pair doesn't care the condition. */ 192 + /* This (offset, data) pair doesn't care the condition. */ 192 193 if (v1 < 0x40000000) { 193 194 odm_ConfigMAC_8723B(pDM_Odm, v1, (u8)v2); 194 195 continue; 195 196 } else { 196 - /* This line is the beginning of branch. */ 197 + /* This line is the beginning of branch. */ 197 198 bool bMatched = true; 198 - u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); 199 + u8 cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28); 199 200 200 - if (cCond == COND_ELSE) { /* ELSE, ENDIF */ 201 + if (cCond == COND_ELSE) { /* ELSE, ENDIF */ 201 202 bMatched = true; 202 203 READ_NEXT_PAIR(v1, v2, i); 203 204 } else if (!CheckPositive(pDM_Odm, v1, v2)) { ··· 211 212 } 212 213 213 214 if (!bMatched) { 214 - /* Condition isn't matched. Discard the following (offset, data) pairs. */ 215 - while (v1 < 0x40000000 && i < ArrayLen-2) 215 + /* 216 + * Condition isn't matched. 217 + * Discard the following (offset, data) pairs. 218 + */ 219 + while (v1 < 0x40000000 && i < ArrayLen - 2) 216 220 READ_NEXT_PAIR(v1, v2, i); 217 221 218 - i -= 2; /* prevent from for-loop += 2 */ 219 - } else { /* Configure matched pairs and skip to end of if-else. */ 220 - while (v1 < 0x40000000 && i < ArrayLen-2) { 222 + i -= 2; /* prevent from for-loop += 2 */ 223 + } else { /* Configure matched pairs and skip to end of if-else. */ 224 + while (v1 < 0x40000000 && i < ArrayLen - 2) { 221 225 odm_ConfigMAC_8723B(pDM_Odm, v1, (u8)v2); 222 226 READ_NEXT_PAIR(v1, v2, i); 223 227 } 224 228 225 - /* Keeps reading until ENDIF. */ 226 - cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); 227 - while (cCond != COND_ENDIF && i < ArrayLen-2) { 229 + /* Keeps reading until ENDIF. */ 230 + cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28); 231 + while (cCond != COND_ENDIF && i < ArrayLen - 2) { 228 232 READ_NEXT_PAIR(v1, v2, i); 229 - cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); 233 + cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28); 230 234 } 231 235 } 232 236 }
+14 -13
drivers/staging/rtl8723bs/hal/HalHWImg8723B_RF.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /****************************************************************************** 3 - * 4 - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 - * 6 - ******************************************************************************/ 3 + * 4 + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. 5 + * 6 + ******************************************************************************/ 7 7 8 8 #include <linux/kernel.h> 9 9 #include "odm_precomp.h" ··· 79 79 } 80 80 81 81 /****************************************************************************** 82 - * RadioA.TXT 83 - ******************************************************************************/ 82 + * RadioA.TXT 83 + ******************************************************************************/ 84 84 85 85 static u32 Array_MP_8723B_RadioA[] = { 86 86 0x000, 0x00010000, ··· 243 243 } 244 244 245 245 if (!bMatched) { 246 - /* Condition isn't matched. 247 - * Discard the following (offset, data) pairs. 248 - */ 246 + /* 247 + * Condition isn't matched. 248 + * Discard the following (offset, data) pairs. 249 + */ 249 250 while (v1 < 0x40000000 && i < ArrayLen-2) 250 251 READ_NEXT_PAIR(v1, v2, i); 251 252 ··· 270 269 } 271 270 272 271 /****************************************************************************** 273 - * TxPowerTrack_SDIO.TXT 274 - ******************************************************************************/ 272 + * TxPowerTrack_SDIO.TXT 273 + ******************************************************************************/ 275 274 276 275 static u8 gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_SDIO_8723B[] = { 277 276 0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 6, 6, ··· 355 354 } 356 355 357 356 /****************************************************************************** 358 - * TXPWR_LMT.TXT 359 - ******************************************************************************/ 357 + * TXPWR_LMT.TXT 358 + ******************************************************************************/ 360 359 361 360 static u8 *Array_MP_8723B_TXPWR_LMT[] = { 362 361 "FCC", "20M", "CCK", "1T", "01", "32",
+13 -17
drivers/staging/rtl8723bs/hal/HalPhyRf_8723B.c
··· 1078 1078 { 1079 1079 1080 1080 struct odm_rf_cal_t *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo; 1081 + u8 path; 1081 1082 1082 1083 if ( 1083 1084 (pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][VAL] != 0x0) && ··· 1086 1085 (pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC80][VAL] != 0x0) && 1087 1086 (pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xC14][VAL] != 0x0) 1088 1087 ) { 1089 - if (RFpath) { /* S1: RFpath = 0, S0:RFpath = 1 */ 1090 - /* S0 TX IQC */ 1091 - PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC94][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC94][VAL]); 1092 - PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][VAL]); 1093 - PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC4C][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC4C][VAL]); 1094 - /* S0 RX IQC */ 1095 - PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xC14][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xC14][VAL]); 1096 - PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xCA0][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xCA0][VAL]); 1097 - } else { 1098 - /* S1 TX IQC */ 1099 - PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC94][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC94][VAL]); 1100 - PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC80][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC80][VAL]); 1101 - PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC4C][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC4C][VAL]); 1102 - /* S1 RX IQC */ 1103 - PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xC14][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xC14][VAL]); 1104 - PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xCA0][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xCA0][VAL]); 1105 - } 1088 + if (RFpath) 1089 + path = PATH_S0; 1090 + else 1091 + path = PATH_S1; 1092 + 1093 + /* TX IQC */ 1094 + PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC94][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC94][VAL]); 1095 + PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC80][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC80][VAL]); 1096 + PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC4C][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC4C][VAL]); 1097 + /* RX IQC */ 1098 + PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[path][IDX_0xC14][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[path][IDX_0xC14][VAL]); 1099 + PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[path][IDX_0xCA0][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[path][IDX_0xCA0][VAL]); 1106 1100 } 1107 1101 } 1108 1102
-13
drivers/staging/rtl8723bs/hal/hal_com.c
··· 782 782 783 783 void rtw_hal_check_rxfifo_full(struct adapter *adapter) 784 784 { 785 - struct dvobj_priv *psdpriv = adapter->dvobj; 786 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 787 - int save_cnt = false; 788 - 789 785 /* switch counter to RX fifo */ 790 786 rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xf0); 791 - save_cnt = true; 792 - /* todo: other chips */ 793 - 794 - if (save_cnt) { 795 - /* rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xa0); */ 796 - pdbgpriv->dbg_rx_fifo_last_overflow = pdbgpriv->dbg_rx_fifo_curr_overflow; 797 - pdbgpriv->dbg_rx_fifo_curr_overflow = rtw_read16(adapter, REG_RXERR_RPT); 798 - pdbgpriv->dbg_rx_fifo_diff_overflow = pdbgpriv->dbg_rx_fifo_curr_overflow-pdbgpriv->dbg_rx_fifo_last_overflow; 799 - } 800 787 } 801 788 802 789 static u32 Array_kfreemap[] = {
+8 -6
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
··· 573 573 s8 value = 0; 574 574 u8 rateIndex = PHY_GetRateIndexOfTxPowerByRate(Rate); 575 575 576 - if ((padapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory == 2) || 577 - padapter->registrypriv.RegEnableTxPowerByRate == 0) 576 + if ((padapter->registrypriv.reg_enable_tx_power_by_rate == 2 && 577 + pHalData->EEPROMRegulatory == 2) || 578 + padapter->registrypriv.reg_enable_tx_power_by_rate == 0) 578 579 return 0; 579 580 580 581 if (RFPath >= RF_PATH_MAX) ··· 691 690 struct hal_com_data *hal_data = GET_HAL_DATA(adapter); 692 691 s8 limits[10] = {0}; u8 i = 0; 693 692 694 - if (((adapter->registrypriv.RegEnableTxPowerLimit == 2) && 693 + if (((adapter->registrypriv.reg_enable_tx_power_limit == 2) && 695 694 (hal_data->EEPROMRegulatory != 1)) || 696 - (adapter->registrypriv.RegEnableTxPowerLimit == 0)) 695 + (adapter->registrypriv.reg_enable_tx_power_limit == 0)) 697 696 return MAX_POWER_INDEX; 698 697 699 - switch (adapter->registrypriv.RegPwrTblSel) { 698 + switch (adapter->registrypriv.reg_pwr_tbl_sel) { 700 699 case 1: 701 700 idx_regulation = TXPWR_LMT_ETSI; 702 701 break; ··· 752 751 void PHY_ConvertTxPowerLimitToPowerIndex(struct adapter *Adapter) 753 752 { 754 753 struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); 754 + struct registry_priv *r = &Adapter->registrypriv; 755 755 u8 BW40PwrBasedBm2_4G = 0x2E; 756 756 u8 regulation, bw, channel, rateSection; 757 757 s8 tempValue = 0, tempPwrLmt = 0; ··· 773 771 else if (rateSection == 0) /* CCK */ 774 772 BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, rfPath, CCK); 775 773 } else 776 - BW40PwrBasedBm2_4G = Adapter->registrypriv.RegPowerBase * 2; 774 + BW40PwrBasedBm2_4G = r->reg_power_base * 2; 777 775 778 776 if (tempPwrLmt != MAX_POWER_INDEX) { 779 777 tempValue = tempPwrLmt - BW40PwrBasedBm2_4G;
+1 -12
drivers/staging/rtl8723bs/hal/hal_intf.c
··· 207 207 pmlmepriv = &(padapter->mlmepriv); 208 208 209 209 if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) 210 - add_RATid(padapter, psta, rssi_level); 210 + add_ratid(padapter, psta, rssi_level); 211 211 else { 212 212 UpdateHalRAMask8723B(padapter, psta->mac_id, rssi_level); 213 213 } ··· 216 216 void rtw_hal_add_ra_tid(struct adapter *padapter, u32 bitmap, u8 *arg, u8 rssi_level) 217 217 { 218 218 rtl8723b_Add_RateATid(padapter, bitmap, arg, rssi_level); 219 - } 220 - 221 - /*Start specifical interface thread */ 222 - void rtw_hal_start_thread(struct adapter *padapter) 223 - { 224 - rtl8723b_start_thread(padapter); 225 - } 226 - /*Start specifical interface thread */ 227 - void rtw_hal_stop_thread(struct adapter *padapter) 228 - { 229 - rtl8723b_stop_thread(padapter); 230 219 } 231 220 232 221 u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask)
+8 -9
drivers/staging/rtl8723bs/hal/odm_CfoTracking.c
··· 100 100 u8 Adjust_Xtal = 1; 101 101 102 102 /* 4 Support ability */ 103 - if (!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) { 103 + if (!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) 104 104 return; 105 - } 106 105 107 106 if (!pDM_Odm->bLinked || !pDM_Odm->bOneEntryOnly) { 108 107 /* 4 No link or more than one entry */ ··· 109 110 } else { 110 111 /* 3 1. CFO Tracking */ 111 112 /* 4 1.1 No new packet */ 112 - if (pCfoTrack->packetCount == pCfoTrack->packetCount_pre) { 113 + if (pCfoTrack->packetCount == pCfoTrack->packetCount_pre) 113 114 return; 114 - } 115 + 115 116 pCfoTrack->packetCount_pre = pCfoTrack->packetCount; 116 117 117 118 /* 4 1.2 Calculate CFO */ ··· 132 133 ) { 133 134 pCfoTrack->largeCFOHit = 1; 134 135 return; 135 - } else 136 - pCfoTrack->largeCFOHit = 0; 136 + } 137 + 138 + pCfoTrack->largeCFOHit = 0; 137 139 pCfoTrack->CFO_ave_pre = CFO_ave; 138 140 139 141 /* 4 1.4 Dynamic Xtal threshold */ ··· 176 176 } 177 177 178 178 /* 3 2. Dynamic ATC switch */ 179 - if (CFO_ave < CFO_TH_ATC && CFO_ave > -CFO_TH_ATC) { 179 + if (CFO_ave < CFO_TH_ATC && CFO_ave > -CFO_TH_ATC) 180 180 odm_SetATCStatus(pDM_Odm, false); 181 - } else { 181 + else 182 182 odm_SetATCStatus(pDM_Odm, true); 183 - } 184 183 } 185 184 } 186 185
+24 -45
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
··· 17 17 18 18 if (enable) { 19 19 /* 8051 enable */ 20 - tmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1); 21 - rtw_write8(padapter, REG_SYS_FUNC_EN+1, tmp|0x04); 20 + tmp = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); 21 + rtw_write8(padapter, REG_SYS_FUNC_EN + 1, tmp | 0x04); 22 22 23 23 tmp = rtw_read8(padapter, REG_MCUFWDL); 24 24 rtw_write8(padapter, REG_MCUFWDL, tmp|0x01); ··· 158 158 /* Reset 8051(WLMCU) IO wrapper */ 159 159 /* 0x1c[8] = 0 */ 160 160 /* Suggested by Isaac@SD1 and Gimmy@SD1, coding by Lucas@20130624 */ 161 - io_rst = rtw_read8(padapter, REG_RSV_CTRL+1); 161 + io_rst = rtw_read8(padapter, REG_RSV_CTRL + 1); 162 162 io_rst &= ~BIT(0); 163 - rtw_write8(padapter, REG_RSV_CTRL+1, io_rst); 163 + rtw_write8(padapter, REG_RSV_CTRL + 1, io_rst); 164 164 165 - cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN+1); 165 + cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); 166 166 cpu_rst &= ~BIT(2); 167 - rtw_write8(padapter, REG_SYS_FUNC_EN+1, cpu_rst); 167 + rtw_write8(padapter, REG_SYS_FUNC_EN + 1, cpu_rst); 168 168 169 169 /* Enable 8051 IO wrapper */ 170 170 /* 0x1c[8] = 1 */ 171 - io_rst = rtw_read8(padapter, REG_RSV_CTRL+1); 171 + io_rst = rtw_read8(padapter, REG_RSV_CTRL + 1); 172 172 io_rst |= BIT(0); 173 - rtw_write8(padapter, REG_RSV_CTRL+1, io_rst); 173 + rtw_write8(padapter, REG_RSV_CTRL + 1, io_rst); 174 174 175 - cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN+1); 175 + cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); 176 176 cpu_rst |= BIT(2); 177 - rtw_write8(padapter, REG_SYS_FUNC_EN+1, cpu_rst); 177 + rtw_write8(padapter, REG_SYS_FUNC_EN + 1, cpu_rst); 178 178 } 179 179 180 180 u8 g_fwdl_chksum_fail; ··· 259 259 void rtl8723b_FirmwareSelfReset(struct adapter *padapter) 260 260 { 261 261 struct hal_com_data *pHalData = GET_HAL_DATA(padapter); 262 - u8 u1bTmp; 262 + u8 val; 263 263 u8 Delay = 100; 264 264 265 265 if ( ··· 268 268 /* 0x1cf = 0x20. Inform 8051 to reset. 2009.12.25. tynli_test */ 269 269 rtw_write8(padapter, REG_HMETFR+3, 0x20); 270 270 271 - u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1); 272 - while (u1bTmp & BIT2) { 271 + val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); 272 + while (val & BIT2) { 273 273 Delay--; 274 274 if (Delay == 0) 275 275 break; 276 276 udelay(50); 277 - u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1); 277 + val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); 278 278 } 279 279 280 280 if (Delay == 0) { 281 281 /* force firmware reset */ 282 - u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1); 283 - rtw_write8(padapter, REG_SYS_FUNC_EN+1, u1bTmp&(~BIT2)); 282 + val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); 283 + rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val & (~BIT2)); 284 284 } 285 285 } 286 286 } ··· 304 304 const struct firmware *fw; 305 305 struct device *device = dvobj_to_dev(padapter->dvobj); 306 306 u8 *fwfilepath; 307 - struct dvobj_priv *psdpriv = padapter->dvobj; 308 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 309 307 u8 tmp_ps; 310 308 311 309 pFirmware = kzalloc(sizeof(struct rt_firmware), GFP_KERNEL); ··· 322 324 /* 2. read power_state = 0xA0[1:0] */ 323 325 tmp_ps = rtw_read8(padapter, 0xa0); 324 326 tmp_ps &= 0x03; 325 - if (tmp_ps != 0x01) 326 - pdbgpriv->dbg_downloadfw_pwr_state_cnt++; 327 327 328 328 fwfilepath = "rtlwifi/rtl8723bs_nic.bin"; 329 329 ··· 342 346 343 347 if (fw->size > FW_8723B_SIZE) { 344 348 rtStatus = _FAIL; 349 + release_firmware(fw); 345 350 goto exit; 346 351 } 347 352 348 353 pFirmware->fw_buffer_sz = kmemdup(fw->data, fw->size, GFP_KERNEL); 349 354 if (!pFirmware->fw_buffer_sz) { 350 355 rtStatus = _FAIL; 356 + release_firmware(fw); 351 357 goto exit; 352 358 } 353 359 ··· 640 642 if ((_offset + _size_byte) > EFUSE_MAX_MAP_LEN) 641 643 return; 642 644 643 - efuseTbl = rtw_malloc(EFUSE_MAX_MAP_LEN); 645 + efuseTbl = kmalloc(EFUSE_MAX_MAP_LEN, GFP_ATOMIC); 644 646 if (!efuseTbl) 645 647 return; 646 648 ··· 728 730 if ((_offset + _size_byte) > EFUSE_BT_MAP_LEN) 729 731 return; 730 732 731 - efuseTbl = rtw_malloc(EFUSE_BT_MAP_LEN); 733 + efuseTbl = kmalloc(EFUSE_BT_MAP_LEN, GFP_ATOMIC); 732 734 if (!efuseTbl) 733 735 return; 734 736 ··· 1022 1024 void UpdateHalRAMask8723B(struct adapter *padapter, u32 mac_id, u8 rssi_level) 1023 1025 { 1024 1026 u32 mask, rate_bitmap; 1025 - u8 shortGIrate = false; 1027 + u8 short_gi_rate = false; 1026 1028 struct sta_info *psta; 1027 1029 struct hal_com_data *pHalData = GET_HAL_DATA(padapter); 1028 1030 struct dm_priv *pdmpriv = &pHalData->dmpriv; ··· 1036 1038 if (!psta) 1037 1039 return; 1038 1040 1039 - shortGIrate = query_ra_short_GI(psta); 1041 + short_gi_rate = query_ra_short_GI(psta); 1040 1042 1041 1043 mask = psta->ra_mask; 1042 1044 ··· 1049 1051 mask &= ~rate_bitmap; 1050 1052 1051 1053 if (pHalData->fw_ractrl) { 1052 - rtl8723b_set_FwMacIdConfig_cmd(padapter, mac_id, psta->raid, psta->bw_mode, shortGIrate, mask); 1054 + rtl8723b_set_FwMacIdConfig_cmd(padapter, mac_id, psta->raid, psta->bw_mode, short_gi_rate, mask); 1053 1055 } 1054 1056 1055 1057 /* set correct initial date rate for each mac_id */ ··· 1944 1946 rtw_write8(padapter, REG_BCN_CTRL, val8); 1945 1947 1946 1948 /* set net_type */ 1947 - Set_MSR(padapter, mode); 1949 + set_msr(padapter, mode); 1948 1950 1949 1951 if ((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) { 1950 1952 { ··· 2911 2913 } 2912 2914 2913 2915 return bResult; 2914 - } 2915 - 2916 - void rtl8723b_start_thread(struct adapter *padapter) 2917 - { 2918 - struct xmit_priv *xmitpriv = &padapter->xmitpriv; 2919 - 2920 - xmitpriv->SdioXmitThread = kthread_run(rtl8723bs_xmit_thread, padapter, "RTWHALXT"); 2921 - } 2922 - 2923 - void rtl8723b_stop_thread(struct adapter *padapter) 2924 - { 2925 - struct xmit_priv *xmitpriv = &padapter->xmitpriv; 2926 - 2927 - /* stop xmit_buf_thread */ 2928 - if (xmitpriv->SdioXmitThread) { 2929 - complete(&xmitpriv->SdioXmitStart); 2930 - wait_for_completion(&xmitpriv->SdioXmitTerminate); 2931 - xmitpriv->SdioXmitThread = NULL; 2932 - } 2933 2916 }
+13 -18
drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
··· 338 338 339 339 /* Read Tx Power Limit File */ 340 340 PHY_InitTxPowerLimit(Adapter); 341 - if ( 342 - Adapter->registrypriv.RegEnableTxPowerLimit == 1 || 343 - (Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1) 344 - ) { 345 - ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, 346 - CONFIG_RF_TXPWR_LMT, 0); 347 - } 341 + if (Adapter->registrypriv.reg_enable_tx_power_limit == 1 || 342 + (Adapter->registrypriv.reg_enable_tx_power_limit == 2 && 343 + pHalData->EEPROMRegulatory == 1)) 344 + ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_TXPWR_LMT, 0); 348 345 349 346 /* */ 350 347 /* 1. Read PHY_REG.TXT BB INIT!! */ ··· 350 353 351 354 /* If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */ 352 355 PHY_InitTxPowerByRate(Adapter); 353 - if ( 354 - Adapter->registrypriv.RegEnableTxPowerByRate == 1 || 355 - (Adapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory != 2) 356 - ) { 357 - ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, 358 - CONFIG_BB_PHY_REG_PG); 356 + 357 + if (Adapter->registrypriv.reg_enable_tx_power_by_rate == 1 || 358 + (Adapter->registrypriv.reg_enable_tx_power_by_rate == 2 && 359 + pHalData->EEPROMRegulatory != 2)) { 360 + ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG); 359 361 360 362 if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE) 361 363 PHY_TxPowerByRateConfiguration(Adapter); 362 364 363 - if ( 364 - Adapter->registrypriv.RegEnableTxPowerLimit == 1 || 365 - (Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1) 366 - ) 365 + if (Adapter->registrypriv.reg_enable_tx_power_limit == 1 || 366 + (Adapter->registrypriv.reg_enable_tx_power_limit == 2 && 367 + pHalData->EEPROMRegulatory == 1)) 367 368 PHY_ConvertTxPowerLimitToPowerIndex(Adapter); 368 369 } 369 370 ··· 536 541 537 542 limit = phy_get_tx_pwr_lmt( 538 543 padapter, 539 - padapter->registrypriv.RegPwrTblSel, 544 + padapter->registrypriv.reg_pwr_tbl_sel, 540 545 pHalData->CurrentChannelBW, 541 546 RFPath, 542 547 Rate,
+4 -7
drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c
··· 159 159 if (length == 0) 160 160 return; 161 161 162 - tmp = rtw_zmalloc(length); 162 + tmp = kmemdup(pbuf, length, GFP_ATOMIC); 163 163 if (!tmp) 164 164 return; 165 - 166 - memcpy(tmp, pbuf, length); 167 165 168 166 res = rtw_c2h_packet_wk_cmd(padapter, tmp, length); 169 167 ··· 290 292 alloc_sz += 14; 291 293 } 292 294 293 - pkt_copy = rtw_skb_alloc(alloc_sz); 295 + pkt_copy = __dev_alloc_skb(alloc_sz, GFP_ATOMIC); 294 296 if (!pkt_copy) { 295 297 rtw_free_recvframe(precvframe, &precvpriv->free_recv_queue); 296 298 break; ··· 380 382 spin_lock_init(&precvpriv->recv_buf_pending_queue.lock); 381 383 382 384 n = NR_RECVBUFF * sizeof(struct recv_buf) + 4; 383 - precvpriv->pallocated_recv_buf = rtw_zmalloc(n); 385 + precvpriv->pallocated_recv_buf = kzalloc(n, GFP_KERNEL); 384 386 if (!precvpriv->pallocated_recv_buf) { 385 387 res = _FAIL; 386 388 goto exit; ··· 397 399 SIZE_PTR tmpaddr = 0; 398 400 SIZE_PTR alignment = 0; 399 401 400 - precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); 401 - 402 + precvbuf->pskb = __dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_ATOMIC); 402 403 if (precvbuf->pskb) { 403 404 precvbuf->pskb->dev = padapter->pnetdev; 404 405
+4 -4
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
··· 146 146 147 147 do { 148 148 queue_empty = rtl8723_dequeue_writeport(padapter); 149 - /* dump secondary adapter xmitbuf */ 149 + /* dump secondary adapter xmitbuf */ 150 150 } while (!queue_empty); 151 151 152 152 rtw_unregister_tx_alive(padapter); ··· 289 289 pxmitframe->buf_addr = pxmitbuf->ptail; 290 290 291 291 ret = rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe); 292 - if (ret == _FAIL) { 292 + if (ret != _SUCCESS) { 293 293 netdev_err(padapter->pnetdev, 294 - "%s: coalesce FAIL!", 295 - __func__); 294 + "%s: coalesce failed with error %d\n", 295 + __func__, ret); 296 296 /* Todo: error handler */ 297 297 } else { 298 298 k++;
+17 -23
drivers/staging/rtl8723bs/hal/sdio_halinit.c
··· 589 589 struct hal_com_data *pHalData; 590 590 struct pwrctrl_priv *pwrctrlpriv; 591 591 u32 NavUpper = WiFiNavUpperUs; 592 - u8 u1bTmp; 592 + u8 val; 593 593 594 594 pHalData = GET_HAL_DATA(padapter); 595 595 pwrctrlpriv = adapter_to_pwrctl(padapter); ··· 780 780 pHalData->SdioTxOQTMaxFreeSpace = pHalData->SdioTxOQTFreeSpace; 781 781 782 782 /* Enable MACTXEN/MACRXEN block */ 783 - u1bTmp = rtw_read8(padapter, REG_CR); 784 - u1bTmp |= (MACTXEN | MACRXEN); 785 - rtw_write8(padapter, REG_CR, u1bTmp); 783 + val = rtw_read8(padapter, REG_CR); 784 + val |= (MACTXEN | MACRXEN); 785 + rtw_write8(padapter, REG_CR, val); 786 786 787 787 rtw_hal_set_hwreg(padapter, HW_VAR_NAV_UPPER, (u8 *)&NavUpper); 788 788 ··· 848 848 /* */ 849 849 static void CardDisableRTL8723BSdio(struct adapter *padapter) 850 850 { 851 - u8 u1bTmp; 851 + u8 val; 852 852 u8 bMacPwrCtrlOn; 853 853 854 854 /* Run LPS WL RFOFF flow */ ··· 856 856 857 857 /* ==== Reset digital sequence ====== */ 858 858 859 - u1bTmp = rtw_read8(padapter, REG_MCUFWDL); 860 - if ((u1bTmp & RAM_DL_SEL) && padapter->bFWReady) /* 8051 RAM code */ 859 + val = rtw_read8(padapter, REG_MCUFWDL); 860 + if ((val & RAM_DL_SEL) && padapter->bFWReady) /* 8051 RAM code */ 861 861 rtl8723b_FirmwareSelfReset(padapter); 862 862 863 863 /* Reset MCU 0x2[10]= 0. Suggested by Filen. 2011.01.26. by tynli. */ 864 - u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); 865 - u1bTmp &= ~BIT(2); /* 0x2[10], FEN_CPUEN */ 866 - rtw_write8(padapter, REG_SYS_FUNC_EN + 1, u1bTmp); 864 + val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1); 865 + val &= ~BIT(2); /* 0x2[10], FEN_CPUEN */ 866 + rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val); 867 867 868 868 /* MCUFWDL 0x80[1:0]= 0 */ 869 869 /* reset MCU ready status */ 870 870 rtw_write8(padapter, REG_MCUFWDL, 0); 871 871 872 872 /* Reset MCU IO Wrapper, added by Roger, 2011.08.30 */ 873 - u1bTmp = rtw_read8(padapter, REG_RSV_CTRL + 1); 874 - u1bTmp &= ~BIT(0); 875 - rtw_write8(padapter, REG_RSV_CTRL + 1, u1bTmp); 876 - u1bTmp = rtw_read8(padapter, REG_RSV_CTRL + 1); 877 - u1bTmp |= BIT(0); 878 - rtw_write8(padapter, REG_RSV_CTRL+1, u1bTmp); 873 + val = rtw_read8(padapter, REG_RSV_CTRL + 1); 874 + val &= ~BIT(0); 875 + rtw_write8(padapter, REG_RSV_CTRL + 1, val); 876 + val = rtw_read8(padapter, REG_RSV_CTRL + 1); 877 + val |= BIT(0); 878 + rtw_write8(padapter, REG_RSV_CTRL + 1, val); 879 879 880 880 /* ==== Reset digital sequence end ====== */ 881 881 ··· 886 886 887 887 u32 rtl8723bs_hal_deinit(struct adapter *padapter) 888 888 { 889 - struct dvobj_priv *psdpriv = padapter->dvobj; 890 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 891 - 892 889 if (padapter->hw_init_completed) { 893 890 if (adapter_to_pwrctl(padapter)->bips_processing) { 894 891 if (padapter->netif_up) { ··· 918 921 adapter_to_pwrctl(padapter)->pre_ips_type = 0; 919 922 920 923 } else { 921 - pdbgpriv->dbg_carddisable_cnt++; 922 924 CardDisableRTL8723BSdio(padapter); 923 925 924 926 adapter_to_pwrctl(padapter)->pre_ips_type = 1; 925 927 } 926 928 927 929 } else { 928 - pdbgpriv->dbg_carddisable_cnt++; 929 930 CardDisableRTL8723BSdio(padapter); 930 931 } 931 - } else 932 - pdbgpriv->dbg_deinit_fail_cnt++; 932 + } 933 933 934 934 return _SUCCESS; 935 935 }
+15 -14
drivers/staging/rtl8723bs/hal/sdio_ops.c
··· 132 132 static u8 sdio_read8(struct intf_hdl *intfhdl, u32 addr) 133 133 { 134 134 u32 ftaddr; 135 + 135 136 ftaddr = _cvrt2ftaddr(addr, NULL, NULL); 136 137 137 138 return sd_read8(intfhdl, ftaddr, NULL); ··· 181 180 } else { 182 181 u8 *tmpbuf; 183 182 184 - tmpbuf = rtw_malloc(8); 183 + tmpbuf = kmalloc(8, GFP_ATOMIC); 185 184 if (!tmpbuf) 186 185 return SDIO_ERR_VAL32; 187 186 ··· 228 227 229 228 ftaddr &= ~(u16)0x3; 230 229 n = cnt + shift; 231 - tmpbuf = rtw_malloc(n); 230 + tmpbuf = kmalloc(n, GFP_ATOMIC); 232 231 if (!tmpbuf) 233 - return -1; 232 + return -ENOMEM; 234 233 235 234 err = sd_read(intfhdl, ftaddr, n, tmpbuf); 236 235 if (!err) ··· 331 330 332 331 ftaddr &= ~(u16)0x3; 333 332 n = cnt + shift; 334 - tmpbuf = rtw_malloc(n); 333 + tmpbuf = kmalloc(n, GFP_ATOMIC); 335 334 if (!tmpbuf) 336 - return -1; 335 + return -ENOMEM; 337 336 err = sd_read(intfhdl, ftaddr, 4, tmpbuf); 338 337 if (err) { 339 338 kfree(tmpbuf); ··· 503 502 return _sd_cmd52_read(intfhdl, addr, cnt, buf); 504 503 505 504 n = round_up(cnt, 4); 506 - tmpbuf = rtw_malloc(n); 505 + tmpbuf = kmalloc(n, GFP_ATOMIC); 507 506 if (!tmpbuf) 508 - return -1; 507 + return -ENOMEM; 509 508 510 509 err = _sd_read(intfhdl, addr, n, tmpbuf); 511 510 if (!err) ··· 544 543 return sd_cmd52_read(intfhdl, addr, cnt, buf); 545 544 546 545 n = round_up(cnt, 4); 547 - tmpbuf = rtw_malloc(n); 546 + tmpbuf = kmalloc(n, GFP_ATOMIC); 548 547 if (!tmpbuf) 549 - return -1; 548 + return -ENOMEM; 550 549 551 550 err = sd_read(intfhdl, addr, n, tmpbuf); 552 551 if (!err) ··· 583 582 ) 584 583 return sd_cmd52_write(intfhdl, addr, cnt, buf); 585 584 586 - tmpbuf = rtw_malloc(cnt); 585 + tmpbuf = kmalloc(cnt, GFP_ATOMIC); 587 586 if (!tmpbuf) 588 - return -1; 587 + return -ENOMEM; 589 588 590 589 memcpy(tmpbuf, buf, cnt); 591 590 ··· 810 809 SIZE_PTR tmpaddr = 0; 811 810 SIZE_PTR alignment = 0; 812 811 813 - recvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); 812 + recvbuf->pskb = __dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_ATOMIC); 814 813 if (!recvbuf->pskb) 815 814 return NULL; 816 815 ··· 883 882 u8 *status; 884 883 u32 addr; 885 884 886 - status = rtw_malloc(4); 885 + status = kmalloc(4, GFP_ATOMIC); 887 886 if (status) { 888 887 addr = REG_TXDMA_STATUS; 889 888 hal_sdio_get_cmd_addr_8723b(adapter, WLAN_IOREG_DEVICE_ID, addr, &addr); ··· 896 895 if (hal->sdio_hisr & SDIO_HISR_C2HCMD) { 897 896 struct c2h_evt_hdr_88xx *c2h_evt; 898 897 899 - c2h_evt = rtw_zmalloc(16); 898 + c2h_evt = kzalloc(16, GFP_ATOMIC); 900 899 if (c2h_evt) { 901 900 if (c2h_evt_read_88xx(adapter, (u8 *)c2h_evt) == _SUCCESS) { 902 901 if (c2h_id_filter_ccx_8723b((u8 *)c2h_evt)) {
+4 -49
drivers/staging/rtl8723bs/include/drv_types.h
··· 156 156 u8 notch_filter; 157 157 158 158 /* define for tx power adjust */ 159 - u8 RegEnableTxPowerLimit; 160 - u8 RegEnableTxPowerByRate; 161 - u8 RegPowerBase; 162 - u8 RegPwrTblSel; 163 - s8 TxBBSwing_2G; 164 - u8 AmplifierType_2G; 165 - u8 bEn_RFE; 166 - u8 RFE_Type; 159 + u8 reg_enable_tx_power_limit; 160 + u8 reg_enable_tx_power_by_rate; 161 + u8 reg_power_base; 162 + u8 reg_pwr_tbl_sel; 167 163 u8 check_fw_ps; 168 164 169 165 u8 qos_opt_enable; ··· 172 176 #define GET_PRIMARY_ADAPTER(padapter) (((struct adapter *)padapter)->dvobj->if1) 173 177 #define GET_IFACE_NUMS(padapter) (((struct adapter *)padapter)->dvobj->iface_nums) 174 178 #define GET_ADAPTER(padapter, iface_id) (((struct adapter *)padapter)->dvobj->padapters[iface_id]) 175 - 176 - struct debug_priv { 177 - u32 dbg_sdio_free_irq_error_cnt; 178 - u32 dbg_sdio_alloc_irq_error_cnt; 179 - u32 dbg_sdio_free_irq_cnt; 180 - u32 dbg_sdio_alloc_irq_cnt; 181 - u32 dbg_sdio_deinit_error_cnt; 182 - u32 dbg_sdio_init_error_cnt; 183 - u32 dbg_suspend_error_cnt; 184 - u32 dbg_suspend_cnt; 185 - u32 dbg_resume_cnt; 186 - u32 dbg_resume_error_cnt; 187 - u32 dbg_deinit_fail_cnt; 188 - u32 dbg_carddisable_cnt; 189 - u32 dbg_carddisable_error_cnt; 190 - u32 dbg_ps_insuspend_cnt; 191 - u32 dbg_dev_unload_inIPS_cnt; 192 - u32 dbg_wow_leave_ps_fail_cnt; 193 - u32 dbg_scan_pwr_state_cnt; 194 - u32 dbg_downloadfw_pwr_state_cnt; 195 - u32 dbg_fw_read_ps_state_fail_cnt; 196 - u32 dbg_leave_ips_fail_cnt; 197 - u32 dbg_leave_lps_fail_cnt; 198 - u32 dbg_h2c_leave32k_fail_cnt; 199 - u32 dbg_diswow_dload_fw_fail_cnt; 200 - u32 dbg_enwow_dload_fw_fail_cnt; 201 - u32 dbg_ips_drvopen_fail_cnt; 202 - u32 dbg_poll_fail_cnt; 203 - u32 dbg_rpwm_toggle_cnt; 204 - u32 dbg_rpwm_timeout_fail_cnt; 205 - u64 dbg_rx_fifo_last_overflow; 206 - u64 dbg_rx_fifo_curr_overflow; 207 - u64 dbg_rx_fifo_diff_overflow; 208 - u64 dbg_rx_ampdu_drop_count; 209 - u64 dbg_rx_ampdu_forced_indicate_count; 210 - u64 dbg_rx_ampdu_loss_count; 211 - u64 dbg_rx_dup_mgt_frame_drop_count; 212 - u64 dbg_rx_ampdu_window_shift_cnt; 213 - }; 214 179 215 180 struct rtw_traffic_statistics { 216 181 /* tx statistics */ ··· 207 250 struct adapter *if1; /* PRIMARY_ADAPTER */ 208 251 209 252 s32 processing_dev_remove; 210 - 211 - struct debug_priv drv_dbg; 212 253 213 254 /* for local/global synchronization */ 214 255 /* */
-3
drivers/staging/rtl8723bs/include/hal_intf.h
··· 221 221 void rtw_hal_update_ra_mask(struct sta_info *psta, u8 rssi_level); 222 222 void rtw_hal_add_ra_tid(struct adapter *padapter, u32 bitmap, u8 *arg, u8 rssi_level); 223 223 224 - void rtw_hal_start_thread(struct adapter *padapter); 225 - void rtw_hal_stop_thread(struct adapter *padapter); 226 - 227 224 void beacon_timing_control(struct adapter *padapter); 228 225 229 226 u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask);
-1
drivers/staging/rtl8723bs/include/ieee80211.h
··· 506 506 507 507 #define DEFAULT_MAX_SCAN_AGE (15 * HZ) 508 508 #define DEFAULT_FTS 2346 509 - #define MAC_ARG(x) (x) 510 509 #define IP_ARG(x) (x) 511 510 512 511 static inline int is_multicast_mac_addr(const u8 *addr)
-15
drivers/staging/rtl8723bs/include/osdep_service.h
··· 54 54 55 55 extern int RTW_STATUS_CODE(int error_code); 56 56 57 - void *_rtw_zmalloc(u32 sz); 58 - void *_rtw_malloc(u32 sz); 59 57 void _kfree(u8 *pbuf, u32 sz); 60 58 61 - struct sk_buff *_rtw_skb_alloc(u32 sz); 62 - struct sk_buff *_rtw_skb_copy(const struct sk_buff *skb); 63 59 int _rtw_netif_rx(struct net_device *ndev, struct sk_buff *skb); 64 60 65 - #define rtw_malloc(sz) _rtw_malloc((sz)) 66 - #define rtw_zmalloc(sz) _rtw_zmalloc((sz)) 67 - 68 - #define rtw_skb_alloc(size) _rtw_skb_alloc((size)) 69 - #define rtw_skb_alloc_f(size, mstat_f) _rtw_skb_alloc((size)) 70 - #define rtw_skb_copy(skb) _rtw_skb_copy((skb)) 71 - #define rtw_skb_copy_f(skb, mstat_f) _rtw_skb_copy((skb)) 72 61 #define rtw_netif_rx(ndev, skb) _rtw_netif_rx(ndev, skb) 73 62 74 63 extern void _rtw_init_queue(struct __queue *pqueue); ··· 79 90 } 80 91 81 92 #define _RND(sz, r) ((((sz)+((r)-1))/(r))*(r)) 82 - 83 - #ifndef MAC_ARG 84 - #define MAC_ARG(x) (x) 85 - #endif 86 93 87 94 extern void rtw_free_netdev(struct net_device *netdev); 88 95
-3
drivers/staging/rtl8723bs/include/rtl8723b_hal.h
··· 231 231 void _InitBurstPktLen_8723BS(struct adapter *adapter); 232 232 void _8051Reset8723(struct adapter *padapter); 233 233 234 - void rtl8723b_start_thread(struct adapter *padapter); 235 - void rtl8723b_stop_thread(struct adapter *padapter); 236 - 237 234 int FirmwareDownloadBT(struct adapter *adapter, struct rt_firmware *firmware); 238 235 239 236 void CCX_FwC2HTxRpt_8723b(struct adapter *padapter, u8 *pdata, u8 len);
+1 -1
drivers/staging/rtl8723bs/include/rtw_ap.h
··· 11 11 void free_mlme_ap_info(struct adapter *padapter); 12 12 /* void update_BCNTIM(struct adapter *padapter); */ 13 13 void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx); 14 - void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level); 14 + void add_ratid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level); 15 15 void expire_timeout_chk(struct adapter *padapter); 16 16 void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta); 17 17 void start_bss_network(struct adapter *padapter);
+1 -1
drivers/staging/rtl8723bs/include/rtw_mlme_ext.h
··· 441 441 void Restore_DM_Func_Flag(struct adapter *padapter); 442 442 void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable); 443 443 444 - void Set_MSR(struct adapter *padapter, u8 type); 444 + void set_msr(struct adapter *padapter, u8 type); 445 445 446 446 u8 rtw_get_oper_ch(struct adapter *adapter); 447 447 void rtw_set_oper_ch(struct adapter *adapter, u8 ch);
+1 -1
drivers/staging/rtl8723bs/include/xmit_osdep.h
··· 35 35 36 36 extern uint rtw_remainder_len(struct pkt_file *pfile); 37 37 extern void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile); 38 - extern uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen); 38 + int _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, unsigned int rlen); 39 39 extern signed int rtw_endofpktfile(struct pkt_file *pfile); 40 40 41 41 extern void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);
+15 -17
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
··· 111 111 { 112 112 struct ieee80211_supported_band *spt_band = NULL; 113 113 int n_channels, n_bitrates; 114 + size_t alloc_sz; 114 115 115 116 if (band == NL80211_BAND_2GHZ) { 116 117 n_channels = RTW_2G_CHANNELS_NUM; ··· 120 119 goto exit; 121 120 } 122 121 123 - spt_band = rtw_zmalloc(sizeof(struct ieee80211_supported_band) + 124 - sizeof(struct ieee80211_channel) * n_channels + 125 - sizeof(struct ieee80211_rate) * n_bitrates); 122 + alloc_sz = sizeof(*spt_band); 123 + alloc_sz = size_add(alloc_sz, array_size(n_channels, sizeof(struct ieee80211_channel))); 124 + alloc_sz = size_add(alloc_sz, array_size(n_bitrates, sizeof(struct ieee80211_rate))); 125 + spt_band = kzalloc(alloc_sz, GFP_KERNEL); 126 126 if (!spt_band) 127 127 goto exit; 128 128 ··· 317 315 len, notify_signal, GFP_ATOMIC); 318 316 319 317 if (unlikely(!bss)) 320 - goto exit; 318 + goto free_buf; 321 319 322 320 cfg80211_put_bss(wiphy, bss); 321 + free_buf: 323 322 kfree(buf); 324 323 325 324 exit: ··· 843 840 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 844 841 845 842 param_len = sizeof(struct ieee_param) + params->key_len; 846 - param = rtw_malloc(param_len); 843 + param = kzalloc(param_len, GFP_KERNEL); 847 844 if (!param) 848 - return -1; 849 - 850 - memset(param, 0, param_len); 845 + return -ENOMEM; 851 846 852 847 param->cmd = IEEE_CMD_SET_ENCRYPTION; 853 848 eth_broadcast_addr(param->sta_addr); ··· 1163 1162 pmlmepriv->wps_probe_req_ie = NULL; 1164 1163 } 1165 1164 1166 - pmlmepriv->wps_probe_req_ie = rtw_malloc(wps_ielen); 1165 + pmlmepriv->wps_probe_req_ie = kmemdup(wps_ie, wps_ielen, GFP_KERNEL); 1167 1166 if (!pmlmepriv->wps_probe_req_ie) 1168 1167 return -EINVAL; 1169 1168 1170 - memcpy(pmlmepriv->wps_probe_req_ie, wps_ie, wps_ielen); 1171 1169 pmlmepriv->wps_probe_req_ie_len = wps_ielen; 1172 1170 } 1173 1171 } ··· 1430 1430 goto exit; 1431 1431 } 1432 1432 1433 - buf = rtw_zmalloc(ielen); 1433 + buf = kzalloc(ielen, GFP_KERNEL); 1434 1434 if (!buf) { 1435 1435 ret = -ENOMEM; 1436 1436 goto exit; ··· 1714 1714 wep_key_len = wep_key_len <= 5 ? 5 : 13; 1715 1715 wep_total_len = wep_key_len + 1716 1716 offsetof(struct ndis_802_11_wep, key_material); 1717 - pwep = rtw_malloc(wep_total_len); 1717 + pwep = kzalloc(wep_total_len, GFP_KERNEL); 1718 1718 if (!pwep) { 1719 1719 ret = -ENOMEM; 1720 1720 goto exit; 1721 1721 } 1722 - 1723 - memset(pwep, 0, wep_total_len); 1724 1722 1725 1723 pwep->key_length = wep_key_len; 1726 1724 pwep->length = wep_total_len; ··· 2145 2147 pnpi->sizeof_priv = sizeof(struct adapter); 2146 2148 2147 2149 /* wdev */ 2148 - mon_wdev = rtw_zmalloc(sizeof(struct wireless_dev)); 2150 + mon_wdev = kzalloc(sizeof(*mon_wdev), GFP_KERNEL); 2149 2151 if (!mon_wdev) { 2150 2152 ret = -ENOMEM; 2151 2153 goto out; ··· 2255 2257 if (head_len < 24) 2256 2258 return -EINVAL; 2257 2259 2258 - pbuf = rtw_zmalloc(head_len + tail_len); 2260 + pbuf = kzalloc(head_len + tail_len, GFP_KERNEL); 2259 2261 if (!pbuf) 2260 2262 return -ENOMEM; 2261 2263 ··· 2726 2728 goto free_wiphy; 2727 2729 2728 2730 /* wdev */ 2729 - wdev = rtw_zmalloc(sizeof(struct wireless_dev)); 2731 + wdev = kzalloc(sizeof(*wdev), GFP_KERNEL); 2730 2732 if (!wdev) { 2731 2733 ret = -ENOMEM; 2732 2734 goto unregister_wiphy;
+20 -34
drivers/staging/rtl8723bs/os_dep/os_intfs.c
··· 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 8 #include <hal_data.h> 9 + #include <rtl8723b_xmit.h> 9 10 10 11 MODULE_LICENSE("GPL"); 11 12 MODULE_DESCRIPTION("Realtek Wireless Lan Driver"); ··· 260 259 261 260 registry_par->notch_filter = (u8)rtw_notch_filter; 262 261 263 - registry_par->RegEnableTxPowerLimit = (u8)rtw_tx_pwr_lmt_enable; 264 - registry_par->RegEnableTxPowerByRate = (u8)rtw_tx_pwr_by_rate; 262 + registry_par->reg_enable_tx_power_limit = (u8)rtw_tx_pwr_lmt_enable; 263 + registry_par->reg_enable_tx_power_by_rate = (u8)rtw_tx_pwr_by_rate; 265 264 266 - registry_par->RegPowerBase = 14; 267 - registry_par->TxBBSwing_2G = 0xFF; 268 - registry_par->bEn_RFE = 1; 269 - registry_par->RFE_Type = 64; 265 + registry_par->reg_power_base = 14; 270 266 271 267 registry_par->qos_opt_enable = (u8)rtw_qos_opt_enable; 272 268 ··· 478 480 else 479 481 wait_for_completion(&padapter->cmdpriv.terminate_cmdthread_comp); /* wait for cmd_thread to run */ 480 482 481 - rtw_hal_start_thread(padapter); 483 + padapter->xmitpriv.SdioXmitThread = kthread_run(rtl8723bs_xmit_thread, 484 + padapter, "RTWHALXT"); 485 + if (IS_ERR(padapter->xmitpriv.SdioXmitThread)) { 486 + padapter->xmitpriv.SdioXmitThread = NULL; 487 + _status = _FAIL; 488 + } 489 + 482 490 return _status; 483 491 } 484 492 ··· 496 492 complete(&padapter->xmitpriv.xmit_comp); 497 493 wait_for_completion(&padapter->xmitpriv.terminate_xmitthread_comp); 498 494 499 - rtw_hal_stop_thread(padapter); 495 + /* stop SdioXmitThread */ 496 + if (padapter->xmitpriv.SdioXmitThread) { 497 + complete(&padapter->xmitpriv.SdioXmitStart); 498 + wait_for_completion(&padapter->xmitpriv.SdioXmitTerminate); 499 + padapter->xmitpriv.SdioXmitThread = NULL; 500 + } 500 501 } 501 502 502 503 static void rtw_init_default_value(struct adapter *padapter) ··· 562 553 padapter->fix_rate = 0xFF; 563 554 padapter->driver_ampdu_spacing = 0xFF; 564 555 padapter->driver_rx_ampdu_factor = 0xFF; 565 - 566 556 } 567 557 568 558 struct dvobj_priv *devobj_init(void) 569 559 { 570 560 struct dvobj_priv *pdvobj = NULL; 571 561 572 - pdvobj = rtw_zmalloc(sizeof(*pdvobj)); 562 + pdvobj = kzalloc(sizeof(*pdvobj), GFP_KERNEL); 573 563 if (!pdvobj) 574 564 return NULL; 575 565 ··· 906 898 907 899 void rtw_ips_dev_unload(struct adapter *padapter) 908 900 { 909 - 910 901 if (!padapter->bSurpriseRemoved) 911 902 rtw_hal_deinit(padapter); 912 903 } ··· 941 934 padapter->net_closed = true; 942 935 padapter->netif_up = false; 943 936 944 - /*if (!padapter->hw_init_completed) 945 - { 946 - 947 - padapter->bDriverStopped = true; 948 - 949 - rtw_dev_unload(padapter); 950 - } 951 - else*/ 952 937 if (pwrctl->rf_pwrstate == rf_on) { 953 938 /* s1. */ 954 939 if (pnetdev) { ··· 973 974 void rtw_dev_unload(struct adapter *padapter) 974 975 { 975 976 struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); 976 - struct dvobj_priv *pobjpriv = padapter->dvobj; 977 - struct debug_priv *pdbgpriv = &pobjpriv->drv_dbg; 978 977 struct cmd_priv *pcmdpriv = &padapter->cmdpriv; 979 978 u8 cnt = 0; 980 979 981 980 if (padapter->bup) { 982 - 983 981 padapter->bDriverStopped = true; 984 982 if (padapter->xmitpriv.ack_tx) 985 983 rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP); ··· 1001 1005 /* check HW status and SW state */ 1002 1006 netdev_dbg(padapter->pnetdev, 1003 1007 "%s: driver in IPS-FWLPS\n", __func__); 1004 - pdbgpriv->dbg_dev_unload_inIPS_cnt++; 1005 1008 LeaveAllPowerSaveMode(padapter); 1006 1009 } else { 1007 1010 netdev_dbg(padapter->pnetdev, ··· 1017 1022 } 1018 1023 1019 1024 padapter->bup = false; 1020 - 1021 1025 } 1022 1026 } 1023 1027 ··· 1083 1089 void rtw_suspend_common(struct adapter *padapter) 1084 1090 { 1085 1091 struct dvobj_priv *psdpriv = padapter->dvobj; 1086 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 1087 1092 struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(psdpriv); 1088 1093 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1089 1094 1090 1095 unsigned long start_time = jiffies; 1091 1096 1092 1097 netdev_dbg(padapter->pnetdev, " suspend start\n"); 1093 - pdbgpriv->dbg_suspend_cnt++; 1094 1098 1095 1099 pwrpriv->bInSuspend = true; 1096 1100 1097 1101 while (pwrpriv->bips_processing) 1098 1102 msleep(1); 1099 1103 1100 - if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) { 1101 - pdbgpriv->dbg_suspend_error_cnt++; 1104 + if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) 1102 1105 return; 1103 - } 1106 + 1104 1107 rtw_ps_deny(padapter, PS_DENY_SUSPEND); 1105 1108 1106 1109 rtw_cancel_all_timer(padapter); ··· 1125 1134 struct net_device *pnetdev; 1126 1135 struct pwrctrl_priv *pwrpriv; 1127 1136 struct mlme_priv *pmlmepriv; 1128 - struct dvobj_priv *psdpriv; 1129 - struct debug_priv *pdbgpriv; 1130 1137 1131 1138 int ret = _SUCCESS; 1132 1139 ··· 1136 1147 pnetdev = padapter->pnetdev; 1137 1148 pwrpriv = adapter_to_pwrctl(padapter); 1138 1149 pmlmepriv = &padapter->mlmepriv; 1139 - psdpriv = padapter->dvobj; 1140 - pdbgpriv = &psdpriv->drv_dbg; 1141 1150 /* interface init */ 1142 1151 /* if (sdio_init(adapter_to_dvobj(padapter)) != _SUCCESS) */ 1143 1152 if ((padapter->intf_init) && (padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS)) { ··· 1154 1167 1155 1168 if (pm_netdev_open(pnetdev, true) != 0) { 1156 1169 ret = -1; 1157 - pdbgpriv->dbg_resume_error_cnt++; 1158 1170 goto exit; 1159 1171 } 1160 1172
+6 -40
drivers/staging/rtl8723bs/os_dep/osdep_service.c
··· 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 8 9 - /* 10 - * Translate the OS dependent @param error_code to OS independent RTW_STATUS_CODE 11 - * @return: one of RTW_STATUS_CODE 12 - */ 9 + /* Translate the OS dependent error_code to RTW_STATUS_CODE */ 13 10 inline int RTW_STATUS_CODE(int error_code) 14 11 { 15 12 if (error_code >= 0) 16 13 return _SUCCESS; 17 14 return _FAIL; 18 - } 19 - 20 - void *_rtw_malloc(u32 sz) 21 - { 22 - return kmalloc(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); 23 - } 24 - 25 - void *_rtw_zmalloc(u32 sz) 26 - { 27 - void *pbuf = _rtw_malloc(sz); 28 - 29 - if (pbuf) 30 - memset(pbuf, 0, sz); 31 - 32 - return pbuf; 33 - } 34 - 35 - inline struct sk_buff *_rtw_skb_alloc(u32 sz) 36 - { 37 - return __dev_alloc_skb(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); 38 - } 39 - 40 - inline struct sk_buff *_rtw_skb_copy(const struct sk_buff *skb) 41 - { 42 - return skb_copy(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); 43 15 } 44 16 45 17 inline int _rtw_netif_rx(struct net_device *ndev, struct sk_buff *skb) ··· 104 132 goto keep_ori; 105 133 106 134 /* duplicate src */ 107 - dup = rtw_malloc(src_len); 108 - if (dup) { 135 + dup = kmemdup(src, src_len, GFP_ATOMIC); 136 + if (dup) 109 137 dup_len = src_len; 110 - memcpy(dup, src, dup_len); 111 - } 112 138 113 139 keep_ori: 114 140 ori = *buf; ··· 121 151 if (ori && ori_len > 0) 122 152 kfree(ori); 123 153 } 124 - 125 154 126 155 /** 127 156 * rtw_cbuf_full - test if cbuf is full ··· 173 204 void *rtw_cbuf_pop(struct rtw_cbuf *cbuf) 174 205 { 175 206 void *buf; 207 + 176 208 if (rtw_cbuf_empty(cbuf)) 177 209 return NULL; 178 210 ··· 193 223 { 194 224 struct rtw_cbuf *cbuf; 195 225 196 - cbuf = rtw_malloc(struct_size(cbuf, bufs, size)); 197 - 198 - if (cbuf) { 199 - cbuf->write = cbuf->read = 0; 200 - cbuf->size = size; 201 - } 226 + cbuf = kzalloc(struct_size(cbuf, bufs, size), GFP_KERNEL); 227 + cbuf->size = size; 202 228 203 229 return cbuf; 204 230 }
+12 -36
drivers/staging/rtl8723bs/os_dep/sdio_intf.c
··· 70 70 sdio_claim_host(func); 71 71 72 72 err = sdio_claim_irq(func, &sd_sync_int_hdl); 73 - if (err) { 74 - dvobj->drv_dbg.dbg_sdio_alloc_irq_error_cnt++; 73 + if (err) 75 74 netdev_crit(dvobj->if1->pnetdev, "%s: sdio_claim_irq FAIL(%d)!\n", __func__, err); 76 - } else { 77 - dvobj->drv_dbg.dbg_sdio_alloc_irq_cnt++; 75 + else 78 76 dvobj->irq_alloc = 1; 79 - } 80 77 81 78 sdio_release_host(func); 82 79 ··· 94 97 sdio_claim_host(func); 95 98 err = sdio_release_irq(func); 96 99 if (err) { 97 - dvobj->drv_dbg.dbg_sdio_free_irq_error_cnt++; 98 100 netdev_err(dvobj->if1->pnetdev, 99 101 "%s: sdio_release_irq FAIL(%d)!\n", 100 102 __func__, err); 101 - } else 102 - dvobj->drv_dbg.dbg_sdio_free_irq_cnt++; 103 + } 103 104 sdio_release_host(func); 104 105 } 105 106 dvobj->irq_alloc = 0; ··· 117 122 sdio_claim_host(func); 118 123 119 124 err = sdio_enable_func(func); 120 - if (err) { 121 - dvobj->drv_dbg.dbg_sdio_init_error_cnt++; 125 + if (err) 122 126 goto release; 123 - } 124 127 125 128 err = sdio_set_block_size(func, 512); 126 - if (err) { 127 - dvobj->drv_dbg.dbg_sdio_init_error_cnt++; 129 + if (err) 128 130 goto release; 129 - } 131 + 130 132 psdio_data->block_transfer_len = 512; 131 133 psdio_data->tx_block_mode = 1; 132 134 psdio_data->rx_block_mode = 1; ··· 139 147 static void sdio_deinit(struct dvobj_priv *dvobj) 140 148 { 141 149 struct sdio_func *func; 142 - int err; 143 150 144 151 func = dvobj->intf_data.func; 145 152 146 153 if (func) { 147 154 sdio_claim_host(func); 148 - err = sdio_disable_func(func); 149 - if (err) 150 - dvobj->drv_dbg.dbg_sdio_deinit_error_cnt++; 155 + sdio_disable_func(func); 151 156 152 157 if (dvobj->irq_alloc) { 153 - err = sdio_release_irq(func); 154 - if (err) 155 - dvobj->drv_dbg.dbg_sdio_free_irq_error_cnt++; 156 - else 157 - dvobj->drv_dbg.dbg_sdio_free_irq_cnt++; 158 + sdio_release_irq(func); 158 159 } 159 160 160 161 sdio_release_host(func); ··· 362 377 if (status != _SUCCESS) 363 378 goto free_if1; 364 379 365 - if (sdio_alloc_irq(dvobj) != _SUCCESS) 380 + status = sdio_alloc_irq(dvobj); 381 + if (status != _SUCCESS) 366 382 goto free_if1; 367 383 368 384 status = _SUCCESS; ··· 419 433 struct dvobj_priv *psdpriv = sdio_get_drvdata(func); 420 434 struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(psdpriv); 421 435 struct adapter *padapter = psdpriv->if1; 422 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 423 436 424 437 if (padapter->bDriverStopped) 425 438 return 0; 426 439 427 - if (pwrpriv->bInSuspend) { 428 - pdbgpriv->dbg_suspend_error_cnt++; 440 + if (pwrpriv->bInSuspend) 429 441 return 0; 430 - } 431 442 432 443 rtw_suspend_common(padapter); 433 444 ··· 434 451 static int rtw_resume_process(struct adapter *padapter) 435 452 { 436 453 struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); 437 - struct dvobj_priv *psdpriv = padapter->dvobj; 438 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 439 454 440 - if (!pwrpriv->bInSuspend) { 441 - pdbgpriv->dbg_resume_error_cnt++; 455 + if (!pwrpriv->bInSuspend) 442 456 return -1; 443 - } 444 457 445 458 return rtw_resume_common(padapter); 446 459 } ··· 448 469 struct adapter *padapter = psdpriv->if1; 449 470 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 450 471 int ret = 0; 451 - struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; 452 - 453 - pdbgpriv->dbg_resume_cnt++; 454 472 455 473 ret = rtw_resume_process(padapter); 456 474
+14 -14
drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
··· 219 219 if (*err == 0) { 220 220 rtw_reset_continual_io_error(psdiodev); 221 221 break; 222 - } else { 223 - if ((-ESHUTDOWN == *err) || (-ENODEV == *err)) 224 - padapter->bSurpriseRemoved = true; 222 + } 225 223 226 - if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) { 227 - padapter->bSurpriseRemoved = true; 228 - break; 229 - } 224 + if ((-ESHUTDOWN == *err) || (-ENODEV == *err)) 225 + padapter->bSurpriseRemoved = true; 226 + 227 + if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) { 228 + padapter->bSurpriseRemoved = true; 229 + break; 230 230 } 231 231 } 232 232 } ··· 295 295 if (*err == 0) { 296 296 rtw_reset_continual_io_error(psdiodev); 297 297 break; 298 - } else { 299 - if ((-ESHUTDOWN == *err) || (-ENODEV == *err)) 300 - padapter->bSurpriseRemoved = true; 298 + } 301 299 302 - if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) { 303 - padapter->bSurpriseRemoved = true; 304 - break; 305 - } 300 + if ((-ESHUTDOWN == *err) || (-ENODEV == *err)) 301 + padapter->bSurpriseRemoved = true; 302 + 303 + if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) { 304 + padapter->bSurpriseRemoved = true; 305 + break; 306 306 } 307 307 } 308 308 }
+14 -12
drivers/staging/rtl8723bs/os_dep/xmit_linux.c
··· 21 21 pfile->cur_buffer = pfile->buf_start; 22 22 } 23 23 24 - uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen) 24 + int _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, unsigned int rlen) 25 25 { 26 - uint len = 0; 26 + int ret; 27 27 28 - len = rtw_remainder_len(pfile); 29 - len = (rlen > len) ? len : rlen; 28 + if (rtw_remainder_len(pfile) < rlen) 29 + return -EINVAL; 30 30 31 - if (rmem) 32 - skb_copy_bits(pfile->pkt, pfile->buf_len - pfile->pkt_len, rmem, len); 31 + if (rmem) { 32 + ret = skb_copy_bits(pfile->pkt, pfile->buf_len - pfile->pkt_len, rmem, rlen); 33 + if (ret < 0) 34 + return ret; 35 + } 33 36 34 - pfile->cur_addr += len; 35 - pfile->pkt_len -= len; 36 - return len; 37 + pfile->cur_addr += rlen; 38 + pfile->pkt_len -= rlen; 39 + return rlen; 37 40 } 38 41 39 42 signed int rtw_endofpktfile(struct pkt_file *pfile) ··· 49 46 int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf, u32 alloc_sz, u8 flag) 50 47 { 51 48 if (alloc_sz > 0) { 52 - pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz); 49 + pxmitbuf->pallocated_buf = kzalloc(alloc_sz, GFP_KERNEL); 53 50 if (!pxmitbuf->pallocated_buf) 54 51 return _FAIL; 55 52 ··· 162 159 !memcmp(psta->hwaddr, bc_addr, 6)) 163 160 continue; 164 161 165 - newskb = rtw_skb_copy(skb); 166 - 162 + newskb = skb_copy(skb, GFP_ATOMIC); 167 163 if (newskb) { 168 164 memcpy(newskb->data, psta->hwaddr, 6); 169 165 res = rtw_xmit(padapter, &newskb);
-2
drivers/staging/sm750fb/TODO
··· 1 1 TODO: 2 - - lots of checkpatch cleanup 3 - - use kernel coding style 4 2 - refine the code and remove unused code 5 3 - Implement hardware acceleration for imageblit if image->depth > 1 6 4 - must be ported to the atomic kms framework in the drm subsystem (which will
+1 -1
drivers/staging/sm750fb/ddk750_chip.c
··· 249 249 * Reset the memory controller. 250 250 * If the memory controller is not reset in SM750, 251 251 * the system might hang when sw accesses the memory. 252 - * The memory should be resetted after changing the MXCLK. 252 + * The memory should be reset after changing the MXCLK. 253 253 */ 254 254 if (p_init_param->reset_memory == 1) { 255 255 reg = peek32(MISC_CTRL);
+8 -8
drivers/staging/sm750fb/sm750.c
··· 740 740 "kernel HELPERS prepared vesa_modes", 741 741 }; 742 742 743 - static const char *fixId[2] = { 743 + static const char *fix_id[2] = { 744 744 "sm750_fb1", "sm750_fb2", 745 745 }; 746 746 ··· 862 862 fix->ywrapstep = crtc->ywrapstep; 863 863 fix->accel = FB_ACCEL_SMI; 864 864 865 - strscpy(fix->id, fixId[index], sizeof(fix->id)); 865 + strscpy(fix->id, fix_id[index], sizeof(fix->id)); 866 866 867 867 fix->smem_start = crtc->o_screen + sm750_dev->vidmem_start; 868 868 pr_info("fix->smem_start = %lx\n", fix->smem_start); ··· 918 918 919 919 swap = 0; 920 920 921 - sm750_dev->initParm.chip_clk = 0; 922 - sm750_dev->initParm.mem_clk = 0; 923 - sm750_dev->initParm.master_clk = 0; 924 - sm750_dev->initParm.powerMode = 0; 925 - sm750_dev->initParm.setAllEngOff = 0; 926 - sm750_dev->initParm.resetMemory = 1; 921 + sm750_dev->init_parm.chip_clk = 0; 922 + sm750_dev->init_parm.mem_clk = 0; 923 + sm750_dev->init_parm.master_clk = 0; 924 + sm750_dev->init_parm.powerMode = 0; 925 + sm750_dev->init_parm.setAllEngOff = 0; 926 + sm750_dev->init_parm.resetMemory = 1; 927 927 928 928 /* defaultly turn g_hwcursor on for both view */ 929 929 g_hwcursor = 3;
+1 -1
drivers/staging/sm750fb/sm750.h
··· 102 102 /* locks*/ 103 103 spinlock_t slock; 104 104 105 - struct init_status initParm; 105 + struct init_status init_parm; 106 106 enum sm750_pnltype pnltype; 107 107 enum sm750_dataflow dataflow; 108 108 int nocrt;
+58 -58
drivers/staging/sm750fb/sm750_accel.c
··· 27 27 return readl(accel->dpr_base + offset); 28 28 } 29 29 30 - static inline void write_dpPort(struct lynx_accel *accel, u32 data) 30 + static inline void write_dp_port(struct lynx_accel *accel, u32 data) 31 31 { 32 32 writel(data, accel->dp_port_base); 33 33 } ··· 132 132 /** 133 133 * sm750_hw_copyarea 134 134 * @accel: Acceleration device data 135 - * @sBase: Address of source: offset in frame buffer 136 - * @sPitch: Pitch value of source surface in BYTE 135 + * @source_base: Address of source: offset in frame buffer 136 + * @source_pitch: Pitch value of source surface in BYTE 137 137 * @sx: Starting x coordinate of source surface 138 138 * @sy: Starting y coordinate of source surface 139 - * @dBase: Address of destination: offset in frame buffer 140 - * @dPitch: Pitch value of destination surface in BYTE 139 + * @dest_base: Address of destination: offset in frame buffer 140 + * @dest_pitch: Pitch value of destination surface in BYTE 141 141 * @Bpp: Color depth of destination surface 142 142 * @dx: Starting x coordinate of destination surface 143 143 * @dy: Starting y coordinate of destination surface ··· 146 146 * @rop2: ROP value 147 147 */ 148 148 int sm750_hw_copyarea(struct lynx_accel *accel, 149 - unsigned int sBase, unsigned int sPitch, 149 + unsigned int source_base, unsigned int source_pitch, 150 150 unsigned int sx, unsigned int sy, 151 - unsigned int dBase, unsigned int dPitch, 151 + unsigned int dest_base, unsigned int dest_pitch, 152 152 unsigned int Bpp, unsigned int dx, unsigned int dy, 153 153 unsigned int width, unsigned int height, 154 154 unsigned int rop2) 155 155 { 156 - unsigned int nDirection, de_ctrl; 156 + unsigned int direction, de_ctrl; 157 157 158 - nDirection = LEFT_TO_RIGHT; 158 + direction = LEFT_TO_RIGHT; 159 159 /* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */ 160 160 de_ctrl = 0; 161 161 162 162 /* If source and destination are the same surface, need to check for overlay cases */ 163 - if (sBase == dBase && sPitch == dPitch) { 163 + if (source_base == dest_base && source_pitch == dest_pitch) { 164 164 /* Determine direction of operation */ 165 165 if (sy < dy) { 166 166 /* +----------+ ··· 173 173 * +----------+ 174 174 */ 175 175 176 - nDirection = BOTTOM_TO_TOP; 176 + direction = BOTTOM_TO_TOP; 177 177 } else if (sy > dy) { 178 178 /* +----------+ 179 179 * |D | ··· 185 185 * +----------+ 186 186 */ 187 187 188 - nDirection = TOP_TO_BOTTOM; 188 + direction = TOP_TO_BOTTOM; 189 189 } else { 190 190 /* sy == dy */ 191 191 ··· 198 198 * +------+---+------+ 199 199 */ 200 200 201 - nDirection = RIGHT_TO_LEFT; 201 + direction = RIGHT_TO_LEFT; 202 202 } else { 203 203 /* sx > dx */ 204 204 ··· 210 210 * +------+---+------+ 211 211 */ 212 212 213 - nDirection = LEFT_TO_RIGHT; 213 + direction = LEFT_TO_RIGHT; 214 214 } 215 215 } 216 216 } 217 217 218 - if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) { 218 + if ((direction == BOTTOM_TO_TOP) || (direction == RIGHT_TO_LEFT)) { 219 219 sx += width - 1; 220 220 sy += height - 1; 221 221 dx += width - 1; ··· 234 234 * It is an address offset (128 bit aligned) 235 235 * from the beginning of frame buffer. 236 236 */ 237 - write_dpr(accel, DE_WINDOW_SOURCE_BASE, sBase); /* dpr40 */ 237 + write_dpr(accel, DE_WINDOW_SOURCE_BASE, source_base); /* dpr40 */ 238 238 239 239 /* 240 240 * 2D Destination Base. 241 241 * It is an address offset (128 bit aligned) 242 242 * from the beginning of frame buffer. 243 243 */ 244 - write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); /* dpr44 */ 244 + write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dest_base); /* dpr44 */ 245 245 246 246 /* 247 247 * Program pitch (distance between the 1st points of two adjacent lines). ··· 249 249 * pixel values. Need Byte to pixel conversion. 250 250 */ 251 251 write_dpr(accel, DE_PITCH, 252 - ((dPitch / Bpp << DE_PITCH_DESTINATION_SHIFT) & 252 + ((dest_pitch / Bpp << DE_PITCH_DESTINATION_SHIFT) & 253 253 DE_PITCH_DESTINATION_MASK) | 254 - (sPitch / Bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */ 254 + (source_pitch / Bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */ 255 255 256 256 /* 257 257 * Screen Window width in Pixels. ··· 259 259 * for a given point. 260 260 */ 261 261 write_dpr(accel, DE_WINDOW_WIDTH, 262 - ((dPitch / Bpp << DE_WINDOW_WIDTH_DST_SHIFT) & 262 + ((dest_pitch / Bpp << DE_WINDOW_WIDTH_DST_SHIFT) & 263 263 DE_WINDOW_WIDTH_DST_MASK) | 264 - (sPitch / Bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr3c */ 264 + (source_pitch / Bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr3c */ 265 265 266 266 if (accel->de_wait() != 0) 267 267 return -1; ··· 277 277 (height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */ 278 278 279 279 de_ctrl = (rop2 & DE_CONTROL_ROP_MASK) | DE_CONTROL_ROP_SELECT | 280 - ((nDirection == RIGHT_TO_LEFT) ? DE_CONTROL_DIRECTION : 0) | 280 + ((direction == RIGHT_TO_LEFT) ? DE_CONTROL_DIRECTION : 0) | 281 281 DE_CONTROL_COMMAND_BITBLT | DE_CONTROL_STATUS; 282 282 write_dpr(accel, DE_CONTROL, de_ctrl); /* dpr0c */ 283 283 ··· 299 299 /** 300 300 * sm750_hw_imageblit 301 301 * @accel: Acceleration device data 302 - * @pSrcbuf: pointer to start of source buffer in system memory 303 - * @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down 302 + * @src_buf: pointer to start of source buffer in system memory 303 + * @src_delta: Pitch value (in bytes) of the source buffer, +ive means top down 304 304 * and -ive mean button up 305 - * @startBit: Mono data can start at any bit in a byte, this value should be 305 + * @start_bit: Mono data can start at any bit in a byte, this value should be 306 306 * 0 to 7 307 - * @dBase: Address of destination: offset in frame buffer 308 - * @dPitch: Pitch value of destination surface in BYTE 309 - * @bytePerPixel: Color depth of destination surface 307 + * @dest_base: Address of destination: offset in frame buffer 308 + * @dest_pitch: Pitch value of destination surface in BYTE 309 + * @byte_per_pixel: Color depth of destination surface 310 310 * @dx: Starting x coordinate of destination surface 311 311 * @dy: Starting y coordinate of destination surface 312 312 * @width: width of rectangle in pixel value 313 313 * @height: height of rectangle in pixel value 314 - * @fColor: Foreground color (corresponding to a 1 in the monochrome data 315 - * @bColor: Background color (corresponding to a 0 in the monochrome data 314 + * @fg_color: Foreground color (corresponding to a 1 in the monochrome data 315 + * @bg_color: Background color (corresponding to a 0 in the monochrome data 316 316 * @rop2: ROP value 317 317 */ 318 - int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf, 319 - u32 srcDelta, u32 startBit, u32 dBase, u32 dPitch, 320 - u32 bytePerPixel, u32 dx, u32 dy, u32 width, 321 - u32 height, u32 fColor, u32 bColor, u32 rop2) 318 + int sm750_hw_imageblit(struct lynx_accel *accel, const char *src_buf, 319 + u32 src_delta, u32 start_bit, u32 dest_base, u32 dest_pitch, 320 + u32 byte_per_pixel, u32 dx, u32 dy, u32 width, 321 + u32 height, u32 fg_color, u32 bg_color, u32 rop2) 322 322 { 323 - unsigned int ulBytesPerScan; 324 - unsigned int ul4BytesPerScan; 325 - unsigned int ulBytesRemain; 323 + unsigned int bytes_per_scan; 324 + unsigned int words_per_scan; 325 + unsigned int bytes_remain; 326 326 unsigned int de_ctrl = 0; 327 - unsigned char ajRemain[4]; 327 + unsigned char remain[4]; 328 328 int i, j; 329 329 330 - startBit &= 7; /* Just make sure the start bit is within legal range */ 331 - ulBytesPerScan = (width + startBit + 7) / 8; 332 - ul4BytesPerScan = ulBytesPerScan & ~3; 333 - ulBytesRemain = ulBytesPerScan & 3; 330 + start_bit &= 7; /* Just make sure the start bit is within legal range */ 331 + bytes_per_scan = (width + start_bit + 7) / 8; 332 + words_per_scan = bytes_per_scan & ~3; 333 + bytes_remain = bytes_per_scan & 3; 334 334 335 335 if (accel->de_wait() != 0) 336 336 return -1; ··· 345 345 * It is an address offset (128 bit aligned) 346 346 * from the beginning of frame buffer. 347 347 */ 348 - write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); 348 + write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dest_base); 349 349 350 350 /* 351 351 * Program pitch (distance between the 1st points of two adjacent ··· 353 353 * register uses pixel values. Need Byte to pixel conversion. 354 354 */ 355 355 write_dpr(accel, DE_PITCH, 356 - ((dPitch / bytePerPixel << DE_PITCH_DESTINATION_SHIFT) & 356 + ((dest_pitch / byte_per_pixel << DE_PITCH_DESTINATION_SHIFT) & 357 357 DE_PITCH_DESTINATION_MASK) | 358 - (dPitch / bytePerPixel & DE_PITCH_SOURCE_MASK)); /* dpr10 */ 358 + (dest_pitch / byte_per_pixel & DE_PITCH_SOURCE_MASK)); /* dpr10 */ 359 359 360 360 /* 361 361 * Screen Window width in Pixels. ··· 363 363 * in frame buffer for a given point. 364 364 */ 365 365 write_dpr(accel, DE_WINDOW_WIDTH, 366 - ((dPitch / bytePerPixel << DE_WINDOW_WIDTH_DST_SHIFT) & 366 + ((dest_pitch / byte_per_pixel << DE_WINDOW_WIDTH_DST_SHIFT) & 367 367 DE_WINDOW_WIDTH_DST_MASK) | 368 - (dPitch / bytePerPixel & DE_WINDOW_WIDTH_SRC_MASK)); 368 + (dest_pitch / byte_per_pixel & DE_WINDOW_WIDTH_SRC_MASK)); 369 369 370 370 /* 371 371 * Note: For 2D Source in Host Write, only X_K1_MONO field is needed, 372 372 * and Y_K2 field is not used. 373 - * For mono bitmap, use startBit for X_K1. 373 + * For mono bitmap, use start_bit for X_K1. 374 374 */ 375 375 write_dpr(accel, DE_SOURCE, 376 - (startBit << DE_SOURCE_X_K1_SHIFT) & 376 + (start_bit << DE_SOURCE_X_K1_SHIFT) & 377 377 DE_SOURCE_X_K1_MONO_MASK); /* dpr00 */ 378 378 379 379 write_dpr(accel, DE_DESTINATION, ··· 384 384 ((width << DE_DIMENSION_X_SHIFT) & DE_DIMENSION_X_MASK) | 385 385 (height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */ 386 386 387 - write_dpr(accel, DE_FOREGROUND, fColor); 388 - write_dpr(accel, DE_BACKGROUND, bColor); 387 + write_dpr(accel, DE_FOREGROUND, fg_color); 388 + write_dpr(accel, DE_BACKGROUND, bg_color); 389 389 390 390 de_ctrl = (rop2 & DE_CONTROL_ROP_MASK) | 391 391 DE_CONTROL_ROP_SELECT | DE_CONTROL_COMMAND_HOST_WRITE | ··· 396 396 /* Write MONO data (line by line) to 2D Engine data port */ 397 397 for (i = 0; i < height; i++) { 398 398 /* For each line, send the data in chunks of 4 bytes */ 399 - for (j = 0; j < (ul4BytesPerScan / 4); j++) 400 - write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4))); 399 + for (j = 0; j < (words_per_scan / 4); j++) 400 + write_dp_port(accel, *(unsigned int *)(src_buf + (j * 4))); 401 401 402 - if (ulBytesRemain) { 403 - memcpy(ajRemain, pSrcbuf + ul4BytesPerScan, 404 - ulBytesRemain); 405 - write_dpPort(accel, *(unsigned int *)ajRemain); 402 + if (bytes_remain) { 403 + memcpy(remain, src_buf + words_per_scan, 404 + bytes_remain); 405 + write_dp_port(accel, *(unsigned int *)remain); 406 406 } 407 407 408 - pSrcbuf += srcDelta; 408 + src_buf += src_delta; 409 409 } 410 410 411 411 return 0;
+2 -2
drivers/staging/sm750fb/sm750_hw.c
··· 93 93 { 94 94 struct init_status *parm; 95 95 96 - parm = &sm750_dev->initParm; 96 + parm = &sm750_dev->init_parm; 97 97 if (parm->chip_clk == 0) 98 98 parm->chip_clk = (sm750_get_chip_type() == SM750LE) ? 99 99 DEFAULT_SM750LE_CHIP_CLOCK : ··· 104 104 if (parm->master_clk == 0) 105 105 parm->master_clk = parm->chip_clk / 3; 106 106 107 - ddk750_init_hw((struct initchip_param *)&sm750_dev->initParm); 107 + ddk750_init_hw((struct initchip_param *)&sm750_dev->init_parm); 108 108 /* for sm718, open pci burst */ 109 109 if (sm750_dev->devid == 0x718) { 110 110 poke32(SYSTEM_CTRL,
+1 -1
drivers/staging/vme_user/vme.c
··· 1288 1288 * already in use. Hardware specific errors also possible. 1289 1289 */ 1290 1290 int vme_irq_request(struct vme_dev *vdev, int level, int statid, 1291 - void (*callback)(int, int, void *), 1291 + void (*callback)(int level, int statid, void *priv_data), 1292 1292 void *priv_data) 1293 1293 { 1294 1294 struct vme_bridge *bridge;
+49 -48
drivers/staging/vme_user/vme.h
··· 121 121 */ 122 122 struct vme_driver { 123 123 const char *name; 124 - int (*match)(struct vme_dev *); 125 - int (*probe)(struct vme_dev *); 126 - void (*remove)(struct vme_dev *); 124 + int (*match)(struct vme_dev *vdev); 125 + int (*probe)(struct vme_dev *vdev); 126 + void (*remove)(struct vme_dev *vdev); 127 127 struct device_driver driver; 128 128 struct list_head devices; 129 129 }; 130 130 131 - void *vme_alloc_consistent(struct vme_resource *, size_t, dma_addr_t *); 132 - void vme_free_consistent(struct vme_resource *, size_t, void *, dma_addr_t); 131 + void *vme_alloc_consistent(struct vme_resource *resource, size_t size, dma_addr_t *dma); 132 + void vme_free_consistent(struct vme_resource *resource, size_t size, void *vaddr, dma_addr_t dma); 133 133 134 - size_t vme_get_size(struct vme_resource *); 134 + size_t vme_get_size(struct vme_resource *resource); 135 135 int vme_check_window(struct vme_bridge *bridge, u32 aspace, 136 136 unsigned long long vme_base, unsigned long long size); 137 137 138 - struct vme_resource *vme_slave_request(struct vme_dev *, u32, u32); 139 - int vme_slave_set(struct vme_resource *, int, unsigned long long, 140 - unsigned long long, dma_addr_t, u32, u32); 141 - int vme_slave_get(struct vme_resource *, int *, unsigned long long *, 142 - unsigned long long *, dma_addr_t *, u32 *, u32 *); 143 - void vme_slave_free(struct vme_resource *); 138 + struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address, u32 cycle); 139 + int vme_slave_set(struct vme_resource *resource, int enabled, unsigned long long vme_base, 140 + unsigned long long size, dma_addr_t buf_base, u32 aspace, u32 cycle); 141 + int vme_slave_get(struct vme_resource *resource, int *enabled, unsigned long long *vme_base, 142 + unsigned long long *size, dma_addr_t *buf_base, u32 *aspace, u32 *cycle); 143 + void vme_slave_free(struct vme_resource *resource); 144 144 145 - struct vme_resource *vme_master_request(struct vme_dev *, u32, u32, u32); 146 - int vme_master_set(struct vme_resource *, int, unsigned long long, 147 - unsigned long long, u32, u32, u32); 148 - int vme_master_get(struct vme_resource *, int *, unsigned long long *, 149 - unsigned long long *, u32 *, u32 *, u32 *); 150 - ssize_t vme_master_read(struct vme_resource *, void *, size_t, loff_t); 151 - ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t); 152 - unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int, 153 - unsigned int, loff_t); 145 + struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address, u32 cycle, u32 dwidth); 146 + int vme_master_set(struct vme_resource *resource, int enabled, unsigned long long vme_base, 147 + unsigned long long size, u32 aspace, u32 cycle, u32 dwidth); 148 + int vme_master_get(struct vme_resource *resource, int *enabled, unsigned long long *vme_base, 149 + unsigned long long *size, u32 *aspace, u32 *cycle, u32 *dwidth); 150 + ssize_t vme_master_read(struct vme_resource *resource, void *buf, size_t count, loff_t offset); 151 + ssize_t vme_master_write(struct vme_resource *resource, void *buf, size_t count, loff_t offset); 152 + unsigned int vme_master_rmw(struct vme_resource *resource, unsigned int mask, unsigned int compare, 153 + unsigned int swap, loff_t offset); 154 154 int vme_master_mmap(struct vme_resource *resource, struct vm_area_struct *vma); 155 - void vme_master_free(struct vme_resource *); 155 + void vme_master_free(struct vme_resource *resource); 156 156 157 - struct vme_resource *vme_dma_request(struct vme_dev *, u32); 158 - struct vme_dma_list *vme_new_dma_list(struct vme_resource *); 159 - struct vme_dma_attr *vme_dma_pattern_attribute(u32, u32); 160 - struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t); 161 - struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long, u32, u32, u32); 162 - void vme_dma_free_attribute(struct vme_dma_attr *); 163 - int vme_dma_list_add(struct vme_dma_list *, struct vme_dma_attr *, 164 - struct vme_dma_attr *, size_t); 165 - int vme_dma_list_exec(struct vme_dma_list *); 166 - int vme_dma_list_free(struct vme_dma_list *); 167 - int vme_dma_free(struct vme_resource *); 157 + struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route); 158 + struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource); 159 + struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern, u32 type); 160 + struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t address); 161 + struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long address, 162 + u32 aspace, u32 cycle, u32 dwidth); 163 + void vme_dma_free_attribute(struct vme_dma_attr *attributes); 164 + int vme_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src, 165 + struct vme_dma_attr *dest, size_t count); 166 + int vme_dma_list_exec(struct vme_dma_list *list); 167 + int vme_dma_list_free(struct vme_dma_list *list); 168 + int vme_dma_free(struct vme_resource *resource); 168 169 169 - int vme_irq_request(struct vme_dev *, int, int, 170 - void (*callback)(int, int, void *), void *); 171 - void vme_irq_free(struct vme_dev *, int, int); 172 - int vme_irq_generate(struct vme_dev *, int, int); 170 + int vme_irq_request(struct vme_dev *vdev, int level, int statid, 171 + void (*callback)(int level, int statid, void *priv_data), void *priv_data); 172 + void vme_irq_free(struct vme_dev *vdev, int level, int statid); 173 + int vme_irq_generate(struct vme_dev *vdev, int level, int statid); 173 174 174 - struct vme_resource *vme_lm_request(struct vme_dev *); 175 - int vme_lm_count(struct vme_resource *); 176 - int vme_lm_set(struct vme_resource *, unsigned long long, u32, u32); 177 - int vme_lm_get(struct vme_resource *, unsigned long long *, u32 *, u32 *); 178 - int vme_lm_attach(struct vme_resource *, int, void (*callback)(void *), void *); 179 - int vme_lm_detach(struct vme_resource *, int); 180 - void vme_lm_free(struct vme_resource *); 175 + struct vme_resource *vme_lm_request(struct vme_dev *vdev); 176 + int vme_lm_count(struct vme_resource *resource); 177 + int vme_lm_set(struct vme_resource *resource, unsigned long long lm_base, u32 aspace, u32 cycle); 178 + int vme_lm_get(struct vme_resource *resource, unsigned long long *lm_base, u32 *aspace, u32 *cycle); 179 + int vme_lm_attach(struct vme_resource *resource, int monitor, void (*callback)(void *), void *data); 180 + int vme_lm_detach(struct vme_resource *resource, int monitor); 181 + void vme_lm_free(struct vme_resource *resource); 181 182 182 - int vme_slot_num(struct vme_dev *); 183 - int vme_bus_num(struct vme_dev *); 183 + int vme_slot_num(struct vme_dev *vdev); 184 + int vme_bus_num(struct vme_dev *vdev); 184 185 185 - int vme_register_driver(struct vme_driver *, unsigned int); 186 - void vme_unregister_driver(struct vme_driver *); 186 + int vme_register_driver(struct vme_driver *drv, unsigned int ndevs); 187 + void vme_unregister_driver(struct vme_driver *drv); 187 188 188 189 #endif /* _VME_H_ */ 189 190
+5 -5
drivers/staging/vme_user/vme_bridge.h
··· 88 88 }; 89 89 90 90 struct vme_callback { 91 - void (*func)(int, int, void*); 91 + void (*func)(int level, int statid, void *priv_data); 92 92 void *priv_data; 93 93 }; 94 94 ··· 178 178 }; 179 179 180 180 void vme_bus_error_handler(struct vme_bridge *bridge, unsigned long long address, int am); 181 - void vme_irq_handler(struct vme_bridge *, int, int); 181 + void vme_irq_handler(struct vme_bridge *bridge, int level, int statid); 182 182 183 - struct vme_bridge *vme_init_bridge(struct vme_bridge *); 184 - int vme_register_bridge(struct vme_bridge *); 185 - void vme_unregister_bridge(struct vme_bridge *); 183 + struct vme_bridge *vme_init_bridge(struct vme_bridge *bridge); 184 + int vme_register_bridge(struct vme_bridge *bridge); 185 + void vme_unregister_bridge(struct vme_bridge *bridge); 186 186 struct vme_error_handler *vme_register_error_handler(struct vme_bridge *bridge, u32 aspace, 187 187 unsigned long long address, size_t len); 188 188 void vme_unregister_error_handler(struct vme_error_handler *handler);
+1 -1
drivers/staging/vme_user/vme_user.c
··· 690 690 return err; 691 691 } 692 692 693 - static void vme_user_remove(struct vme_dev *dev) 693 + static void vme_user_remove(struct vme_dev *vdev) 694 694 { 695 695 int i; 696 696