Skip to content

Commit 9085423

Browse files
committed
Merge tag 'char-misc-5.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here are some small driver fixes for 5.14-rc7. They consist of: - revert for an interconnect patch that was found to have problems - ipack tpci200 driver fixes for reported problems - slimbus messaging and ngd fixes for reported problems All are small and have been in linux-next for a while with no reported issues" * tag 'char-misc-5.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: ipack: tpci200: fix memory leak in the tpci200_register ipack: tpci200: fix many double free issues in tpci200_pci_probe slimbus: ngd: reset dma setup during runtime pm slimbus: ngd: set correct device for pm slimbus: messaging: check for valid transaction id slimbus: messaging: start transaction ids from 1 instead of zero Revert "interconnect: qcom: icc-rpmh: Add BCMs to commit list in pre_aggregate"
2 parents f4ff9e6 + d30836a commit 9085423

File tree

4 files changed

+54
-45
lines changed

4 files changed

+54
-45
lines changed

drivers/interconnect/qcom/icc-rpmh.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,13 @@ void qcom_icc_pre_aggregate(struct icc_node *node)
2020
{
2121
size_t i;
2222
struct qcom_icc_node *qn;
23-
struct qcom_icc_provider *qp;
2423

2524
qn = node->data;
26-
qp = to_qcom_provider(node->provider);
2725

2826
for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) {
2927
qn->sum_avg[i] = 0;
3028
qn->max_peak[i] = 0;
3129
}
32-
33-
for (i = 0; i < qn->num_bcms; i++)
34-
qcom_icc_bcm_voter_add(qp->voter, qn->bcms[i]);
3530
}
3631
EXPORT_SYMBOL_GPL(qcom_icc_pre_aggregate);
3732

@@ -49,8 +44,10 @@ int qcom_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
4944
{
5045
size_t i;
5146
struct qcom_icc_node *qn;
47+
struct qcom_icc_provider *qp;
5248

5349
qn = node->data;
50+
qp = to_qcom_provider(node->provider);
5451

5552
if (!tag)
5653
tag = QCOM_ICC_TAG_ALWAYS;
@@ -70,6 +67,9 @@ int qcom_icc_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
7067
*agg_avg += avg_bw;
7168
*agg_peak = max_t(u32, *agg_peak, peak_bw);
7269

70+
for (i = 0; i < qn->num_bcms; i++)
71+
qcom_icc_bcm_voter_add(qp->voter, qn->bcms[i]);
72+
7373
return 0;
7474
}
7575
EXPORT_SYMBOL_GPL(qcom_icc_aggregate);

drivers/ipack/carriers/tpci200.c

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,13 @@ static void tpci200_unregister(struct tpci200_board *tpci200)
8989
free_irq(tpci200->info->pdev->irq, (void *) tpci200);
9090

9191
pci_iounmap(tpci200->info->pdev, tpci200->info->interface_regs);
92-
pci_iounmap(tpci200->info->pdev, tpci200->info->cfg_regs);
9392

9493
pci_release_region(tpci200->info->pdev, TPCI200_IP_INTERFACE_BAR);
9594
pci_release_region(tpci200->info->pdev, TPCI200_IO_ID_INT_SPACES_BAR);
9695
pci_release_region(tpci200->info->pdev, TPCI200_MEM16_SPACE_BAR);
9796
pci_release_region(tpci200->info->pdev, TPCI200_MEM8_SPACE_BAR);
98-
pci_release_region(tpci200->info->pdev, TPCI200_CFG_MEM_BAR);
9997

10098
pci_disable_device(tpci200->info->pdev);
101-
pci_dev_put(tpci200->info->pdev);
10299
}
103100

104101
static void tpci200_enable_irq(struct tpci200_board *tpci200,
@@ -257,7 +254,7 @@ static int tpci200_register(struct tpci200_board *tpci200)
257254
"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 2 !",
258255
tpci200->info->pdev->bus->number,
259256
tpci200->info->pdev->devfn);
260-
goto out_disable_pci;
257+
goto err_disable_device;
261258
}
262259

263260
/* Request IO ID INT space (Bar 3) */
@@ -269,7 +266,7 @@ static int tpci200_register(struct tpci200_board *tpci200)
269266
"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 3 !",
270267
tpci200->info->pdev->bus->number,
271268
tpci200->info->pdev->devfn);
272-
goto out_release_ip_space;
269+
goto err_ip_interface_bar;
273270
}
274271

275272
/* Request MEM8 space (Bar 5) */
@@ -280,7 +277,7 @@ static int tpci200_register(struct tpci200_board *tpci200)
280277
"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 5!",
281278
tpci200->info->pdev->bus->number,
282279
tpci200->info->pdev->devfn);
283-
goto out_release_ioid_int_space;
280+
goto err_io_id_int_spaces_bar;
284281
}
285282

286283
/* Request MEM16 space (Bar 4) */
@@ -291,7 +288,7 @@ static int tpci200_register(struct tpci200_board *tpci200)
291288
"(bn 0x%X, sn 0x%X) failed to allocate PCI resource for BAR 4!",
292289
tpci200->info->pdev->bus->number,
293290
tpci200->info->pdev->devfn);
294-
goto out_release_mem8_space;
291+
goto err_mem8_space_bar;
295292
}
296293

297294
/* Map internal tpci200 driver user space */
@@ -305,7 +302,7 @@ static int tpci200_register(struct tpci200_board *tpci200)
305302
tpci200->info->pdev->bus->number,
306303
tpci200->info->pdev->devfn);
307304
res = -ENOMEM;
308-
goto out_release_mem8_space;
305+
goto err_mem16_space_bar;
309306
}
310307

311308
/* Initialize lock that protects interface_regs */
@@ -344,18 +341,22 @@ static int tpci200_register(struct tpci200_board *tpci200)
344341
"(bn 0x%X, sn 0x%X) unable to register IRQ !",
345342
tpci200->info->pdev->bus->number,
346343
tpci200->info->pdev->devfn);
347-
goto out_release_ioid_int_space;
344+
goto err_interface_regs;
348345
}
349346

350347
return 0;
351348

352-
out_release_mem8_space:
349+
err_interface_regs:
350+
pci_iounmap(tpci200->info->pdev, tpci200->info->interface_regs);
351+
err_mem16_space_bar:
352+
pci_release_region(tpci200->info->pdev, TPCI200_MEM16_SPACE_BAR);
353+
err_mem8_space_bar:
353354
pci_release_region(tpci200->info->pdev, TPCI200_MEM8_SPACE_BAR);
354-
out_release_ioid_int_space:
355+
err_io_id_int_spaces_bar:
355356
pci_release_region(tpci200->info->pdev, TPCI200_IO_ID_INT_SPACES_BAR);
356-
out_release_ip_space:
357+
err_ip_interface_bar:
357358
pci_release_region(tpci200->info->pdev, TPCI200_IP_INTERFACE_BAR);
358-
out_disable_pci:
359+
err_disable_device:
359360
pci_disable_device(tpci200->info->pdev);
360361
return res;
361362
}
@@ -527,7 +528,7 @@ static int tpci200_pci_probe(struct pci_dev *pdev,
527528
tpci200->info = kzalloc(sizeof(struct tpci200_infos), GFP_KERNEL);
528529
if (!tpci200->info) {
529530
ret = -ENOMEM;
530-
goto out_err_info;
531+
goto err_tpci200;
531532
}
532533

533534
pci_dev_get(pdev);
@@ -538,15 +539,15 @@ static int tpci200_pci_probe(struct pci_dev *pdev,
538539
if (ret) {
539540
dev_err(&pdev->dev, "Failed to allocate PCI Configuration Memory");
540541
ret = -EBUSY;
541-
goto out_err_pci_request;
542+
goto err_tpci200_info;
542543
}
543544
tpci200->info->cfg_regs = ioremap(
544545
pci_resource_start(pdev, TPCI200_CFG_MEM_BAR),
545546
pci_resource_len(pdev, TPCI200_CFG_MEM_BAR));
546547
if (!tpci200->info->cfg_regs) {
547548
dev_err(&pdev->dev, "Failed to map PCI Configuration Memory");
548549
ret = -EFAULT;
549-
goto out_err_ioremap;
550+
goto err_request_region;
550551
}
551552

552553
/* Disable byte swapping for 16 bit IP module access. This will ensure
@@ -569,7 +570,7 @@ static int tpci200_pci_probe(struct pci_dev *pdev,
569570
if (ret) {
570571
dev_err(&pdev->dev, "error during tpci200 install\n");
571572
ret = -ENODEV;
572-
goto out_err_install;
573+
goto err_cfg_regs;
573574
}
574575

575576
/* Register the carrier in the industry pack bus driver */
@@ -581,7 +582,7 @@ static int tpci200_pci_probe(struct pci_dev *pdev,
581582
dev_err(&pdev->dev,
582583
"error registering the carrier on ipack driver\n");
583584
ret = -EFAULT;
584-
goto out_err_bus_register;
585+
goto err_tpci200_install;
585586
}
586587

587588
/* save the bus number given by ipack to logging purpose */
@@ -592,19 +593,16 @@ static int tpci200_pci_probe(struct pci_dev *pdev,
592593
tpci200_create_device(tpci200, i);
593594
return 0;
594595

595-
out_err_bus_register:
596+
err_tpci200_install:
596597
tpci200_uninstall(tpci200);
597-
/* tpci200->info->cfg_regs is unmapped in tpci200_uninstall */
598-
tpci200->info->cfg_regs = NULL;
599-
out_err_install:
600-
if (tpci200->info->cfg_regs)
601-
iounmap(tpci200->info->cfg_regs);
602-
out_err_ioremap:
598+
err_cfg_regs:
599+
pci_iounmap(tpci200->info->pdev, tpci200->info->cfg_regs);
600+
err_request_region:
603601
pci_release_region(pdev, TPCI200_CFG_MEM_BAR);
604-
out_err_pci_request:
605-
pci_dev_put(pdev);
602+
err_tpci200_info:
606603
kfree(tpci200->info);
607-
out_err_info:
604+
pci_dev_put(pdev);
605+
err_tpci200:
608606
kfree(tpci200);
609607
return ret;
610608
}
@@ -614,6 +612,12 @@ static void __tpci200_pci_remove(struct tpci200_board *tpci200)
614612
ipack_bus_unregister(tpci200->info->ipack_bus);
615613
tpci200_uninstall(tpci200);
616614

615+
pci_iounmap(tpci200->info->pdev, tpci200->info->cfg_regs);
616+
617+
pci_release_region(tpci200->info->pdev, TPCI200_CFG_MEM_BAR);
618+
619+
pci_dev_put(tpci200->info->pdev);
620+
617621
kfree(tpci200->info);
618622
kfree(tpci200);
619623
}

drivers/slimbus/messaging.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int slim_alloc_txn_tid(struct slim_controller *ctrl, struct slim_msg_txn *txn)
6666
int ret = 0;
6767

6868
spin_lock_irqsave(&ctrl->txn_lock, flags);
69-
ret = idr_alloc_cyclic(&ctrl->tid_idr, txn, 0,
69+
ret = idr_alloc_cyclic(&ctrl->tid_idr, txn, 1,
7070
SLIM_MAX_TIDS, GFP_ATOMIC);
7171
if (ret < 0) {
7272
spin_unlock_irqrestore(&ctrl->txn_lock, flags);
@@ -131,7 +131,8 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
131131
goto slim_xfer_err;
132132
}
133133
}
134-
134+
/* Initialize tid to invalid value */
135+
txn->tid = 0;
135136
need_tid = slim_tid_txn(txn->mt, txn->mc);
136137

137138
if (need_tid) {
@@ -163,7 +164,7 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn)
163164
txn->mt, txn->mc, txn->la, ret);
164165

165166
slim_xfer_err:
166-
if (!clk_pause_msg && (!need_tid || ret == -ETIMEDOUT)) {
167+
if (!clk_pause_msg && (txn->tid == 0 || ret == -ETIMEDOUT)) {
167168
/*
168169
* remove runtime-pm vote if this was TX only, or
169170
* if there was error during this transaction

drivers/slimbus/qcom-ngd-ctrl.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ static void qcom_slim_ngd_rx(struct qcom_slim_ngd_ctrl *ctrl, u8 *buf)
618618
(mc == SLIM_USR_MC_GENERIC_ACK &&
619619
mt == SLIM_MSG_MT_SRC_REFERRED_USER)) {
620620
slim_msg_response(&ctrl->ctrl, &buf[4], buf[3], len - 4);
621-
pm_runtime_mark_last_busy(ctrl->dev);
621+
pm_runtime_mark_last_busy(ctrl->ctrl.dev);
622622
}
623623
}
624624

@@ -1080,7 +1080,8 @@ static void qcom_slim_ngd_setup(struct qcom_slim_ngd_ctrl *ctrl)
10801080
{
10811081
u32 cfg = readl_relaxed(ctrl->ngd->base);
10821082

1083-
if (ctrl->state == QCOM_SLIM_NGD_CTRL_DOWN)
1083+
if (ctrl->state == QCOM_SLIM_NGD_CTRL_DOWN ||
1084+
ctrl->state == QCOM_SLIM_NGD_CTRL_ASLEEP)
10841085
qcom_slim_ngd_init_dma(ctrl);
10851086

10861087
/* By default enable message queues */
@@ -1131,6 +1132,7 @@ static int qcom_slim_ngd_power_up(struct qcom_slim_ngd_ctrl *ctrl)
11311132
dev_info(ctrl->dev, "Subsys restart: ADSP active framer\n");
11321133
return 0;
11331134
}
1135+
qcom_slim_ngd_setup(ctrl);
11341136
return 0;
11351137
}
11361138

@@ -1257,13 +1259,14 @@ static int qcom_slim_ngd_enable(struct qcom_slim_ngd_ctrl *ctrl, bool enable)
12571259
}
12581260
/* controller state should be in sync with framework state */
12591261
complete(&ctrl->qmi.qmi_comp);
1260-
if (!pm_runtime_enabled(ctrl->dev) ||
1261-
!pm_runtime_suspended(ctrl->dev))
1262-
qcom_slim_ngd_runtime_resume(ctrl->dev);
1262+
if (!pm_runtime_enabled(ctrl->ctrl.dev) ||
1263+
!pm_runtime_suspended(ctrl->ctrl.dev))
1264+
qcom_slim_ngd_runtime_resume(ctrl->ctrl.dev);
12631265
else
1264-
pm_runtime_resume(ctrl->dev);
1265-
pm_runtime_mark_last_busy(ctrl->dev);
1266-
pm_runtime_put(ctrl->dev);
1266+
pm_runtime_resume(ctrl->ctrl.dev);
1267+
1268+
pm_runtime_mark_last_busy(ctrl->ctrl.dev);
1269+
pm_runtime_put(ctrl->ctrl.dev);
12671270

12681271
ret = slim_register_controller(&ctrl->ctrl);
12691272
if (ret) {
@@ -1389,7 +1392,7 @@ static int qcom_slim_ngd_ssr_pdr_notify(struct qcom_slim_ngd_ctrl *ctrl,
13891392
/* Make sure the last dma xfer is finished */
13901393
mutex_lock(&ctrl->tx_lock);
13911394
if (ctrl->state != QCOM_SLIM_NGD_CTRL_DOWN) {
1392-
pm_runtime_get_noresume(ctrl->dev);
1395+
pm_runtime_get_noresume(ctrl->ctrl.dev);
13931396
ctrl->state = QCOM_SLIM_NGD_CTRL_DOWN;
13941397
qcom_slim_ngd_down(ctrl);
13951398
qcom_slim_ngd_exit_dma(ctrl);
@@ -1617,6 +1620,7 @@ static int __maybe_unused qcom_slim_ngd_runtime_suspend(struct device *dev)
16171620
struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev);
16181621
int ret = 0;
16191622

1623+
qcom_slim_ngd_exit_dma(ctrl);
16201624
if (!ctrl->qmi.handle)
16211625
return 0;
16221626

0 commit comments

Comments
 (0)