forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/platform/x86/samsung-laptop.c
....@@ -1,13 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Samsung Laptop driver
34 *
45 * Copyright (C) 2009,2011 Greg Kroah-Hartman (gregkh@suse.de)
56 * Copyright (C) 2009,2011 Novell Inc.
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms of the GNU General Public License version 2 as published by
9
- * the Free Software Foundation.
10
- *
117 */
128 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
139
....@@ -1125,8 +1121,6 @@
11251121
11261122 if (value > samsung->kbd_led.max_brightness)
11271123 value = samsung->kbd_led.max_brightness;
1128
- else if (value < 0)
1129
- value = 0;
11301124
11311125 samsung->kbd_led_wk = value;
11321126 queue_work(samsung->led_workqueue, &samsung->kbd_led_work);
....@@ -1142,8 +1136,7 @@
11421136
11431137 static void samsung_leds_exit(struct samsung_laptop *samsung)
11441138 {
1145
- if (!IS_ERR_OR_NULL(samsung->kbd_led.dev))
1146
- led_classdev_unregister(&samsung->kbd_led);
1139
+ led_classdev_unregister(&samsung->kbd_led);
11471140 if (samsung->led_workqueue)
11481141 destroy_workqueue(samsung->led_workqueue);
11491142 }
....@@ -1280,15 +1273,12 @@
12801273 debugfs_remove_recursive(samsung->debug.root);
12811274 }
12821275
1283
-static int samsung_debugfs_init(struct samsung_laptop *samsung)
1276
+static void samsung_debugfs_init(struct samsung_laptop *samsung)
12841277 {
1285
- struct dentry *dent;
1278
+ struct dentry *root;
12861279
1287
- samsung->debug.root = debugfs_create_dir("samsung-laptop", NULL);
1288
- if (!samsung->debug.root) {
1289
- pr_err("failed to create debugfs directory");
1290
- goto error_debugfs;
1291
- }
1280
+ root = debugfs_create_dir("samsung-laptop", NULL);
1281
+ samsung->debug.root = root;
12921282
12931283 samsung->debug.f0000_wrapper.data = samsung->f0000_segment;
12941284 samsung->debug.f0000_wrapper.size = 0xffff;
....@@ -1299,60 +1289,24 @@
12991289 samsung->debug.sdiag_wrapper.data = samsung->sdiag;
13001290 samsung->debug.sdiag_wrapper.size = strlen(samsung->sdiag);
13011291
1302
- dent = debugfs_create_u16("command", S_IRUGO | S_IWUSR,
1303
- samsung->debug.root, &samsung->debug.command);
1304
- if (!dent)
1305
- goto error_debugfs;
1306
-
1307
- dent = debugfs_create_u32("d0", S_IRUGO | S_IWUSR, samsung->debug.root,
1308
- &samsung->debug.data.d0);
1309
- if (!dent)
1310
- goto error_debugfs;
1311
-
1312
- dent = debugfs_create_u32("d1", S_IRUGO | S_IWUSR, samsung->debug.root,
1313
- &samsung->debug.data.d1);
1314
- if (!dent)
1315
- goto error_debugfs;
1316
-
1317
- dent = debugfs_create_u16("d2", S_IRUGO | S_IWUSR, samsung->debug.root,
1318
- &samsung->debug.data.d2);
1319
- if (!dent)
1320
- goto error_debugfs;
1321
-
1322
- dent = debugfs_create_u8("d3", S_IRUGO | S_IWUSR, samsung->debug.root,
1323
- &samsung->debug.data.d3);
1324
- if (!dent)
1325
- goto error_debugfs;
1326
-
1327
- dent = debugfs_create_blob("data", S_IRUGO | S_IWUSR,
1328
- samsung->debug.root,
1329
- &samsung->debug.data_wrapper);
1330
- if (!dent)
1331
- goto error_debugfs;
1332
-
1333
- dent = debugfs_create_blob("f0000_segment", S_IRUSR | S_IWUSR,
1334
- samsung->debug.root,
1335
- &samsung->debug.f0000_wrapper);
1336
- if (!dent)
1337
- goto error_debugfs;
1338
-
1339
- dent = debugfs_create_file("call", S_IFREG | S_IRUGO,
1340
- samsung->debug.root, samsung,
1341
- &samsung_laptop_call_fops);
1342
- if (!dent)
1343
- goto error_debugfs;
1344
-
1345
- dent = debugfs_create_blob("sdiag", S_IRUGO | S_IWUSR,
1346
- samsung->debug.root,
1347
- &samsung->debug.sdiag_wrapper);
1348
- if (!dent)
1349
- goto error_debugfs;
1350
-
1351
- return 0;
1352
-
1353
-error_debugfs:
1354
- samsung_debugfs_exit(samsung);
1355
- return -ENOMEM;
1292
+ debugfs_create_u16("command", S_IRUGO | S_IWUSR, root,
1293
+ &samsung->debug.command);
1294
+ debugfs_create_u32("d0", S_IRUGO | S_IWUSR, root,
1295
+ &samsung->debug.data.d0);
1296
+ debugfs_create_u32("d1", S_IRUGO | S_IWUSR, root,
1297
+ &samsung->debug.data.d1);
1298
+ debugfs_create_u16("d2", S_IRUGO | S_IWUSR, root,
1299
+ &samsung->debug.data.d2);
1300
+ debugfs_create_u8("d3", S_IRUGO | S_IWUSR, root,
1301
+ &samsung->debug.data.d3);
1302
+ debugfs_create_blob("data", S_IRUGO | S_IWUSR, root,
1303
+ &samsung->debug.data_wrapper);
1304
+ debugfs_create_blob("f0000_segment", S_IRUSR | S_IWUSR, root,
1305
+ &samsung->debug.f0000_wrapper);
1306
+ debugfs_create_file("call", S_IFREG | S_IRUGO, root, samsung,
1307
+ &samsung_laptop_call_fops);
1308
+ debugfs_create_blob("sdiag", S_IRUGO | S_IWUSR, root,
1309
+ &samsung->debug.sdiag_wrapper);
13561310 }
13571311
13581312 static void samsung_sabi_exit(struct samsung_laptop *samsung)
....@@ -1437,7 +1391,7 @@
14371391 int ret = 0;
14381392 int i;
14391393
1440
- samsung->f0000_segment = ioremap_nocache(0xf0000, 0xffff);
1394
+ samsung->f0000_segment = ioremap(0xf0000, 0xffff);
14411395 if (!samsung->f0000_segment) {
14421396 if (debug || force)
14431397 pr_err("Can't map the segment at 0xf0000\n");
....@@ -1477,7 +1431,7 @@
14771431 if (debug)
14781432 samsung_sabi_infos(samsung, loca, ifaceP);
14791433
1480
- samsung->sabi_iface = ioremap_nocache(ifaceP, 16);
1434
+ samsung->sabi_iface = ioremap(ifaceP, 16);
14811435 if (!samsung->sabi_iface) {
14821436 pr_err("Can't remap %x\n", ifaceP);
14831437 ret = -EINVAL;
....@@ -1745,9 +1699,7 @@
17451699 if (ret)
17461700 goto error_lid_handling;
17471701
1748
- ret = samsung_debugfs_init(samsung);
1749
- if (ret)
1750
- goto error_debugfs;
1702
+ samsung_debugfs_init(samsung);
17511703
17521704 samsung->pm_nb.notifier_call = samsung_pm_notification;
17531705 register_pm_notifier(&samsung->pm_nb);
....@@ -1755,8 +1707,6 @@
17551707 samsung_platform_device = samsung->platform_device;
17561708 return ret;
17571709
1758
-error_debugfs:
1759
- samsung_lid_handling_exit(samsung);
17601710 error_lid_handling:
17611711 samsung_leds_exit(samsung);
17621712 error_leds: