# HG changeset patch # User Florian Pose # Date 1185367926 0 # Node ID f57de4585a5f0167d3f3c073cdb221f4ac6908b5 # Parent 884a5b5b0163d60cfc76f1e7fcb43150f0e18b9f Replaced ecdev_link_state() with ecdev_set_link(); added ecdev_get_link(). diff -r 884a5b5b0163 -r f57de4585a5f NEWS --- a/NEWS Wed Jul 25 07:46:09 2007 +0000 +++ b/NEWS Wed Jul 25 12:52:06 2007 +0000 @@ -34,6 +34,7 @@ - Replaced ecdev_register() and ecdev_unregister() with ecdev_offer() and ecdev_withdraw(), respectively. The device modules now offer all their devices to the master. The master then decides, which ones to register. + - Replaced ecdev_link_state() with ecdev_set_link(); added ecdev_get_link(). * All EEPROM write operations from user space are now blocking until writing has finished. Appropriate error codes are returned. * Implemented setting of the "Secondary slave address" (alias) via sysfs. diff -r 884a5b5b0163 -r f57de4585a5f devices/8139too-2.6.13-ethercat.c --- a/devices/8139too-2.6.13-ethercat.c Wed Jul 25 07:46:09 2007 +0000 +++ b/devices/8139too-2.6.13-ethercat.c Wed Jul 25 12:52:06 2007 +0000 @@ -1435,7 +1435,7 @@ if (tp->ecdev) { void __iomem *ioaddr = tp->mmio_addr; uint16_t state = RTL_R16(BasicModeStatus) & BMSR_LSTATUS; - ecdev_link_state(tp->ecdev, state ? 1 : 0); + ecdev_set_link(tp->ecdev, state ? 1 : 0); } else { if (tp->phys[0] >= 0) { diff -r 884a5b5b0163 -r f57de4585a5f devices/8139too-2.6.17-ethercat.c --- a/devices/8139too-2.6.17-ethercat.c Wed Jul 25 07:46:09 2007 +0000 +++ b/devices/8139too-2.6.17-ethercat.c Wed Jul 25 12:52:06 2007 +0000 @@ -1439,7 +1439,7 @@ if (tp->ecdev) { void __iomem *ioaddr = tp->mmio_addr; uint16_t state = RTL_R16(BasicModeStatus) & BMSR_LSTATUS; - ecdev_link_state(tp->ecdev, state ? 1 : 0); + ecdev_set_link(tp->ecdev, state ? 1 : 0); } else { if (tp->phys[0] >= 0) { diff -r 884a5b5b0163 -r f57de4585a5f devices/8139too-2.6.18-ethercat.c --- a/devices/8139too-2.6.18-ethercat.c Wed Jul 25 07:46:09 2007 +0000 +++ b/devices/8139too-2.6.18-ethercat.c Wed Jul 25 12:52:06 2007 +0000 @@ -1440,7 +1440,7 @@ if (tp->ecdev) { void __iomem *ioaddr = tp->mmio_addr; uint16_t state = RTL_R16(BasicModeStatus) & BMSR_LSTATUS; - ecdev_link_state(tp->ecdev, state ? 1 : 0); + ecdev_set_link(tp->ecdev, state ? 1 : 0); } else { if (tp->phys[0] >= 0) { diff -r 884a5b5b0163 -r f57de4585a5f devices/8139too-2.6.19-ethercat.c --- a/devices/8139too-2.6.19-ethercat.c Wed Jul 25 07:46:09 2007 +0000 +++ b/devices/8139too-2.6.19-ethercat.c Wed Jul 25 12:52:06 2007 +0000 @@ -1439,7 +1439,7 @@ if (tp->ecdev) { void __iomem *ioaddr = tp->mmio_addr; uint16_t state = RTL_R16(BasicModeStatus) & BMSR_LSTATUS; - ecdev_link_state(tp->ecdev, state ? 1 : 0); + ecdev_set_link(tp->ecdev, state ? 1 : 0); } else { if (tp->phys[0] >= 0) { diff -r 884a5b5b0163 -r f57de4585a5f devices/e100-2.6.18-ethercat.c --- a/devices/e100-2.6.18-ethercat.c Wed Jul 25 07:46:09 2007 +0000 +++ b/devices/e100-2.6.18-ethercat.c Wed Jul 25 12:52:06 2007 +0000 @@ -1634,7 +1634,7 @@ /* mii library handles link maintenance tasks */ if (nic->ethercat) { - ecdev_link_state(nic->ecdev, mii_link_ok(&nic->mii) ? 1 : 0); + ecdev_set_link(nic->ecdev, mii_link_ok(&nic->mii) ? 1 : 0); goto finish; } diff -r 884a5b5b0163 -r f57de4585a5f devices/ecdev.h --- a/devices/ecdev.h Wed Jul 25 07:46:09 2007 +0000 +++ b/devices/ecdev.h Wed Jul 25 12:52:06 2007 +0000 @@ -76,8 +76,8 @@ int ecdev_open(ec_device_t *device); void ecdev_close(ec_device_t *device); void ecdev_receive(ec_device_t *device, const void *data, size_t size); -void ecdev_link_state(ec_device_t *device, uint8_t newstate); -uint8_t ecdev_link_up(ec_device_t *device); +void ecdev_set_link(ec_device_t *device, uint8_t state); +uint8_t ecdev_get_link(ec_device_t *device); /*****************************************************************************/ diff -r 884a5b5b0163 -r f57de4585a5f devices/forcedeth-2.6.17-ethercat.c --- a/devices/forcedeth-2.6.17-ethercat.c Wed Jul 25 07:46:09 2007 +0000 +++ b/devices/forcedeth-2.6.17-ethercat.c Wed Jul 25 12:52:06 2007 +0000 @@ -2053,7 +2053,7 @@ if (np->ecdev) { int link = nv_update_linkspeed(dev); - ecdev_link_state(np->ecdev, link); + ecdev_set_link(np->ecdev, link); return; } @@ -2985,7 +2985,7 @@ nv_start_tx(dev); if (np->ecdev) { - ecdev_link_state(np->ecdev, ret); + ecdev_set_link(np->ecdev, ret); } else { netif_start_queue(dev); diff -r 884a5b5b0163 -r f57de4585a5f devices/forcedeth-2.6.19-ethercat.c --- a/devices/forcedeth-2.6.19-ethercat.c Wed Jul 25 07:46:09 2007 +0000 +++ b/devices/forcedeth-2.6.19-ethercat.c Wed Jul 25 12:52:06 2007 +0000 @@ -2386,7 +2386,7 @@ if (np->ecdev) { int link = nv_update_linkspeed(dev); - ecdev_link_state(np->ecdev, link); + ecdev_set_link(np->ecdev, link); return; } @@ -4220,7 +4220,7 @@ nv_start_tx(dev); if (np->ecdev) { - ecdev_link_state(np->ecdev, ret); + ecdev_set_link(np->ecdev, ret); } else { netif_start_queue(dev); diff -r 884a5b5b0163 -r f57de4585a5f master/device.c --- a/master/device.c Wed Jul 25 07:46:09 2007 +0000 +++ b/master/device.c Wed Jul 25 12:52:06 2007 +0000 @@ -301,9 +301,9 @@ \ingroup DeviceInterface */ -void ecdev_link_state(ec_device_t *device, /**< EtherCAT device */ - uint8_t state /**< new link state */ - ) +void ecdev_set_link(ec_device_t *device, /**< EtherCAT device */ + uint8_t state /**< new link state */ + ) { if (unlikely(!device)) { EC_WARN("ecdev_link_state: no device!\n"); @@ -318,10 +318,28 @@ /*****************************************************************************/ +/** + Reads the link state. + \ingroup DeviceInterface +*/ + +uint8_t ecdev_get_link(ec_device_t *device /**< EtherCAT device */) +{ + if (unlikely(!device)) { + EC_WARN("ecdev_link_state: no device!\n"); + return 0; + } + + return device->link_state; +} + +/*****************************************************************************/ + /** \cond */ EXPORT_SYMBOL(ecdev_receive); -EXPORT_SYMBOL(ecdev_link_state); +EXPORT_SYMBOL(ecdev_get_link); +EXPORT_SYMBOL(ecdev_set_link); /** \endcond */