| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Samsung Laptop driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2009,2011 Greg Kroah-Hartman (gregkh@suse.de) |
|---|
| 5 | 6 | * 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 | | - * |
|---|
| 11 | 7 | */ |
|---|
| 12 | 8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| 13 | 9 | |
|---|
| .. | .. |
|---|
| 1125 | 1121 | |
|---|
| 1126 | 1122 | if (value > samsung->kbd_led.max_brightness) |
|---|
| 1127 | 1123 | value = samsung->kbd_led.max_brightness; |
|---|
| 1128 | | - else if (value < 0) |
|---|
| 1129 | | - value = 0; |
|---|
| 1130 | 1124 | |
|---|
| 1131 | 1125 | samsung->kbd_led_wk = value; |
|---|
| 1132 | 1126 | queue_work(samsung->led_workqueue, &samsung->kbd_led_work); |
|---|
| .. | .. |
|---|
| 1142 | 1136 | |
|---|
| 1143 | 1137 | static void samsung_leds_exit(struct samsung_laptop *samsung) |
|---|
| 1144 | 1138 | { |
|---|
| 1145 | | - if (!IS_ERR_OR_NULL(samsung->kbd_led.dev)) |
|---|
| 1146 | | - led_classdev_unregister(&samsung->kbd_led); |
|---|
| 1139 | + led_classdev_unregister(&samsung->kbd_led); |
|---|
| 1147 | 1140 | if (samsung->led_workqueue) |
|---|
| 1148 | 1141 | destroy_workqueue(samsung->led_workqueue); |
|---|
| 1149 | 1142 | } |
|---|
| .. | .. |
|---|
| 1280 | 1273 | debugfs_remove_recursive(samsung->debug.root); |
|---|
| 1281 | 1274 | } |
|---|
| 1282 | 1275 | |
|---|
| 1283 | | -static int samsung_debugfs_init(struct samsung_laptop *samsung) |
|---|
| 1276 | +static void samsung_debugfs_init(struct samsung_laptop *samsung) |
|---|
| 1284 | 1277 | { |
|---|
| 1285 | | - struct dentry *dent; |
|---|
| 1278 | + struct dentry *root; |
|---|
| 1286 | 1279 | |
|---|
| 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; |
|---|
| 1292 | 1282 | |
|---|
| 1293 | 1283 | samsung->debug.f0000_wrapper.data = samsung->f0000_segment; |
|---|
| 1294 | 1284 | samsung->debug.f0000_wrapper.size = 0xffff; |
|---|
| .. | .. |
|---|
| 1299 | 1289 | samsung->debug.sdiag_wrapper.data = samsung->sdiag; |
|---|
| 1300 | 1290 | samsung->debug.sdiag_wrapper.size = strlen(samsung->sdiag); |
|---|
| 1301 | 1291 | |
|---|
| 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); |
|---|
| 1356 | 1310 | } |
|---|
| 1357 | 1311 | |
|---|
| 1358 | 1312 | static void samsung_sabi_exit(struct samsung_laptop *samsung) |
|---|
| .. | .. |
|---|
| 1437 | 1391 | int ret = 0; |
|---|
| 1438 | 1392 | int i; |
|---|
| 1439 | 1393 | |
|---|
| 1440 | | - samsung->f0000_segment = ioremap_nocache(0xf0000, 0xffff); |
|---|
| 1394 | + samsung->f0000_segment = ioremap(0xf0000, 0xffff); |
|---|
| 1441 | 1395 | if (!samsung->f0000_segment) { |
|---|
| 1442 | 1396 | if (debug || force) |
|---|
| 1443 | 1397 | pr_err("Can't map the segment at 0xf0000\n"); |
|---|
| .. | .. |
|---|
| 1477 | 1431 | if (debug) |
|---|
| 1478 | 1432 | samsung_sabi_infos(samsung, loca, ifaceP); |
|---|
| 1479 | 1433 | |
|---|
| 1480 | | - samsung->sabi_iface = ioremap_nocache(ifaceP, 16); |
|---|
| 1434 | + samsung->sabi_iface = ioremap(ifaceP, 16); |
|---|
| 1481 | 1435 | if (!samsung->sabi_iface) { |
|---|
| 1482 | 1436 | pr_err("Can't remap %x\n", ifaceP); |
|---|
| 1483 | 1437 | ret = -EINVAL; |
|---|
| .. | .. |
|---|
| 1745 | 1699 | if (ret) |
|---|
| 1746 | 1700 | goto error_lid_handling; |
|---|
| 1747 | 1701 | |
|---|
| 1748 | | - ret = samsung_debugfs_init(samsung); |
|---|
| 1749 | | - if (ret) |
|---|
| 1750 | | - goto error_debugfs; |
|---|
| 1702 | + samsung_debugfs_init(samsung); |
|---|
| 1751 | 1703 | |
|---|
| 1752 | 1704 | samsung->pm_nb.notifier_call = samsung_pm_notification; |
|---|
| 1753 | 1705 | register_pm_notifier(&samsung->pm_nb); |
|---|
| .. | .. |
|---|
| 1755 | 1707 | samsung_platform_device = samsung->platform_device; |
|---|
| 1756 | 1708 | return ret; |
|---|
| 1757 | 1709 | |
|---|
| 1758 | | -error_debugfs: |
|---|
| 1759 | | - samsung_lid_handling_exit(samsung); |
|---|
| 1760 | 1710 | error_lid_handling: |
|---|
| 1761 | 1711 | samsung_leds_exit(samsung); |
|---|
| 1762 | 1712 | error_leds: |
|---|