History

net: phy: add phy_modify_paged_changed

Add helper function phy_modify_paged_changed, behavios is the same as for phy_modify_changed.

Heiner Kallweit committed 7 years ago

Commit bf22b341 parent f4069cd2 files · +26 −5Browse files

Unified · Split

2 files
  1. drivers/net/phy/phy-core.c +24 −5
  2. include/linux/phy.h +2 −0
drivers/net/phy/phy-core.c+24−5
@@ -783,24 +783,43 @@ int phy_write_paged(struct phy_device *phydev, int page, u32 regnum, u16 val) · 782 unmodified lines
783783 EXPORT_SYMBOL(phy_write_paged);
784784
785785 /**
786− * phy_modify_paged() - Convenience function for modifying a paged register
786+ * phy_modify_paged_changed() - Function for modifying a paged register
787787 * @phydev: a pointer to a &struct phy_device
788788 * @page: the page for the phy
789789 * @regnum: register number
790790 * @mask: bit mask of bits to clear
791791 * @set: bit mask of bits to set
792792 *
793− * Same rules as for phy_read() and phy_write().
793+ * Returns negative errno, 0 if there was no change, and 1 in case of change
794794 */
795−int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum,
796− u16 mask, u16 set)
795+int phy_modify_paged_changed(struct phy_device *phydev, int page, u32 regnum,
796+ u16 mask, u16 set)
797797 {
798798 int ret = 0, oldpage;
799799
800800 oldpage = phy_select_page(phydev, page);
801801 if (oldpage >= 0)
802− ret = __phy_modify(phydev, regnum, mask, set);
802+ ret = __phy_modify_changed(phydev, regnum, mask, set);
803803
804804 return phy_restore_page(phydev, oldpage, ret);
805805 }
806+EXPORT_SYMBOL(phy_modify_paged_changed);
807+
808+/**
809+ * phy_modify_paged() - Convenience function for modifying a paged register
810+ * @phydev: a pointer to a &struct phy_device
811+ * @page: the page for the phy
812+ * @regnum: register number
813+ * @mask: bit mask of bits to clear
814+ * @set: bit mask of bits to set
815+ *
816+ * Same rules as for phy_read() and phy_write().
817+ */
818+int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum,
819+ u16 mask, u16 set)
820+{
821+ int ret = phy_modify_paged_changed(phydev, page, regnum, mask, set);
822+
823+ return ret < 0 ? ret : 0;
824+}
806825 EXPORT_SYMBOL(phy_modify_paged);
include/linux/phy.h+2−0
@@ -984,6 +984,8 @@ int phy_select_page(struct phy_device *phydev, int page); · 983 unmodified lines
984984 int phy_restore_page(struct phy_device *phydev, int oldpage, int ret);
985985 int phy_read_paged(struct phy_device *phydev, int page, u32 regnum);
986986 int phy_write_paged(struct phy_device *phydev, int page, u32 regnum, u16 val);
987+int phy_modify_paged_changed(struct phy_device *phydev, int page, u32 regnum,
988+ u16 mask, u16 set);
987989 int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum,
988990 u16 mask, u16 set);
989991

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t