mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
Revert "Use small lock to protect usbdev and endpoint in arch renesas."
This reverts commit e211904640.
This commit is contained in:
parent
2301fd5d25
commit
a488b22b22
1 changed files with 15 additions and 34 deletions
|
|
@ -35,7 +35,6 @@
|
|||
#include <debug.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <sched.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
|
@ -46,7 +45,6 @@
|
|||
#include <nuttx/serial/serial.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/spinlock.h>
|
||||
#include <arch/board/board.h>
|
||||
#include <arch/chip/types.h>
|
||||
|
||||
|
|
@ -242,10 +240,6 @@ struct rx65n_usbdev_s
|
|||
/* The endpoint list */
|
||||
|
||||
struct rx65n_ep_s eplist[RX65N_NENDPOINTS];
|
||||
|
||||
/* Spinlock */
|
||||
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
/* For maintaining tables of endpoint info */
|
||||
|
|
@ -1844,9 +1838,9 @@ static void rx65n_reqcomplete(struct rx65n_ep_s *privep, int16_t result)
|
|||
|
||||
/* Remove the completed request at the head of the endpoint request list */
|
||||
|
||||
flags = spin_lock_irqsave(&privep->dev->lock);
|
||||
flags = enter_critical_section();
|
||||
privreq = rx65n_rqdequeue(privep);
|
||||
spin_unlock_irqrestore(&privep->dev->lock, flags);
|
||||
leave_critical_section(flags);
|
||||
|
||||
if (privreq)
|
||||
{
|
||||
|
|
@ -3004,12 +2998,10 @@ static int rx65n_epdisable(struct usbdev_ep_s *ep)
|
|||
|
||||
/* Cancel any ongoing activity */
|
||||
|
||||
flags = spin_lock_irqsave(&privep->dev->lock);
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
rx65n_cancelrequests(privep);
|
||||
|
||||
spin_unlock_irqrestore(&privep->dev->lock, flags);
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
@ -3114,8 +3106,7 @@ static int rx65n_epsubmit(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
|
|||
epno = USB_EPNO(ep->eplog);
|
||||
req->result = -EINPROGRESS;
|
||||
req->xfrd = 0;
|
||||
flags = spin_lock_irqsave(&priv->lock);
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* If we are stalled, then drop all requests on the floor */
|
||||
|
||||
|
|
@ -3142,8 +3133,7 @@ static int rx65n_epsubmit(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
|
|||
{
|
||||
privreq->req.len = CDC_CLASS_DATA_LENGTH;
|
||||
rx65n_rdrequest(epno, priv, privep);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
@ -3152,8 +3142,7 @@ static int rx65n_epsubmit(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
|
|||
if (!privep->txbusy)
|
||||
{
|
||||
ret = rx65n_wrrequest(epno, priv, privep);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
|
@ -3167,8 +3156,7 @@ static int rx65n_epsubmit(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
|
|||
if (priv->ep0state == EP0STATE_RDREQUEST)
|
||||
{
|
||||
rx65n_rdrequest(epno, priv, privep);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
@ -3201,8 +3189,7 @@ static int rx65n_epsubmit(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
|
|||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -3243,11 +3230,9 @@ static int rx65n_epcancel(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
|
|||
#endif
|
||||
usbtrace(TRACE_EPCANCEL, USB_EPNO(ep->eplog));
|
||||
|
||||
flags = spin_lock_irqsave(&privep->dev->lock);
|
||||
sched_lock();
|
||||
flags = enter_critical_section();
|
||||
rx65n_cancelrequests(privep);
|
||||
spin_unlock_irqrestore(&privep->dev->lock, flags);
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
@ -3262,7 +3247,7 @@ static inline struct rx65n_ep_s *rx65n_epreserve(struct rx65n_usbdev_s *priv,
|
|||
irqstate_t flags;
|
||||
int epndx = 0;
|
||||
|
||||
flags = spin_lock_irqsave(&priv->lock);
|
||||
flags = enter_critical_section();
|
||||
epset &= priv->epavail;
|
||||
if (epset)
|
||||
{
|
||||
|
|
@ -3287,7 +3272,7 @@ static inline struct rx65n_ep_s *rx65n_epreserve(struct rx65n_usbdev_s *priv,
|
|||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
leave_critical_section(flags);
|
||||
return privep;
|
||||
}
|
||||
|
||||
|
|
@ -3381,9 +3366,9 @@ errout:
|
|||
static inline void
|
||||
rx65n_epunreserve(struct rx65n_usbdev_s *priv, struct rx65n_ep_s *privep)
|
||||
{
|
||||
irqstate_t flags = spin_lock_irqsave(&priv->lock);
|
||||
irqstate_t flags = enter_critical_section();
|
||||
priv->epavail |= RX65N_ENDP_BIT(USB_EPNO(privep->ep.eplog));
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -6046,10 +6031,6 @@ void renesas_usbinitialize(void)
|
|||
int epno;
|
||||
usbtrace(TRACE_DEVINIT, 0);
|
||||
|
||||
/* Initialize driver lock */
|
||||
|
||||
spin_lock_init(&priv->lock);
|
||||
|
||||
/* Enable write to System registers */
|
||||
|
||||
regval = rx65n_getreg16(RX65N_PRCR_ADDR);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue