The sole implementation for the PTP verify/enable methods only supports the EXTTS function. Move these checks into mv88e6xxx_ptp_verify() and mv88e6xxx_ptp_enable(), renaming the ptp_enable() method to ptp_enable_extts(). Signed-off-by: Russell King (Oracle) --- drivers/net/dsa/mv88e6xxx/chip.h | 4 ++-- drivers/net/dsa/mv88e6xxx/ptp.c | 26 +++++++++----------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index 7618f6db235e..ae56a88ca1c5 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -731,8 +731,8 @@ struct mv88e6xxx_avb_ops { struct mv88e6xxx_ptp_ops { u64 (*clock_read)(struct mv88e6xxx_chip *chip); - int (*ptp_enable)(struct mv88e6xxx_chip *chip, - struct ptp_clock_request *rq, int on); + int (*ptp_enable_extts)(struct mv88e6xxx_chip *chip, + struct ptp_clock_request *rq, int on); int (*ptp_verify)(struct mv88e6xxx_chip *chip, unsigned int pin, enum ptp_pin_function func, unsigned int chan); void (*event_work)(struct work_struct *ugly); diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c index 72ad6be05943..de44622d8513 100644 --- a/drivers/net/dsa/mv88e6xxx/ptp.c +++ b/drivers/net/dsa/mv88e6xxx/ptp.c @@ -311,7 +311,10 @@ static int mv88e6xxx_ptp_enable(struct ptp_clock_info *ptp, { struct mv88e6xxx_chip *chip = ptp_to_chip(ptp); - return chip->info->ops->ptp_ops->ptp_enable(chip, req, enable); + if (req->type != PTP_CLK_REQ_EXTTS) + return -EOPNOTSUPP; + + return chip->info->ops->ptp_ops->ptp_enable_extts(chip, req, enable); } static int mv88e6xxx_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin, @@ -323,6 +326,9 @@ static int mv88e6xxx_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin, if (func == PTP_PF_NONE) return 0; + if (func != PTP_PF_EXTTS) + return -EOPNOTSUPP; + return chip->info->ops->ptp_ops->ptp_verify(chip, pin, func, chan); } @@ -372,23 +378,9 @@ static int mv88e6352_ptp_enable_extts(struct mv88e6xxx_chip *chip, return err; } -static int mv88e6352_ptp_enable(struct mv88e6xxx_chip *chip, - struct ptp_clock_request *rq, int on) -{ - switch (rq->type) { - case PTP_CLK_REQ_EXTTS: - return mv88e6352_ptp_enable_extts(chip, rq, on); - default: - return -EOPNOTSUPP; - } -} - static int mv88e6352_ptp_verify(struct mv88e6xxx_chip *chip, unsigned int pin, enum ptp_pin_function func, unsigned int chan) { - if (func != PTP_PF_EXTTS) - return -EOPNOTSUPP; - return 0; } @@ -410,7 +402,7 @@ const struct mv88e6xxx_ptp_ops mv88e6165_ptp_ops = { const struct mv88e6xxx_ptp_ops mv88e6352_ptp_ops = { .clock_read = mv88e6352_ptp_clock_read, - .ptp_enable = mv88e6352_ptp_enable, + .ptp_enable_extts = mv88e6352_ptp_enable_extts, .ptp_verify = mv88e6352_ptp_verify, .event_work = mv88e6352_tai_event_work, .port_enable = mv88e6352_hwtstamp_port_enable, @@ -433,7 +425,7 @@ const struct mv88e6xxx_ptp_ops mv88e6352_ptp_ops = { const struct mv88e6xxx_ptp_ops mv88e6390_ptp_ops = { .clock_read = mv88e6352_ptp_clock_read, - .ptp_enable = mv88e6352_ptp_enable, + .ptp_enable_extts = mv88e6352_ptp_enable_extts, .ptp_verify = mv88e6352_ptp_verify, .event_work = mv88e6352_tai_event_work, .port_enable = mv88e6352_hwtstamp_port_enable, -- 2.47.3