Donny9 commented on a change in pull request #2315: URL: https://github.com/apache/incubator-nuttx/pull/2315#discussion_r525733189
########## File path: include/nuttx/mm/circ_buf.h ########## @@ -0,0 +1,308 @@ +/**************************************************************************** + * include/nuttx/mm/circ_buf.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_MM_CIRC_BUF_H +#define __INCLUDE_NUTTX_MM_CIRC_BUF_H + +/* Note about locking: There is no locking required until only one reader + * and one writer is using the circular buffer. + * For multiple writer and one reader there is only a need to lock the + * writer. And vice versa for only one writer and multiple reader there is + * only a need to lock the reader. + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <stdbool.h> +#include <sys/types.h> + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* This structure describes circular buffer */ + +struct circ_buf_s +{ + FAR void *base; + size_t size; + size_t head; + size_t tail; + bool external; Review comment: yes, i do ########## File path: drivers/sensors/sensor.c ########## @@ -77,7 +68,7 @@ struct sensor_upperhalf_s FAR struct pollfd *fds[CONFIG_SENSORS_NPOLLWAITERS]; FAR struct sensor_lowerhalf_s *lower; /* the handle of lower half driver */ - FAR struct sensor_buffer_s *buffer; /* The circualr buffer of sensor device */ + struct circ_buf_s buffer; /* The circualr buffer of sensor device */ Review comment: done ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org