| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 2016 Broadcom |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License, version 2, as |
|---|
| 6 | | - * published by the Free Software Foundation (the "GPL"). |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 9 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 11 | | - * General Public License version 2 (GPLv2) for more details. |
|---|
| 12 | | - * |
|---|
| 13 | | - * You should have received a copy of the GNU General Public License |
|---|
| 14 | | - * version 2 (GPLv2) along with this source code. |
|---|
| 15 | 4 | */ |
|---|
| 16 | 5 | |
|---|
| 17 | 6 | /* |
|---|
| .. | .. |
|---|
| 406 | 395 | */ |
|---|
| 407 | 396 | struct scatterlist *src_sg[PDC_RING_ENTRIES]; |
|---|
| 408 | 397 | |
|---|
| 409 | | - struct dentry *debugfs_stats; /* debug FS stats file for this PDC */ |
|---|
| 410 | | - |
|---|
| 411 | 398 | /* counters */ |
|---|
| 412 | 399 | u32 pdc_requests; /* number of request messages submitted */ |
|---|
| 413 | 400 | u32 pdc_replies; /* number of reply messages received */ |
|---|
| .. | .. |
|---|
| 449 | 436 | |
|---|
| 450 | 437 | pdcs = filp->private_data; |
|---|
| 451 | 438 | out_offset = 0; |
|---|
| 452 | | - out_offset += snprintf(buf + out_offset, out_count - out_offset, |
|---|
| 439 | + out_offset += scnprintf(buf + out_offset, out_count - out_offset, |
|---|
| 453 | 440 | "SPU %u stats:\n", pdcs->pdc_idx); |
|---|
| 454 | | - out_offset += snprintf(buf + out_offset, out_count - out_offset, |
|---|
| 441 | + out_offset += scnprintf(buf + out_offset, out_count - out_offset, |
|---|
| 455 | 442 | "PDC requests....................%u\n", |
|---|
| 456 | 443 | pdcs->pdc_requests); |
|---|
| 457 | | - out_offset += snprintf(buf + out_offset, out_count - out_offset, |
|---|
| 444 | + out_offset += scnprintf(buf + out_offset, out_count - out_offset, |
|---|
| 458 | 445 | "PDC responses...................%u\n", |
|---|
| 459 | 446 | pdcs->pdc_replies); |
|---|
| 460 | | - out_offset += snprintf(buf + out_offset, out_count - out_offset, |
|---|
| 447 | + out_offset += scnprintf(buf + out_offset, out_count - out_offset, |
|---|
| 461 | 448 | "Tx not done.....................%u\n", |
|---|
| 462 | 449 | pdcs->last_tx_not_done); |
|---|
| 463 | | - out_offset += snprintf(buf + out_offset, out_count - out_offset, |
|---|
| 450 | + out_offset += scnprintf(buf + out_offset, out_count - out_offset, |
|---|
| 464 | 451 | "Tx ring full....................%u\n", |
|---|
| 465 | 452 | pdcs->tx_ring_full); |
|---|
| 466 | | - out_offset += snprintf(buf + out_offset, out_count - out_offset, |
|---|
| 453 | + out_offset += scnprintf(buf + out_offset, out_count - out_offset, |
|---|
| 467 | 454 | "Rx ring full....................%u\n", |
|---|
| 468 | 455 | pdcs->rx_ring_full); |
|---|
| 469 | | - out_offset += snprintf(buf + out_offset, out_count - out_offset, |
|---|
| 456 | + out_offset += scnprintf(buf + out_offset, out_count - out_offset, |
|---|
| 470 | 457 | "Tx desc write fail. Ring full...%u\n", |
|---|
| 471 | 458 | pdcs->txnobuf); |
|---|
| 472 | | - out_offset += snprintf(buf + out_offset, out_count - out_offset, |
|---|
| 459 | + out_offset += scnprintf(buf + out_offset, out_count - out_offset, |
|---|
| 473 | 460 | "Rx desc write fail. Ring full...%u\n", |
|---|
| 474 | 461 | pdcs->rxnobuf); |
|---|
| 475 | | - out_offset += snprintf(buf + out_offset, out_count - out_offset, |
|---|
| 462 | + out_offset += scnprintf(buf + out_offset, out_count - out_offset, |
|---|
| 476 | 463 | "Receive overflow................%u\n", |
|---|
| 477 | 464 | pdcs->rx_oflow); |
|---|
| 478 | | - out_offset += snprintf(buf + out_offset, out_count - out_offset, |
|---|
| 465 | + out_offset += scnprintf(buf + out_offset, out_count - out_offset, |
|---|
| 479 | 466 | "Num frags in rx ring............%u\n", |
|---|
| 480 | 467 | NRXDACTIVE(pdcs->rxin, pdcs->last_rx_curr, |
|---|
| 481 | 468 | pdcs->nrxpost)); |
|---|
| .. | .. |
|---|
| 512 | 499 | debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL); |
|---|
| 513 | 500 | |
|---|
| 514 | 501 | /* S_IRUSR == 0400 */ |
|---|
| 515 | | - pdcs->debugfs_stats = debugfs_create_file(spu_stats_name, 0400, |
|---|
| 516 | | - debugfs_dir, pdcs, |
|---|
| 517 | | - &pdc_debugfs_stats); |
|---|
| 502 | + debugfs_create_file(spu_stats_name, 0400, debugfs_dir, pdcs, |
|---|
| 503 | + &pdc_debugfs_stats); |
|---|
| 518 | 504 | } |
|---|
| 519 | 505 | |
|---|
| 520 | 506 | static void pdc_free_debugfs(void) |
|---|
| .. | .. |
|---|
| 693 | 679 | |
|---|
| 694 | 680 | /* read last_rx_curr from register once */ |
|---|
| 695 | 681 | pdcs->last_rx_curr = |
|---|
| 696 | | - (ioread32(&pdcs->rxregs_64->status0) & |
|---|
| 682 | + (ioread32((const void __iomem *)&pdcs->rxregs_64->status0) & |
|---|
| 697 | 683 | CRYPTO_D64_RS0_CD_MASK) / RING_ENTRY_SIZE; |
|---|
| 698 | 684 | |
|---|
| 699 | 685 | do { |
|---|
| .. | .. |
|---|
| 976 | 962 | * a DMA receive interrupt. Reenables the receive interrupt. |
|---|
| 977 | 963 | * @data: PDC state structure |
|---|
| 978 | 964 | */ |
|---|
| 979 | | -static void pdc_tasklet_cb(unsigned long data) |
|---|
| 965 | +static void pdc_tasklet_cb(struct tasklet_struct *t) |
|---|
| 980 | 966 | { |
|---|
| 981 | | - struct pdc_state *pdcs = (struct pdc_state *)data; |
|---|
| 967 | + struct pdc_state *pdcs = from_tasklet(pdcs, t, rx_tasklet); |
|---|
| 982 | 968 | |
|---|
| 983 | 969 | pdc_receive(pdcs); |
|---|
| 984 | 970 | |
|---|
| .. | .. |
|---|
| 1471 | 1457 | mbc->chans[chan_index].con_priv = pdcs; |
|---|
| 1472 | 1458 | |
|---|
| 1473 | 1459 | /* Register mailbox controller */ |
|---|
| 1474 | | - err = mbox_controller_register(mbc); |
|---|
| 1460 | + err = devm_mbox_controller_register(dev, mbc); |
|---|
| 1475 | 1461 | if (err) { |
|---|
| 1476 | 1462 | dev_crit(dev, |
|---|
| 1477 | 1463 | "Failed to register PDC mailbox controller. Error %d.", |
|---|
| .. | .. |
|---|
| 1603 | 1589 | pdc_hw_init(pdcs); |
|---|
| 1604 | 1590 | |
|---|
| 1605 | 1591 | /* Init tasklet for deferred DMA rx processing */ |
|---|
| 1606 | | - tasklet_init(&pdcs->rx_tasklet, pdc_tasklet_cb, (unsigned long)pdcs); |
|---|
| 1592 | + tasklet_setup(&pdcs->rx_tasklet, pdc_tasklet_cb); |
|---|
| 1607 | 1593 | |
|---|
| 1608 | 1594 | err = pdc_interrupts_init(pdcs); |
|---|
| 1609 | 1595 | if (err) |
|---|
| .. | .. |
|---|
| 1614 | 1600 | if (err) |
|---|
| 1615 | 1601 | goto cleanup_buf_pool; |
|---|
| 1616 | 1602 | |
|---|
| 1617 | | - pdcs->debugfs_stats = NULL; |
|---|
| 1618 | 1603 | pdc_setup_debugfs(pdcs); |
|---|
| 1619 | 1604 | |
|---|
| 1620 | 1605 | dev_dbg(dev, "pdc_probe() successful"); |
|---|
| .. | .. |
|---|
| 1640 | 1625 | tasklet_kill(&pdcs->rx_tasklet); |
|---|
| 1641 | 1626 | |
|---|
| 1642 | 1627 | pdc_hw_disable(pdcs); |
|---|
| 1643 | | - |
|---|
| 1644 | | - mbox_controller_unregister(&pdcs->mbc); |
|---|
| 1645 | 1628 | |
|---|
| 1646 | 1629 | dma_pool_destroy(pdcs->rx_buf_pool); |
|---|
| 1647 | 1630 | dma_pool_destroy(pdcs->ring_pool); |
|---|