hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/mfd/aat2870-core.c
....@@ -1,26 +1,12 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/drivers/mfd/aat2870-core.c
34 *
45 * Copyright (c) 2011, NVIDIA Corporation.
56 * Author: Jin Park <jinyoungp@nvidia.com>
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * version 2 as published by the Free Software Foundation.
10
- *
11
- * This program is distributed in the hope that it will be useful, but
12
- * WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19
- * 02110-1301 USA
207 */
218
229 #include <linux/kernel.h>
23
-#include <linux/module.h>
2410 #include <linux/init.h>
2511 #include <linux/debugfs.h>
2612 #include <linux/slab.h>
....@@ -235,7 +221,7 @@
235221
236222 count += sprintf(buf, "aat2870 registers\n");
237223 for (addr = 0; addr < AAT2870_REG_NUM; addr++) {
238
- count += sprintf(buf + count, "0x%02x: ", addr);
224
+ count += snprintf(buf + count, PAGE_SIZE - count, "0x%02x: ", addr);
239225 if (count >= PAGE_SIZE - 1)
240226 break;
241227
....@@ -335,30 +321,13 @@
335321 static void aat2870_init_debugfs(struct aat2870_data *aat2870)
336322 {
337323 aat2870->dentry_root = debugfs_create_dir("aat2870", NULL);
338
- if (!aat2870->dentry_root) {
339
- dev_warn(aat2870->dev,
340
- "Failed to create debugfs root directory\n");
341
- return;
342
- }
343324
344
- aat2870->dentry_reg = debugfs_create_file("regs", 0644,
345
- aat2870->dentry_root,
346
- aat2870, &aat2870_reg_fops);
347
- if (!aat2870->dentry_reg)
348
- dev_warn(aat2870->dev,
349
- "Failed to create debugfs register file\n");
325
+ debugfs_create_file("regs", 0644, aat2870->dentry_root, aat2870,
326
+ &aat2870_reg_fops);
350327 }
351328
352
-static void aat2870_uninit_debugfs(struct aat2870_data *aat2870)
353
-{
354
- debugfs_remove_recursive(aat2870->dentry_root);
355
-}
356329 #else
357330 static inline void aat2870_init_debugfs(struct aat2870_data *aat2870)
358
-{
359
-}
360
-
361
-static inline void aat2870_uninit_debugfs(struct aat2870_data *aat2870)
362331 {
363332 }
364333 #endif /* CONFIG_DEBUG_FS */
....@@ -440,20 +409,6 @@
440409 return ret;
441410 }
442411
443
-static int aat2870_i2c_remove(struct i2c_client *client)
444
-{
445
- struct aat2870_data *aat2870 = i2c_get_clientdata(client);
446
-
447
- aat2870_uninit_debugfs(aat2870);
448
-
449
- mfd_remove_devices(aat2870->dev);
450
- aat2870_disable(aat2870);
451
- if (aat2870->uninit)
452
- aat2870->uninit(aat2870);
453
-
454
- return 0;
455
-}
456
-
457412 #ifdef CONFIG_PM_SLEEP
458413 static int aat2870_i2c_suspend(struct device *dev)
459414 {
....@@ -492,15 +447,14 @@
492447 { "aat2870", 0 },
493448 { }
494449 };
495
-MODULE_DEVICE_TABLE(i2c, aat2870_i2c_id_table);
496450
497451 static struct i2c_driver aat2870_i2c_driver = {
498452 .driver = {
499
- .name = "aat2870",
500
- .pm = &aat2870_pm_ops,
453
+ .name = "aat2870",
454
+ .pm = &aat2870_pm_ops,
455
+ .suppress_bind_attrs = true,
501456 },
502457 .probe = aat2870_i2c_probe,
503
- .remove = aat2870_i2c_remove,
504458 .id_table = aat2870_i2c_id_table,
505459 };
506460
....@@ -509,13 +463,3 @@
509463 return i2c_add_driver(&aat2870_i2c_driver);
510464 }
511465 subsys_initcall(aat2870_init);
512
-
513
-static void __exit aat2870_exit(void)
514
-{
515
- i2c_del_driver(&aat2870_i2c_driver);
516
-}
517
-module_exit(aat2870_exit);
518
-
519
-MODULE_DESCRIPTION("Core support for the AnalogicTech AAT2870");
520
-MODULE_LICENSE("GPL");
521
-MODULE_AUTHOR("Jin Park <jinyoungp@nvidia.com>");