| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Freescale MMA9551L Intelligent Motion-Sensing Platform driver |
|---|
| 3 | 4 | * Copyright (c) 2014, Intel Corporation. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms and conditions of the GNU General Public License, |
|---|
| 7 | | - * version 2, as published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
|---|
| 10 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 11 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 12 | | - * more details. |
|---|
| 13 | 5 | */ |
|---|
| 14 | 6 | |
|---|
| 15 | 7 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 481 | 473 | |
|---|
| 482 | 474 | mutex_init(&data->mutex); |
|---|
| 483 | 475 | |
|---|
| 484 | | - indio_dev->dev.parent = &client->dev; |
|---|
| 485 | 476 | indio_dev->channels = mma9551_channels; |
|---|
| 486 | 477 | indio_dev->num_channels = ARRAY_SIZE(mma9551_channels); |
|---|
| 487 | 478 | indio_dev->name = name; |
|---|
| .. | .. |
|---|
| 504 | 495 | ret = iio_device_register(indio_dev); |
|---|
| 505 | 496 | if (ret < 0) { |
|---|
| 506 | 497 | dev_err(&client->dev, "unable to register iio device\n"); |
|---|
| 507 | | - goto out_poweroff; |
|---|
| 498 | + goto err_pm_cleanup; |
|---|
| 508 | 499 | } |
|---|
| 509 | 500 | |
|---|
| 510 | 501 | return 0; |
|---|
| 511 | 502 | |
|---|
| 503 | +err_pm_cleanup: |
|---|
| 504 | + pm_runtime_dont_use_autosuspend(&client->dev); |
|---|
| 505 | + pm_runtime_disable(&client->dev); |
|---|
| 512 | 506 | out_poweroff: |
|---|
| 513 | 507 | mma9551_set_device_state(client, false); |
|---|
| 514 | 508 | |
|---|