Avoid C-style cast warnings am: cc8d9f9fcb
am: ac416b9ed3
Change-Id: Ia98fdea4ff7d0b2804ade2be3cf38fc637f0caee
This commit is contained in:
@@ -678,7 +678,7 @@ static inline int audio_hw_device_open(const struct hw_module_t* module,
|
||||
struct audio_hw_device** device)
|
||||
{
|
||||
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)
|
||||
|
||||
@@ -160,7 +160,7 @@ typedef struct framebuffer_device_t {
|
||||
static inline int framebuffer_open(const struct hw_module_t* module,
|
||||
struct framebuffer_device_t** device) {
|
||||
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) {
|
||||
|
||||
@@ -372,7 +372,7 @@ typedef struct alloc_device_t {
|
||||
static inline int gralloc_open(const struct hw_module_t* module,
|
||||
struct alloc_device_t** device) {
|
||||
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) {
|
||||
|
||||
@@ -290,7 +290,7 @@ typedef struct gralloc1_device {
|
||||
static inline int gralloc1_open(const struct hw_module_t* module,
|
||||
gralloc1_device_t** device) {
|
||||
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) {
|
||||
|
||||
@@ -201,6 +201,12 @@ typedef struct 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
|
||||
*/
|
||||
|
||||
@@ -417,7 +417,7 @@ typedef struct hdmi_cec_device {
|
||||
static inline int hdmi_cec_open(const struct hw_module_t* module,
|
||||
struct hdmi_cec_device** device) {
|
||||
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) {
|
||||
|
||||
@@ -783,7 +783,7 @@ typedef struct hwc_composer_device_1 {
|
||||
static inline int hwc_open_1(const struct hw_module_t* module,
|
||||
hwc_composer_device_1_t** device) {
|
||||
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) {
|
||||
|
||||
@@ -740,7 +740,7 @@ typedef struct hwc2_device {
|
||||
static inline int hwc2_open(const struct hw_module_t* module,
|
||||
hwc2_device_t** device) {
|
||||
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) {
|
||||
|
||||
@@ -134,7 +134,7 @@ static inline int keymaster0_open(const struct hw_module_t* module,
|
||||
keymaster0_device_t** device)
|
||||
{
|
||||
int rc = module->methods->open(module, KEYSTORE_KEYMASTER,
|
||||
(struct hw_device_t**) device);
|
||||
TO_HW_DEVICE_T_OPEN(device));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ typedef struct keymaster1_device keymaster1_device_t;
|
||||
/* Convenience API for opening and closing keymaster devices */
|
||||
|
||||
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) {
|
||||
|
||||
@@ -420,7 +420,7 @@ typedef struct keymaster2_device keymaster2_device_t;
|
||||
/* Convenience API for opening and closing keymaster devices */
|
||||
|
||||
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) {
|
||||
|
||||
@@ -109,7 +109,7 @@ static inline int local_time_hw_device_open(
|
||||
struct local_time_hw_device** device)
|
||||
{
|
||||
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)
|
||||
|
||||
@@ -326,7 +326,7 @@ typedef struct nvram_device nvram_device_t;
|
||||
static inline int nvram_open(const struct hw_module_t* module,
|
||||
nvram_device_t** device) {
|
||||
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) {
|
||||
|
||||
@@ -285,7 +285,7 @@ static inline int radio_hw_device_open(const struct hw_module_t* module,
|
||||
struct radio_hw_device** 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)
|
||||
|
||||
@@ -1388,7 +1388,7 @@ typedef struct sensors_poll_device_1 {
|
||||
static inline int sensors_open(const struct hw_module_t* module,
|
||||
struct sensors_poll_device_t** device) {
|
||||
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) {
|
||||
@@ -1398,7 +1398,7 @@ static inline int sensors_close(struct sensors_poll_device_t* device) {
|
||||
static inline int sensors_open_1(const struct hw_module_t* module,
|
||||
sensors_poll_device_1_t** device) {
|
||||
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) {
|
||||
|
||||
@@ -124,7 +124,7 @@ static inline int sound_trigger_hw_device_open(const struct hw_module_t* module,
|
||||
struct sound_trigger_hw_device** device)
|
||||
{
|
||||
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)
|
||||
|
||||
@@ -65,7 +65,7 @@ typedef struct vibrator_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
|
||||
|
||||
Reference in New Issue
Block a user