hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/mmc/core/debugfs.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Debugfs support for hosts and cards
34 *
45 * Copyright (C) 2008 Atmel Corporation
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
96 */
107 #include <linux/moduleparam.h>
118 #include <linux/export.h>
....@@ -222,32 +219,7 @@
222219 return 0;
223220 }
224221
225
-DEFINE_SIMPLE_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set,
226
- "%llu\n");
227
-
228
-static int mmc_max_clock_opt_get(void *data, u64 *val)
229
-{
230
- struct mmc_host *host = data;
231
-
232
- *val = host->f_max;
233
-
234
- return 0;
235
-}
236
-
237
-static int mmc_max_clock_opt_set(void *data, u64 val)
238
-{
239
- struct mmc_host *host = data;
240
-
241
- /* We need this check due to input value is u64 */
242
- if (val != 0 && (val > UHS_SDR104_MAX_DTR || val < host->f_min))
243
- return -EINVAL;
244
-
245
- host->f_max = (unsigned int) val;
246
-
247
- return 0;
248
-}
249
-
250
-DEFINE_DEBUGFS_ATTRIBUTE(mmc_max_clock_fops, mmc_max_clock_opt_get, mmc_max_clock_opt_set,
222
+DEFINE_DEBUGFS_ATTRIBUTE(mmc_clock_fops, mmc_clock_opt_get, mmc_clock_opt_set,
251223 "%llu\n");
252224
253225 void mmc_add_host_debugfs(struct mmc_host *host)
....@@ -255,48 +227,21 @@
255227 struct dentry *root;
256228
257229 root = debugfs_create_dir(mmc_hostname(host), NULL);
258
- if (IS_ERR(root))
259
- /* Don't complain -- debugfs just isn't enabled */
260
- return;
261
- if (!root)
262
- /* Complain -- debugfs is enabled, but it failed to
263
- * create the directory. */
264
- goto err_root;
265
-
266230 host->debugfs_root = root;
267231
268
- if (!debugfs_create_file("ios", S_IRUSR, root, host, &mmc_ios_fops))
269
- goto err_node;
270
-
271
- if (!debugfs_create_x32("caps", S_IRUSR, root, &host->caps))
272
- goto err_node;
273
-
274
- if (!debugfs_create_x32("caps2", S_IRUSR, root, &host->caps2))
275
- goto err_node;
276
-
277
- if (!debugfs_create_file("clock", S_IRUSR | S_IWUSR, root, host,
278
- &mmc_clock_fops))
279
- goto err_node;
280
-
281
- debugfs_create_file_unsafe("max_clock", S_IRUSR | S_IWUSR, root, host,
282
- &mmc_max_clock_fops);
232
+ debugfs_create_file("ios", S_IRUSR, root, host, &mmc_ios_fops);
233
+ debugfs_create_x32("caps", S_IRUSR, root, &host->caps);
234
+ debugfs_create_x32("caps2", S_IRUSR, root, &host->caps2);
235
+ debugfs_create_file_unsafe("clock", S_IRUSR | S_IWUSR, root, host,
236
+ &mmc_clock_fops);
283237
284238 #ifdef CONFIG_FAIL_MMC_REQUEST
285239 if (fail_request)
286240 setup_fault_attr(&fail_default_attr, fail_request);
287241 host->fail_mmc_request = fail_default_attr;
288
- if (IS_ERR(fault_create_debugfs_attr("fail_mmc_request",
289
- root,
290
- &host->fail_mmc_request)))
291
- goto err_node;
242
+ fault_create_debugfs_attr("fail_mmc_request", root,
243
+ &host->fail_mmc_request);
292244 #endif
293
- return;
294
-
295
-err_node:
296
- debugfs_remove_recursive(root);
297
- host->debugfs_root = NULL;
298
-err_root:
299
- dev_err(&host->class_dev, "failed to initialize debugfs\n");
300245 }
301246
302247 void mmc_remove_host_debugfs(struct mmc_host *host)
....@@ -313,25 +258,9 @@
313258 return;
314259
315260 root = debugfs_create_dir(mmc_card_id(card), host->debugfs_root);
316
- if (IS_ERR(root))
317
- /* Don't complain -- debugfs just isn't enabled */
318
- return;
319
- if (!root)
320
- /* Complain -- debugfs is enabled, but it failed to
321
- * create the directory. */
322
- goto err;
323
-
324261 card->debugfs_root = root;
325262
326
- if (!debugfs_create_x32("state", S_IRUSR, root, &card->state))
327
- goto err;
328
-
329
- return;
330
-
331
-err:
332
- debugfs_remove_recursive(root);
333
- card->debugfs_root = NULL;
334
- dev_err(&card->dev, "failed to initialize debugfs\n");
263
+ debugfs_create_x32("state", S_IRUSR, root, &card->state);
335264 }
336265
337266 void mmc_remove_card_debugfs(struct mmc_card *card)