debugfs.c (8e8c668927b029f6ccc350eb1aa936864cc4eb6f) | debugfs.c (cfce94653dad2d0661e1926c028ce63052eb20cd) |
---|---|
1/* This program is free software; you can redistribute it and/or modify 2 * it under the terms of the GNU General Public License version 2 3 * as published by the Free Software Foundation. 4 * 5 * This program is distributed in the hope that it will be useful, 6 * but WITHOUT ANY WARRANTY; without even the implied warranty of 7 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 8 * GNU General Public License for more details. --- 231 unchanged lines hidden (view full) --- 240 241static const struct file_operations lowpan_context_fops = { 242 .open = lowpan_context_open, 243 .read = seq_read, 244 .llseek = seq_lseek, 245 .release = single_release, 246}; 247 | 1/* This program is free software; you can redistribute it and/or modify 2 * it under the terms of the GNU General Public License version 2 3 * as published by the Free Software Foundation. 4 * 5 * This program is distributed in the hope that it will be useful, 6 * but WITHOUT ANY WARRANTY; without even the implied warranty of 7 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 8 * GNU General Public License for more details. --- 231 unchanged lines hidden (view full) --- 240 241static const struct file_operations lowpan_context_fops = { 242 .open = lowpan_context_open, 243 .read = seq_read, 244 .llseek = seq_lseek, 245 .release = single_release, 246}; 247 |
248static int lowpan_short_addr_get(void *data, u64 *val) 249{ 250 struct wpan_dev *wdev = data; 251 252 rtnl_lock(); 253 *val = le16_to_cpu(wdev->short_addr); 254 rtnl_unlock(); 255 256 return 0; 257} 258 259DEFINE_SIMPLE_ATTRIBUTE(lowpan_short_addr_fops, lowpan_short_addr_get, 260 NULL, "0x%04llx\n"); 261 262static int lowpan_dev_debugfs_802154_init(const struct net_device *dev, 263 struct lowpan_dev *ldev) 264{ 265 struct dentry *dentry, *root; 266 267 if (!lowpan_is_ll(dev, LOWPAN_LLTYPE_IEEE802154)) 268 return 0; 269 270 root = debugfs_create_dir("ieee802154", ldev->iface_debugfs); 271 if (!root) 272 return -EINVAL; 273 274 dentry = debugfs_create_file("short_addr", 0444, root, 275 lowpan_802154_dev(dev)->wdev->ieee802154_ptr, 276 &lowpan_short_addr_fops); 277 if (!dentry) 278 return -EINVAL; 279 280 return 0; 281} 282 |
|
248int lowpan_dev_debugfs_init(struct net_device *dev) 249{ 250 struct lowpan_dev *ldev = lowpan_dev(dev); 251 struct dentry *contexts, *dentry; 252 int ret, i; 253 254 /* creating the root */ 255 ldev->iface_debugfs = debugfs_create_dir(dev->name, lowpan_debugfs); --- 11 unchanged lines hidden (view full) --- 267 goto remove_root; 268 269 for (i = 0; i < LOWPAN_IPHC_CTX_TABLE_SIZE; i++) { 270 ret = lowpan_dev_debugfs_ctx_init(dev, contexts, i); 271 if (ret < 0) 272 goto remove_root; 273 } 274 | 283int lowpan_dev_debugfs_init(struct net_device *dev) 284{ 285 struct lowpan_dev *ldev = lowpan_dev(dev); 286 struct dentry *contexts, *dentry; 287 int ret, i; 288 289 /* creating the root */ 290 ldev->iface_debugfs = debugfs_create_dir(dev->name, lowpan_debugfs); --- 11 unchanged lines hidden (view full) --- 302 goto remove_root; 303 304 for (i = 0; i < LOWPAN_IPHC_CTX_TABLE_SIZE; i++) { 305 ret = lowpan_dev_debugfs_ctx_init(dev, contexts, i); 306 if (ret < 0) 307 goto remove_root; 308 } 309 |
310 ret = lowpan_dev_debugfs_802154_init(dev, ldev); 311 if (ret < 0) 312 goto remove_root; 313 |
|
275 return 0; 276 277remove_root: 278 lowpan_dev_debugfs_exit(dev); 279fail: 280 return -EINVAL; 281} 282 --- 18 unchanged lines hidden --- | 314 return 0; 315 316remove_root: 317 lowpan_dev_debugfs_exit(dev); 318fail: 319 return -EINVAL; 320} 321 --- 18 unchanged lines hidden --- |