diff options
author | Bitan Biswas <bbiswas@nvidia.com> | 2011-10-28 01:32:14 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:49:47 -0800 |
commit | 8dca2269d34f694a9a02934ad750f42d8cadcf97 (patch) | |
tree | 7583485a348037a946dd207ecb871a8cca7c47b4 /drivers/misc | |
parent | ffdcfb0a34701f7f95e84dd1abc0959a7f5dcc09 (diff) |
misc: nct1008: debugfs change
debugfs API usage corrected to return dentry type.
- nct1008 register dump message modified based on review comments
Reviewed-on: http://git-master/r/60711
(cherry picked from commit 7d06b1a5fd610dcc0f7d4389ab35f4f2991eeb09)
Change-Id: If012b03b055724bceec65efa9367248623a6c61f
Reviewed-on: http://git-master/r/62068
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Rebase-Id: R490ece304bf77178de2d703f6ad30e29b131634f
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/nct1008.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/misc/nct1008.c b/drivers/misc/nct1008.c index af8660915a9a..0a56485d5ae6 100644 --- a/drivers/misc/nct1008.c +++ b/drivers/misc/nct1008.c @@ -434,12 +434,24 @@ static const struct file_operations debug_fops = { static int __init nct1008_debuginit(struct nct1008_data *nct) { - int err; - err = debugfs_create_file("nct1008", S_IRUGO, NULL, - nct, &debug_fops); - if (err < 0) - pr_err("Error: %s debugfs not supported, error=%d\n", - __func__, err); + int err = 0; + struct dentry *d; + d = debugfs_create_file("nct1008", S_IRUGO, NULL, + (void *)nct, &debug_fops); + if ((!d) || IS_ERR(d)) { + dev_err(&nct->client->dev, "Error: %s debugfs_create_file" + " returned an error\n", __func__); + err = -ENOENT; + goto end; + } + if (d == ERR_PTR(-ENODEV)) { + dev_err(&nct->client->dev, "Error: %s debugfs not supported " + "error=-ENODEV\n", __func__); + err = -ENODEV; + } else { + nct->dent = d; + } +end: return err; } #else @@ -974,6 +986,8 @@ static int __devexit nct1008_remove(struct i2c_client *client) { struct nct1008_data *data = i2c_get_clientdata(client); + if (data->dent) + debugfs_remove(data->dent); free_irq(data->client->irq, data); cancel_work_sync(&data->work); sysfs_remove_group(&client->dev.kobj, &nct1008_attr_group); |