aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-01-22 11:05:46 -0500
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-02-07 05:50:23 -0500
commit9a7c551ba7aae3648473179f234e960cfd46eaf4 (patch)
tree2cf1a4456f7c43586e16eccdb1d640003af81a0d
parent334c4efd295cda01069cab03bf753537dc20c3eb (diff)
platform/x86: samsung-laptop: Re-use DEFINE_SHOW_ATTRIBUTE() macro
...instead of open coding file operations followed by custom ->open() callbacks per each attribute. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-rw-r--r--drivers/platform/x86/samsung-laptop.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index d3cb26f6df73..03305e0b89ff 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -1252,7 +1252,7 @@ static int __init samsung_sysfs_init(struct samsung_laptop *samsung)
1252 1252
1253} 1253}
1254 1254
1255static int show_call(struct seq_file *m, void *data) 1255static int samsung_laptop_call_show(struct seq_file *m, void *data)
1256{ 1256{
1257 struct samsung_laptop *samsung = m->private; 1257 struct samsung_laptop *samsung = m->private;
1258 struct sabi_data *sdata = &samsung->debug.data; 1258 struct sabi_data *sdata = &samsung->debug.data;
@@ -1274,19 +1274,7 @@ static int show_call(struct seq_file *m, void *data)
1274 sdata->d0, sdata->d1, sdata->d2, sdata->d3); 1274 sdata->d0, sdata->d1, sdata->d2, sdata->d3);
1275 return 0; 1275 return 0;
1276} 1276}
1277 1277DEFINE_SHOW_ATTRIBUTE(samsung_laptop_call);
1278static int samsung_debugfs_open(struct inode *inode, struct file *file)
1279{
1280 return single_open(file, show_call, inode->i_private);
1281}
1282
1283static const struct file_operations samsung_laptop_call_io_ops = {
1284 .owner = THIS_MODULE,
1285 .open = samsung_debugfs_open,
1286 .read = seq_read,
1287 .llseek = seq_lseek,
1288 .release = single_release,
1289};
1290 1278
1291static void samsung_debugfs_exit(struct samsung_laptop *samsung) 1279static void samsung_debugfs_exit(struct samsung_laptop *samsung)
1292{ 1280{
@@ -1351,7 +1339,7 @@ static int samsung_debugfs_init(struct samsung_laptop *samsung)
1351 1339
1352 dent = debugfs_create_file("call", S_IFREG | S_IRUGO, 1340 dent = debugfs_create_file("call", S_IFREG | S_IRUGO,
1353 samsung->debug.root, samsung, 1341 samsung->debug.root, samsung,
1354 &samsung_laptop_call_io_ops); 1342 &samsung_laptop_call_fops);
1355 if (!dent) 1343 if (!dent)
1356 goto error_debugfs; 1344 goto error_debugfs;
1357 1345