media: camera: Ensure gpio_device_get_chip is present

In Linux v6.7, both gpio_device_find() and gpio_device_get_chip() were
added. However, don't assume that if one is present then so is the other
and so add a test to check if gpio_device_get_chip() is also present.

Bug 4471899

Change-Id: I0c547a52b0f397aef43884ab76d815573e8ed3f8
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3112133
(cherry picked from commit 9458d6b97f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3119068
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2024-04-09 11:56:40 +01:00
committed by mobile promotions
parent 5ff50fc9ea
commit e351ba75c7
4 changed files with 26 additions and 4 deletions

View File

@@ -46,7 +46,8 @@ static struct gpio_chip *cdi_gpio_get_chip(struct platform_device *pdev,
struct cdi_gpio_plat_data *pd)
{
struct gpio_chip *gc = NULL;
#if defined(NV_GPIO_DEVICE_FIND_PRESENT) /* Linux 6.7 */
#if defined(NV_GPIO_DEVICE_FIND_PRESENT) && \
defined(NV_GPIO_DEVICE_GET_CHIP_PRESENT) /* Linux 6.7 */
struct gpio_device *gdev;
#endif
char name[MAX_STR_SIZE];
@@ -58,7 +59,8 @@ static struct gpio_chip *cdi_gpio_get_chip(struct platform_device *pdev,
}
strcpy(name, pd->gpio_prnt_chip);
#if defined(NV_GPIO_DEVICE_FIND_PRESENT) /* Linux 6.7 */
#if defined(NV_GPIO_DEVICE_FIND_PRESENT) && \
defined(NV_GPIO_DEVICE_GET_CHIP_PRESENT) /* Linux 6.7 */
gdev = gpio_device_find(name, cdi_gpio_chip_match);
if (gdev) {
gc = gpio_device_get_chip(gdev);

View File

@@ -47,7 +47,8 @@ static struct gpio_chip *isc_gpio_get_chip(struct platform_device *pdev,
{
struct gpio_chip *gc = NULL;
char name[MAX_STR_SIZE];
#if defined(NV_GPIO_DEVICE_FIND_PRESENT) /* Linux 6.7 */
#if defined(NV_GPIO_DEVICE_FIND_PRESENT) && \
defined(NV_GPIO_DEVICE_GET_CHIP_PRESENT) /* Linux 6.7 */
struct gpio_device *gdev;
#endif
@@ -58,7 +59,8 @@ static struct gpio_chip *isc_gpio_get_chip(struct platform_device *pdev,
}
strcpy(name, pd->gpio_prnt_chip);
#if defined(NV_GPIO_DEVICE_FIND_PRESENT) /* Linux 6.7 */
#if defined(NV_GPIO_DEVICE_FIND_PRESENT) && \
defined(NV_GPIO_DEVICE_GET_CHIP_PRESENT) /* Linux 6.7 */
gdev = gpio_device_find(name, isc_gpio_chip_match);
if (gdev) {
gc = gpio_device_get_chip(gdev);