pn53x_usb: minor code clean up.
This commit is contained in:
parent
324af418db
commit
38bdfe3281
2 changed files with 5 additions and 34 deletions
|
@ -66,37 +66,6 @@ Thanks to d18c7db and Okko for example code
|
||||||
|
|
||||||
#define DRIVER_DATA(pnd) ((struct pn53x_usb_data*)(pnd->driver_data))
|
#define DRIVER_DATA(pnd) ((struct pn53x_usb_data*)(pnd->driver_data))
|
||||||
|
|
||||||
/* This modified from some GNU example _not_ to overwrite y */
|
|
||||||
int timeval_subtract(struct timeval *result,
|
|
||||||
const struct timeval *x,
|
|
||||||
const struct timeval *y)
|
|
||||||
{
|
|
||||||
struct timeval tmp;
|
|
||||||
|
|
||||||
tmp.tv_sec = y->tv_sec;
|
|
||||||
tmp.tv_usec = y->tv_usec;
|
|
||||||
|
|
||||||
/* Perform the carry for the later subtraction */
|
|
||||||
if (x->tv_usec < y->tv_usec) {
|
|
||||||
int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
|
|
||||||
tmp.tv_usec -= 1000000 * nsec;
|
|
||||||
tmp.tv_sec += nsec;
|
|
||||||
}
|
|
||||||
if (x->tv_usec - y->tv_usec > 1000000) {
|
|
||||||
int nsec = (x->tv_usec - y->tv_usec) / 1000000;
|
|
||||||
tmp.tv_usec += 1000000 * nsec;
|
|
||||||
tmp.tv_sec -= nsec;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Compute the time remaining to wait.
|
|
||||||
tv_usec is certainly positive. */
|
|
||||||
result->tv_sec = x->tv_sec - tmp.tv_sec;
|
|
||||||
result->tv_usec = x->tv_usec - tmp.tv_usec;
|
|
||||||
|
|
||||||
/* Return 1 if result is negative. */
|
|
||||||
return x->tv_sec < tmp.tv_sec;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
UNKNOWN,
|
UNKNOWN,
|
||||||
NXP_PN531,
|
NXP_PN531,
|
||||||
|
|
|
@ -23,11 +23,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __NFC_DRIVER_PN53X_USB_H__
|
#ifndef __NFC_DRIVER_PN53X_USB_H__
|
||||||
# define __NFC_DRIVER_PN53X_USB_H__
|
#define __NFC_DRIVER_PN53X_USB_H__
|
||||||
|
|
||||||
# include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
# include <nfc/nfc-types.h>
|
#include <nfc/nfc-types.h>
|
||||||
|
|
||||||
|
#include "nfc-internal.h"
|
||||||
|
|
||||||
bool pn53x_usb_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound);
|
bool pn53x_usb_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound);
|
||||||
nfc_device *pn53x_usb_open (const nfc_connstring connstring);
|
nfc_device *pn53x_usb_open (const nfc_connstring connstring);
|
||||||
|
|
Loading…
Add table
Reference in a new issue