Skip to content

Commit

Permalink
resolving c++ linter
Browse files Browse the repository at this point in the history
Extra space after ( in XXXX call  [whitespace/parens]
  • Loading branch information
ruck314 committed Jul 6, 2024
1 parent c9a32e1 commit d8a707b
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 64 deletions.
1 change: 0 additions & 1 deletion CPPLINT.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ filter=-whitespace/indent
filter=-whitespace/newline
filter=-whitespace/comma
filter=-whitespace/comments
filter=-whitespace/parens
12 changes: 6 additions & 6 deletions common/driver/axis_gen2.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct hardware_functions AxisG2_functions = {
*
* Return: Status of the mapping (0 for failure, 1 for success).
*/
inline uint8_t AxisG2_MapReturn ( struct DmaDevice * dev, struct AxisG2Return *ret, uint32_t desc128En, uint32_t index, uint32_t *ring) {
inline uint8_t AxisG2_MapReturn(struct DmaDevice * dev, struct AxisG2Return *ret, uint32_t desc128En, uint32_t index, uint32_t *ring) {
uint32_t * ptr;
uint32_t chan;
uint32_t dest;
Expand Down Expand Up @@ -124,7 +124,7 @@ inline uint8_t AxisG2_MapReturn ( struct DmaDevice * dev, struct AxisG2Return *r
* of free buffers. It writes the buffer index and, if enabled, the buffer handle
* to the device's write FIFOs to mark the buffer as free.
*/
inline void AxisG2_WriteFree ( struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En ) {
inline void AxisG2_WriteFree(struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En) {
uint32_t wrData[2];

// Mask the buffer index to fit within the 28-bit field
Expand Down Expand Up @@ -219,7 +219,7 @@ inline void AxisG2_WriteTx(struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32
*
* Returns: Number of processed items
*/
uint32_t AxisG2_Process (struct DmaDevice * dev, struct AxisG2Reg *reg, struct AxisG2Data *hwData ) {
uint32_t AxisG2_Process(struct DmaDevice * dev, struct AxisG2Reg *reg, struct AxisG2Data *hwData) {
struct DmaDesc *desc;
struct DmaBuffer *buff;
struct AxisG2Return ret;
Expand All @@ -241,7 +241,7 @@ uint32_t AxisG2_Process (struct DmaDevice * dev, struct AxisG2Reg *reg, struct A

// Attempt to find buffer in tx pool and return. otherwise return rx entry to hw.
// Must adjust counters here and check for buffer need
if ((buff = dmaRetBufferIdxIrq (dev,ret.index)) != NULL) {
if ((buff = dmaRetBufferIdxIrq(dev,ret.index)) != NULL) {
// Add to receive/write software queue
if ( hwData->hwWrBuffCnt >= (hwData->addrCount-1) ) {
dmaQueuePushIrq(&(hwData->wrQueue),buff);
Expand Down Expand Up @@ -340,7 +340,7 @@ uint32_t AxisG2_Process (struct DmaDevice * dev, struct AxisG2Reg *reg, struct A
AxisG2_WriteFree(hwData->buffList[x],reg,hwData->desc128En);
++hwData->hwWrBuffCnt;
}
} while(bCnt > 0);
} while (bCnt > 0);
}

return handleCount;
Expand Down Expand Up @@ -430,7 +430,7 @@ void AxisG2_Init(struct DmaDevice *dev) {
size = hwData->addrCount*(hwData->desc128En?16:8);

// Allocate DMA buffers based on configuration mode
if(dev->cfgMode & AXIS2_RING_ACP) {
if (dev->cfgMode & AXIS2_RING_ACP) {
// Allocate read and write buffers in contiguous physical memory
hwData->readAddr = kzalloc(size, GFP_DMA | GFP_KERNEL);
hwData->readHandle = virt_to_phys(hwData->readAddr);
Expand Down
14 changes: 7 additions & 7 deletions common/driver/axis_gen2.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ struct AxisG2Data {
};

// Function prototypes
inline uint8_t AxisG2_MapReturn ( struct DmaDevice *dev, struct AxisG2Return *ret, uint32_t desc128En, uint32_t index, uint32_t *ring);
inline void AxisG2_WriteFree ( struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En );
inline void AxisG2_WriteTx ( struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En );
uint32_t AxisG2_Process (struct DmaDevice * dev, struct AxisG2Reg *reg, struct AxisG2Data *hwData );
inline uint8_t AxisG2_MapReturn(struct DmaDevice *dev, struct AxisG2Return *ret, uint32_t desc128En, uint32_t index, uint32_t *ring);
inline void AxisG2_WriteFree(struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En);
inline void AxisG2_WriteTx(struct DmaBuffer *buff, struct AxisG2Reg *reg, uint32_t desc128En);
uint32_t AxisG2_Process(struct DmaDevice * dev, struct AxisG2Reg *reg, struct AxisG2Data *hwData);
irqreturn_t AxisG2_Irq(int irq, void *dev_id);
void AxisG2_Init(struct DmaDevice *dev);
void AxisG2_Enable(struct DmaDevice *dev);
Expand All @@ -223,8 +223,8 @@ int32_t AxisG2_SendBuffer(struct DmaDevice *dev, struct DmaBuffer **buff, uint32
int32_t AxisG2_Command(struct DmaDevice *dev, uint32_t cmd, uint64_t arg);
void AxisG2_SeqShow(struct seq_file *s, struct DmaDevice *dev);
extern struct hardware_functions AxisG2_functions;
void AxisG2_WqTask_IrqForce ( struct work_struct *work );
void AxisG2_WqTask_Poll ( struct work_struct *work );
void AxisG2_WqTask_Service ( struct work_struct *work );
void AxisG2_WqTask_IrqForce(struct work_struct *work);
void AxisG2_WqTask_Poll(struct work_struct *work);
void AxisG2_WqTask_Service(struct work_struct *work);

#endif // __AXIS_GEN2_H__
10 changes: 5 additions & 5 deletions common/driver/dma_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
*
* Return: the count of successfully allocated buffers, or 0 on failure.
*/
size_t dmaAllocBuffers ( struct DmaDevice *dev, struct DmaBufferList *list,
size_t dmaAllocBuffers(struct DmaDevice *dev, struct DmaBufferList *list,
uint32_t count, uint32_t baseIdx, enum dma_data_direction direction) {
uint32_t x;
uint32_t sl;
Expand All @@ -66,7 +66,7 @@ size_t dmaAllocBuffers ( struct DmaDevice *dev, struct DmaBufferList *list,
if ( count == 0 ) return 0;

// Allocate first level pointers
if ((list->indexed = (struct DmaBuffer ***) kzalloc(sizeof(struct DmaBuffer**) * list->subCount, GFP_KERNEL)) == NULL ) {
if ((list->indexed = (struct DmaBuffer ***)kzalloc(sizeof(struct DmaBuffer**) * list->subCount, GFP_KERNEL)) == NULL) {
dev_err(dev->device,"dmaAllocBuffers: Failed to allocate indexed list pointer. Count=%u.\n",list->subCount);
goto cleanup_forced_exit;
}
Expand All @@ -89,7 +89,7 @@ size_t dmaAllocBuffers ( struct DmaDevice *dev, struct DmaBufferList *list,
for (x=0; x < count; x++) {
sl = x / BUFFERS_PER_LIST;
sli = x % BUFFERS_PER_LIST;
if ( (buff = (struct DmaBuffer *) kzalloc(sizeof(struct DmaBuffer), GFP_KERNEL)) == NULL) {
if ((buff = (struct DmaBuffer *)kzalloc(sizeof(struct DmaBuffer), GFP_KERNEL)) == NULL) {
dev_err(dev->device,"dmaAllocBuffers: Failed to create buffer structure index %ui. Unloading.\n",x);
goto cleanup_buffers;
}
Expand Down Expand Up @@ -139,7 +139,7 @@ size_t dmaAllocBuffers ( struct DmaDevice *dev, struct DmaBufferList *list,
}

// Alloc or mapping failed
if ( buff->buffAddr == NULL || buff->buffHandle == 0) {
if (buff->buffAddr == NULL || buff->buffHandle == 0) {
dev_err(dev->device,"dmaAllocBuffers: Failed to create stream buffer and dma mapping.\n");
goto cleanup_buffers;
}
Expand Down Expand Up @@ -905,7 +905,7 @@ uint32_t dmaQueuePushListIrq(struct DmaQueue *queue, struct DmaBuffer **buff, si
*
* Return: A pointer to a DmaBuffer if available; NULL if the queue is empty.
*/
struct DmaBuffer * dmaQueuePop ( struct DmaQueue *queue ) {
struct DmaBuffer * dmaQueuePop(struct DmaQueue *queue ) {
unsigned long iflags;
struct DmaBuffer * ret;

Expand Down
8 changes: 4 additions & 4 deletions common/driver/dma_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ int Dma_Init(struct DmaDevice *dev) {


// Setup /proc
if ( NULL == proc_create_data(dev->devName, 0, NULL, &DmaProcOps, dev)) {
if (NULL == proc_create_data(dev->devName, 0, NULL, &DmaProcOps, dev)) {
dev_err(dev->device,"Init: Failed to create proc entry.\n");
goto cleanup_device_create;
}
Expand All @@ -286,7 +286,7 @@ int Dma_Init(struct DmaDevice *dev) {
// Create TX buffers
dev_info(dev->device,"Init: Creating %i TX Buffers. Size=%i Bytes. Mode=%i.\n",
dev->cfgTxCount,dev->cfgSize,dev->cfgMode);
res = dmaAllocBuffers (dev, &(dev->txBuffers), dev->cfgTxCount, 0, DMA_TO_DEVICE );
res = dmaAllocBuffers(dev, &(dev->txBuffers), dev->cfgTxCount, 0, DMA_TO_DEVICE);
tot = res * dev->cfgSize;

dev_info(dev->device,"Init: Created %i out of %i TX Buffers. %llu Bytes.\n", res,dev->cfgTxCount,tot);
Expand All @@ -309,7 +309,7 @@ int Dma_Init(struct DmaDevice *dev) {
// Create RX buffers, bidirectional because RX buffers can be passed to TX
dev_info(dev->device,"Init: Creating %i RX Buffers. Size=%i Bytes. Mode=%i.\n",
dev->cfgRxCount,dev->cfgSize,dev->cfgMode);
res = dmaAllocBuffers (dev, &(dev->rxBuffers), dev->cfgRxCount, dev->txBuffers.count, DMA_BIDIRECTIONAL);
res = dmaAllocBuffers(dev, &(dev->rxBuffers), dev->cfgRxCount, dev->txBuffers.count, DMA_BIDIRECTIONAL);
tot = res * dev->cfgSize;

dev_info(dev->device,"Init: Created %i out of %i RX Buffers. %llu Bytes.\n", res,dev->cfgRxCount,tot);
Expand All @@ -324,7 +324,7 @@ int Dma_Init(struct DmaDevice *dev) {
// Set interrupt
if ( dev->irq != 0 ) {
dev_info(dev->device,"Init: IRQ %d\n", dev->irq);
res = request_irq( dev->irq, dev->hwFunc->irq, IRQF_SHARED, dev->devName, (void*)dev);
res = request_irq(dev->irq, dev->hwFunc->irq, IRQF_SHARED, dev->devName, (void*)dev);

// Result of request IRQ from OS.
if (res < 0) {
Expand Down
6 changes: 3 additions & 3 deletions common/driver/dma_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,23 +204,23 @@ extern struct file_operations DmaFunctions;

// Function prototypes
char *Dma_DevNode(struct device *dev, umode_t *mode);
int Dma_MapReg ( struct DmaDevice *dev );
int Dma_MapReg(struct DmaDevice *dev);
int Dma_Init(struct DmaDevice *dev);
void Dma_Clean(struct DmaDevice *dev);
int Dma_Open(struct inode *inode, struct file *filp);
int Dma_Release(struct inode *inode, struct file *filp);
ssize_t Dma_Read(struct file *filp, char *buffer, size_t count, loff_t *f_pos);
ssize_t Dma_Write(struct file *filp, const char* buffer, size_t count, loff_t* f_pos);
ssize_t Dma_Ioctl(struct file *filp, uint32_t cmd, unsigned long arg);
uint32_t Dma_Poll(struct file *filp, poll_table *wait );
uint32_t Dma_Poll(struct file *filp, poll_table *wait);
int Dma_Mmap(struct file *filp, struct vm_area_struct *vma);
int Dma_Fasync(int fd, struct file *filp, int mode);
int Dma_ProcOpen(struct inode *inode, struct file *file);
void * Dma_SeqStart(struct seq_file *s, loff_t *pos);
void * Dma_SeqNext(struct seq_file *s, void *v, loff_t *pos);
void Dma_SeqStop(struct seq_file *s, void *v);
int Dma_SeqShow(struct seq_file *s, void *v);
int Dma_SetMaskBytes(struct DmaDevice *dev, struct DmaDesc *desc, uint8_t * mask );
int Dma_SetMaskBytes(struct DmaDevice *dev, struct DmaDesc *desc, uint8_t * mask);
int32_t Dma_WriteRegister(struct DmaDevice *dev, uint64_t arg);
int32_t Dma_ReadRegister(struct DmaDevice *dev, uint64_t arg);

Expand Down
4 changes: 2 additions & 2 deletions common/driver/gpu_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ int32_t Gpu_AddNvidia(struct DmaDevice *dev, uint64_t arg) {

x = 0;

if (data->writeBuffers.count > 0 ) {
if (data->writeBuffers.count > 0) {
x |= 0x00000100;
x |= (data->writeBuffers.count-1);
}

if (data->readBuffers.count > 0 ) {
if (data->readBuffers.count > 0) {
x |= 0x01000000;
x |= (data->readBuffers.count-1) << 16;
}
Expand Down
2 changes: 1 addition & 1 deletion data_dev/app/src/dmaRate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static struct argp_option options[] = {
error_t parseArgs(int key, char *arg, struct argp_state *state) {
struct PrgArgs *args = (struct PrgArgs *)state->input;

switch(key) {
switch (key) {
case 'p': args->path = arg; break;
case 'c': args->count = atoi(arg); break;
default: return ARGP_ERR_UNKNOWN; break;
Expand Down
4 changes: 2 additions & 2 deletions data_dev/driver/src/data_dev_top.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ int DataDev_Probe(struct pci_dev *pcidev, const struct pci_device_id *dev_id) {
pci_set_master(pcidev); // Set the device as bus master

// Retrieve and store the base address and size of the device's register space
dev->baseAddr = pci_resource_start (pcidev, 0);
dev->baseSize = pci_resource_len (pcidev, 0);
dev->baseAddr = pci_resource_start(pcidev, 0);
dev->baseSize = pci_resource_len(pcidev, 0);

// Map the device's register space for use in the driver
if ( Dma_MapReg(dev) < 0 ) {
Expand Down
4 changes: 2 additions & 2 deletions data_gpu/driver/src/data_gpu_top.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ int DataGpu_Probe(struct pci_dev *pcidev, const struct pci_device_id *dev_id) {
pci_set_master(pcidev); // Set the device as bus master

// Retrieve and store the base address and size of the device's register space
dev->baseAddr = pci_resource_start (pcidev, 0);
dev->baseSize = pci_resource_len (pcidev, 0);
dev->baseAddr = pci_resource_start(pcidev, 0);
dev->baseSize = pci_resource_len(pcidev, 0);

// Map the device's register space for use in the driver
if ( Dma_MapReg(dev) < 0 ) {
Expand Down
2 changes: 1 addition & 1 deletion rce_memmap/driver/src/rce_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int Map_Init(void) {

// Map space
dev.maps->base = ioremap_wc(dev.maps->addr, MAP_SIZE);
if (!dev.maps->base ) {
if (!dev.maps->base) {
printk(KERN_ERR MOD_NAME " Init: Could not map memory addr %p with size 0x%x.\n",(void *)dev.maps->addr,MAP_SIZE);
kfree(dev.maps);
return (-1);
Expand Down
24 changes: 12 additions & 12 deletions rce_stream/app/src/dmaLoopTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ static struct argp_option options[] = {
{0}
};

error_t parseArgs ( int key, char *arg, struct argp_state *state ) {
error_t parseArgs(int key, char *arg, struct argp_state *state) {
struct PrgArgs *args = (struct PrgArgs *)state->input;

switch(key) {
switch (key) {
case 'p': args->path = arg; break;
case 'm': args->dest = arg; break;
case 's': args->size = strtol(arg,NULL,10); break;
Expand Down Expand Up @@ -107,7 +107,7 @@ class RunData {
bool running;
};

void *runWrite ( void *t ) {
void *runWrite(void *t) {
fd_set fds;
struct timeval timeout;
int32_t ret;
Expand All @@ -122,20 +122,20 @@ void *runWrite ( void *t ) {

RunData *txData = (RunData *)t;

if ( (fd = open(txData->dev, O_RDWR )) < 0 ) {
if ((fd = open(txData->dev, O_RDWR)) < 0) {
printf("Error opening device\n");
txData->running = false;
return(NULL);
}

if ( txData->idxEn ) {
if ((dmaBuffers = dmaMapDma(fd,&dmaCount,&dmaSize)) == NULL ) {
if ((dmaBuffers = dmaMapDma(fd,&dmaCount,&dmaSize)) == NULL) {
printf("Write failed to map dma buffer\n");
txData->running = false;
return(NULL);
}
} else {
if ((data = malloc(txData->size)) == NULL ) {
if ((data = malloc(txData->size)) == NULL) {
printf("Write failed to allocate buffer\n");
txData->running = false;
return(NULL);
Expand Down Expand Up @@ -199,7 +199,7 @@ void *runWrite ( void *t ) {
}


void *runRead ( void *t ) {
void *runRead(void *t) {
fd_set fds;
struct timeval timeout;
int32_t ret;
Expand All @@ -224,20 +224,20 @@ void *runRead ( void *t ) {
maxSize = rxData->size*2;
idxEn = rxData->idxEn;

if ( (fd = open(rxData->dev, O_RDWR )) < 0 ) {
if ( (fd = open(rxData->dev, O_RDWR)) < 0 ) {
printf("Error opening device\n");
rxData->running = false;
return NULL;
}

if ( rxData->idxEn ) {
if ((dmaBuffers = dmaMapDma(fd,&dmaCount,&dmaSize)) == NULL ) {
if ((dmaBuffers = dmaMapDma(fd,&dmaCount,&dmaSize)) == NULL) {
printf("Read failed to map dma buffer\n");
rxData->running = false;
return(NULL);
}
} else {
if ((data = malloc(maxSize)) == NULL ) {
if ((data = malloc(maxSize)) == NULL) {
printf("Read failed to allocate buffer\n");
rxData->running = false;
return(NULL);
Expand Down Expand Up @@ -286,7 +286,7 @@ void *runRead ( void *t ) {
if ( idxEn ) dmaRetIndex(fd,dmaIndex);

// Stop on size mismatch or frame errors
if ( ret != (int)rxData->size || rxDest != rxData->dest || rxData->fuser != rxFuser || rxData->luser != rxLuser) {
if (ret != (int)rxData->size || rxDest != rxData->dest || rxData->fuser != rxFuser || rxData->luser != rxLuser) {
printf("Read Error. Dest=%i, ExpDest=%i, Ret=%i, Exp=%i, Fuser=0x%.2x, Luser=0x%.2x\n",
rxDest,rxData->dest,ret,rxData->size,rxFuser,rxLuser);
break;
Expand All @@ -310,7 +310,7 @@ void *runRead ( void *t ) {
return(NULL);
}

int main (int argc, char **argv) {
int main(int argc, char **argv) {
RunData * txData[DMA_MASK_SIZE];
RunData * rxData[DMA_MASK_SIZE];
pthread_t txThread[DMA_MASK_SIZE];
Expand Down
8 changes: 4 additions & 4 deletions rce_stream/app/src/dmaRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ static struct argp_option options[] = {
{0}
};

error_t parseArgs ( int key, char *arg, struct argp_state *state ) {
error_t parseArgs(int key, char *arg, struct argp_state *state) {
struct PrgArgs *args = (struct PrgArgs *)state->input;

switch(key) {
switch (key) {
case 'p': args->path = arg; break;
case 'm': args->dest = arg; break;
case 'd': args->prbsDis = 1; break;
Expand All @@ -72,7 +72,7 @@ error_t parseArgs ( int key, char *arg, struct argp_state *state ) {

static struct argp argp = {options,parseArgs,args_doc,doc};

int main (int argc, char **argv) {
int main(int argc, char **argv) {
uint8_t mask[DMA_MASK_SIZE];
int32_t s;
int32_t ret;
Expand Down Expand Up @@ -128,7 +128,7 @@ int main (int argc, char **argv) {
return(0);
}
} else {
if ((rxData = malloc(maxSize)) == NULL ) {
if ((rxData = malloc(maxSize)) == NULL) {
printf("Failed to allocate rxData!\n");
return(0);
}
Expand Down
6 changes: 3 additions & 3 deletions rce_stream/app/src/dmaSetDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ static struct argp_option options[] = {
{0}
};

error_t parseArgs ( int key, char *arg, struct argp_state *state ) {
error_t parseArgs(int key, char *arg, struct argp_state *state) {
struct PrgArgs *args = (struct PrgArgs *)state->input;

switch(key) {
switch (key) {
case 'p': args->path = arg; break;
case ARGP_KEY_ARG:
switch (state->arg_num) {
Expand All @@ -70,7 +70,7 @@ error_t parseArgs ( int key, char *arg, struct argp_state *state ) {

static struct argp argp = {options,parseArgs,args_doc,doc};

int main (int argc, char **argv) {
int main(int argc, char **argv) {
int s;

struct PrgArgs args;
Expand Down
Loading

0 comments on commit d8a707b

Please sign in to comment.