sfp-bus.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. #include <linux/export.h>
  2. #include <linux/kref.h>
  3. #include <linux/list.h>
  4. #include <linux/mutex.h>
  5. #include <linux/phylink.h>
  6. #include <linux/rtnetlink.h>
  7. #include <linux/slab.h>
  8. #include "sfp.h"
  9. /**
  10. * struct sfp_bus - internal representation of a sfp bus
  11. */
  12. struct sfp_bus {
  13. /* private: */
  14. struct kref kref;
  15. struct list_head node;
  16. struct fwnode_handle *fwnode;
  17. const struct sfp_socket_ops *socket_ops;
  18. struct device *sfp_dev;
  19. struct sfp *sfp;
  20. const struct sfp_upstream_ops *upstream_ops;
  21. void *upstream;
  22. struct net_device *netdev;
  23. struct phy_device *phydev;
  24. bool registered;
  25. bool started;
  26. };
  27. /**
  28. * sfp_parse_port() - Parse the EEPROM base ID, setting the port type
  29. * @bus: a pointer to the &struct sfp_bus structure for the sfp module
  30. * @id: a pointer to the module's &struct sfp_eeprom_id
  31. * @support: optional pointer to an array of unsigned long for the
  32. * ethtool support mask
  33. *
  34. * Parse the EEPROM identification given in @id, and return one of
  35. * %PORT_TP, %PORT_FIBRE or %PORT_OTHER. If @support is non-%NULL,
  36. * also set the ethtool %ETHTOOL_LINK_MODE_xxx_BIT corresponding with
  37. * the connector type.
  38. *
  39. * If the port type is not known, returns %PORT_OTHER.
  40. */
  41. int sfp_parse_port(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
  42. unsigned long *support)
  43. {
  44. int port;
  45. /* port is the physical connector, set this from the connector field. */
  46. switch (id->base.connector) {
  47. case SFP_CONNECTOR_SC:
  48. case SFP_CONNECTOR_FIBERJACK:
  49. case SFP_CONNECTOR_LC:
  50. case SFP_CONNECTOR_MT_RJ:
  51. case SFP_CONNECTOR_MU:
  52. case SFP_CONNECTOR_OPTICAL_PIGTAIL:
  53. port = PORT_FIBRE;
  54. break;
  55. case SFP_CONNECTOR_RJ45:
  56. port = PORT_TP;
  57. break;
  58. case SFP_CONNECTOR_COPPER_PIGTAIL:
  59. port = PORT_DA;
  60. break;
  61. case SFP_CONNECTOR_UNSPEC:
  62. if (id->base.e1000_base_t) {
  63. port = PORT_TP;
  64. break;
  65. }
  66. /* fallthrough */
  67. case SFP_CONNECTOR_SG: /* guess */
  68. case SFP_CONNECTOR_MPO_1X12:
  69. case SFP_CONNECTOR_MPO_2X16:
  70. case SFP_CONNECTOR_HSSDC_II:
  71. case SFP_CONNECTOR_NOSEPARATE:
  72. case SFP_CONNECTOR_MXC_2X16:
  73. port = PORT_OTHER;
  74. break;
  75. default:
  76. dev_warn(bus->sfp_dev, "SFP: unknown connector id 0x%02x\n",
  77. id->base.connector);
  78. port = PORT_OTHER;
  79. break;
  80. }
  81. if (support) {
  82. switch (port) {
  83. case PORT_FIBRE:
  84. phylink_set(support, FIBRE);
  85. break;
  86. case PORT_TP:
  87. phylink_set(support, TP);
  88. break;
  89. }
  90. }
  91. return port;
  92. }
  93. EXPORT_SYMBOL_GPL(sfp_parse_port);
  94. /**
  95. * sfp_parse_support() - Parse the eeprom id for supported link modes
  96. * @bus: a pointer to the &struct sfp_bus structure for the sfp module
  97. * @id: a pointer to the module's &struct sfp_eeprom_id
  98. * @support: pointer to an array of unsigned long for the ethtool support mask
  99. *
  100. * Parse the EEPROM identification information and derive the supported
  101. * ethtool link modes for the module.
  102. */
  103. void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
  104. unsigned long *support)
  105. {
  106. unsigned int br_min, br_nom, br_max;
  107. __ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = { 0, };
  108. /* Decode the bitrate information to MBd */
  109. br_min = br_nom = br_max = 0;
  110. if (id->base.br_nominal) {
  111. if (id->base.br_nominal != 255) {
  112. br_nom = id->base.br_nominal * 100;
  113. br_min = br_nom - id->base.br_nominal * id->ext.br_min;
  114. br_max = br_nom + id->base.br_nominal * id->ext.br_max;
  115. } else if (id->ext.br_max) {
  116. br_nom = 250 * id->ext.br_max;
  117. br_max = br_nom + br_nom * id->ext.br_min / 100;
  118. br_min = br_nom - br_nom * id->ext.br_min / 100;
  119. }
  120. /* When using passive cables, in case neither BR,min nor BR,max
  121. * are specified, set br_min to 0 as the nominal value is then
  122. * used as the maximum.
  123. */
  124. if (br_min == br_max && id->base.sfp_ct_passive)
  125. br_min = 0;
  126. }
  127. /* Set ethtool support from the compliance fields. */
  128. if (id->base.e10g_base_sr)
  129. phylink_set(modes, 10000baseSR_Full);
  130. if (id->base.e10g_base_lr)
  131. phylink_set(modes, 10000baseLR_Full);
  132. if (id->base.e10g_base_lrm)
  133. phylink_set(modes, 10000baseLRM_Full);
  134. if (id->base.e10g_base_er)
  135. phylink_set(modes, 10000baseER_Full);
  136. if (id->base.e1000_base_sx ||
  137. id->base.e1000_base_lx ||
  138. id->base.e1000_base_cx)
  139. phylink_set(modes, 1000baseX_Full);
  140. if (id->base.e1000_base_t) {
  141. phylink_set(modes, 1000baseT_Half);
  142. phylink_set(modes, 1000baseT_Full);
  143. }
  144. /* 1000Base-PX or 1000Base-BX10 */
  145. if ((id->base.e_base_px || id->base.e_base_bx10) &&
  146. br_min <= 1300 && br_max >= 1200)
  147. phylink_set(modes, 1000baseX_Full);
  148. /* For active or passive cables, select the link modes
  149. * based on the bit rates and the cable compliance bytes.
  150. */
  151. if ((id->base.sfp_ct_passive || id->base.sfp_ct_active) && br_nom) {
  152. /* This may look odd, but some manufacturers use 12000MBd */
  153. if (br_min <= 12000 && br_max >= 10300)
  154. phylink_set(modes, 10000baseCR_Full);
  155. if (br_min <= 3200 && br_max >= 3100)
  156. phylink_set(modes, 2500baseX_Full);
  157. if (br_min <= 1300 && br_max >= 1200)
  158. phylink_set(modes, 1000baseX_Full);
  159. }
  160. if (id->base.sfp_ct_passive) {
  161. if (id->base.passive.sff8431_app_e)
  162. phylink_set(modes, 10000baseCR_Full);
  163. }
  164. if (id->base.sfp_ct_active) {
  165. if (id->base.active.sff8431_app_e ||
  166. id->base.active.sff8431_lim) {
  167. phylink_set(modes, 10000baseCR_Full);
  168. }
  169. }
  170. switch (id->base.extended_cc) {
  171. case 0x00: /* Unspecified */
  172. break;
  173. case 0x02: /* 100Gbase-SR4 or 25Gbase-SR */
  174. phylink_set(modes, 100000baseSR4_Full);
  175. phylink_set(modes, 25000baseSR_Full);
  176. break;
  177. case 0x03: /* 100Gbase-LR4 or 25Gbase-LR */
  178. case 0x04: /* 100Gbase-ER4 or 25Gbase-ER */
  179. phylink_set(modes, 100000baseLR4_ER4_Full);
  180. break;
  181. case 0x0b: /* 100Gbase-CR4 or 25Gbase-CR CA-L */
  182. case 0x0c: /* 25Gbase-CR CA-S */
  183. case 0x0d: /* 25Gbase-CR CA-N */
  184. phylink_set(modes, 100000baseCR4_Full);
  185. phylink_set(modes, 25000baseCR_Full);
  186. break;
  187. default:
  188. dev_warn(bus->sfp_dev,
  189. "Unknown/unsupported extended compliance code: 0x%02x\n",
  190. id->base.extended_cc);
  191. break;
  192. }
  193. /* For fibre channel SFP, derive possible BaseX modes */
  194. if (id->base.fc_speed_100 ||
  195. id->base.fc_speed_200 ||
  196. id->base.fc_speed_400) {
  197. if (id->base.br_nominal >= 31)
  198. phylink_set(modes, 2500baseX_Full);
  199. if (id->base.br_nominal >= 12)
  200. phylink_set(modes, 1000baseX_Full);
  201. }
  202. /* If we haven't discovered any modes that this module supports, try
  203. * the encoding and bitrate to determine supported modes. Some BiDi
  204. * modules (eg, 1310nm/1550nm) are not 1000BASE-BX compliant due to
  205. * the differing wavelengths, so do not set any transceiver bits.
  206. */
  207. if (bitmap_empty(modes, __ETHTOOL_LINK_MODE_MASK_NBITS)) {
  208. /* If the encoding and bit rate allows 1000baseX */
  209. if (id->base.encoding == SFP_ENCODING_8B10B && br_nom &&
  210. br_min <= 1300 && br_max >= 1200)
  211. phylink_set(modes, 1000baseX_Full);
  212. }
  213. bitmap_or(support, support, modes, __ETHTOOL_LINK_MODE_MASK_NBITS);
  214. phylink_set(support, Autoneg);
  215. phylink_set(support, Pause);
  216. phylink_set(support, Asym_Pause);
  217. }
  218. EXPORT_SYMBOL_GPL(sfp_parse_support);
  219. /**
  220. * sfp_select_interface() - Select appropriate phy_interface_t mode
  221. * @bus: a pointer to the &struct sfp_bus structure for the sfp module
  222. * @id: a pointer to the module's &struct sfp_eeprom_id
  223. * @link_modes: ethtool link modes mask
  224. *
  225. * Derive the phy_interface_t mode for the information found in the
  226. * module's identifying EEPROM and the link modes mask. There is no
  227. * standard or defined way to derive this information, so we decide
  228. * based upon the link mode mask.
  229. */
  230. phy_interface_t sfp_select_interface(struct sfp_bus *bus,
  231. const struct sfp_eeprom_id *id,
  232. unsigned long *link_modes)
  233. {
  234. if (phylink_test(link_modes, 10000baseCR_Full) ||
  235. phylink_test(link_modes, 10000baseSR_Full) ||
  236. phylink_test(link_modes, 10000baseLR_Full) ||
  237. phylink_test(link_modes, 10000baseLRM_Full) ||
  238. phylink_test(link_modes, 10000baseER_Full))
  239. return PHY_INTERFACE_MODE_10GKR;
  240. if (phylink_test(link_modes, 2500baseX_Full))
  241. return PHY_INTERFACE_MODE_2500BASEX;
  242. if (id->base.e1000_base_t ||
  243. id->base.e100_base_lx ||
  244. id->base.e100_base_fx)
  245. return PHY_INTERFACE_MODE_SGMII;
  246. if (phylink_test(link_modes, 1000baseX_Full))
  247. return PHY_INTERFACE_MODE_1000BASEX;
  248. dev_warn(bus->sfp_dev, "Unable to ascertain link mode\n");
  249. return PHY_INTERFACE_MODE_NA;
  250. }
  251. EXPORT_SYMBOL_GPL(sfp_select_interface);
  252. static LIST_HEAD(sfp_buses);
  253. static DEFINE_MUTEX(sfp_mutex);
  254. static const struct sfp_upstream_ops *sfp_get_upstream_ops(struct sfp_bus *bus)
  255. {
  256. return bus->registered ? bus->upstream_ops : NULL;
  257. }
  258. static struct sfp_bus *sfp_bus_get(struct fwnode_handle *fwnode)
  259. {
  260. struct sfp_bus *sfp, *new, *found = NULL;
  261. new = kzalloc(sizeof(*new), GFP_KERNEL);
  262. mutex_lock(&sfp_mutex);
  263. list_for_each_entry(sfp, &sfp_buses, node) {
  264. if (sfp->fwnode == fwnode) {
  265. kref_get(&sfp->kref);
  266. found = sfp;
  267. break;
  268. }
  269. }
  270. if (!found && new) {
  271. kref_init(&new->kref);
  272. new->fwnode = fwnode;
  273. list_add(&new->node, &sfp_buses);
  274. found = new;
  275. new = NULL;
  276. }
  277. mutex_unlock(&sfp_mutex);
  278. kfree(new);
  279. return found;
  280. }
  281. static void sfp_bus_release(struct kref *kref)
  282. {
  283. struct sfp_bus *bus = container_of(kref, struct sfp_bus, kref);
  284. list_del(&bus->node);
  285. mutex_unlock(&sfp_mutex);
  286. kfree(bus);
  287. }
  288. static void sfp_bus_put(struct sfp_bus *bus)
  289. {
  290. kref_put_mutex(&bus->kref, sfp_bus_release, &sfp_mutex);
  291. }
  292. static int sfp_register_bus(struct sfp_bus *bus)
  293. {
  294. const struct sfp_upstream_ops *ops = bus->upstream_ops;
  295. int ret;
  296. if (ops) {
  297. if (ops->link_down)
  298. ops->link_down(bus->upstream);
  299. if (ops->connect_phy && bus->phydev) {
  300. ret = ops->connect_phy(bus->upstream, bus->phydev);
  301. if (ret)
  302. return ret;
  303. }
  304. }
  305. if (bus->started)
  306. bus->socket_ops->start(bus->sfp);
  307. bus->netdev->sfp_bus = bus;
  308. bus->registered = true;
  309. return 0;
  310. }
  311. static void sfp_unregister_bus(struct sfp_bus *bus)
  312. {
  313. const struct sfp_upstream_ops *ops = bus->upstream_ops;
  314. bus->netdev->sfp_bus = NULL;
  315. if (bus->registered) {
  316. if (bus->started)
  317. bus->socket_ops->stop(bus->sfp);
  318. if (bus->phydev && ops && ops->disconnect_phy)
  319. ops->disconnect_phy(bus->upstream);
  320. }
  321. bus->registered = false;
  322. }
  323. /**
  324. * sfp_get_module_info() - Get the ethtool_modinfo for a SFP module
  325. * @bus: a pointer to the &struct sfp_bus structure for the sfp module
  326. * @modinfo: a &struct ethtool_modinfo
  327. *
  328. * Fill in the type and eeprom_len parameters in @modinfo for a module on
  329. * the sfp bus specified by @bus.
  330. *
  331. * Returns 0 on success or a negative errno number.
  332. */
  333. int sfp_get_module_info(struct sfp_bus *bus, struct ethtool_modinfo *modinfo)
  334. {
  335. return bus->socket_ops->module_info(bus->sfp, modinfo);
  336. }
  337. EXPORT_SYMBOL_GPL(sfp_get_module_info);
  338. /**
  339. * sfp_get_module_eeprom() - Read the SFP module EEPROM
  340. * @bus: a pointer to the &struct sfp_bus structure for the sfp module
  341. * @ee: a &struct ethtool_eeprom
  342. * @data: buffer to contain the EEPROM data (must be at least @ee->len bytes)
  343. *
  344. * Read the EEPROM as specified by the supplied @ee. See the documentation
  345. * for &struct ethtool_eeprom for the region to be read.
  346. *
  347. * Returns 0 on success or a negative errno number.
  348. */
  349. int sfp_get_module_eeprom(struct sfp_bus *bus, struct ethtool_eeprom *ee,
  350. u8 *data)
  351. {
  352. return bus->socket_ops->module_eeprom(bus->sfp, ee, data);
  353. }
  354. EXPORT_SYMBOL_GPL(sfp_get_module_eeprom);
  355. /**
  356. * sfp_upstream_start() - Inform the SFP that the network device is up
  357. * @bus: a pointer to the &struct sfp_bus structure for the sfp module
  358. *
  359. * Inform the SFP socket that the network device is now up, so that the
  360. * module can be enabled by allowing TX_DISABLE to be deasserted. This
  361. * should be called from the network device driver's &struct net_device_ops
  362. * ndo_open() method.
  363. */
  364. void sfp_upstream_start(struct sfp_bus *bus)
  365. {
  366. if (bus->registered)
  367. bus->socket_ops->start(bus->sfp);
  368. bus->started = true;
  369. }
  370. EXPORT_SYMBOL_GPL(sfp_upstream_start);
  371. /**
  372. * sfp_upstream_stop() - Inform the SFP that the network device is down
  373. * @bus: a pointer to the &struct sfp_bus structure for the sfp module
  374. *
  375. * Inform the SFP socket that the network device is now up, so that the
  376. * module can be disabled by asserting TX_DISABLE, disabling the laser
  377. * in optical modules. This should be called from the network device
  378. * driver's &struct net_device_ops ndo_stop() method.
  379. */
  380. void sfp_upstream_stop(struct sfp_bus *bus)
  381. {
  382. if (bus->registered)
  383. bus->socket_ops->stop(bus->sfp);
  384. bus->started = false;
  385. }
  386. EXPORT_SYMBOL_GPL(sfp_upstream_stop);
  387. static void sfp_upstream_clear(struct sfp_bus *bus)
  388. {
  389. bus->upstream_ops = NULL;
  390. bus->upstream = NULL;
  391. bus->netdev = NULL;
  392. }
  393. /**
  394. * sfp_register_upstream() - Register the neighbouring device
  395. * @fwnode: firmware node for the SFP bus
  396. * @ndev: network device associated with the interface
  397. * @upstream: the upstream private data
  398. * @ops: the upstream's &struct sfp_upstream_ops
  399. *
  400. * Register the upstream device (eg, PHY) with the SFP bus. MAC drivers
  401. * should use phylink, which will call this function for them. Returns
  402. * a pointer to the allocated &struct sfp_bus.
  403. *
  404. * On error, returns %NULL.
  405. */
  406. struct sfp_bus *sfp_register_upstream(struct fwnode_handle *fwnode,
  407. struct net_device *ndev, void *upstream,
  408. const struct sfp_upstream_ops *ops)
  409. {
  410. struct sfp_bus *bus = sfp_bus_get(fwnode);
  411. int ret = 0;
  412. if (bus) {
  413. rtnl_lock();
  414. bus->upstream_ops = ops;
  415. bus->upstream = upstream;
  416. bus->netdev = ndev;
  417. if (bus->sfp) {
  418. ret = sfp_register_bus(bus);
  419. if (ret)
  420. sfp_upstream_clear(bus);
  421. }
  422. rtnl_unlock();
  423. }
  424. if (ret) {
  425. sfp_bus_put(bus);
  426. bus = NULL;
  427. }
  428. return bus;
  429. }
  430. EXPORT_SYMBOL_GPL(sfp_register_upstream);
  431. /**
  432. * sfp_unregister_upstream() - Unregister sfp bus
  433. * @bus: a pointer to the &struct sfp_bus structure for the sfp module
  434. *
  435. * Unregister a previously registered upstream connection for the SFP
  436. * module. @bus is returned from sfp_register_upstream().
  437. */
  438. void sfp_unregister_upstream(struct sfp_bus *bus)
  439. {
  440. rtnl_lock();
  441. if (bus->sfp)
  442. sfp_unregister_bus(bus);
  443. sfp_upstream_clear(bus);
  444. rtnl_unlock();
  445. sfp_bus_put(bus);
  446. }
  447. EXPORT_SYMBOL_GPL(sfp_unregister_upstream);
  448. /* Socket driver entry points */
  449. int sfp_add_phy(struct sfp_bus *bus, struct phy_device *phydev)
  450. {
  451. const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus);
  452. int ret = 0;
  453. if (ops && ops->connect_phy)
  454. ret = ops->connect_phy(bus->upstream, phydev);
  455. if (ret == 0)
  456. bus->phydev = phydev;
  457. return ret;
  458. }
  459. EXPORT_SYMBOL_GPL(sfp_add_phy);
  460. void sfp_remove_phy(struct sfp_bus *bus)
  461. {
  462. const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus);
  463. if (ops && ops->disconnect_phy)
  464. ops->disconnect_phy(bus->upstream);
  465. bus->phydev = NULL;
  466. }
  467. EXPORT_SYMBOL_GPL(sfp_remove_phy);
  468. void sfp_link_up(struct sfp_bus *bus)
  469. {
  470. const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus);
  471. if (ops && ops->link_up)
  472. ops->link_up(bus->upstream);
  473. }
  474. EXPORT_SYMBOL_GPL(sfp_link_up);
  475. void sfp_link_down(struct sfp_bus *bus)
  476. {
  477. const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus);
  478. if (ops && ops->link_down)
  479. ops->link_down(bus->upstream);
  480. }
  481. EXPORT_SYMBOL_GPL(sfp_link_down);
  482. int sfp_module_insert(struct sfp_bus *bus, const struct sfp_eeprom_id *id)
  483. {
  484. const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus);
  485. int ret = 0;
  486. if (ops && ops->module_insert)
  487. ret = ops->module_insert(bus->upstream, id);
  488. return ret;
  489. }
  490. EXPORT_SYMBOL_GPL(sfp_module_insert);
  491. void sfp_module_remove(struct sfp_bus *bus)
  492. {
  493. const struct sfp_upstream_ops *ops = sfp_get_upstream_ops(bus);
  494. if (ops && ops->module_remove)
  495. ops->module_remove(bus->upstream);
  496. }
  497. EXPORT_SYMBOL_GPL(sfp_module_remove);
  498. static void sfp_socket_clear(struct sfp_bus *bus)
  499. {
  500. bus->sfp_dev = NULL;
  501. bus->sfp = NULL;
  502. bus->socket_ops = NULL;
  503. }
  504. struct sfp_bus *sfp_register_socket(struct device *dev, struct sfp *sfp,
  505. const struct sfp_socket_ops *ops)
  506. {
  507. struct sfp_bus *bus = sfp_bus_get(dev->fwnode);
  508. int ret = 0;
  509. if (bus) {
  510. rtnl_lock();
  511. bus->sfp_dev = dev;
  512. bus->sfp = sfp;
  513. bus->socket_ops = ops;
  514. if (bus->netdev) {
  515. ret = sfp_register_bus(bus);
  516. if (ret)
  517. sfp_socket_clear(bus);
  518. }
  519. rtnl_unlock();
  520. }
  521. if (ret) {
  522. sfp_bus_put(bus);
  523. bus = NULL;
  524. }
  525. return bus;
  526. }
  527. EXPORT_SYMBOL_GPL(sfp_register_socket);
  528. void sfp_unregister_socket(struct sfp_bus *bus)
  529. {
  530. rtnl_lock();
  531. if (bus->netdev)
  532. sfp_unregister_bus(bus);
  533. sfp_socket_clear(bus);
  534. rtnl_unlock();
  535. sfp_bus_put(bus);
  536. }
  537. EXPORT_SYMBOL_GPL(sfp_unregister_socket);