bat_sysfs.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. /*
  2. * Copyright (C) 2010-2011 B.A.T.M.A.N. contributors:
  3. *
  4. * Marek Lindner
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of version 2 of the GNU General Public
  8. * License as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  18. * 02110-1301, USA
  19. *
  20. */
  21. #include "main.h"
  22. #include "bat_sysfs.h"
  23. #include "translation-table.h"
  24. #include "originator.h"
  25. #include "hard-interface.h"
  26. #include "gateway_common.h"
  27. #include "gateway_client.h"
  28. #include "vis.h"
  29. static struct net_device *kobj_to_netdev(struct kobject *obj)
  30. {
  31. struct device *dev = container_of(obj->parent, struct device, kobj);
  32. return to_net_dev(dev);
  33. }
  34. static struct bat_priv *kobj_to_batpriv(struct kobject *obj)
  35. {
  36. struct net_device *net_dev = kobj_to_netdev(obj);
  37. return netdev_priv(net_dev);
  38. }
  39. /* Use this, if you have customized show and store functions */
  40. #define BAT_ATTR(_name, _mode, _show, _store) \
  41. struct bat_attribute bat_attr_##_name = { \
  42. .attr = {.name = __stringify(_name), \
  43. .mode = _mode }, \
  44. .show = _show, \
  45. .store = _store, \
  46. };
  47. #define BAT_ATTR_STORE_BOOL(_name, _post_func) \
  48. ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
  49. char *buff, size_t count) \
  50. { \
  51. struct net_device *net_dev = kobj_to_netdev(kobj); \
  52. struct bat_priv *bat_priv = netdev_priv(net_dev); \
  53. return __store_bool_attr(buff, count, _post_func, attr, \
  54. &bat_priv->_name, net_dev); \
  55. }
  56. #define BAT_ATTR_SHOW_BOOL(_name) \
  57. ssize_t show_##_name(struct kobject *kobj, struct attribute *attr, \
  58. char *buff) \
  59. { \
  60. struct bat_priv *bat_priv = kobj_to_batpriv(kobj); \
  61. return sprintf(buff, "%s\n", \
  62. atomic_read(&bat_priv->_name) == 0 ? \
  63. "disabled" : "enabled"); \
  64. } \
  65. /* Use this, if you are going to turn a [name] in bat_priv on or off */
  66. #define BAT_ATTR_BOOL(_name, _mode, _post_func) \
  67. static BAT_ATTR_STORE_BOOL(_name, _post_func) \
  68. static BAT_ATTR_SHOW_BOOL(_name) \
  69. static BAT_ATTR(_name, _mode, show_##_name, store_##_name)
  70. #define BAT_ATTR_STORE_UINT(_name, _min, _max, _post_func) \
  71. ssize_t store_##_name(struct kobject *kobj, struct attribute *attr, \
  72. char *buff, size_t count) \
  73. { \
  74. struct net_device *net_dev = kobj_to_netdev(kobj); \
  75. struct bat_priv *bat_priv = netdev_priv(net_dev); \
  76. return __store_uint_attr(buff, count, _min, _max, _post_func, \
  77. attr, &bat_priv->_name, net_dev); \
  78. }
  79. #define BAT_ATTR_SHOW_UINT(_name) \
  80. ssize_t show_##_name(struct kobject *kobj, struct attribute *attr, \
  81. char *buff) \
  82. { \
  83. struct bat_priv *bat_priv = kobj_to_batpriv(kobj); \
  84. return sprintf(buff, "%i\n", atomic_read(&bat_priv->_name)); \
  85. } \
  86. /* Use this, if you are going to set [name] in bat_priv to unsigned integer
  87. * values only */
  88. #define BAT_ATTR_UINT(_name, _mode, _min, _max, _post_func) \
  89. static BAT_ATTR_STORE_UINT(_name, _min, _max, _post_func) \
  90. static BAT_ATTR_SHOW_UINT(_name) \
  91. static BAT_ATTR(_name, _mode, show_##_name, store_##_name)
  92. static int store_bool_attr(char *buff, size_t count,
  93. struct net_device *net_dev,
  94. const char *attr_name, atomic_t *attr)
  95. {
  96. int enabled = -1;
  97. if (buff[count - 1] == '\n')
  98. buff[count - 1] = '\0';
  99. if ((strncmp(buff, "1", 2) == 0) ||
  100. (strncmp(buff, "enable", 7) == 0) ||
  101. (strncmp(buff, "enabled", 8) == 0))
  102. enabled = 1;
  103. if ((strncmp(buff, "0", 2) == 0) ||
  104. (strncmp(buff, "disable", 8) == 0) ||
  105. (strncmp(buff, "disabled", 9) == 0))
  106. enabled = 0;
  107. if (enabled < 0) {
  108. bat_info(net_dev,
  109. "%s: Invalid parameter received: %s\n",
  110. attr_name, buff);
  111. return -EINVAL;
  112. }
  113. if (atomic_read(attr) == enabled)
  114. return count;
  115. bat_info(net_dev, "%s: Changing from: %s to: %s\n", attr_name,
  116. atomic_read(attr) == 1 ? "enabled" : "disabled",
  117. enabled == 1 ? "enabled" : "disabled");
  118. atomic_set(attr, (unsigned)enabled);
  119. return count;
  120. }
  121. static inline ssize_t __store_bool_attr(char *buff, size_t count,
  122. void (*post_func)(struct net_device *),
  123. struct attribute *attr,
  124. atomic_t *attr_store, struct net_device *net_dev)
  125. {
  126. int ret;
  127. ret = store_bool_attr(buff, count, net_dev, attr->name, attr_store);
  128. if (post_func && ret)
  129. post_func(net_dev);
  130. return ret;
  131. }
  132. static int store_uint_attr(const char *buff, size_t count,
  133. struct net_device *net_dev, const char *attr_name,
  134. unsigned int min, unsigned int max, atomic_t *attr)
  135. {
  136. unsigned long uint_val;
  137. int ret;
  138. ret = strict_strtoul(buff, 10, &uint_val);
  139. if (ret) {
  140. bat_info(net_dev,
  141. "%s: Invalid parameter received: %s\n",
  142. attr_name, buff);
  143. return -EINVAL;
  144. }
  145. if (uint_val < min) {
  146. bat_info(net_dev, "%s: Value is too small: %lu min: %u\n",
  147. attr_name, uint_val, min);
  148. return -EINVAL;
  149. }
  150. if (uint_val > max) {
  151. bat_info(net_dev, "%s: Value is too big: %lu max: %u\n",
  152. attr_name, uint_val, max);
  153. return -EINVAL;
  154. }
  155. if (atomic_read(attr) == uint_val)
  156. return count;
  157. bat_info(net_dev, "%s: Changing from: %i to: %lu\n",
  158. attr_name, atomic_read(attr), uint_val);
  159. atomic_set(attr, uint_val);
  160. return count;
  161. }
  162. static inline ssize_t __store_uint_attr(const char *buff, size_t count,
  163. int min, int max,
  164. void (*post_func)(struct net_device *),
  165. const struct attribute *attr,
  166. atomic_t *attr_store, struct net_device *net_dev)
  167. {
  168. int ret;
  169. ret = store_uint_attr(buff, count, net_dev, attr->name,
  170. min, max, attr_store);
  171. if (post_func && ret)
  172. post_func(net_dev);
  173. return ret;
  174. }
  175. static ssize_t show_vis_mode(struct kobject *kobj, struct attribute *attr,
  176. char *buff)
  177. {
  178. struct bat_priv *bat_priv = kobj_to_batpriv(kobj);
  179. int vis_mode = atomic_read(&bat_priv->vis_mode);
  180. return sprintf(buff, "%s\n",
  181. vis_mode == VIS_TYPE_CLIENT_UPDATE ?
  182. "client" : "server");
  183. }
  184. static ssize_t store_vis_mode(struct kobject *kobj, struct attribute *attr,
  185. char *buff, size_t count)
  186. {
  187. struct net_device *net_dev = kobj_to_netdev(kobj);
  188. struct bat_priv *bat_priv = netdev_priv(net_dev);
  189. unsigned long val;
  190. int ret, vis_mode_tmp = -1;
  191. ret = strict_strtoul(buff, 10, &val);
  192. if (((count == 2) && (!ret) && (val == VIS_TYPE_CLIENT_UPDATE)) ||
  193. (strncmp(buff, "client", 6) == 0) ||
  194. (strncmp(buff, "off", 3) == 0))
  195. vis_mode_tmp = VIS_TYPE_CLIENT_UPDATE;
  196. if (((count == 2) && (!ret) && (val == VIS_TYPE_SERVER_SYNC)) ||
  197. (strncmp(buff, "server", 6) == 0))
  198. vis_mode_tmp = VIS_TYPE_SERVER_SYNC;
  199. if (vis_mode_tmp < 0) {
  200. if (buff[count - 1] == '\n')
  201. buff[count - 1] = '\0';
  202. bat_info(net_dev,
  203. "Invalid parameter for 'vis mode' setting received: "
  204. "%s\n", buff);
  205. return -EINVAL;
  206. }
  207. if (atomic_read(&bat_priv->vis_mode) == vis_mode_tmp)
  208. return count;
  209. bat_info(net_dev, "Changing vis mode from: %s to: %s\n",
  210. atomic_read(&bat_priv->vis_mode) == VIS_TYPE_CLIENT_UPDATE ?
  211. "client" : "server", vis_mode_tmp == VIS_TYPE_CLIENT_UPDATE ?
  212. "client" : "server");
  213. atomic_set(&bat_priv->vis_mode, (unsigned)vis_mode_tmp);
  214. return count;
  215. }
  216. static void post_gw_deselect(struct net_device *net_dev)
  217. {
  218. struct bat_priv *bat_priv = netdev_priv(net_dev);
  219. gw_deselect(bat_priv);
  220. }
  221. static ssize_t show_gw_mode(struct kobject *kobj, struct attribute *attr,
  222. char *buff)
  223. {
  224. struct bat_priv *bat_priv = kobj_to_batpriv(kobj);
  225. int bytes_written;
  226. switch (atomic_read(&bat_priv->gw_mode)) {
  227. case GW_MODE_CLIENT:
  228. bytes_written = sprintf(buff, "%s\n", GW_MODE_CLIENT_NAME);
  229. break;
  230. case GW_MODE_SERVER:
  231. bytes_written = sprintf(buff, "%s\n", GW_MODE_SERVER_NAME);
  232. break;
  233. default:
  234. bytes_written = sprintf(buff, "%s\n", GW_MODE_OFF_NAME);
  235. break;
  236. }
  237. return bytes_written;
  238. }
  239. static ssize_t store_gw_mode(struct kobject *kobj, struct attribute *attr,
  240. char *buff, size_t count)
  241. {
  242. struct net_device *net_dev = kobj_to_netdev(kobj);
  243. struct bat_priv *bat_priv = netdev_priv(net_dev);
  244. char *curr_gw_mode_str;
  245. int gw_mode_tmp = -1;
  246. if (buff[count - 1] == '\n')
  247. buff[count - 1] = '\0';
  248. if (strncmp(buff, GW_MODE_OFF_NAME, strlen(GW_MODE_OFF_NAME)) == 0)
  249. gw_mode_tmp = GW_MODE_OFF;
  250. if (strncmp(buff, GW_MODE_CLIENT_NAME,
  251. strlen(GW_MODE_CLIENT_NAME)) == 0)
  252. gw_mode_tmp = GW_MODE_CLIENT;
  253. if (strncmp(buff, GW_MODE_SERVER_NAME,
  254. strlen(GW_MODE_SERVER_NAME)) == 0)
  255. gw_mode_tmp = GW_MODE_SERVER;
  256. if (gw_mode_tmp < 0) {
  257. bat_info(net_dev,
  258. "Invalid parameter for 'gw mode' setting received: "
  259. "%s\n", buff);
  260. return -EINVAL;
  261. }
  262. if (atomic_read(&bat_priv->gw_mode) == gw_mode_tmp)
  263. return count;
  264. switch (atomic_read(&bat_priv->gw_mode)) {
  265. case GW_MODE_CLIENT:
  266. curr_gw_mode_str = GW_MODE_CLIENT_NAME;
  267. break;
  268. case GW_MODE_SERVER:
  269. curr_gw_mode_str = GW_MODE_SERVER_NAME;
  270. break;
  271. default:
  272. curr_gw_mode_str = GW_MODE_OFF_NAME;
  273. break;
  274. }
  275. bat_info(net_dev, "Changing gw mode from: %s to: %s\n",
  276. curr_gw_mode_str, buff);
  277. gw_deselect(bat_priv);
  278. atomic_set(&bat_priv->gw_mode, (unsigned)gw_mode_tmp);
  279. return count;
  280. }
  281. static ssize_t show_gw_bwidth(struct kobject *kobj, struct attribute *attr,
  282. char *buff)
  283. {
  284. struct bat_priv *bat_priv = kobj_to_batpriv(kobj);
  285. int down, up;
  286. int gw_bandwidth = atomic_read(&bat_priv->gw_bandwidth);
  287. gw_bandwidth_to_kbit(gw_bandwidth, &down, &up);
  288. return sprintf(buff, "%i%s/%i%s\n",
  289. (down > 2048 ? down / 1024 : down),
  290. (down > 2048 ? "MBit" : "KBit"),
  291. (up > 2048 ? up / 1024 : up),
  292. (up > 2048 ? "MBit" : "KBit"));
  293. }
  294. static ssize_t store_gw_bwidth(struct kobject *kobj, struct attribute *attr,
  295. char *buff, size_t count)
  296. {
  297. struct net_device *net_dev = kobj_to_netdev(kobj);
  298. if (buff[count - 1] == '\n')
  299. buff[count - 1] = '\0';
  300. return gw_bandwidth_set(net_dev, buff, count);
  301. }
  302. BAT_ATTR_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL);
  303. BAT_ATTR_BOOL(bonding, S_IRUGO | S_IWUSR, NULL);
  304. BAT_ATTR_BOOL(fragmentation, S_IRUGO | S_IWUSR, update_min_mtu);
  305. static BAT_ATTR(vis_mode, S_IRUGO | S_IWUSR, show_vis_mode, store_vis_mode);
  306. static BAT_ATTR(gw_mode, S_IRUGO | S_IWUSR, show_gw_mode, store_gw_mode);
  307. BAT_ATTR_UINT(orig_interval, S_IRUGO | S_IWUSR, 2 * JITTER, INT_MAX, NULL);
  308. BAT_ATTR_UINT(hop_penalty, S_IRUGO | S_IWUSR, 0, TQ_MAX_VALUE, NULL);
  309. BAT_ATTR_UINT(gw_sel_class, S_IRUGO | S_IWUSR, 1, TQ_MAX_VALUE,
  310. post_gw_deselect);
  311. static BAT_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, show_gw_bwidth,
  312. store_gw_bwidth);
  313. #ifdef CONFIG_BATMAN_ADV_DEBUG
  314. BAT_ATTR_UINT(log_level, S_IRUGO | S_IWUSR, 0, 7, NULL);
  315. #endif
  316. static struct bat_attribute *mesh_attrs[] = {
  317. &bat_attr_aggregated_ogms,
  318. &bat_attr_bonding,
  319. &bat_attr_fragmentation,
  320. &bat_attr_vis_mode,
  321. &bat_attr_gw_mode,
  322. &bat_attr_orig_interval,
  323. &bat_attr_hop_penalty,
  324. &bat_attr_gw_sel_class,
  325. &bat_attr_gw_bandwidth,
  326. #ifdef CONFIG_BATMAN_ADV_DEBUG
  327. &bat_attr_log_level,
  328. #endif
  329. NULL,
  330. };
  331. int sysfs_add_meshif(struct net_device *dev)
  332. {
  333. struct kobject *batif_kobject = &dev->dev.kobj;
  334. struct bat_priv *bat_priv = netdev_priv(dev);
  335. struct bat_attribute **bat_attr;
  336. int err;
  337. bat_priv->mesh_obj = kobject_create_and_add(SYSFS_IF_MESH_SUBDIR,
  338. batif_kobject);
  339. if (!bat_priv->mesh_obj) {
  340. bat_err(dev, "Can't add sysfs directory: %s/%s\n", dev->name,
  341. SYSFS_IF_MESH_SUBDIR);
  342. goto out;
  343. }
  344. for (bat_attr = mesh_attrs; *bat_attr; ++bat_attr) {
  345. err = sysfs_create_file(bat_priv->mesh_obj,
  346. &((*bat_attr)->attr));
  347. if (err) {
  348. bat_err(dev, "Can't add sysfs file: %s/%s/%s\n",
  349. dev->name, SYSFS_IF_MESH_SUBDIR,
  350. ((*bat_attr)->attr).name);
  351. goto rem_attr;
  352. }
  353. }
  354. return 0;
  355. rem_attr:
  356. for (bat_attr = mesh_attrs; *bat_attr; ++bat_attr)
  357. sysfs_remove_file(bat_priv->mesh_obj, &((*bat_attr)->attr));
  358. kobject_put(bat_priv->mesh_obj);
  359. bat_priv->mesh_obj = NULL;
  360. out:
  361. return -ENOMEM;
  362. }
  363. void sysfs_del_meshif(struct net_device *dev)
  364. {
  365. struct bat_priv *bat_priv = netdev_priv(dev);
  366. struct bat_attribute **bat_attr;
  367. for (bat_attr = mesh_attrs; *bat_attr; ++bat_attr)
  368. sysfs_remove_file(bat_priv->mesh_obj, &((*bat_attr)->attr));
  369. kobject_put(bat_priv->mesh_obj);
  370. bat_priv->mesh_obj = NULL;
  371. }
  372. static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
  373. char *buff)
  374. {
  375. struct net_device *net_dev = kobj_to_netdev(kobj);
  376. struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
  377. ssize_t length;
  378. if (!hard_iface)
  379. return 0;
  380. length = sprintf(buff, "%s\n", hard_iface->if_status == IF_NOT_IN_USE ?
  381. "none" : hard_iface->soft_iface->name);
  382. hardif_free_ref(hard_iface);
  383. return length;
  384. }
  385. static ssize_t store_mesh_iface(struct kobject *kobj, struct attribute *attr,
  386. char *buff, size_t count)
  387. {
  388. struct net_device *net_dev = kobj_to_netdev(kobj);
  389. struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
  390. int status_tmp = -1;
  391. int ret = count;
  392. if (!hard_iface)
  393. return count;
  394. if (buff[count - 1] == '\n')
  395. buff[count - 1] = '\0';
  396. if (strlen(buff) >= IFNAMSIZ) {
  397. pr_err("Invalid parameter for 'mesh_iface' setting received: "
  398. "interface name too long '%s'\n", buff);
  399. hardif_free_ref(hard_iface);
  400. return -EINVAL;
  401. }
  402. if (strncmp(buff, "none", 4) == 0)
  403. status_tmp = IF_NOT_IN_USE;
  404. else
  405. status_tmp = IF_I_WANT_YOU;
  406. if (hard_iface->if_status == status_tmp)
  407. goto out;
  408. if ((hard_iface->soft_iface) &&
  409. (strncmp(hard_iface->soft_iface->name, buff, IFNAMSIZ) == 0))
  410. goto out;
  411. if (!rtnl_trylock()) {
  412. ret = -ERESTARTSYS;
  413. goto out;
  414. }
  415. if (status_tmp == IF_NOT_IN_USE) {
  416. hardif_disable_interface(hard_iface);
  417. goto unlock;
  418. }
  419. /* if the interface already is in use */
  420. if (hard_iface->if_status != IF_NOT_IN_USE)
  421. hardif_disable_interface(hard_iface);
  422. ret = hardif_enable_interface(hard_iface, buff);
  423. unlock:
  424. rtnl_unlock();
  425. out:
  426. hardif_free_ref(hard_iface);
  427. return ret;
  428. }
  429. static ssize_t show_iface_status(struct kobject *kobj, struct attribute *attr,
  430. char *buff)
  431. {
  432. struct net_device *net_dev = kobj_to_netdev(kobj);
  433. struct hard_iface *hard_iface = hardif_get_by_netdev(net_dev);
  434. ssize_t length;
  435. if (!hard_iface)
  436. return 0;
  437. switch (hard_iface->if_status) {
  438. case IF_TO_BE_REMOVED:
  439. length = sprintf(buff, "disabling\n");
  440. break;
  441. case IF_INACTIVE:
  442. length = sprintf(buff, "inactive\n");
  443. break;
  444. case IF_ACTIVE:
  445. length = sprintf(buff, "active\n");
  446. break;
  447. case IF_TO_BE_ACTIVATED:
  448. length = sprintf(buff, "enabling\n");
  449. break;
  450. case IF_NOT_IN_USE:
  451. default:
  452. length = sprintf(buff, "not in use\n");
  453. break;
  454. }
  455. hardif_free_ref(hard_iface);
  456. return length;
  457. }
  458. static BAT_ATTR(mesh_iface, S_IRUGO | S_IWUSR,
  459. show_mesh_iface, store_mesh_iface);
  460. static BAT_ATTR(iface_status, S_IRUGO, show_iface_status, NULL);
  461. static struct bat_attribute *batman_attrs[] = {
  462. &bat_attr_mesh_iface,
  463. &bat_attr_iface_status,
  464. NULL,
  465. };
  466. int sysfs_add_hardif(struct kobject **hardif_obj, struct net_device *dev)
  467. {
  468. struct kobject *hardif_kobject = &dev->dev.kobj;
  469. struct bat_attribute **bat_attr;
  470. int err;
  471. *hardif_obj = kobject_create_and_add(SYSFS_IF_BAT_SUBDIR,
  472. hardif_kobject);
  473. if (!*hardif_obj) {
  474. bat_err(dev, "Can't add sysfs directory: %s/%s\n", dev->name,
  475. SYSFS_IF_BAT_SUBDIR);
  476. goto out;
  477. }
  478. for (bat_attr = batman_attrs; *bat_attr; ++bat_attr) {
  479. err = sysfs_create_file(*hardif_obj, &((*bat_attr)->attr));
  480. if (err) {
  481. bat_err(dev, "Can't add sysfs file: %s/%s/%s\n",
  482. dev->name, SYSFS_IF_BAT_SUBDIR,
  483. ((*bat_attr)->attr).name);
  484. goto rem_attr;
  485. }
  486. }
  487. return 0;
  488. rem_attr:
  489. for (bat_attr = batman_attrs; *bat_attr; ++bat_attr)
  490. sysfs_remove_file(*hardif_obj, &((*bat_attr)->attr));
  491. out:
  492. return -ENOMEM;
  493. }
  494. void sysfs_del_hardif(struct kobject **hardif_obj)
  495. {
  496. kobject_put(*hardif_obj);
  497. *hardif_obj = NULL;
  498. }