Skip to content

Commit ae3147b

Browse files
committed
Merge tag 'imx-soc-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into arm/soc
i.MX SoC update for 6.3: - Call ida_simple_remove() to free up ID allocated by ida_simple_get() for MMDC driver. - Add i.MX6ULZ compatible string to match table. * tag 'imx-soc-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux: ARM: imx: mach-imx6ul: add imx6ulz support ARM: imx: Call ida_simple_remove() for ida_simple_get Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 3f0f5d2 + 7c355b5 commit ae3147b

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

arch/arm/mach-imx/mach-imx6ul.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ static void __init imx6ul_init_late(void)
6363
static const char * const imx6ul_dt_compat[] __initconst = {
6464
"fsl,imx6ul",
6565
"fsl,imx6ull",
66+
"fsl,imx6ulz",
6667
NULL,
6768
};
6869

arch/arm/mach-imx/mmdc.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct mmdc_pmu {
9999
cpumask_t cpu;
100100
struct hrtimer hrtimer;
101101
unsigned int active_events;
102+
int id;
102103
struct device *dev;
103104
struct perf_event *mmdc_events[MMDC_NUM_COUNTERS];
104105
struct hlist_node node;
@@ -433,8 +434,6 @@ static enum hrtimer_restart mmdc_pmu_timer_handler(struct hrtimer *hrtimer)
433434
static int mmdc_pmu_init(struct mmdc_pmu *pmu_mmdc,
434435
void __iomem *mmdc_base, struct device *dev)
435436
{
436-
int mmdc_num;
437-
438437
*pmu_mmdc = (struct mmdc_pmu) {
439438
.pmu = (struct pmu) {
440439
.task_ctx_nr = perf_invalid_context,
@@ -452,15 +451,16 @@ static int mmdc_pmu_init(struct mmdc_pmu *pmu_mmdc,
452451
.active_events = 0,
453452
};
454453

455-
mmdc_num = ida_simple_get(&mmdc_ida, 0, 0, GFP_KERNEL);
454+
pmu_mmdc->id = ida_simple_get(&mmdc_ida, 0, 0, GFP_KERNEL);
456455

457-
return mmdc_num;
456+
return pmu_mmdc->id;
458457
}
459458

460459
static int imx_mmdc_remove(struct platform_device *pdev)
461460
{
462461
struct mmdc_pmu *pmu_mmdc = platform_get_drvdata(pdev);
463462

463+
ida_simple_remove(&mmdc_ida, pmu_mmdc->id);
464464
cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
465465
perf_pmu_unregister(&pmu_mmdc->pmu);
466466
iounmap(pmu_mmdc->mmdc_base);
@@ -474,7 +474,6 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b
474474
{
475475
struct mmdc_pmu *pmu_mmdc;
476476
char *name;
477-
int mmdc_num;
478477
int ret;
479478
const struct of_device_id *of_id =
480479
of_match_device(imx_mmdc_dt_ids, &pdev->dev);
@@ -497,14 +496,14 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b
497496
cpuhp_mmdc_state = ret;
498497
}
499498

500-
mmdc_num = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev);
501-
pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk;
502-
if (mmdc_num == 0)
503-
name = "mmdc";
504-
else
505-
name = devm_kasprintf(&pdev->dev,
506-
GFP_KERNEL, "mmdc%d", mmdc_num);
499+
ret = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev);
500+
if (ret < 0)
501+
goto pmu_free;
507502

503+
name = devm_kasprintf(&pdev->dev,
504+
GFP_KERNEL, "mmdc%d", ret);
505+
506+
pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk;
508507
pmu_mmdc->devtype_data = (struct fsl_mmdc_devtype_data *)of_id->data;
509508

510509
hrtimer_init(&pmu_mmdc->hrtimer, CLOCK_MONOTONIC,
@@ -525,6 +524,7 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b
525524

526525
pmu_register_err:
527526
pr_warn("MMDC Perf PMU failed (%d), disabled\n", ret);
527+
ida_simple_remove(&mmdc_ida, pmu_mmdc->id);
528528
cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
529529
hrtimer_cancel(&pmu_mmdc->hrtimer);
530530
pmu_free:

0 commit comments

Comments
 (0)