summaryrefslogtreecommitdiff
path: root/nuttx/drivers
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-08-16 14:08:04 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-08-16 14:08:04 -0600
commitb5984a1d75fd6c01103008c82a8235b0d5a39483 (patch)
tree141eac09cfd1f45e4b629068ec1e7dbcbc0ebcc7 /nuttx/drivers
parentd0aff5ef2704e0687b0ae387cdd239018607a85c (diff)
downloadpx4-nuttx-b5984a1d75fd6c01103008c82a8235b0d5a39483.tar.gz
px4-nuttx-b5984a1d75fd6c01103008c82a8235b0d5a39483.tar.bz2
px4-nuttx-b5984a1d75fd6c01103008c82a8235b0d5a39483.zip
Finishes the ioctl definition to subscribe to PHY events. Revamp network ioctl signature to support arguments other than struct mii_ioctl_data.
Diffstat (limited to 'nuttx/drivers')
-rw-r--r--nuttx/drivers/net/phy_notify.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/nuttx/drivers/net/phy_notify.c b/nuttx/drivers/net/phy_notify.c
index 3aba800ac..29b68c3d8 100644
--- a/nuttx/drivers/net/phy_notify.c
+++ b/nuttx/drivers/net/phy_notify.c
@@ -39,6 +39,7 @@
#include <nuttx/config.h>
+#include <unistd.h>
#include <string.h>
#include <semaphore.h>
#include <signal.h>
@@ -311,7 +312,8 @@ static int phy_handler_3(int irq, FAR void *context)
* intf - Provides the name of the network interface, for example, "eth0".
* The length of intf must not exceed 4 bytes (excluding NULL
* terminator). Configurable with CONFIG_PHY_NOTIFICATION_MAXINTFLEN.
- * pid - Identifies the task to receive the signal.
+ * pid - Identifies the task to receive the signal. The special value
+ * of zero means to use the pid of the current task.
* signo - This is the signal number to use when notifying the task.
* arg - An argument that will accompany the notification signal.
*
@@ -335,6 +337,13 @@ int phy_notify_subscribe(FAR const char *intf, pid_t pid, int signo,
return -ENOMEM;
}
+ /* The special value pid == 0 means to use the pid of the current task. */
+
+ if (pid == 0)
+ {
+ pid = getpid();
+ }
+
/* Initialize the client entry */
client->signo = signo;
@@ -388,7 +397,7 @@ int phy_notify_unsubscribe(FAR const char *intf, pid_t pid)
/* Detach and disable the PHY interrupt */
- phy_semtask();
+ phy_semtake();
(void)arch_phy_irq(intf, NULL);
/* Un-initialize the client entry */