Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkpatch script #187

Merged
merged 4 commits into from Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions .checkpatch.conf
@@ -0,0 +1,22 @@
--emacs
--no-tree
--summary-file
--show-types
--max-line-length=80
--min-conf-desc-length=1

--ignore BRACES
--ignore PRINTK_WITHOUT_KERN_LEVEL
--ignore SPLIT_STRING
--ignore VOLATILE
--ignore CONFIG_EXPERIMENTAL
--ignore AVOID_EXTERNS
--ignore NETWORKING_BLOCK_COMMENT_STYLE
--ignore DATE_TIME
--ignore MINMAX
--ignore CONST_STRUCT
--ignore FILE_PATH_CHANGES
--ignore BIT_MACRO
--ignore PREFER_KERNEL_TYPES
--ignore NEW_TYPEDEFS
--ignore ARRAY_SIZE
1 change: 0 additions & 1 deletion lib/include/openamp/open_amp.h
Expand Up @@ -13,5 +13,4 @@
#include <openamp/remoteproc.h>
#include <openamp/remoteproc_virtio.h>


#endif /* OPEN_AMP_H_ */
2 changes: 1 addition & 1 deletion lib/include/openamp/rpmsg_retarget.h
Expand Up @@ -52,7 +52,7 @@ struct rpmsg_rpc_data {
/**
* rpmsg_rpc_init - initialize RPMsg remote procedure call
*
* This function is to intialize the remote procedure call
* This function is to initialize the remote procedure call
* global data. RPMsg RPC will send request to remote and
* wait for callback.
*
Expand Down
2 changes: 1 addition & 1 deletion lib/include/openamp/rpmsg_virtio.h
Expand Up @@ -89,7 +89,7 @@ static inline int
rpmsg_virtio_create_virtqueues(struct rpmsg_virtio_device *rvdev,
int flags, unsigned int nvqs,
const char *names[],
vq_callback *callbacks[])
vq_callback *callbacks)
{
return virtio_create_virtqueues(rvdev->vdev, flags, nvqs, names,
callbacks);
Expand Down
2 changes: 1 addition & 1 deletion lib/include/openamp/virtio.h
Expand Up @@ -141,7 +141,7 @@ struct virtio_dispatch {

int virtio_create_virtqueues(struct virtio_device *vdev, unsigned int flags,
unsigned int nvqs, const char *names[],
vq_callback *callbacks[]);
vq_callback callbacks[]);

#if defined __cplusplus
}
Expand Down
8 changes: 4 additions & 4 deletions lib/include/openamp/virtio_ring.h
Expand Up @@ -46,14 +46,14 @@ struct vring_desc {
uint16_t flags;
/* We chain unused descriptors via this, too. */
uint16_t next;
}METAL_PACKED_END;
} METAL_PACKED_END;

METAL_PACKED_BEGIN
struct vring_avail {
uint16_t flags;
uint16_t idx;
uint16_t ring[0];
}METAL_PACKED_END;
} METAL_PACKED_END;

/* uint32_t is used here for ids for padding reasons. */
METAL_PACKED_BEGIN
Expand All @@ -65,14 +65,14 @@ struct vring_used_elem {
};
/* Total length of the descriptor chain which was written to. */
uint32_t len;
}METAL_PACKED_END;
} METAL_PACKED_END;

METAL_PACKED_BEGIN
struct vring_used {
uint16_t flags;
uint16_t idx;
struct vring_used_elem ring[0];
}METAL_PACKED_END;
} METAL_PACKED_END;

struct vring {
unsigned int num;
Expand Down
4 changes: 2 additions & 2 deletions lib/include/openamp/virtqueue.h
Expand Up @@ -109,8 +109,8 @@ struct vring_alloc_info {
uint16_t pad;
};

typedef void vq_callback(struct virtqueue *);
typedef void vq_notify(struct virtqueue *);
typedef void (*vq_callback)(struct virtqueue *);
typedef void (*vq_notify)(struct virtqueue *);

#ifdef VQUEUE_DEBUG
#include <metal/log.h>
Expand Down
31 changes: 14 additions & 17 deletions lib/proxy/rpmsg_retarget.c
Expand Up @@ -23,7 +23,7 @@ static int rpmsg_rpc_ept_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
(void)priv;
(void)src;

if (data != NULL && ept != NULL) {
if (data && ept) {
syscall = data;
if (syscall->id == TERM_SYSCALL_ID) {
rpmsg_destroy_ept(ept);
Expand All @@ -34,7 +34,7 @@ static int rpmsg_rpc_ept_cb(struct rpmsg_endpoint *ept, void *data, size_t len,
struct rpmsg_rpc_data,
ept);
metal_spinlock_acquire(&rpc->buflock);
if (rpc->respbuf != NULL && rpc->respbuf_len != 0) {
if (rpc->respbuf && rpc->respbuf_len != 0) {
if (len > rpc->respbuf_len)
len = rpc->respbuf_len;
memcpy(rpc->respbuf, data, len);
Expand All @@ -59,7 +59,6 @@ static void rpmsg_service_unbind(struct rpmsg_endpoint *ept)
rpc->shutdown_cb(rpc);
}


int rpmsg_rpc_init(struct rpmsg_rpc_data *rpc,
struct rpmsg_device *rdev,
const char *ept_name, uint32_t ept_addr,
Expand All @@ -69,7 +68,7 @@ int rpmsg_rpc_init(struct rpmsg_rpc_data *rpc,
{
int ret;

if (rpc == NULL || rdev == NULL)
if (!rpc || !rdev)
return -EINVAL;
metal_spinlock_init(&rpc->buflock);
metal_mutex_init(&rpc->lock);
Expand All @@ -96,7 +95,7 @@ int rpmsg_rpc_init(struct rpmsg_rpc_data *rpc,

void rpmsg_rpc_release(struct rpmsg_rpc_data *rpc)
{
if (rpc == NULL)
if (!rpc)
return;
if (rpc->ept_destroyed == 0)
rpmsg_destroy_ept(&rpc->ept);
Expand All @@ -107,8 +106,6 @@ void rpmsg_rpc_release(struct rpmsg_rpc_data *rpc)
metal_spinlock_release(&rpc->buflock);
metal_mutex_release(&rpc->lock);
metal_mutex_deinit(&rpc->lock);

return;
}

int rpmsg_rpc_send(struct rpmsg_rpc_data *rpc,
Expand All @@ -117,7 +114,7 @@ int rpmsg_rpc_send(struct rpmsg_rpc_data *rpc,
{
int ret;

if (rpc == NULL)
if (!rpc)
return -EINVAL;
metal_spinlock_acquire(&rpc->buflock);
rpc->respbuf = resp;
Expand All @@ -129,7 +126,7 @@ int rpmsg_rpc_send(struct rpmsg_rpc_data *rpc,
return -EINVAL;
if (!resp)
return ret;
while((atomic_flag_test_and_set(&rpc->nacked))) {
while ((atomic_flag_test_and_set(&rpc->nacked))) {
if (rpc->poll)
rpc->poll(rpc->poll_arg);
}
Expand All @@ -138,7 +135,7 @@ int rpmsg_rpc_send(struct rpmsg_rpc_data *rpc,

void rpmsg_set_default_rpc(struct rpmsg_rpc_data *rpc)
{
if (rpc == NULL)
if (!rpc)
return;
rpmsg_default_rpc = rpc;
}
Expand Down Expand Up @@ -166,11 +163,11 @@ int _open(const char *filename, int flags, int mode)
unsigned char tmpbuf[MAX_BUF_LEN];
int ret;

if (filename == NULL || payload_size > (int)MAX_BUF_LEN) {
if (!filename || payload_size > (int)MAX_BUF_LEN) {
return -EINVAL;
}

if (rpc == NULL)
if (!rpc)
return -EINVAL;

/* Construct rpc payload */
Expand Down Expand Up @@ -215,7 +212,7 @@ int _read(int fd, char *buffer, int buflen)
unsigned char tmpbuf[MAX_BUF_LEN];
int ret;

if (rpc == NULL || buffer == NULL || buflen == 0)
if (!rpc || !buffer || buflen == 0)
return -EINVAL;

/* Construct rpc payload */
Expand Down Expand Up @@ -272,7 +269,7 @@ int _write(int fd, const char *ptr, int len)
unsigned char *tmpptr;
int null_term = 0;

if (rpc == NULL)
if (!rpc)
return -EINVAL;
if (fd == 1)
null_term = 1;
Expand Down Expand Up @@ -322,16 +319,16 @@ int _close(int fd)
int payload_size = sizeof(syscall);
struct rpmsg_rpc_data *rpc = rpmsg_default_rpc;

if (rpc == NULL)
if (!rpc)
return -EINVAL;
syscall.id = CLOSE_SYSCALL_ID;
syscall.args.int_field1 = fd;
syscall.args.int_field2 = 0; /*not used */
syscall.args.data_len = 0; /*not used */

resp.id = 0;
ret = rpmsg_rpc_send(rpc, (void*)&syscall, payload_size,
(void*)&resp, sizeof(resp));
ret = rpmsg_rpc_send(rpc, (void *)&syscall, payload_size,
(void *)&resp, sizeof(resp));

if (ret >= 0) {
if (resp.id == CLOSE_SYSCALL_ID)
Expand Down