forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-09 244b2c5ca8b14627e4a17755e5922221e121c771
kernel/drivers/iio/adc/palmas_gpadc.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * palmas-adc.c -- TI PALMAS GPADC.
34 *
45 * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
56 *
67 * Author: Pradeep Goudagunta <pgoudagunta@nvidia.com>
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License as
10
- * published by the Free Software Foundation version 2.
118 */
129
1310 #include <linux/module.h>
....@@ -79,7 +76,7 @@
7976 PALMAS_ADC_INFO(IN15, 0, 0, 0, 0, INVALID, INVALID, true),
8077 };
8178
82
-/**
79
+/*
8380 * struct palmas_gpadc - the palmas_gpadc structure
8481 * @ch0_current: channel 0 current source setting
8582 * 0: 0 uA
....@@ -97,7 +94,6 @@
9794 * This is the palmas_gpadc structure to store run-time information
9895 * and pointers for this driver instance.
9996 */
100
-
10197 struct palmas_gpadc {
10298 struct device *dev;
10399 struct palmas *palmas;
....@@ -596,7 +592,6 @@
596592 adc->extended_delay = gpadc_pdata->extended_delay;
597593
598594 indio_dev->name = MOD_NAME;
599
- indio_dev->dev.parent = &pdev->dev;
600595 indio_dev->info = &palmas_gpadc_iio_info;
601596 indio_dev->modes = INDIO_DIRECT_MODE;
602597 indio_dev->channels = palmas_gpadc_iio_channel;
....@@ -633,7 +628,7 @@
633628
634629 static int palmas_gpadc_remove(struct platform_device *pdev)
635630 {
636
- struct iio_dev *indio_dev = dev_to_iio_dev(&pdev->dev);
631
+ struct iio_dev *indio_dev = dev_get_drvdata(&pdev->dev);
637632 struct palmas_gpadc *adc = iio_priv(indio_dev);
638633
639634 if (adc->wakeup1_enable || adc->wakeup2_enable)
....@@ -839,18 +834,7 @@
839834 .of_match_table = of_palmas_gpadc_match_tbl,
840835 },
841836 };
842
-
843
-static int __init palmas_gpadc_init(void)
844
-{
845
- return platform_driver_register(&palmas_gpadc_driver);
846
-}
847
-module_init(palmas_gpadc_init);
848
-
849
-static void __exit palmas_gpadc_exit(void)
850
-{
851
- platform_driver_unregister(&palmas_gpadc_driver);
852
-}
853
-module_exit(palmas_gpadc_exit);
837
+module_platform_driver(palmas_gpadc_driver);
854838
855839 MODULE_DESCRIPTION("palmas GPADC driver");
856840 MODULE_AUTHOR("Pradeep Goudagunta<pgoudagunta@nvidia.com>");