| .. | .. |
|---|
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved. |
|---|
| 4 | + * (C) COPYRIGHT 2019-2022 ARM Limited. All rights reserved. |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * This program is free software and is provided to you under the terms of the |
|---|
| 7 | 7 | * GNU General Public License version 2 as published by the Free Software |
|---|
| .. | .. |
|---|
| 28 | 28 | #include <tl/mali_kbase_tracepoints.h> |
|---|
| 29 | 29 | #include <linux/of.h> |
|---|
| 30 | 30 | #include <linux/of_platform.h> |
|---|
| 31 | | -#include "mali_kbase_arbiter_interface.h" |
|---|
| 31 | +#include "linux/mali_arbiter_interface.h" |
|---|
| 32 | 32 | |
|---|
| 33 | 33 | /* Arbiter interface version against which was implemented this module */ |
|---|
| 34 | 34 | #define MALI_REQUIRED_KBASE_ARBITER_INTERFACE_VERSION 5 |
|---|
| 35 | 35 | #if MALI_REQUIRED_KBASE_ARBITER_INTERFACE_VERSION != \ |
|---|
| 36 | | - MALI_KBASE_ARBITER_INTERFACE_VERSION |
|---|
| 36 | + MALI_ARBITER_INTERFACE_VERSION |
|---|
| 37 | 37 | #error "Unsupported Mali Arbiter interface version." |
|---|
| 38 | 38 | #endif |
|---|
| 39 | 39 | |
|---|
| .. | .. |
|---|
| 205 | 205 | |
|---|
| 206 | 206 | if (!pdev->dev.driver || !try_module_get(pdev->dev.driver->owner)) { |
|---|
| 207 | 207 | dev_err(kbdev->dev, "arbiter_if driver not available\n"); |
|---|
| 208 | + put_device(&pdev->dev); |
|---|
| 208 | 209 | return -EPROBE_DEFER; |
|---|
| 209 | 210 | } |
|---|
| 210 | 211 | kbdev->arb.arb_dev = &pdev->dev; |
|---|
| .. | .. |
|---|
| 212 | 213 | if (!arb_if) { |
|---|
| 213 | 214 | dev_err(kbdev->dev, "arbiter_if driver not ready\n"); |
|---|
| 214 | 215 | module_put(pdev->dev.driver->owner); |
|---|
| 216 | + put_device(&pdev->dev); |
|---|
| 215 | 217 | return -EPROBE_DEFER; |
|---|
| 216 | 218 | } |
|---|
| 217 | 219 | |
|---|
| .. | .. |
|---|
| 233 | 235 | if (err) { |
|---|
| 234 | 236 | dev_err(&pdev->dev, "Failed to register with arbiter\n"); |
|---|
| 235 | 237 | module_put(pdev->dev.driver->owner); |
|---|
| 238 | + put_device(&pdev->dev); |
|---|
| 236 | 239 | if (err != -EPROBE_DEFER) |
|---|
| 237 | 240 | err = -EFAULT; |
|---|
| 238 | 241 | return err; |
|---|
| .. | .. |
|---|
| 262 | 265 | arb_if->vm_ops.vm_arb_unregister_dev(kbdev->arb.arb_if); |
|---|
| 263 | 266 | } |
|---|
| 264 | 267 | kbdev->arb.arb_if = NULL; |
|---|
| 265 | | - if (kbdev->arb.arb_dev) |
|---|
| 268 | + if (kbdev->arb.arb_dev) { |
|---|
| 266 | 269 | module_put(kbdev->arb.arb_dev->driver->owner); |
|---|
| 270 | + put_device(kbdev->arb.arb_dev); |
|---|
| 271 | + } |
|---|
| 267 | 272 | kbdev->arb.arb_dev = NULL; |
|---|
| 268 | 273 | } |
|---|
| 269 | 274 | |
|---|