aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwmc3200wifi
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-05-03 14:46:05 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-05-03 14:46:37 -0400
commit1f55c12cef6d369d76ae13d522edd1c07e667788 (patch)
tree693ed1d4e7f18785765f3490697485cc182f9675 /drivers/net/wireless/iwmc3200wifi
parentf5c044e53a6b319776c7140b22fee9be3bc1f758 (diff)
iwmc3200wifi: cleanup unneeded debugfs error handling
"iwl: cleanup: remove unneeded error handling" missed the one in if_sdio_debugfs_init(). I don't think we even need to check -ENODEV ourselves because if DEBUG_FS is not compiled in, all the debugfs utility functions will become no-op. Reported-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Acked-by: Dan Carpenter <error27@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwmc3200wifi')
-rw-r--r--drivers/net/wireless/iwmc3200wifi/bus.h2
-rw-r--r--drivers/net/wireless/iwmc3200wifi/debug.h4
-rw-r--r--drivers/net/wireless/iwmc3200wifi/debugfs.c47
-rw-r--r--drivers/net/wireless/iwmc3200wifi/sdio.c17
4 files changed, 15 insertions, 55 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/bus.h b/drivers/net/wireless/iwmc3200wifi/bus.h
index 836663eec257..62edd5888a7b 100644
--- a/drivers/net/wireless/iwmc3200wifi/bus.h
+++ b/drivers/net/wireless/iwmc3200wifi/bus.h
@@ -31,7 +31,7 @@ struct iwm_if_ops {
31 int (*disable)(struct iwm_priv *iwm); 31 int (*disable)(struct iwm_priv *iwm);
32 int (*send_chunk)(struct iwm_priv *iwm, u8* buf, int count); 32 int (*send_chunk)(struct iwm_priv *iwm, u8* buf, int count);
33 33
34 int (*debugfs_init)(struct iwm_priv *iwm, struct dentry *parent_dir); 34 void (*debugfs_init)(struct iwm_priv *iwm, struct dentry *parent_dir);
35 void (*debugfs_exit)(struct iwm_priv *iwm); 35 void (*debugfs_exit)(struct iwm_priv *iwm);
36 36
37 const char *umac_name; 37 const char *umac_name;
diff --git a/drivers/net/wireless/iwmc3200wifi/debug.h b/drivers/net/wireless/iwmc3200wifi/debug.h
index e35c9b693d1f..f98bf125a8ae 100644
--- a/drivers/net/wireless/iwmc3200wifi/debug.h
+++ b/drivers/net/wireless/iwmc3200wifi/debug.h
@@ -113,10 +113,10 @@ struct iwm_debugfs {
113}; 113};
114 114
115#ifdef CONFIG_IWM_DEBUG 115#ifdef CONFIG_IWM_DEBUG
116int iwm_debugfs_init(struct iwm_priv *iwm); 116void iwm_debugfs_init(struct iwm_priv *iwm);
117void iwm_debugfs_exit(struct iwm_priv *iwm); 117void iwm_debugfs_exit(struct iwm_priv *iwm);
118#else 118#else
119static inline int iwm_debugfs_init(struct iwm_priv *iwm) 119static inline void iwm_debugfs_init(struct iwm_priv *iwm)
120{ 120{
121 return 0; 121 return 0;
122} 122}
diff --git a/drivers/net/wireless/iwmc3200wifi/debugfs.c b/drivers/net/wireless/iwmc3200wifi/debugfs.c
index c916152bb936..b42165c40288 100644
--- a/drivers/net/wireless/iwmc3200wifi/debugfs.c
+++ b/drivers/net/wireless/iwmc3200wifi/debugfs.c
@@ -47,12 +47,11 @@ static struct {
47 47
48#define add_dbg_module(dbg, name, id, initlevel) \ 48#define add_dbg_module(dbg, name, id, initlevel) \
49do { \ 49do { \
50 struct dentry *d; \
51 dbg.dbg_module[id] = (initlevel); \ 50 dbg.dbg_module[id] = (initlevel); \
52 d = debugfs_create_x8(name, 0600, dbg.dbgdir, \ 51 dbg.dbg_module_dentries[id] = \
53 &(dbg.dbg_module[id])); \ 52 debugfs_create_x8(name, 0600, \
54 if (!IS_ERR(d)) \ 53 dbg.dbgdir, \
55 dbg.dbg_module_dentries[id] = d; \ 54 &(dbg.dbg_module[id])); \
56} while (0) 55} while (0)
57 56
58static int iwm_debugfs_u32_read(void *data, u64 *val) 57static int iwm_debugfs_u32_read(void *data, u64 *val)
@@ -422,37 +421,19 @@ static const struct file_operations iwm_debugfs_fw_err_fops = {
422 .read = iwm_debugfs_fw_err_read, 421 .read = iwm_debugfs_fw_err_read,
423}; 422};
424 423
425int iwm_debugfs_init(struct iwm_priv *iwm) 424void iwm_debugfs_init(struct iwm_priv *iwm)
426{ 425{
427 int i, result; 426 int i;
428 char devdir[16];
429 427
430 iwm->dbg.rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL); 428 iwm->dbg.rootdir = debugfs_create_dir(KBUILD_MODNAME, NULL);
431 result = PTR_ERR(iwm->dbg.rootdir); 429 iwm->dbg.devdir = debugfs_create_dir(wiphy_name(iwm_to_wiphy(iwm)),
432 if (!result || IS_ERR(iwm->dbg.rootdir)) { 430 iwm->dbg.rootdir);
433 if (result == -ENODEV) {
434 IWM_ERR(iwm, "DebugFS (CONFIG_DEBUG_FS) not "
435 "enabled in kernel config\n");
436 result = 0; /* No debugfs support */
437 }
438 IWM_ERR(iwm, "Couldn't create rootdir: %d\n", result);
439 goto error;
440 }
441
442 snprintf(devdir, sizeof(devdir), "%s", wiphy_name(iwm_to_wiphy(iwm)));
443
444 iwm->dbg.devdir = debugfs_create_dir(devdir, iwm->dbg.rootdir);
445 iwm->dbg.dbgdir = debugfs_create_dir("debug", iwm->dbg.devdir); 431 iwm->dbg.dbgdir = debugfs_create_dir("debug", iwm->dbg.devdir);
446 iwm->dbg.rxdir = debugfs_create_dir("rx", iwm->dbg.devdir); 432 iwm->dbg.rxdir = debugfs_create_dir("rx", iwm->dbg.devdir);
447 iwm->dbg.txdir = debugfs_create_dir("tx", iwm->dbg.devdir); 433 iwm->dbg.txdir = debugfs_create_dir("tx", iwm->dbg.devdir);
448 iwm->dbg.busdir = debugfs_create_dir("bus", iwm->dbg.devdir); 434 iwm->dbg.busdir = debugfs_create_dir("bus", iwm->dbg.devdir);
449 if (iwm->bus_ops->debugfs_init) { 435 if (iwm->bus_ops->debugfs_init)
450 result = iwm->bus_ops->debugfs_init(iwm, iwm->dbg.busdir); 436 iwm->bus_ops->debugfs_init(iwm, iwm->dbg.busdir);
451 if (result < 0) {
452 IWM_ERR(iwm, "Couldn't create bus entry: %d\n", result);
453 goto error;
454 }
455 }
456 437
457 iwm->dbg.dbg_level = IWM_DL_NONE; 438 iwm->dbg.dbg_level = IWM_DL_NONE;
458 iwm->dbg.dbg_level_dentry = 439 iwm->dbg.dbg_level_dentry =
@@ -471,23 +452,15 @@ int iwm_debugfs_init(struct iwm_priv *iwm)
471 iwm->dbg.txq_dentry = debugfs_create_file("queues", 0200, 452 iwm->dbg.txq_dentry = debugfs_create_file("queues", 0200,
472 iwm->dbg.txdir, iwm, 453 iwm->dbg.txdir, iwm,
473 &iwm_debugfs_txq_fops); 454 &iwm_debugfs_txq_fops);
474
475 iwm->dbg.tx_credit_dentry = debugfs_create_file("credits", 0200, 455 iwm->dbg.tx_credit_dentry = debugfs_create_file("credits", 0200,
476 iwm->dbg.txdir, iwm, 456 iwm->dbg.txdir, iwm,
477 &iwm_debugfs_tx_credit_fops); 457 &iwm_debugfs_tx_credit_fops);
478
479 iwm->dbg.rx_ticket_dentry = debugfs_create_file("tickets", 0200, 458 iwm->dbg.rx_ticket_dentry = debugfs_create_file("tickets", 0200,
480 iwm->dbg.rxdir, iwm, 459 iwm->dbg.rxdir, iwm,
481 &iwm_debugfs_rx_ticket_fops); 460 &iwm_debugfs_rx_ticket_fops);
482
483 iwm->dbg.fw_err_dentry = debugfs_create_file("last_fw_err", 0200, 461 iwm->dbg.fw_err_dentry = debugfs_create_file("last_fw_err", 0200,
484 iwm->dbg.dbgdir, iwm, 462 iwm->dbg.dbgdir, iwm,
485 &iwm_debugfs_fw_err_fops); 463 &iwm_debugfs_fw_err_fops);
486
487 return 0;
488
489 error:
490 return result;
491} 464}
492 465
493void iwm_debugfs_exit(struct iwm_priv *iwm) 466void iwm_debugfs_exit(struct iwm_priv *iwm)
diff --git a/drivers/net/wireless/iwmc3200wifi/sdio.c b/drivers/net/wireless/iwmc3200wifi/sdio.c
index a7ec7eac9137..b55f4b7446bc 100644
--- a/drivers/net/wireless/iwmc3200wifi/sdio.c
+++ b/drivers/net/wireless/iwmc3200wifi/sdio.c
@@ -365,21 +365,13 @@ static const struct file_operations iwm_debugfs_sdio_fops = {
365 .read = iwm_debugfs_sdio_read, 365 .read = iwm_debugfs_sdio_read,
366}; 366};
367 367
368static int if_sdio_debugfs_init(struct iwm_priv *iwm, struct dentry *parent_dir) 368static void if_sdio_debugfs_init(struct iwm_priv *iwm, struct dentry *parent_dir)
369{ 369{
370 int result;
371 struct iwm_sdio_priv *hw = iwm_to_if_sdio(iwm); 370 struct iwm_sdio_priv *hw = iwm_to_if_sdio(iwm);
372 371
373 hw->cccr_dentry = debugfs_create_file("cccr", 0200, 372 hw->cccr_dentry = debugfs_create_file("cccr", 0200,
374 parent_dir, iwm, 373 parent_dir, iwm,
375 &iwm_debugfs_sdio_fops); 374 &iwm_debugfs_sdio_fops);
376 result = PTR_ERR(hw->cccr_dentry);
377 if (IS_ERR(hw->cccr_dentry) && (result != -ENODEV)) {
378 IWM_ERR(iwm, "Couldn't create CCCR entry: %d\n", result);
379 return result;
380 }
381
382 return 0;
383} 375}
384 376
385static void if_sdio_debugfs_exit(struct iwm_priv *iwm) 377static void if_sdio_debugfs_exit(struct iwm_priv *iwm)
@@ -439,11 +431,7 @@ static int iwm_sdio_probe(struct sdio_func *func,
439 hw = iwm_private(iwm); 431 hw = iwm_private(iwm);
440 hw->iwm = iwm; 432 hw->iwm = iwm;
441 433
442 ret = iwm_debugfs_init(iwm); 434 iwm_debugfs_init(iwm);
443 if (ret < 0) {
444 IWM_ERR(iwm, "Debugfs registration failed\n");
445 goto if_free;
446 }
447 435
448 sdio_set_drvdata(func, hw); 436 sdio_set_drvdata(func, hw);
449 437
@@ -472,7 +460,6 @@ static int iwm_sdio_probe(struct sdio_func *func,
472 destroy_workqueue(hw->isr_wq); 460 destroy_workqueue(hw->isr_wq);
473 debugfs_exit: 461 debugfs_exit:
474 iwm_debugfs_exit(iwm); 462 iwm_debugfs_exit(iwm);
475 if_free:
476 iwm_if_free(iwm); 463 iwm_if_free(iwm);
477 return ret; 464 return ret;
478} 465}