消除编译警告.
Signed-off-by: rick.chan <chenyang@autoai.com>
This commit is contained in:
parent
b8c62c06de
commit
16a2889826
@ -7,8 +7,7 @@ LOCAL_MODULE_RELATIVE_PATH := $(TARGET_OUT_SHARED_LIBRARIIES)/hw
|
|||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
LOCAL_PRELINK_MODULE := false
|
LOCAL_PRELINK_MODULE := false
|
||||||
LOCAL_VENDOR_MODULE := true
|
LOCAL_VENDOR_MODULE := true
|
||||||
LOCAL_LDLIBS := -llog
|
LOCAL_SHARED_LIBRARIES := libhardware libcutils libutils liblog
|
||||||
LOCAL_SHARED_LIBRARIES := libhardware libcutils libutils
|
|
||||||
LOCAL_SRC_FILES := miccom.c
|
LOCAL_SRC_FILES := miccom.c
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
@ -11,11 +11,10 @@
|
|||||||
#define LOG_TAG "MiccomStub"
|
#define LOG_TAG "MiccomStub"
|
||||||
|
|
||||||
#include <hardware/hardware.h>
|
#include <hardware/hardware.h>
|
||||||
|
#include <utils/Log.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <cutils/log.h>
|
|
||||||
#include <cutils/atomic.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "miccom.h"
|
#include "miccom.h"
|
||||||
@ -24,6 +23,8 @@
|
|||||||
#define MODULE_NAME "Miccom"
|
#define MODULE_NAME "Miccom"
|
||||||
#define MODULE_AUTHOR "chenyang@auotai.com"
|
#define MODULE_AUTHOR "chenyang@auotai.com"
|
||||||
|
|
||||||
|
#define UNUSED(x) ((void)(x))
|
||||||
|
|
||||||
static int miccom_device_open(const struct hw_module_t* module, const char* name, struct hw_device_t** device);
|
static int miccom_device_open(const struct hw_module_t* module, const char* name, struct hw_device_t** device);
|
||||||
static int miccom_device_close(struct hw_device_t* device);
|
static int miccom_device_close(struct hw_device_t* device);
|
||||||
static int miccom_set_reg(struct miccom_device_t* dev, char reg, unsigned char num);
|
static int miccom_set_reg(struct miccom_device_t* dev, char reg, unsigned char num);
|
||||||
@ -49,7 +50,8 @@ static int miccom_device_open(const struct hw_module_t* module, const char* name
|
|||||||
{
|
{
|
||||||
struct miccom_device_t* dev;
|
struct miccom_device_t* dev;
|
||||||
|
|
||||||
dev = (struct hw_device_t*)malloc(sizeof(*dev));
|
UNUSED(name);
|
||||||
|
dev = (struct miccom_device_t*)malloc(sizeof(*dev));
|
||||||
if(!dev) {
|
if(!dev) {
|
||||||
ALOGE("Miccom stub: failed to alloc space.");
|
ALOGE("Miccom stub: failed to alloc space.");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
@ -63,7 +65,8 @@ static int miccom_device_open(const struct hw_module_t* module, const char* name
|
|||||||
dev->set_reg = miccom_set_reg;
|
dev->set_reg = miccom_set_reg;
|
||||||
dev->get_reg = miccom_get_reg;
|
dev->get_reg = miccom_get_reg;
|
||||||
|
|
||||||
if(dev->fd = open(DEVICE_NAME, O_RDWR) == -1) {
|
dev->fd = open(DEVICE_NAME, O_RDWR);
|
||||||
|
if(dev->fd == -1) {
|
||||||
ALOGE("Miccom stub: failed to open "DEVICE_NAME" -- %s.", strerror(errno));
|
ALOGE("Miccom stub: failed to open "DEVICE_NAME" -- %s.", strerror(errno));
|
||||||
free(dev);
|
free(dev);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user