aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-03-23 11:24:57 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-23 11:31:58 -0400
commit03fe2debbb2771fb90881e4ce8109b09cf772a5c (patch)
treefbaf8738296b2e9dcba81c6daef2d515b6c4948c /drivers/net/phy/phy.c
parent6686c459e1449a3ee5f3fd313b0a559ace7a700e (diff)
parentf36b7534b83357cf52e747905de6d65b4f7c2512 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Fun set of conflict resolutions here... For the mac80211 stuff, these were fortunately just parallel adds. Trivially resolved. In drivers/net/phy/phy.c we had a bug fix in 'net' that moved the function phy_disable_interrupts() earlier in the file, whilst in 'net-next' the phy_error() call from this function was removed. In net/ipv4/xfrm4_policy.c, David Ahern's changes to remove the 'rt_table_id' member of rtable collided with a bug fix in 'net' that added a new struct member "rt_mtu_locked" which needs to be copied over here. The mlxsw driver conflict consisted of net-next separating the span code and definitions into separate files, whilst a 'net' bug fix made some changes to that moved code. The mlx5 infiniband conflict resolution was quite non-trivial, the RDMA tree's merge commit was used as a guide here, and here are their notes: ==================== Due to bug fixes found by the syzkaller bot and taken into the for-rc branch after development for the 4.17 merge window had already started being taken into the for-next branch, there were fairly non-trivial merge issues that would need to be resolved between the for-rc branch and the for-next branch. This merge resolves those conflicts and provides a unified base upon which ongoing development for 4.17 can be based. Conflicts: drivers/infiniband/hw/mlx5/main.c - Commit 42cea83f9524 (IB/mlx5: Fix cleanup order on unload) added to for-rc and commit b5ca15ad7e61 (IB/mlx5: Add proper representors support) add as part of the devel cycle both needed to modify the init/de-init functions used by mlx5. To support the new representors, the new functions added by the cleanup patch needed to be made non-static, and the init/de-init list added by the representors patch needed to be modified to match the init/de-init list changes made by the cleanup patch. Updates: drivers/infiniband/hw/mlx5/mlx5_ib.h - Update function prototypes added by representors patch to reflect new function names as changed by cleanup patch drivers/infiniband/hw/mlx5/ib_rep.c - Update init/de-init stage list to match new order from cleanup patch ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c127
1 files changed, 63 insertions, 64 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index c2d9027be863..05c1e8ef15e6 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -618,6 +618,68 @@ static void phy_error(struct phy_device *phydev)
618} 618}
619 619
620/** 620/**
621 * phy_disable_interrupts - Disable the PHY interrupts from the PHY side
622 * @phydev: target phy_device struct
623 */
624static int phy_disable_interrupts(struct phy_device *phydev)
625{
626 int err;
627
628 /* Disable PHY interrupts */
629 err = phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED);
630 if (err)
631 return err;
632
633 /* Clear the interrupt */
634 return phy_clear_interrupt(phydev);
635}
636
637/**
638 * phy_change - Called by the phy_interrupt to handle PHY changes
639 * @phydev: phy_device struct that interrupted
640 */
641static irqreturn_t phy_change(struct phy_device *phydev)
642{
643 if (phy_interrupt_is_valid(phydev)) {
644 if (phydev->drv->did_interrupt &&
645 !phydev->drv->did_interrupt(phydev))
646 return IRQ_NONE;
647
648 if (phydev->state == PHY_HALTED)
649 if (phy_disable_interrupts(phydev))
650 goto phy_err;
651 }
652
653 mutex_lock(&phydev->lock);
654 if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state))
655 phydev->state = PHY_CHANGELINK;
656 mutex_unlock(&phydev->lock);
657
658 /* reschedule state queue work to run as soon as possible */
659 phy_trigger_machine(phydev, true);
660
661 if (phy_interrupt_is_valid(phydev) && phy_clear_interrupt(phydev))
662 goto phy_err;
663 return IRQ_HANDLED;
664
665phy_err:
666 phy_error(phydev);
667 return IRQ_NONE;
668}
669
670/**
671 * phy_change_work - Scheduled by the phy_mac_interrupt to handle PHY changes
672 * @work: work_struct that describes the work to be done
673 */
674void phy_change_work(struct work_struct *work)
675{
676 struct phy_device *phydev =
677 container_of(work, struct phy_device, phy_queue);
678
679 phy_change(phydev);
680}
681
682/**
621 * phy_interrupt - PHY interrupt handler 683 * phy_interrupt - PHY interrupt handler
622 * @irq: interrupt line 684 * @irq: interrupt line
623 * @phy_dat: phy_device pointer 685 * @phy_dat: phy_device pointer
@@ -632,9 +694,7 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat)
632 if (PHY_HALTED == phydev->state) 694 if (PHY_HALTED == phydev->state)
633 return IRQ_NONE; /* It can't be ours. */ 695 return IRQ_NONE; /* It can't be ours. */
634 696
635 phy_change(phydev); 697 return phy_change(phydev);
636
637 return IRQ_HANDLED;
638} 698}
639 699
640/** 700/**
@@ -652,23 +712,6 @@ static int phy_enable_interrupts(struct phy_device *phydev)
652} 712}
653 713
654/** 714/**
655 * phy_disable_interrupts - Disable the PHY interrupts from the PHY side
656 * @phydev: target phy_device struct
657 */
658static int phy_disable_interrupts(struct phy_device *phydev)
659{
660 int err;
661
662 /* Disable PHY interrupts */
663 err = phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED);
664 if (err)
665 return err;
666
667 /* Clear the interrupt */
668 return phy_clear_interrupt(phydev);
669}
670
671/**
672 * phy_start_interrupts - request and enable interrupts for a PHY device 715 * phy_start_interrupts - request and enable interrupts for a PHY device
673 * @phydev: target phy_device struct 716 * @phydev: target phy_device struct
674 * 717 *
@@ -711,50 +754,6 @@ int phy_stop_interrupts(struct phy_device *phydev)
711EXPORT_SYMBOL(phy_stop_interrupts); 754EXPORT_SYMBOL(phy_stop_interrupts);
712 755
713/** 756/**
714 * phy_change - Called by the phy_interrupt to handle PHY changes
715 * @phydev: phy_device struct that interrupted
716 */
717void phy_change(struct phy_device *phydev)
718{
719 if (phy_interrupt_is_valid(phydev)) {
720 if (phydev->drv->did_interrupt &&
721 !phydev->drv->did_interrupt(phydev))
722 return;
723
724 if (phydev->state == PHY_HALTED)
725 if (phy_disable_interrupts(phydev))
726 goto phy_err;
727 }
728
729 mutex_lock(&phydev->lock);
730 if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state))
731 phydev->state = PHY_CHANGELINK;
732 mutex_unlock(&phydev->lock);
733
734 /* reschedule state queue work to run as soon as possible */
735 phy_trigger_machine(phydev, true);
736
737 if (phy_interrupt_is_valid(phydev) && phy_clear_interrupt(phydev))
738 goto phy_err;
739 return;
740
741phy_err:
742 phy_error(phydev);
743}
744
745/**
746 * phy_change_work - Scheduled by the phy_mac_interrupt to handle PHY changes
747 * @work: work_struct that describes the work to be done
748 */
749void phy_change_work(struct work_struct *work)
750{
751 struct phy_device *phydev =
752 container_of(work, struct phy_device, phy_queue);
753
754 phy_change(phydev);
755}
756
757/**
758 * phy_stop - Bring down the PHY link, and stop checking the status 757 * phy_stop - Bring down the PHY link, and stop checking the status
759 * @phydev: target phy_device struct 758 * @phydev: target phy_device struct
760 */ 759 */