diff options
author | Su Sung Chung <Su.Chung@amd.com> | 2019-07-08 18:31:39 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-08-15 18:53:55 +0300 |
commit | 91db9311945f01901ddb9813ce11364de214a156 (patch) | |
tree | 1afec6692b3e5f2a29036ab0b889bf558adf91ac /drivers/gpu/drm/amd/display/dc/inc/hw/gpio.h | |
parent | 37495fbdf12d1bce30dbc228c901ef45eba35739 (diff) | |
download | linux-91db9311945f01901ddb9813ce11364de214a156.tar.xz |
drm/amd/display: refactor gpio to allocate hw_container in constructor
[why]
if dynamic allocation fails during gpio_open, it will cause crash due to
page fault.
[how]
handle allocation when gpio object gets created and prevent from calling
gpio_open if allocation failed
Signed-off-by: Su Sung Chung <Su.Chung@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/inc/hw/gpio.h')
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/inc/hw/gpio.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/gpio.h b/drivers/gpu/drm/amd/display/dc/inc/hw/gpio.h index 90d0148430fb..5253dc8b15f8 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/hw/gpio.h +++ b/drivers/gpu/drm/amd/display/dc/inc/hw/gpio.h @@ -28,12 +28,22 @@ #include "gpio_types.h" + +union gpio_hw_container { + struct hw_ddc *ddc; + struct hw_generic *generic; + struct hw_hpd *hpd; +}; + struct gpio { struct gpio_service *service; struct hw_gpio_pin *pin; enum gpio_id id; uint32_t en; + + union gpio_hw_container hw_container; enum gpio_mode mode; + /* when GPIO comes from VBIOS, it has defined output state */ enum gpio_pin_output_state output_state; }; |