| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Keystone Queue Manager subsystem driver |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * Authors: Sandeep Nair <sandeep_n@ti.com> |
|---|
| 6 | 7 | * Cyril Chemparathy <cyril@ti.com> |
|---|
| 7 | 8 | * Santosh Shilimkar <santosh.shilimkar@ti.com> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or |
|---|
| 10 | | - * modify it under the terms of the GNU General Public License |
|---|
| 11 | | - * version 2 as published by the Free Software Foundation. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 14 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 16 | | - * General Public License for more details. |
|---|
| 17 | 9 | */ |
|---|
| 18 | 10 | |
|---|
| 19 | 11 | #include <linux/debugfs.h> |
|---|
| .. | .. |
|---|
| 33 | 25 | |
|---|
| 34 | 26 | static struct knav_device *kdev; |
|---|
| 35 | 27 | static DEFINE_MUTEX(knav_dev_lock); |
|---|
| 28 | +#define knav_dev_lock_held() \ |
|---|
| 29 | + lockdep_is_held(&knav_dev_lock) |
|---|
| 36 | 30 | |
|---|
| 37 | 31 | /* Queue manager register indices in DTS */ |
|---|
| 38 | 32 | #define KNAV_QUEUE_PEEK_REG_INDEX 0 |
|---|
| .. | .. |
|---|
| 60 | 54 | #define knav_queue_idx_to_inst(kdev, idx) \ |
|---|
| 61 | 55 | (kdev->instances + (idx << kdev->inst_shift)) |
|---|
| 62 | 56 | |
|---|
| 63 | | -#define for_each_handle_rcu(qh, inst) \ |
|---|
| 64 | | - list_for_each_entry_rcu(qh, &inst->handles, list) |
|---|
| 57 | +#define for_each_handle_rcu(qh, inst) \ |
|---|
| 58 | + list_for_each_entry_rcu(qh, &inst->handles, list, \ |
|---|
| 59 | + knav_dev_lock_held()) |
|---|
| 65 | 60 | |
|---|
| 66 | 61 | #define for_each_instance(idx, inst, kdev) \ |
|---|
| 67 | 62 | for (idx = 0, inst = kdev->instances; \ |
|---|
| .. | .. |
|---|
| 414 | 409 | return 0; |
|---|
| 415 | 410 | } |
|---|
| 416 | 411 | |
|---|
| 417 | | -struct knav_range_ops knav_gp_range_ops = { |
|---|
| 412 | +static struct knav_range_ops knav_gp_range_ops = { |
|---|
| 418 | 413 | .set_notify = knav_gp_set_notify, |
|---|
| 419 | 414 | .open_queue = knav_gp_open_queue, |
|---|
| 420 | 415 | .close_queue = knav_gp_close_queue, |
|---|
| .. | .. |
|---|
| 483 | 478 | return 0; |
|---|
| 484 | 479 | } |
|---|
| 485 | 480 | |
|---|
| 486 | | -static int knav_queue_debug_open(struct inode *inode, struct file *file) |
|---|
| 487 | | -{ |
|---|
| 488 | | - return single_open(file, knav_queue_debug_show, NULL); |
|---|
| 489 | | -} |
|---|
| 490 | | - |
|---|
| 491 | | -static const struct file_operations knav_queue_debug_ops = { |
|---|
| 492 | | - .open = knav_queue_debug_open, |
|---|
| 493 | | - .read = seq_read, |
|---|
| 494 | | - .llseek = seq_lseek, |
|---|
| 495 | | - .release = single_release, |
|---|
| 496 | | -}; |
|---|
| 481 | +DEFINE_SHOW_ATTRIBUTE(knav_queue_debug); |
|---|
| 497 | 482 | |
|---|
| 498 | 483 | static inline int knav_queue_pdsp_wait(u32 * __iomem addr, unsigned timeout, |
|---|
| 499 | 484 | u32 flags) |
|---|
| .. | .. |
|---|
| 1390 | 1375 | |
|---|
| 1391 | 1376 | ret = of_address_to_resource(node, index, &res); |
|---|
| 1392 | 1377 | if (ret) { |
|---|
| 1393 | | - dev_err(kdev->dev, "Can't translate of node(%s) address for index(%d)\n", |
|---|
| 1394 | | - node->name, index); |
|---|
| 1378 | + dev_err(kdev->dev, "Can't translate of node(%pOFn) address for index(%d)\n", |
|---|
| 1379 | + node, index); |
|---|
| 1395 | 1380 | return ERR_PTR(ret); |
|---|
| 1396 | 1381 | } |
|---|
| 1397 | 1382 | |
|---|
| 1398 | 1383 | regs = devm_ioremap_resource(kdev->dev, &res); |
|---|
| 1399 | 1384 | if (IS_ERR(regs)) |
|---|
| 1400 | | - dev_err(kdev->dev, "Failed to map register base for index(%d) node(%s)\n", |
|---|
| 1401 | | - index, node->name); |
|---|
| 1385 | + dev_err(kdev->dev, "Failed to map register base for index(%d) node(%pOFn)\n", |
|---|
| 1386 | + index, node); |
|---|
| 1402 | 1387 | return regs; |
|---|
| 1403 | 1388 | } |
|---|
| 1404 | 1389 | |
|---|
| .. | .. |
|---|
| 1885 | 1870 | } |
|---|
| 1886 | 1871 | |
|---|
| 1887 | 1872 | debugfs_create_file("qmss", S_IFREG | S_IRUGO, NULL, NULL, |
|---|
| 1888 | | - &knav_queue_debug_ops); |
|---|
| 1873 | + &knav_queue_debug_fops); |
|---|
| 1889 | 1874 | device_ready = true; |
|---|
| 1890 | 1875 | return 0; |
|---|
| 1891 | 1876 | |
|---|