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
783EXPORT_SYMBOL(phy_write_paged);783EXPORT_SYMBOL(phy_write_paged);
784 784
785/**785/**
786 * phy_modify_paged() - Convenience function for modifying a paged register786 * phy_modify_paged_changed() - Function for modifying a paged register
787 * @phydev: a pointer to a &struct phy_device787 * @phydev: a pointer to a &struct phy_device
788 * @page: the page for the phy788 * @page: the page for the phy
789 * @regnum: register number789 * @regnum: register number
790 * @mask: bit mask of bits to clear790 * @mask: bit mask of bits to clear
791 * @set: bit mask of bits to set791 * @set: bit mask of bits to set
792 *792 *
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
794 */794 */
795int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum,795int phy_modify_paged_changed(struct phy_device *phydev, int page, u32 regnum,
796 u16 mask, u16 set)796 u16 mask, u16 set)
797{797{
798 int ret = 0, oldpage;798 int ret = 0, oldpage;
799 799
800 oldpage = phy_select_page(phydev, page);800 oldpage = phy_select_page(phydev, page);
801 if (oldpage >= 0)801 if (oldpage >= 0)
802 ret = __phy_modify(phydev, regnum, mask, set);802 ret = __phy_modify_changed(phydev, regnum, mask, set);
803 803
804 return phy_restore_page(phydev, oldpage, ret);804 return phy_restore_page(phydev, oldpage, ret);
805}805}
806EXPORT_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 */
818int 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}
806EXPORT_SYMBOL(phy_modify_paged);825EXPORT_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
984int phy_restore_page(struct phy_device *phydev, int oldpage, int ret);984int phy_restore_page(struct phy_device *phydev, int oldpage, int ret);
985int phy_read_paged(struct phy_device *phydev, int page, u32 regnum);985int phy_read_paged(struct phy_device *phydev, int page, u32 regnum);
986int phy_write_paged(struct phy_device *phydev, int page, u32 regnum, u16 val);986int phy_write_paged(struct phy_device *phydev, int page, u32 regnum, u16 val);
987int phy_modify_paged_changed(struct phy_device *phydev, int page, u32 regnum,
988 u16 mask, u16 set);
987int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum,989int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum,
988 u16 mask, u16 set);990 u16 mask, u16 set);
989 991

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