summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-10-10 13:41:36 +0300
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-10-15 10:55:11 +0300
commitc7a949766fd24546b15af1d6f4bb57fddeec5558 (patch)
treea6292b87ba255065458c6437781607611ea024a0 /drivers/platform
parent8c7d9ec8a470c39254dd0f64293545dcc86189d5 (diff)
platform/x86: huawei-wmi: No need to keep pointer to platform device
There is no need to keep a pointer to the platform device. Currently there are no users of it directly, and if there will be in the future we may restore it from pointer to the struct device. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/huawei-wmi.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c
index 7ae9848cc6f3..7100814b966b 100644
--- a/drivers/platform/x86/huawei-wmi.c
+++ b/drivers/platform/x86/huawei-wmi.c
@@ -65,7 +65,7 @@ struct huawei_wmi {
struct huawei_wmi_debug debug;
struct input_dev *idev[2];
struct led_classdev cdev;
- struct platform_device *pdev;
+ struct device *dev;
struct mutex battery_lock;
struct mutex wmi_lock;
@@ -152,7 +152,7 @@ static int huawei_wmi_call(struct acpi_buffer *in, struct acpi_buffer *out)
status = wmi_evaluate_method(HWMI_METHOD_GUID, 0, 1, in, out);
mutex_unlock(&huawei_wmi->wmi_lock);
if (ACPI_FAILURE(status)) {
- dev_err(&huawei_wmi->pdev->dev, "Failed to evaluate wmi method\n");
+ dev_err(huawei_wmi->dev, "Failed to evaluate wmi method\n");
return -ENODEV;
}
@@ -202,7 +202,7 @@ static int huawei_wmi_cmd(u64 arg, u8 *buf, size_t buflen)
obj->buffer.pointer += 4;
len = 0x100;
} else {
- dev_err(&huawei_wmi->pdev->dev, "Bad buffer length, got %d\n", obj->buffer.length);
+ dev_err(huawei_wmi->dev, "Bad buffer length, got %d\n", obj->buffer.length);
err = -EIO;
goto fail_cmd;
}
@@ -213,14 +213,14 @@ static int huawei_wmi_cmd(u64 arg, u8 *buf, size_t buflen)
*/
case ACPI_TYPE_PACKAGE:
if (obj->package.count != 2) {
- dev_err(&huawei_wmi->pdev->dev, "Bad package count, got %d\n", obj->package.count);
+ dev_err(huawei_wmi->dev, "Bad package count, got %d\n", obj->package.count);
err = -EIO;
goto fail_cmd;
}
obj = &obj->package.elements[1];
if (obj->type != ACPI_TYPE_BUFFER) {
- dev_err(&huawei_wmi->pdev->dev, "Bad package element type, got %d\n", obj->type);
+ dev_err(huawei_wmi->dev, "Bad package element type, got %d\n", obj->type);
err = -EIO;
goto fail_cmd;
}
@@ -229,7 +229,7 @@ static int huawei_wmi_cmd(u64 arg, u8 *buf, size_t buflen)
break;
/* Shouldn't get here! */
default:
- dev_err(&huawei_wmi->pdev->dev, "Unexpected obj type, got: %d\n", obj->type);
+ dev_err(huawei_wmi->dev, "Unexpected obj type, got: %d\n", obj->type);
err = -EIO;
goto fail_cmd;
}
@@ -633,7 +633,7 @@ static void huawei_wmi_debugfs_call_dump(struct seq_file *m, void *data,
seq_puts(m, "]");
break;
default:
- dev_err(&huawei->pdev->dev, "Unexpected obj type, got %d\n", obj->type);
+ dev_err(huawei->dev, "Unexpected obj type, got %d\n", obj->type);
return;
}
}
@@ -788,7 +788,7 @@ static int huawei_wmi_probe(struct platform_device *pdev)
int err;
platform_set_drvdata(pdev, huawei_wmi);
- huawei_wmi->pdev = pdev;
+ huawei_wmi->dev = &pdev->dev;
while (*guid->guid_string) {
struct input_dev *idev = *huawei_wmi->idev;
@@ -883,7 +883,9 @@ pdrv_err:
static __exit void huawei_wmi_exit(void)
{
- platform_device_unregister(huawei_wmi->pdev);
+ struct platform_device *pdev = to_platform_device(huawei_wmi->dev);
+
+ platform_device_unregister(pdev);
platform_driver_unregister(&huawei_wmi_driver);
kfree(huawei_wmi);