Avoid C-style cast warnings am: cc8d9f9fcb am: ac416b9ed3 am: 9a786a3044

am: 2b932a434e

Change-Id: I6678be57a6905f7c0e490d4b55874107bf8d6e6d
This commit is contained in:
Colin Cross
2016-10-08 01:07:21 +00:00
committed by android-build-merger
17 changed files with 23 additions and 17 deletions

View File

@@ -682,7 +682,7 @@ static inline int audio_hw_device_open(const struct hw_module_t* module,
struct audio_hw_device** device) struct audio_hw_device** device)
{ {
return module->methods->open(module, AUDIO_HARDWARE_INTERFACE, return module->methods->open(module, AUDIO_HARDWARE_INTERFACE,
(struct hw_device_t**)device); TO_HW_DEVICE_T_OPEN(device));
} }
static inline int audio_hw_device_close(struct audio_hw_device* device) static inline int audio_hw_device_close(struct audio_hw_device* device)

View File

@@ -160,7 +160,7 @@ typedef struct framebuffer_device_t {
static inline int framebuffer_open(const struct hw_module_t* module, static inline int framebuffer_open(const struct hw_module_t* module,
struct framebuffer_device_t** device) { struct framebuffer_device_t** device) {
return module->methods->open(module, return module->methods->open(module,
GRALLOC_HARDWARE_FB0, (struct hw_device_t**)device); GRALLOC_HARDWARE_FB0, TO_HW_DEVICE_T_OPEN(device));
} }
static inline int framebuffer_close(struct framebuffer_device_t* device) { static inline int framebuffer_close(struct framebuffer_device_t* device) {

View File

@@ -372,7 +372,7 @@ typedef struct alloc_device_t {
static inline int gralloc_open(const struct hw_module_t* module, static inline int gralloc_open(const struct hw_module_t* module,
struct alloc_device_t** device) { struct alloc_device_t** device) {
return module->methods->open(module, return module->methods->open(module,
GRALLOC_HARDWARE_GPU0, (struct hw_device_t**)device); GRALLOC_HARDWARE_GPU0, TO_HW_DEVICE_T_OPEN(device));
} }
static inline int gralloc_close(struct alloc_device_t* device) { static inline int gralloc_close(struct alloc_device_t* device) {

View File

@@ -290,7 +290,7 @@ typedef struct gralloc1_device {
static inline int gralloc1_open(const struct hw_module_t* module, static inline int gralloc1_open(const struct hw_module_t* module,
gralloc1_device_t** device) { gralloc1_device_t** device) {
return module->methods->open(module, GRALLOC_HARDWARE_MODULE_ID, return module->methods->open(module, GRALLOC_HARDWARE_MODULE_ID,
(struct hw_device_t**) device); TO_HW_DEVICE_T_OPEN(device));
} }
static inline int gralloc1_close(gralloc1_device_t* device) { static inline int gralloc1_close(gralloc1_device_t* device) {

View File

@@ -201,6 +201,12 @@ typedef struct hw_device_t {
} hw_device_t; } hw_device_t;
#ifdef __cplusplus
#define TO_HW_DEVICE_T_OPEN(x) reinterpret_cast<struct hw_device_t**>(x)
#else
#define TO_HW_DEVICE_T_OPEN(x) (struct hw_device_t**)(x)
#endif
/** /**
* Name of the hal_module_info * Name of the hal_module_info
*/ */

View File

@@ -417,7 +417,7 @@ typedef struct hdmi_cec_device {
static inline int hdmi_cec_open(const struct hw_module_t* module, static inline int hdmi_cec_open(const struct hw_module_t* module,
struct hdmi_cec_device** device) { struct hdmi_cec_device** device) {
return module->methods->open(module, return module->methods->open(module,
HDMI_CEC_HARDWARE_INTERFACE, (struct hw_device_t**)device); HDMI_CEC_HARDWARE_INTERFACE, TO_HW_DEVICE_T_OPEN(device));
} }
static inline int hdmi_cec_close(struct hdmi_cec_device* device) { static inline int hdmi_cec_close(struct hdmi_cec_device* device) {

View File

@@ -783,7 +783,7 @@ typedef struct hwc_composer_device_1 {
static inline int hwc_open_1(const struct hw_module_t* module, static inline int hwc_open_1(const struct hw_module_t* module,
hwc_composer_device_1_t** device) { hwc_composer_device_1_t** device) {
return module->methods->open(module, return module->methods->open(module,
HWC_HARDWARE_COMPOSER, (struct hw_device_t**)device); HWC_HARDWARE_COMPOSER, TO_HW_DEVICE_T_OPEN(device));
} }
static inline int hwc_close_1(hwc_composer_device_1_t* device) { static inline int hwc_close_1(hwc_composer_device_1_t* device) {

View File

@@ -740,7 +740,7 @@ typedef struct hwc2_device {
static inline int hwc2_open(const struct hw_module_t* module, static inline int hwc2_open(const struct hw_module_t* module,
hwc2_device_t** device) { hwc2_device_t** device) {
return module->methods->open(module, HWC_HARDWARE_COMPOSER, return module->methods->open(module, HWC_HARDWARE_COMPOSER,
(struct hw_device_t**) device); TO_HW_DEVICE_T_OPEN(device));
} }
static inline int hwc2_close(hwc2_device_t* device) { static inline int hwc2_close(hwc2_device_t* device) {

View File

@@ -134,7 +134,7 @@ static inline int keymaster0_open(const struct hw_module_t* module,
keymaster0_device_t** device) keymaster0_device_t** device)
{ {
int rc = module->methods->open(module, KEYSTORE_KEYMASTER, int rc = module->methods->open(module, KEYSTORE_KEYMASTER,
(struct hw_device_t**) device); TO_HW_DEVICE_T_OPEN(device));
return rc; return rc;
} }

View File

@@ -536,7 +536,7 @@ typedef struct keymaster1_device keymaster1_device_t;
/* Convenience API for opening and closing keymaster devices */ /* Convenience API for opening and closing keymaster devices */
static inline int keymaster1_open(const struct hw_module_t* module, keymaster1_device_t** device) { static inline int keymaster1_open(const struct hw_module_t* module, keymaster1_device_t** device) {
return module->methods->open(module, KEYSTORE_KEYMASTER, (struct hw_device_t**)device); return module->methods->open(module, KEYSTORE_KEYMASTER, TO_HW_DEVICE_T_OPEN(device));
} }
static inline int keymaster1_close(keymaster1_device_t* device) { static inline int keymaster1_close(keymaster1_device_t* device) {

View File

@@ -420,7 +420,7 @@ typedef struct keymaster2_device keymaster2_device_t;
/* Convenience API for opening and closing keymaster devices */ /* Convenience API for opening and closing keymaster devices */
static inline int keymaster2_open(const struct hw_module_t* module, keymaster2_device_t** device) { static inline int keymaster2_open(const struct hw_module_t* module, keymaster2_device_t** device) {
return module->methods->open(module, KEYSTORE_KEYMASTER, (struct hw_device_t**)device); return module->methods->open(module, KEYSTORE_KEYMASTER, TO_HW_DEVICE_T_OPEN(device));
} }
static inline int keymaster2_close(keymaster2_device_t* device) { static inline int keymaster2_close(keymaster2_device_t* device) {

View File

@@ -109,7 +109,7 @@ static inline int local_time_hw_device_open(
struct local_time_hw_device** device) struct local_time_hw_device** device)
{ {
return module->methods->open(module, LOCAL_TIME_HARDWARE_INTERFACE, return module->methods->open(module, LOCAL_TIME_HARDWARE_INTERFACE,
(struct hw_device_t**)device); TO_HW_DEVICE_T_OPEN(device));
} }
static inline int local_time_hw_device_close(struct local_time_hw_device* device) static inline int local_time_hw_device_close(struct local_time_hw_device* device)

View File

@@ -326,7 +326,7 @@ typedef struct nvram_device nvram_device_t;
static inline int nvram_open(const struct hw_module_t* module, static inline int nvram_open(const struct hw_module_t* module,
nvram_device_t** device) { nvram_device_t** device) {
return module->methods->open(module, NVRAM_HARDWARE_DEVICE_ID, return module->methods->open(module, NVRAM_HARDWARE_DEVICE_ID,
(struct hw_device_t**)device); TO_HW_DEVICE_T_OPEN(device));
} }
static inline int nvram_close(nvram_device_t* device) { static inline int nvram_close(nvram_device_t* device) {

View File

@@ -285,7 +285,7 @@ static inline int radio_hw_device_open(const struct hw_module_t* module,
struct radio_hw_device** device) struct radio_hw_device** device)
{ {
return module->methods->open(module, RADIO_HARDWARE_DEVICE, return module->methods->open(module, RADIO_HARDWARE_DEVICE,
(struct hw_device_t**)device); TO_HW_DEVICE_T_OPEN(device));
} }
static inline int radio_hw_device_close(const struct radio_hw_device* device) static inline int radio_hw_device_close(const struct radio_hw_device* device)

View File

@@ -1395,7 +1395,7 @@ typedef struct sensors_poll_device_1 {
static inline int sensors_open(const struct hw_module_t* module, static inline int sensors_open(const struct hw_module_t* module,
struct sensors_poll_device_t** device) { struct sensors_poll_device_t** device) {
return module->methods->open(module, return module->methods->open(module,
SENSORS_HARDWARE_POLL, (struct hw_device_t**)device); SENSORS_HARDWARE_POLL, TO_HW_DEVICE_T_OPEN(device));
} }
static inline int sensors_close(struct sensors_poll_device_t* device) { static inline int sensors_close(struct sensors_poll_device_t* device) {
@@ -1405,7 +1405,7 @@ static inline int sensors_close(struct sensors_poll_device_t* device) {
static inline int sensors_open_1(const struct hw_module_t* module, static inline int sensors_open_1(const struct hw_module_t* module,
sensors_poll_device_1_t** device) { sensors_poll_device_1_t** device) {
return module->methods->open(module, return module->methods->open(module,
SENSORS_HARDWARE_POLL, (struct hw_device_t**)device); SENSORS_HARDWARE_POLL, TO_HW_DEVICE_T_OPEN(device));
} }
static inline int sensors_close_1(sensors_poll_device_1_t* device) { static inline int sensors_close_1(sensors_poll_device_1_t* device) {

View File

@@ -124,7 +124,7 @@ static inline int sound_trigger_hw_device_open(const struct hw_module_t* module,
struct sound_trigger_hw_device** device) struct sound_trigger_hw_device** device)
{ {
return module->methods->open(module, SOUND_TRIGGER_HARDWARE_INTERFACE, return module->methods->open(module, SOUND_TRIGGER_HARDWARE_INTERFACE,
(struct hw_device_t**)device); TO_HW_DEVICE_T_OPEN(device));
} }
static inline int sound_trigger_hw_device_close(struct sound_trigger_hw_device* device) static inline int sound_trigger_hw_device_close(struct sound_trigger_hw_device* device)

View File

@@ -65,7 +65,7 @@ typedef struct vibrator_device {
static inline int vibrator_open(const struct hw_module_t* module, vibrator_device_t** device) static inline int vibrator_open(const struct hw_module_t* module, vibrator_device_t** device)
{ {
return module->methods->open(module, VIBRATOR_DEVICE_ID_MAIN, (struct hw_device_t**)device); return module->methods->open(module, VIBRATOR_DEVICE_ID_MAIN, TO_HW_DEVICE_T_OPEN(device));
} }
__END_DECLS __END_DECLS