Commit 82a5e7f9 authored by Luca Ellero's avatar Luca Ellero Committed by Greg Kroah-Hartman
Browse files

staging: ced1401: remove typedef for TRANSAREA

parent d13778d5
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -593,7 +593,8 @@ int ced_clear_area(DEVICE_EXTENSION *pdx, int nArea)
		dev_err(&pdx->interface->dev, "%s: Attempt to clear area %d\n",
			__func__, nArea);
	} else {
		TRANSAREA *pTA = &pdx->rTransDef[nArea];	/*  to save typing */
		/* to save typing */
		struct transarea *pTA = &pdx->rTransDef[nArea];
		if (!pTA->bUsed)	/*  if not used... */
			iReturn = U14ERR_NOTSET;	/*  ...nothing to be done */
		else {
@@ -622,10 +623,10 @@ int ced_clear_area(DEVICE_EXTENSION *pdx, int nArea)
				    && (pdx->rDMAInfo.wIdent == nArea))
					pdx->bXFerWaiting = false;	/*  Cannot have pending xfer if area cleared */

				/*  Clean out the TRANSAREA except for the wait queue, which is at the end */
				/*  Clean out the struct transarea except for the wait queue, which is at the end */
				/*  This sets bUsed to false and dwEventSz to 0 to say area not used and no events. */
				memset(pTA, 0,
				       sizeof(TRANSAREA) -
				       sizeof(struct transarea) -
				       sizeof(wait_queue_head_t));
			}
			spin_unlock_irq(&pdx->stagedLock);
@@ -670,7 +671,7 @@ static int ced_set_area(DEVICE_EXTENSION *pdx, int nArea, char __user *puBuf,
	unsigned int ulOffset = ((unsigned long)puBuf) & (PAGE_SIZE - 1);
	int len = (dwLength + ulOffset + PAGE_SIZE - 1) >> PAGE_SHIFT;

	TRANSAREA *pTA = &pdx->rTransDef[nArea];	/*  to save typing */
	struct transarea *pTA = &pdx->rTransDef[nArea];	/*  to save typing */
	struct page **pPages = NULL;	/*  space for page tables */
	int nPages = 0;		/*  and number of pages */

@@ -791,7 +792,7 @@ int ced_set_event(DEVICE_EXTENSION *pdx, struct transfer_event __user *pTE)
	if (te.wAreaNum >= MAX_TRANSAREAS)	/*  the area must exist */
		return U14ERR_BADAREA;
	else {
		TRANSAREA *pTA = &pdx->rTransDef[te.wAreaNum];
		struct transarea *pTA = &pdx->rTransDef[te.wAreaNum];
		mutex_lock(&pdx->io_mutex);	/*  make sure we have no competitor */
		spin_lock_irq(&pdx->stagedLock);
		if (pTA->bUsed) {	/*  area must be in use */
@@ -821,7 +822,7 @@ int ced_wait_event(DEVICE_EXTENSION *pdx, int nArea, int msTimeOut)
		return U14ERR_BADAREA;
	else {
		int iWait;
		TRANSAREA *pTA = &pdx->rTransDef[nArea];
		struct transarea *pTA = &pdx->rTransDef[nArea];
		msTimeOut = (msTimeOut * HZ + 999) / 1000;	/*  convert timeout to jiffies */

		/*  We cannot wait holding the mutex, but we check the flags while holding */
@@ -867,7 +868,7 @@ int ced_test_event(DEVICE_EXTENSION *pdx, int nArea)
	if ((unsigned)nArea >= MAX_TRANSAREAS)
		iReturn = U14ERR_BADAREA;
	else {
		TRANSAREA *pTA = &pdx->rTransDef[nArea];
		struct transarea *pTA = &pdx->rTransDef[nArea];
		mutex_lock(&pdx->io_mutex);	/*  make sure we have no competitor */
		spin_lock_irq(&pdx->stagedLock);
		iReturn = pTA->iWakeUp;	/*  get wakeup count since last call */
@@ -1354,7 +1355,8 @@ int ced_get_circ_block(DEVICE_EXTENSION *pdx, TCIRCBLOCK __user *pCB)
	cb.dwSize = 0;

	if (nArea < MAX_TRANSAREAS) {	/*  The area number must be OK */
		TRANSAREA *pArea = &pdx->rTransDef[nArea];	/*  Pointer to relevant info */
		/* Pointer to relevant info */
		struct transarea *pArea = &pdx->rTransDef[nArea];
		spin_lock_irq(&pdx->stagedLock);	/*  Lock others out */

		if ((pArea->bUsed) && (pArea->bCircular) &&	/*  Must be circular area */
@@ -1405,7 +1407,8 @@ int ced_free_circ_block(DEVICE_EXTENSION *pdx, TCIRCBLOCK __user *pCB)
	cb.dwSize = 0;

	if (nArea < MAX_TRANSAREAS) {	/*  The area number must be OK */
		TRANSAREA *pArea = &pdx->rTransDef[nArea];	/*  Pointer to relevant info */
		/* Pointer to relevant info */
		struct transarea *pArea = &pdx->rTransDef[nArea];
		spin_lock_irq(&pdx->stagedLock);	/*  Lock others out */

		if ((pArea->bUsed) && (pArea->bCircular) &&	/*  Must be circular area */
+6 −3
Original line number Diff line number Diff line
@@ -441,7 +441,8 @@ static void ced_copy_user_space(DEVICE_EXTENSION *pdx, int n)
{
	unsigned int nArea = pdx->StagedId;
	if (nArea < MAX_TRANSAREAS) {
		TRANSAREA *pArea = &pdx->rTransDef[nArea];	/*  area to be used */
		/*  area to be used */
		struct transarea *pArea = &pdx->rTransDef[nArea];
		unsigned int dwOffset =
		    pdx->StagedDone + pdx->StagedOffset + pArea->dwBaseOffset;
		char *pCoherBuf = pdx->pCoherStagedIO;	/*  coherent buffer */
@@ -541,7 +542,8 @@ static void staged_callback(struct urb *pUrb)

	if ((pdx->StagedDone == pdx->StagedLength) ||	/*  If no more to do */
	    (bCancel)) {		/*  or this IRP was cancelled */
		TRANSAREA *pArea = &pdx->rTransDef[pdx->StagedId];	/*  Transfer area info */
		/*  Transfer area info */
		struct transarea *pArea = &pdx->rTransDef[pdx->StagedId];
		dev_dbg(&pdx->interface->dev,
			"%s: transfer done, bytes %d, cancel %d\n",
			__func__, pdx->StagedDone, bCancel);
@@ -761,7 +763,8 @@ static int ced_stage_chunk(DEVICE_EXTENSION *pdx)
int ced_read_write_mem(DEVICE_EXTENSION *pdx, bool Read, unsigned short wIdent,
		 unsigned int dwOffs, unsigned int dwLen)
{
	TRANSAREA *pArea = &pdx->rTransDef[wIdent];	/*  Transfer area info */
	/* Transfer area info */
	struct transarea *pArea = &pdx->rTransDef[wIdent];

	if (!can_accept_io_requests(pdx)) {	/*  Are we in a state to accept new requests? */
		dev_err(&pdx->interface->dev, "%s: can't accept requests\n",
+3 −3
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ struct circ_blk {

/*  A structure holding all of the information about a transfer area - an area of */
/*   memory set up for use either as a source or destination in DMA transfers. */
typedef struct transarea {
struct transarea {
	void __user *lpvBuff;                /*  User address of xfer area saved for completeness */
	UINT        dwBaseOffset;           /*  offset to start of xfer area in first page */
	UINT        dwLength;               /*  Length of xfer area, in bytes */
@@ -116,7 +116,7 @@ typedef struct transarea {
	UINT        dwEventSz;              /*  ...notification by the event SZ is 0 if unset */
	struct circ_blk aBlocks[2];         /*  Info on a pair of circular blocks */
	wait_queue_head_t wqEvent;          /*  The wait queue for events in this area MUST BE LAST */
} TRANSAREA;
};

/*  The DMADESC structure is used to hold information on the transfer in progress. It */
/*  is set up by ReadDMAInfo, using information sent by the 1401 in an escape sequence. */
@@ -156,7 +156,7 @@ typedef struct _DEVICE_EXTENSION {
	__u8 bInterval;                     /* Interrupt end point interval */

	volatile unsigned int dwDMAFlag;    /* state of DMA */
	TRANSAREA rTransDef[MAX_TRANSAREAS];/* transfer area info */
	struct transarea rTransDef[MAX_TRANSAREAS];  /* transfer area info */
	volatile DMADESC rDMAInfo;          /*  info on current DMA transfer */
	volatile bool bXFerWaiting;         /*  Flag set if DMA transfer stalled */
	volatile bool bInDrawDown;          /*  Flag that we want to halt transfers */