From e5fc419e450c33e3a59024602857779ecec896c8 Mon Sep 17 00:00:00 2001 From: Florian Pose Date: Wed, 25 Jul 2007 12:52:06 +0000 Subject: [PATCH] Replaced ecdev_link_state() with ecdev_set_link(); added ecdev_get_link(). --- NEWS | 1 + devices/8139too-2.6.13-ethercat.c | 2 +- devices/8139too-2.6.17-ethercat.c | 2 +- devices/8139too-2.6.18-ethercat.c | 2 +- devices/8139too-2.6.19-ethercat.c | 2 +- devices/e100-2.6.18-ethercat.c | 2 +- devices/ecdev.h | 4 ++-- devices/forcedeth-2.6.17-ethercat.c | 4 ++-- devices/forcedeth-2.6.19-ethercat.c | 4 ++-- master/device.c | 26 ++++++++++++++++++++++---- 10 files changed, 34 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index ff4807a5..c658bb53 100644 --- a/NEWS +++ b/NEWS @@ -34,6 +34,7 @@ Changes in version 1.3.0: - 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 --git a/devices/8139too-2.6.13-ethercat.c b/devices/8139too-2.6.13-ethercat.c index b8f247ce..a8d4af79 100644 --- a/devices/8139too-2.6.13-ethercat.c +++ b/devices/8139too-2.6.13-ethercat.c @@ -1435,7 +1435,7 @@ static void rtl_check_media (struct net_device *dev, unsigned int init_media) 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 --git a/devices/8139too-2.6.17-ethercat.c b/devices/8139too-2.6.17-ethercat.c index 24930f07..76aeee62 100644 --- a/devices/8139too-2.6.17-ethercat.c +++ b/devices/8139too-2.6.17-ethercat.c @@ -1439,7 +1439,7 @@ static void rtl_check_media (struct net_device *dev, unsigned int init_media) 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 --git a/devices/8139too-2.6.18-ethercat.c b/devices/8139too-2.6.18-ethercat.c index 74ed0775..663e8932 100644 --- a/devices/8139too-2.6.18-ethercat.c +++ b/devices/8139too-2.6.18-ethercat.c @@ -1440,7 +1440,7 @@ static void rtl_check_media (struct net_device *dev, unsigned int init_media) 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 --git a/devices/8139too-2.6.19-ethercat.c b/devices/8139too-2.6.19-ethercat.c index 3bde3371..f96d9ddd 100644 --- a/devices/8139too-2.6.19-ethercat.c +++ b/devices/8139too-2.6.19-ethercat.c @@ -1439,7 +1439,7 @@ static void rtl_check_media (struct net_device *dev, unsigned int init_media) 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 --git a/devices/e100-2.6.18-ethercat.c b/devices/e100-2.6.18-ethercat.c index 224650a9..546b7d0d 100644 --- a/devices/e100-2.6.18-ethercat.c +++ b/devices/e100-2.6.18-ethercat.c @@ -1634,7 +1634,7 @@ static void e100_watchdog(unsigned long data) /* 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 --git a/devices/ecdev.h b/devices/ecdev.h index 85bf793c..24d6eac3 100644 --- a/devices/ecdev.h +++ b/devices/ecdev.h @@ -76,8 +76,8 @@ void ecdev_withdraw(ec_device_t *device); 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 --git a/devices/forcedeth-2.6.17-ethercat.c b/devices/forcedeth-2.6.17-ethercat.c index 59a93109..4e1ce592 100644 --- a/devices/forcedeth-2.6.17-ethercat.c +++ b/devices/forcedeth-2.6.17-ethercat.c @@ -2053,7 +2053,7 @@ static void nv_linkchange(struct net_device *dev) 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 @@ static int nv_open(struct net_device *dev) 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 --git a/devices/forcedeth-2.6.19-ethercat.c b/devices/forcedeth-2.6.19-ethercat.c index 0fa68ab7..df93585c 100644 --- a/devices/forcedeth-2.6.19-ethercat.c +++ b/devices/forcedeth-2.6.19-ethercat.c @@ -2386,7 +2386,7 @@ static void nv_linkchange(struct net_device *dev) 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 @@ static int nv_open(struct net_device *dev) 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 --git a/master/device.c b/master/device.c index 507491a6..7c7c4c1d 100644 --- a/master/device.c +++ b/master/device.c @@ -301,9 +301,9 @@ void ecdev_receive(ec_device_t *device, /**< EtherCAT device */ \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 @@ void ecdev_link_state(ec_device_t *device, /**< EtherCAT device */ /*****************************************************************************/ +/** + 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 */